diff --git a/lib/node_modules/@stdlib/lapack/base/dlagtf/README.md b/lib/node_modules/@stdlib/lapack/base/dlagtf/README.md new file mode 100644 index 000000000000..dcd6f48c4133 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlagtf/README.md @@ -0,0 +1,311 @@ + + +# dlagtf + +> Compute an `LU` factorization of a matrix `T - lambda*I`, where `T` is a general real tridiagonal matrix and `lambda` is a scalar, using partial pivoting with row interchanges. + +
+ +The `dlagtf` routine factorizes the matrix `T - lambda*I`, where `T` is an N-by-N real tridiagonal matrix and `lambda` is a scalar, as: + +```math +T - \lambda I = P L U +``` + +where `P` is a permutation matrix, `L` is a unit lower tridiagonal matrix with at most one non-zero sub-diagonal element per column, and `U` is an upper triangular matrix with at most two non-zero super-diagonal elements per column. + +The factorization is obtained by Gaussian elimination with partial pivoting and implicit row scaling. + +
+ + + +
+ +## Usage + +```javascript +var dlagtf = require( '@stdlib/lapack/base/dlagtf' ); +``` + +#### dlagtf( N, A, lambda, B, C, tol, D, IN ) + +Computes an `LU` factorization of a matrix `T - lambda*I`, where `T` is a general real tridiagonal matrix and `lambda` is a scalar, using partial pivoting with row interchanges. + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); +var Int32Array = require( '@stdlib/array/int32' ); +var dlagtf = require( '@stdlib/lapack/base/dlagtf' ); + +var A = new Float64Array( [ 2.0, 3.0, 1.0 ] ); +var B = new Float64Array( [ 1.0, 1.0 ] ); +var C = new Float64Array( [ 1.0, 1.0 ] ); +var D = new Float64Array( [ 0.0 ] ); +var IN = new Int32Array( [ 0, 0, 0 ] ); + +dlagtf( 3, A, 0.0, B, C, 0.0, D, IN ); +// A => [ 2.0, 2.5, 0.6 ] +// B => [ 1.0, 1.0 ] +// C => [ 0.5, 0.4 ] +// D => [ 0.0 ] +// IN => [ 0, 0, 0 ] +``` + +The function has the following parameters: + +- **N**: order of the matrix `T`. +- **A**: diagonal elements of `T` as a [`Float64Array`][mdn-float64array]. Should have `N` indexed elements. Overwritten by the diagonal elements of `U`. +- **lambda**: scalar constant. +- **B**: first super-diagonal elements of `T` as a [`Float64Array`][mdn-float64array]. Should have `N-1` indexed elements. Overwritten by the first super-diagonal elements of `U`. +- **C**: first sub-diagonal elements of `T` as a [`Float64Array`][mdn-float64array]. Should have `N-1` indexed elements. Overwritten by the multipliers that define `L`. +- **tol**: relative tolerance constant used to indicate whether `T - lambda*I` is nearly singular. +- **D**: second super-diagonal elements of `U` as a [`Float64Array`][mdn-float64array]. Should have `N-2` indexed elements. Overwritten by the second super-diagonal elements of `U`. +- **IN**: pivot indicators and singularity details as an [`Int32Array`][mdn-int32array]. Should have `N` indexed elements. + +Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views. + + + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); +var Int32Array = require( '@stdlib/array/int32' ); +var dlagtf = require( '@stdlib/lapack/base/dlagtf' ); + +// Initial arrays... +var A0 = new Float64Array( [ 0.0, 2.0, 3.0, 1.0 ] ); +var B0 = new Float64Array( [ 0.0, 1.0, 1.0 ] ); +var C0 = new Float64Array( [ 0.0, 1.0, 1.0 ] ); +var D0 = new Float64Array( [ 0.0, 0.0 ] ); +var IN0 = new Int32Array( [ 0, 0, 0, 0 ] ); + +// Create offset views... +var A = new Float64Array( A0.buffer, A0.BYTES_PER_ELEMENT*1 ); // start at 2nd element +var B = new Float64Array( B0.buffer, B0.BYTES_PER_ELEMENT*1 ); // start at 2nd element +var C = new Float64Array( C0.buffer, C0.BYTES_PER_ELEMENT*1 ); // start at 2nd element +var D = new Float64Array( D0.buffer, D0.BYTES_PER_ELEMENT*1 ); // start at 2nd element +var IN = new Int32Array( IN0.buffer, IN0.BYTES_PER_ELEMENT*1 ); // start at 2nd element + +dlagtf( 3, A, 0.0, B, C, 0.0, D, IN ); +// A0 => [ 0.0, 2.0, 2.5, 0.6 ] +// C0 => [ 0.0, 0.5, 0.4 ] +``` + + + +#### dlagtf.ndarray( N, A, strideA, offsetA, lambda, B, strideB, offsetB, C, strideC, offsetC, tol, D, strideD, offsetD, IN, strideIN, offsetIN ) + +Computes an `LU` factorization of a matrix `T - lambda*I`, where `T` is a general real tridiagonal matrix and `lambda` is a scalar, using partial pivoting with row interchanges and alternative indexing semantics. + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); +var Int32Array = require( '@stdlib/array/int32' ); +var dlagtf = require( '@stdlib/lapack/base/dlagtf' ); + +var A = new Float64Array( [ 2.0, 3.0, 1.0 ] ); +var B = new Float64Array( [ 1.0, 1.0 ] ); +var C = new Float64Array( [ 1.0, 1.0 ] ); +var D = new Float64Array( [ 0.0 ] ); +var IN = new Int32Array( [ 0, 0, 0 ] ); + +dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); +// A => [ 2.0, 2.5, 0.6 ] +// B => [ 1.0, 1.0 ] +// C => [ 0.5, 0.4 ] +// D => [ 0.0 ] +// IN => [ 0, 0, 0 ] +``` + +The function has the following additional parameters: + +- **strideA**: stride length for `A`. +- **offsetA**: starting index for `A`. +- **strideB**: stride length for `B`. +- **offsetB**: starting index for `B`. +- **strideC**: stride length for `C`. +- **offsetC**: starting index for `C`. +- **strideD**: stride length for `D`. +- **offsetD**: starting index for `D`. +- **strideIN**: stride length for `IN`. +- **offsetIN**: starting index for `IN`. + +While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameters support indexing semantics based on starting indices. For example, + + + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); +var Int32Array = require( '@stdlib/array/int32' ); +var dlagtf = require( '@stdlib/lapack/base/dlagtf' ); + +var A = new Float64Array( [ 0.0, 2.0, 3.0, 1.0 ] ); +var B = new Float64Array( [ 0.0, 1.0, 1.0 ] ); +var C = new Float64Array( [ 0.0, 1.0, 1.0 ] ); +var D = new Float64Array( [ 0.0, 0.0 ] ); +var IN = new Int32Array( [ 0, 0, 0, 0 ] ); + +dlagtf.ndarray( 3, A, 1, 1, 0.0, B, 1, 1, C, 1, 1, 0.0, D, 1, 1, IN, 1, 1 ); +// A => [ 0.0, 2.0, 2.5, 0.6 ] +// C => [ 0.0, 0.5, 0.4 ] +``` + +
+ + + +
+ +## Notes + +- Both functions mutate the input arrays `A`, `B`, `C`, `D`, and `IN`. +- `dlagtf()` corresponds to the [LAPACK][lapack] routine [`dlagtf`][lapack-dlagtf]. + +
+ + + +
+ +## Examples + + + +```javascript +var Int32Array = require( '@stdlib/array/int32' ); +var Float64Array = require( '@stdlib/array/float64' ); +var dlagtf = require( '@stdlib/lapack/base/dlagtf' ); + +var N = 5; + +var A = new Float64Array( [ 2.0, 3.0, 1.0, 2.0, 1.0 ] ); +var B = new Float64Array( [ 1.0, 1.0, 1.0, 1.0 ] ); +var C = new Float64Array( [ 1.0, 1.0, 1.0, 1.0 ] ); +var D = new Float64Array( N-2 ); +var IN = new Int32Array( N ); + +var info = dlagtf( N, A, 0.0, B, C, 0.0, D, IN ); + +console.log( A ); +console.log( B ); +console.log( C ); +console.log( D ); +console.log( IN ); +console.log( info ); +``` + +
+ + + + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +TODO +``` + +#### TODO + +TODO. + +```c +TODO +``` + +TODO + +```c +TODO +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +TODO +``` + +
+ + + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/lapack/base/dlagtf/benchmark/benchmark.js b/lib/node_modules/@stdlib/lapack/base/dlagtf/benchmark/benchmark.js new file mode 100644 index 000000000000..73adce697141 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlagtf/benchmark/benchmark.js @@ -0,0 +1,108 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var Int32Array = require( '@stdlib/array/int32' ); +var Float64Array = require( '@stdlib/array/float64' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; +var dlagtf = require( './../lib/dlagtf.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( len ) { + var IN = new Int32Array( len ); + var D = new Float64Array( len-2 ); + var C = uniform( len-1, 0.0, 100.0, options ); + var B = uniform( len-1, 0.0, 100.0, options ); + var A = uniform( len, 0.0, 100.0, options ); + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var d; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + d = dlagtf( len, A, 0.0, B, C, 0.0, D, IN ); + if ( d < 0 ) { + b.fail( 'should return a success status code' ); + } + } + b.toc(); + if ( d < 0 ) { + b.fail( 'should return a success status code' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + f = createBenchmark( len ); + bench( format( '%s:len=%d', pkg, len ), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/lapack/base/dlagtf/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dlagtf/benchmark/benchmark.ndarray.js new file mode 100644 index 000000000000..bf88f1e76eab --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlagtf/benchmark/benchmark.ndarray.js @@ -0,0 +1,108 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var Int32Array = require( '@stdlib/array/int32' ); +var Float64Array = require( '@stdlib/array/float64' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; +var dlagtf = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( len ) { + var IN = new Int32Array( len ); + var D = new Float64Array( len-2 ); + var C = uniform( len-1, 0.0, 100.0, options ); + var B = uniform( len-1, 0.0, 100.0, options ); + var A = uniform( len, 0.0, 100.0, options ); + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var d; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + d = dlagtf( len, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // eslint-disable-line max-len + if ( d < 0 ) { + b.fail( 'should return a success status code' ); + } + } + b.toc(); + if ( d < 0 ) { + b.fail( 'should return a success status code' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + f = createBenchmark( len ); + bench( format( '%s:ndarray:len=%d', pkg, len ), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/lapack/base/dlagtf/docs/repl.txt b/lib/node_modules/@stdlib/lapack/base/dlagtf/docs/repl.txt new file mode 100644 index 000000000000..23b28c547808 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlagtf/docs/repl.txt @@ -0,0 +1,177 @@ + +{{alias}}( N, A, lambda, B, C, tol, D, IN ) + Computes an LU factorization of a matrix `T - lambda*I`, where `T` is a + general real tridiagonal matrix and `lambda` is a scalar, using partial + pivoting with row interchanges. + + Indexing is relative to the first index. To introduce an offset, use typed + array views. + + The function mutates `A`, `B`, `C`, `D`, and `IN`. + + Parameters + ---------- + N: integer + Order of the matrix `T`. + + A: Float64Array + Diagonal elements of `T`. Should have `N` indexed elements. `A` is + overwritten by the diagonal elements of `U`. + + lambda: number + Scalar shift parameter. + + B: Float64Array + First super-diagonal elements of `T`. Should have `N-1` indexed + elements. `B` is overwritten by the first super-diagonal elements of + `U`. + + C: Float64Array + First sub-diagonal elements of `T`. Should have `N-1` indexed elements. + `C` is overwritten by the multipliers that define `L`. + + tol: number + Relative tolerance constant used to indicate whether `T - lambda*I` is + nearly singular. + + D: Float64Array + Second super-diagonal elements of `U`. Should have `N-2` indexed + elements. `D` is overwritten by the second super-diagonal elements of + `U`. + + IN: Int32Array + Pivot indicators and singularity details. Should have `N` indexed + elements. + + Returns + ------- + info: integer + Status code. + + Examples + -------- + > var Float64Array = {{alias:@stdlib/array/float64}}; + > var Int32Array = {{alias:@stdlib/array/int32}}; + > var A = new Float64Array( [ 2.0, 3.0, 1.0 ] ); + > var B = new Float64Array( [ 1.0, 1.0 ] ); + > var C = new Float64Array( [ 1.0, 1.0 ] ); + > var D = new Float64Array( 1 ); + > var IN = new Int32Array( 3 ); + > {{alias}}( 3, A, 0.0, B, C, 0.0, D, IN ) + 0 + > A + [ 2.0, 2.5, 0.6 ] + > B + [ 1.0, 1.0 ] + > C + [ 0.5, 0.4 ] + > D + [ 0.0 ] + > IN + [ 0, 0, 0 ] + + +{{alias}}.ndarray(N, A,sa,oa, lambda, B,sb,ob, C,sc,oc, tol, D,sd,od, IN,si,oi) + Computes an LU factorization of a matrix `T - lambda*I`, where `T` is a + general real tridiagonal matrix and `lambda` is a scalar, using partial + pivoting with row interchanges and alternative indexing semantics. + + While typed array views mandate a view offset based on the underlying + buffer, the offset parameters support indexing semantics based on starting + indices. + + The function mutates `A`, `B`, `C`, `D`, and `IN`. + + Parameters + ---------- + N: integer + Order of the matrix `T`. + + A: Float64Array + Diagonal elements of `T`. Should have `N` indexed elements. `A` is + overwritten by the diagonal elements of `U`. + + sa: integer + Stride length for `A`. + + oa: integer + Starting index for `A`. + + lambda: number + Scalar shift parameter. + + B: Float64Array + First super-diagonal elements of `T`. Should have `N-1` indexed + elements. `B` is overwritten by the first super-diagonal elements of + `U`. + + sb: integer + Stride length for `B`. + + ob: integer + Starting index for `B`. + + C: Float64Array + First sub-diagonal elements of `T`. Should have `N-1` indexed elements. + `C` is overwritten by the multipliers that define `L`. + + sc: integer + Stride length for `C`. + + oc: integer + Starting index for `C`. + + tol: number + Relative tolerance constant used to indicate whether `T - lambda*I` is + nearly singular. + + D: Float64Array + Second super-diagonal elements of `U`. Should have `N-2` indexed + elements. `D` is overwritten by the second super-diagonal elements of + `U`. + + sd: integer + Stride length for `D`. + + od: integer + Starting index for `D`. + + IN: Int32Array + Pivot indicators and singularity details. Should have `N` indexed + elements. + + si: integer + Stride length for `IN`. + + oi: integer + Starting index for `IN`. + + Returns + ------- + info: integer + Status code. + + Examples + -------- + > var Float64Array = {{alias:@stdlib/array/float64}}; + > var Int32Array = {{alias:@stdlib/array/int32}}; + > var A = new Float64Array( [ 2.0, 3.0, 1.0 ] ); + > var B = new Float64Array( [ 1.0, 1.0 ] ); + > var C = new Float64Array( [ 1.0, 1.0 ] ); + > var D = new Float64Array( 1 ); + > var IN = new Int32Array( 3 ); + > {{alias}}.ndarray( 3, A, 1,0, 0.0, B, 1,0, C, 1,0, 0.0, D, 1,0, IN, 1,0 ) + 0 + > A + [ 2.0, 2.5, 0.6 ] + > B + [ 1.0, 1.0 ] + > C + [ 0.5, 0.4 ] + > D + [ 0.0 ] + > IN + [ 0, 0, 0 ] + + See Also + -------- diff --git a/lib/node_modules/@stdlib/lapack/base/dlagtf/docs/types/index.d.ts b/lib/node_modules/@stdlib/lapack/base/dlagtf/docs/types/index.d.ts new file mode 100644 index 000000000000..e4b9ab245c3f --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlagtf/docs/types/index.d.ts @@ -0,0 +1,186 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Status code. +* +* ## Notes +* +* The status code indicates the following conditions: +* +* - `0`: the factorization was successful. Singularity information is stored in the `IN` array, where `IN[k]` records whether a pivot occurred at step `k` (0-based indexing). +*/ +type StatusCode = number; + +/** +* Interface describing `dlagtf`. +*/ +interface Routine { + /** + * Computes an `LU` factorization of a matrix `T - lambda*I`, where `T` is a general real tridiagonal matrix, and `lambda` a scalar, using partial pivoting with row interchanges. + * + * ## Notes + * + * - `A` should have `N` elements and is overwritten by the diagonal elements of `U`. + * - `B` should have `N-1` elements and is overwritten by the first super-diagonal elements of `U`. + * - `C` should have `N-1` elements and is overwritten by the multipliers that define `L`. + * - `D` should have `N-2` elements and is overwritten by the second super-diagonal elements of `U`. + * - `IN` should have `N` elements and is overwritten by the pivot details and singularity info. + * + * @param N - order of the matrix T + * @param A - diagonal elements of T + * @param lambda - scalar constant + * @param B - super-diagonal elements of T + * @param C - sub-diagonal elements of T + * @param tol - tolerance constant + * @param D - second super-diagonal elements of U + * @param IN - pivot and singularity indices + * @returns status code + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * var Int32Array = require( '@stdlib/array/int32' ); + * + * var A = new Float64Array( [ 2.0, 3.0, 1.0 ] ); + * var B = new Float64Array( [ 1.0, 1.0 ] ); + * var C = new Float64Array( [ 1.0, 1.0 ] ); + * var D = new Float64Array( [ 0.0 ] ); + * var IN = new Int32Array( [ 0, 0, 0 ] ); + * + * dlagtf( 3, A, 0.0, B, C, 0.0, D, IN ); + * // A => [ 2.0, 2.5, 0.6 ] + * // B => [ 1.0, 1.0 ] + * // C => [ 0.5, 0.4 ] + * // D => [ 0.0 ] + * // IN => [ 0, 0, 0 ] + */ + ( N: number, A: Float64Array, lambda: number, B: Float64Array, C: Float64Array, tol: number, D: Float64Array, IN: Int32Array ): StatusCode; + + /** + * Computes an `LU` factorization of a matrix `T - lambda*I`, where `T` is a general real tridiagonal matrix, and `lambda` a scalar, using partial pivoting with row interchanges and alternative indexing semantics. + * + * ## Notes + * + * - `A` should have `N` elements and is overwritten by the diagonal elements of `U`. + * - `B` should have `N-1` elements and is overwritten by the first super-diagonal elements of `U`. + * - `C` should have `N-1` elements and is overwritten by the multipliers that define `L`. + * - `D` should have `N-2` elements and is overwritten by the second super-diagonal elements of `U`. + * - `IN` should have `N` elements and is overwritten by the pivot details and singularity info. + * + * @param N - order of the matrix T + * @param A - diagonal elements of T + * @param strideA - stride length for A + * @param offsetA - starting index of A + * @param lambda - scalar constant + * @param B - super-diagonal elements of T + * @param strideB - stride length for B + * @param offsetB - starting index of B + * @param C - sub-diagonal elements of T + * @param strideC - stride length for C + * @param offsetC - starting index of C + * @param tol - tolerance constant + * @param D - second super-diagonal elements of U + * @param strideD - stride length for D + * @param offsetD - starting index of D + * @param IN - pivot and singularity indices + * @param strideIN - stride length for IN + * @param offsetIN - starting index of IN + * @returns status code + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * var Int32Array = require( '@stdlib/array/int32' ); + * + * var A = new Float64Array( [ 2.0, 3.0, 1.0 ] ); + * var B = new Float64Array( [ 1.0, 1.0 ] ); + * var C = new Float64Array( [ 1.0, 1.0 ] ); + * var D = new Float64Array( [ 0.0 ] ); + * var IN = new Int32Array( [ 0, 0, 0 ] ); + * + * dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); + * // A => [ 2.0, 2.5, 0.6 ] + * // B => [ 1.0, 1.0 ] + * // C => [ 0.5, 0.4 ] + * // D => [ 0.0 ] + * // IN => [ 0, 0, 0 ] + */ + ndarray( N: number, A: Float64Array, strideA: number, offsetA: number, lambda: number, B: Float64Array, strideB: number, offsetB: number, C: Float64Array, strideC: number, offsetC: number, tol: number, D: Float64Array, strideD: number, offsetD: number, IN: Int32Array, strideIN: number, offsetIN: number ): StatusCode; +} + +/** +* LAPACK routine to compute an `LU` factorization of a matrix `T - lambda*I`, where `T` is a general real tridiagonal matrix, and `lambda` a scalar, using partial pivoting with row interchanges. +* +* ## Notes +* +* - `A` should have `N` elements and is overwritten by the diagonal elements of `U`. +* - `B` should have `N-1` elements and is overwritten by the first super-diagonal elements of `U`. +* - `C` should have `N-1` elements and is overwritten by the multipliers that define `L`. +* - `D` should have `N-2` elements and is overwritten by the second super-diagonal elements of `U`. +* - `IN` should have `N` elements and is overwritten by the pivot details and singularity info. +* +* @param N - order of the matrix T +* @param A - diagonal elements of T +* @param lambda - scalar constant +* @param B - super-diagonal elements of T +* @param C - sub-diagonal elements of T +* @param tol - tolerance constant +* @param D - second super-diagonal elements of U +* @param IN - pivot and singularity indices +* @returns status code +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var Int32Array = require( '@stdlib/array/int32' ); +* +* var A = new Float64Array( [ 2.0, 3.0, 1.0 ] ); +* var B = new Float64Array( [ 1.0, 1.0 ] ); +* var C = new Float64Array( [ 1.0, 1.0 ] ); +* var D = new Float64Array( [ 0.0 ] ); +* var IN = new Int32Array( [ 0, 0, 0 ] ); +* +* dlagtf( 3, A, 0.0, B, C, 0.0, D, IN ); +* // A => [ 2.0, 2.5, 0.6 ] +* // B => [ 1.0, 1.0 ] +* // C => [ 0.5, 0.4 ] +* // D => [ 0.0 ] +* // IN => [ 0, 0, 0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var Int32Array = require( '@stdlib/array/int32' ); +* +* var A = new Float64Array( [ 2.0, 3.0, 1.0 ] ); +* var B = new Float64Array( [ 1.0, 1.0 ] ); +* var C = new Float64Array( [ 1.0, 1.0 ] ); +* var D = new Float64Array( [ 0.0 ] ); +* var IN = new Int32Array( [ 0, 0, 0 ] ); +* +* dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); +* // A => [ 2.0, 2.5, 0.6 ] +* // B => [ 1.0, 1.0 ] +* // C => [ 0.5, 0.4 ] +* // D => [ 0.0 ] +* // IN => [ 0, 0, 0 ] +*/ +declare var dlagtf: Routine; + +// EXPORTS // + +export = dlagtf; diff --git a/lib/node_modules/@stdlib/lapack/base/dlagtf/docs/types/test.ts b/lib/node_modules/@stdlib/lapack/base/dlagtf/docs/types/test.ts new file mode 100644 index 000000000000..dafdecd13136 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlagtf/docs/types/test.ts @@ -0,0 +1,561 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +import dlagtf = require( './index' ); + +// TESTS // + +// The function returns a number... +{ + const A = new Float64Array( 3 ); + const B = new Float64Array( 2 ); + const C = new Float64Array( 2 ); + const D = new Float64Array( 1 ); + const IN = new Int32Array( 3 ); + + dlagtf( 3, A, 0.0, B, C, 0.0, D, IN ); // $ExpectType number +} + +// The compiler throws an error if the function is provided a first argument which is not a number... +{ + const A = new Float64Array( 3 ); + const B = new Float64Array( 2 ); + const C = new Float64Array( 2 ); + const D = new Float64Array( 1 ); + const IN = new Int32Array( 3 ); + + dlagtf( '5', A, 0.0, B, C, 0.0, D, IN ); // $ExpectError + dlagtf( true, A, 0.0, B, C, 0.0, D, IN ); // $ExpectError + dlagtf( false, A, 0.0, B, C, 0.0, D, IN ); // $ExpectError + dlagtf( null, A, 0.0, B, C, 0.0, D, IN ); // $ExpectError + dlagtf( undefined, A, 0.0, B, C, 0.0, D, IN ); // $ExpectError + dlagtf( [], A, 0.0, B, C, 0.0, D, IN ); // $ExpectError + dlagtf( {}, A, 0.0, B, C, 0.0, D, IN ); // $ExpectError + dlagtf( ( x: number ): number => x, A, 0.0, B, C, 0.0, D, IN ); // $ExpectError +} + +// The compiler throws an error if the function is provided a second argument which is not a Float64Array... +{ + const B = new Float64Array( 2 ); + const C = new Float64Array( 2 ); + const D = new Float64Array( 1 ); + const IN = new Int32Array( 3 ); + + dlagtf( 3, '5', 0.0, B, C, 0.0, D, IN ); // $ExpectError + dlagtf( 3, 5, 0.0, B, C, 0.0, D, IN ); // $ExpectError + dlagtf( 3, true, 0.0, B, C, 0.0, D, IN ); // $ExpectError + dlagtf( 3, false, 0.0, B, C, 0.0, D, IN ); // $ExpectError + dlagtf( 3, null, 0.0, B, C, 0.0, D, IN ); // $ExpectError + dlagtf( 3, undefined, 0.0, B, C, 0.0, D, IN ); // $ExpectError + dlagtf( 3, [], 0.0, B, C, 0.0, D, IN ); // $ExpectError + dlagtf( 3, {}, 0.0, B, C, 0.0, D, IN ); // $ExpectError + dlagtf( 3, ( x: number ): number => x, 0.0, B, C, 0.0, D, IN ); // $ExpectError +} + +// The compiler throws an error if the function is provided a third argument which is not a number... +{ + const A = new Float64Array( 3 ); + const B = new Float64Array( 2 ); + const C = new Float64Array( 2 ); + const D = new Float64Array( 1 ); + const IN = new Int32Array( 3 ); + + dlagtf( 3, A, '5', B, C, 0.0, D, IN ); // $ExpectError + dlagtf( 3, A, true, B, C, 0.0, D, IN ); // $ExpectError + dlagtf( 3, A, false, B, C, 0.0, D, IN ); // $ExpectError + dlagtf( 3, A, null, B, C, 0.0, D, IN ); // $ExpectError + dlagtf( 3, A, undefined, B, C, 0.0, D, IN ); // $ExpectError + dlagtf( 3, A, [], B, C, 0.0, D, IN ); // $ExpectError + dlagtf( 3, A, {}, B, C, 0.0, D, IN ); // $ExpectError + dlagtf( 3, A, ( x: number ): number => x, B, C, 0.0, D, IN ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fourth argument which is not a Float64Array... +{ + const A = new Float64Array( 3 ); + const C = new Float64Array( 2 ); + const D = new Float64Array( 1 ); + const IN = new Int32Array( 3 ); + + dlagtf( 3, A, 0.0, '5', C, 0.0, D, IN ); // $ExpectError + dlagtf( 3, A, 0.0, 5, C, 0.0, D, IN ); // $ExpectError + dlagtf( 3, A, 0.0, true, C, 0.0, D, IN ); // $ExpectError + dlagtf( 3, A, 0.0, false, C, 0.0, D, IN ); // $ExpectError + dlagtf( 3, A, 0.0, null, C, 0.0, D, IN ); // $ExpectError + dlagtf( 3, A, 0.0, undefined, C, 0.0, D, IN ); // $ExpectError + dlagtf( 3, A, 0.0, [], C, 0.0, D, IN ); // $ExpectError + dlagtf( 3, A, 0.0, {}, C, 0.0, D, IN ); // $ExpectError + dlagtf( 3, A, 0.0, ( x: number ): number => x, C, 0.0, D, IN ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fifth argument which is not a Float64Array... +{ + const A = new Float64Array( 3 ); + const B = new Float64Array( 2 ); + const D = new Float64Array( 1 ); + const IN = new Int32Array( 3 ); + + dlagtf( 3, A, 0.0, B, '5', 0.0, D, IN ); // $ExpectError + dlagtf( 3, A, 0.0, B, 5, 0.0, D, IN ); // $ExpectError + dlagtf( 3, A, 0.0, B, true, 0.0, D, IN ); // $ExpectError + dlagtf( 3, A, 0.0, B, false, 0.0, D, IN ); // $ExpectError + dlagtf( 3, A, 0.0, B, null, 0.0, D, IN ); // $ExpectError + dlagtf( 3, A, 0.0, B, undefined, 0.0, D, IN ); // $ExpectError + dlagtf( 3, A, 0.0, B, [], 0.0, D, IN ); // $ExpectError + dlagtf( 3, A, 0.0, B, {}, 0.0, D, IN ); // $ExpectError + dlagtf( 3, A, 0.0, B, ( x: number ): number => x, 0.0, D, IN ); // $ExpectError +} + +// The compiler throws an error if the function is provided a sixth argument which is not a number... +{ + const A = new Float64Array( 3 ); + const B = new Float64Array( 2 ); + const C = new Float64Array( 2 ); + const D = new Float64Array( 1 ); + const IN = new Int32Array( 3 ); + + dlagtf( 3, A, 0.0, B, C, '5', D, IN ); // $ExpectError + dlagtf( 3, A, 0.0, B, C, true, D, IN ); // $ExpectError + dlagtf( 3, A, 0.0, B, C, false, D, IN ); // $ExpectError + dlagtf( 3, A, 0.0, B, C, null, D, IN ); // $ExpectError + dlagtf( 3, A, 0.0, B, C, undefined, D, IN ); // $ExpectError + dlagtf( 3, A, 0.0, B, C, [], D, IN ); // $ExpectError + dlagtf( 3, A, 0.0, B, C, {}, D, IN ); // $ExpectError + dlagtf( 3, A, 0.0, B, C, ( x: number ): number => x, D, IN ); // $ExpectError +} + +// The compiler throws an error if the function is provided a seventh argument which is not a Float64Array... +{ + const A = new Float64Array( 3 ); + const B = new Float64Array( 2 ); + const C = new Float64Array( 2 ); + const IN = new Int32Array( 3 ); + + dlagtf( 3, A, 0.0, B, C, 0.0, '5', IN ); // $ExpectError + dlagtf( 3, A, 0.0, B, C, 0.0, 5, IN ); // $ExpectError + dlagtf( 3, A, 0.0, B, C, 0.0, true, IN ); // $ExpectError + dlagtf( 3, A, 0.0, B, C, 0.0, false, IN ); // $ExpectError + dlagtf( 3, A, 0.0, B, C, 0.0, null, IN ); // $ExpectError + dlagtf( 3, A, 0.0, B, C, 0.0, undefined, IN ); // $ExpectError + dlagtf( 3, A, 0.0, B, C, 0.0, [], IN ); // $ExpectError + dlagtf( 3, A, 0.0, B, C, 0.0, {}, IN ); // $ExpectError + dlagtf( 3, A, 0.0, B, C, 0.0, ( x: number ): number => x, IN ); // $ExpectError +} + +// The compiler throws an error if the function is provided an eighth argument which is not an Int32Array... +{ + const A = new Float64Array( 3 ); + const B = new Float64Array( 2 ); + const C = new Float64Array( 2 ); + const D = new Float64Array( 1 ); + + dlagtf( 3, A, 0.0, B, C, 0.0, D, '5' ); // $ExpectError + dlagtf( 3, A, 0.0, B, C, 0.0, D, 5 ); // $ExpectError + dlagtf( 3, A, 0.0, B, C, 0.0, D, true ); // $ExpectError + dlagtf( 3, A, 0.0, B, C, 0.0, D, false ); // $ExpectError + dlagtf( 3, A, 0.0, B, C, 0.0, D, null ); // $ExpectError + dlagtf( 3, A, 0.0, B, C, 0.0, D, undefined ); // $ExpectError + dlagtf( 3, A, 0.0, B, C, 0.0, D, [] ); // $ExpectError + dlagtf( 3, A, 0.0, B, C, 0.0, D, {} ); // $ExpectError + dlagtf( 3, A, 0.0, B, C, 0.0, D, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + const A = new Float64Array( 3 ); + const B = new Float64Array( 2 ); + const C = new Float64Array( 2 ); + const D = new Float64Array( 1 ); + const IN = new Int32Array( 3 ); + + dlagtf(); // $ExpectError + dlagtf( 3 ); // $ExpectError + dlagtf( 3, A ); // $ExpectError + dlagtf( 3, A, 0.0 ); // $ExpectError + dlagtf( 3, A, 0.0, B ); // $ExpectError + dlagtf( 3, A, 0.0, B, C ); // $ExpectError + dlagtf( 3, A, 0.0, B, C, 0.0 ); // $ExpectError + dlagtf( 3, A, 0.0, B, C, 0.0, D ); // $ExpectError + dlagtf( 3, A, 0.0, B, C, 0.0, D, IN, 10 ); // $ExpectError +} + +// Attached to main export is an `ndarray` method which returns a number... +{ + const A = new Float64Array( 3 ); + const B = new Float64Array( 2 ); + const C = new Float64Array( 2 ); + const D = new Float64Array( 1 ); + const IN = new Int32Array( 3 ); + + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectType number +} + +// The compiler throws an error if the `ndarray` method is provided a first argument which is not a number... +{ + const A = new Float64Array( 3 ); + const B = new Float64Array( 2 ); + const C = new Float64Array( 2 ); + const D = new Float64Array( 1 ); + const IN = new Int32Array( 3 ); + + dlagtf.ndarray( '5', A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( true, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( false, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( null, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( undefined, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( [], A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( {}, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( ( x: number ): number => x, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a second argument which is not a Float64Array... +{ + const B = new Float64Array( 2 ); + const C = new Float64Array( 2 ); + const D = new Float64Array( 1 ); + const IN = new Int32Array( 3 ); + + dlagtf.ndarray( 3, '5', 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, 5, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, true, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, false, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, null, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, undefined, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, [], 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, {}, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, ( x: number ): number => x, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a third argument which is not a number... +{ + const A = new Float64Array( 3 ); + const B = new Float64Array( 2 ); + const C = new Float64Array( 2 ); + const D = new Float64Array( 1 ); + const IN = new Int32Array( 3 ); + + dlagtf.ndarray( 3, A, '5', 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, true, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, false, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, null, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, undefined, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, [], 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, {}, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, ( x: number ): number => x, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a fourth argument which is not a number... +{ + const A = new Float64Array( 3 ); + const B = new Float64Array( 2 ); + const C = new Float64Array( 2 ); + const D = new Float64Array( 1 ); + const IN = new Int32Array( 3 ); + + dlagtf.ndarray( 3, A, 1, '5', 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, true, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, false, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, null, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, undefined, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, [], 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, {}, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, ( x: number ): number => x, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a fifth argument which is not a number... +{ + const A = new Float64Array( 3 ); + const B = new Float64Array( 2 ); + const C = new Float64Array( 2 ); + const D = new Float64Array( 1 ); + const IN = new Int32Array( 3 ); + + dlagtf.ndarray( 3, A, 1, 0, '5', B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, true, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, false, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, null, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, undefined, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, [], B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, {}, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, ( x: number ): number => x, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a sixth argument which is not a Float64Array... +{ + const A = new Float64Array( 3 ); + const C = new Float64Array( 2 ); + const D = new Float64Array( 1 ); + const IN = new Int32Array( 3 ); + + dlagtf.ndarray( 3, A, 1, 0, 0.0, '5', 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, 5, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, true, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, false, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, null, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, undefined, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, [], 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, {}, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, ( x: number ): number => x, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a seventh argument which is not a number... +{ + const A = new Float64Array( 3 ); + const B = new Float64Array( 2 ); + const C = new Float64Array( 2 ); + const D = new Float64Array( 1 ); + const IN = new Int32Array( 3 ); + + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, '5', 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, true, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, false, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, null, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, undefined, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, [], 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, {}, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, ( x: number ): number => x, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided an eighth argument which is not a number... +{ + const A = new Float64Array( 3 ); + const B = new Float64Array( 2 ); + const C = new Float64Array( 2 ); + const D = new Float64Array( 1 ); + const IN = new Int32Array( 3 ); + + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, '5', C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, true, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, false, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, null, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, undefined, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, [], C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, {}, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, ( x: number ): number => x, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a ninth argument which is not a Float64Array... +{ + const A = new Float64Array( 3 ); + const B = new Float64Array( 2 ); + const D = new Float64Array( 1 ); + const IN = new Int32Array( 3 ); + + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, '5', 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, 5, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, true, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, false, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, null, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, undefined, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, [], 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, {}, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, ( x: number ): number => x, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a tenth argument which is not a number... +{ + const A = new Float64Array( 3 ); + const B = new Float64Array( 2 ); + const C = new Float64Array( 2 ); + const D = new Float64Array( 1 ); + const IN = new Int32Array( 3 ); + + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, '5', 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, true, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, false, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, null, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, undefined, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, [], 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, {}, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, ( x: number ): number => x, 0, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided an eleventh argument which is not a number... +{ + const A = new Float64Array( 3 ); + const B = new Float64Array( 2 ); + const C = new Float64Array( 2 ); + const D = new Float64Array( 1 ); + const IN = new Int32Array( 3 ); + + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, '5', 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, true, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, false, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, null, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, undefined, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, [], 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, {}, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, ( x: number ): number => x, 0.0, D, 1, 0, IN, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a twelfth argument which is not a number... +{ + const A = new Float64Array( 3 ); + const B = new Float64Array( 2 ); + const C = new Float64Array( 2 ); + const D = new Float64Array( 1 ); + const IN = new Int32Array( 3 ); + + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, '5', D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, true, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, false, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, null, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, undefined, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, [], D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, {}, D, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, ( x: number ): number => x, D, 1, 0, IN, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a thirteenth argument which is not a Float64Array... +{ + const A = new Float64Array( 3 ); + const B = new Float64Array( 2 ); + const C = new Float64Array( 2 ); + const IN = new Int32Array( 3 ); + + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, '5', 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, 5, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, true, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, false, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, null, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, undefined, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, [], 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, {}, 1, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, ( x: number ): number => x, 1, 0, IN, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a fourteenth argument which is not a number... +{ + const A = new Float64Array( 3 ); + const B = new Float64Array( 2 ); + const C = new Float64Array( 2 ); + const D = new Float64Array( 1 ); + const IN = new Int32Array( 3 ); + + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, '5', 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, true, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, false, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, null, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, undefined, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, [], 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, {}, 0, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, ( x: number ): number => x, 0, IN, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a fifteenth argument which is not a number... +{ + const A = new Float64Array( 3 ); + const B = new Float64Array( 2 ); + const C = new Float64Array( 2 ); + const D = new Float64Array( 1 ); + const IN = new Int32Array( 3 ); + + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, '5', IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, true, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, false, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, null, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, undefined, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, [], IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, {}, IN, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, ( x: number ): number => x, IN, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a sixteenth argument which is not an Int32Array... +{ + const A = new Float64Array( 3 ); + const B = new Float64Array( 2 ); + const C = new Float64Array( 2 ); + const D = new Float64Array( 1 ); + + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, '5', 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, 5, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, true, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, false, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, null, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, undefined, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, [], 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, {}, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, ( x: number ): number => x, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a seventeenth argument which is not a number... +{ + const A = new Float64Array( 3 ); + const B = new Float64Array( 2 ); + const C = new Float64Array( 2 ); + const D = new Float64Array( 1 ); + const IN = new Int32Array( 3 ); + + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, '5', 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, true, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, false, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, null, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, undefined, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, [], 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, {}, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, ( x: number ): number => x, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided an eighteenth argument which is not a number... +{ + const A = new Float64Array( 3 ); + const B = new Float64Array( 2 ); + const C = new Float64Array( 2 ); + const D = new Float64Array( 1 ); + const IN = new Int32Array( 3 ); + + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, '5' ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, true ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, false ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, null ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, undefined ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, [] ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, {} ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided an unsupported number of arguments... +{ + const A = new Float64Array( 3 ); + const B = new Float64Array( 2 ); + const C = new Float64Array( 2 ); + const D = new Float64Array( 1 ); + const IN = new Int32Array( 3 ); + + dlagtf.ndarray(); // $ExpectError + dlagtf.ndarray( 3 ); // $ExpectError + dlagtf.ndarray( 3, A ); // $ExpectError + dlagtf.ndarray( 3, A, 1 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1 ); // $ExpectError + dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0, 10 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlagtf/examples/index.js b/lib/node_modules/@stdlib/lapack/base/dlagtf/examples/index.js new file mode 100644 index 000000000000..67e134b4c9b9 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlagtf/examples/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var Int32Array = require( '@stdlib/array/int32' ); +var Float64Array = require( '@stdlib/array/float64' ); +var dlagtf = require( './../lib' ); + +var N = 5; + +var A = new Float64Array( [ 2.0, 3.0, 1.0, 2.0, 1.0 ] ); +var B = new Float64Array( [ 1.0, 1.0, 1.0, 1.0 ] ); +var C = new Float64Array( [ 1.0, 1.0, 1.0, 1.0 ] ); +var D = new Float64Array( N - 2 ); +var IN = new Int32Array( N ); + +var info = dlagtf( N, A, 0.0, B, C, 0.0, D, IN ); + +console.log( 'A:', A ); +console.log( 'B:', B ); +console.log( 'C:', C ); +console.log( 'D:', D ); +console.log( 'IN:', IN ); +console.log( 'info:', info ); diff --git a/lib/node_modules/@stdlib/lapack/base/dlagtf/lib/base.js b/lib/node_modules/@stdlib/lapack/base/dlagtf/lib/base.js new file mode 100644 index 000000000000..803cee1e478c --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlagtf/lib/base.js @@ -0,0 +1,164 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var abs = require( '@stdlib/math/base/special/abs' ); +var max = require( '@stdlib/math/base/special/max' ); +var dlamch = require( '@stdlib/lapack/base/dlamch' ); + + +// MAIN // + +/** +* Computes an `LU` factorization of a matrix `T - lambda*I`, where `T` is a general real tridiagonal matrix, and `lambda` a scalar, using partial pivoting with row interchanges. +* +* @private +* @param {NonNegativeInteger} N - order of the matrix T +* @param {Float64Array} A - diagonal elements of T +* @param {integer} strideA - stride length for A +* @param {NonNegativeInteger} offsetA - starting index of A +* @param {number} lambda - scalar constant +* @param {Float64Array} B - super-diagonal elements of T +* @param {integer} strideB - stride length for B +* @param {NonNegativeInteger} offsetB - starting index of B +* @param {Float64Array} C - sub-diagonal elements of T +* @param {integer} strideC - stride length for C +* @param {NonNegativeInteger} offsetC - starting index of C +* @param {number} tol - tolerance constant +* @param {Float64Array} D - second super-diagonal elements of U +* @param {integer} strideD - stride length for D +* @param {NonNegativeInteger} offsetD - starting index of D +* @param {Int32Array} IN - pivot and singularity indices +* @param {integer} strideIN - stride length for IN +* @param {NonNegativeInteger} offsetIN - starting index of IN +* @returns {integer} status code +*/ +function dlagtf( N, A, strideA, offsetA, lambda, B, strideB, offsetB, C, strideC, offsetC, tol, D, strideD, offsetD, IN, strideIN, offsetIN ) { // eslint-disable-line max-len, max-params + var scale1; + var scale2; + var mult; + var temp; + var piv1; + var piv2; + var iinN; + var eps; + var iin; + var ia; + var ib; + var ic; + var id; + var tl; + var k; + + if ( N === 0 ) { + return 0; + } + + ia = offsetA; + ib = offsetB; + ic = offsetC; + id = offsetD; + iin = offsetIN; + iinN = offsetIN + ( ( N - 1 ) * strideIN ); + + A[ ia ] -= lambda; + IN[ iinN ] = 0; + + if ( N === 1 ) { + if ( A[ ia ] === 0.0 ) { + IN[ offsetIN ] = 1; + } + return 0; + } + + eps = dlamch( 'e' ); + tl = max( tol, eps ); + scale1 = abs( A[ ia ] ) + abs( B[ ib ] ); + + for ( k = 0; k < N - 1; k++ ) { + A[ ia + strideA ] -= lambda; + scale2 = abs( C[ ic ] ) + abs( A[ ia + strideA ] ); + if ( k < N - 2 ) { + scale2 += abs( B[ ib + strideB ] ); + } + + if ( A[ ia ] === 0.0 ) { + piv1 = 0.0; + } else { + piv1 = abs( A[ ia ] ) / scale1; + } + + if ( C[ ic ] === 0.0 ) { + IN[ iin ] = 0; + piv2 = 0.0; + scale1 = scale2; + if ( k < N - 2 ) { + D[ id ] = 0.0; + } + } else { + piv2 = abs( C[ ic ] ) / scale2; + if ( piv2 <= piv1 ) { + IN[ iin ] = 0; + scale1 = scale2; + C[ ic ] /= A[ ia ]; + A[ ia + strideA ] -= C[ ic ] * B[ ib ]; + if ( k < N - 2 ) { + D[ id ] = 0.0; + } + } else { + IN[ iin ] = 1; + mult = A[ ia ] / C[ ic ]; + A[ ia ] = C[ ic ]; + temp = A[ ia + strideA ]; + A[ ia + strideA ] = B[ ib ] - ( mult * temp ); + if ( k < N - 2 ) { + D[ id ] = B[ ib + strideB ]; + B[ ib + strideB ] = -mult * D[ id ]; + } + B[ ib ] = temp; + C[ ic ] = mult; + } + } + + if ( max( piv1, piv2 ) <= tl && IN[ iinN ] === 0 ) { + IN[ iinN ] = k + 1; + } + + ia += strideA; + ib += strideB; + ic += strideC; + if ( k < N - 2 ) { + id += strideD; + } + iin += strideIN; + } + + if ( abs( A[ ia ] ) <= scale1 * tl && IN[ iinN ] === 0 ) { + IN[ iinN ] = N; + } + + return 0; +} + + +// EXPORTS // + +module.exports = dlagtf; diff --git a/lib/node_modules/@stdlib/lapack/base/dlagtf/lib/dlagtf.js b/lib/node_modules/@stdlib/lapack/base/dlagtf/lib/dlagtf.js new file mode 100644 index 000000000000..2b9cd4e8b2a2 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlagtf/lib/dlagtf.js @@ -0,0 +1,79 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var format = require( '@stdlib/string/format' ); +var base = require( './base.js' ); + + +// MAIN // + +/** +* Computes an `LU` factorization of a matrix `T - lambda*I`, where `T` is a general real tridiagonal matrix, and `lambda` a scalar, using partial pivoting with row interchanges. +* +* ## Notes +* +* - `A` should have `N` elements and is overwritten by the diagonal elements of `U`. +* - `B` should have `N-1` elements and is overwritten by the first super-diagonal elements of `U`. +* - `C` should have `N-1` elements and is overwritten by the multipliers that define `L`. +* - `D` should have `N-2` elements and is overwritten by the second super-diagonal elements of `U`. +* - `IN` should have `N` elements and is overwritten by the pivot details and singularity info. +* +* @param {NonNegativeInteger} N - order of the matrix T +* @param {Float64Array} A - diagonal elements of T +* @param {number} lambda - scalar constant +* @param {Float64Array} B - super-diagonal elements of T +* @param {Float64Array} C - sub-diagonal elements of T +* @param {number} tol - tolerance constant +* @param {Float64Array} D - second super-diagonal elements of U +* @param {Int32Array} IN - pivot and singularity indices +* @throws {RangeError} first argument must be a nonnegative integer +* @returns {integer} status code +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var Int32Array = require( '@stdlib/array/int32' ); +* var dlagtf = require( '@stdlib/lapack/base/dlagtf' ); +* +* var A = new Float64Array( [ 2.0, 3.0, 1.0 ] ); +* var B = new Float64Array( [ 1.0, 1.0 ] ); +* var C = new Float64Array( [ 1.0, 1.0 ] ); +* var D = new Float64Array( [ 0.0 ] ); +* var IN = new Int32Array( [ 0, 0, 0 ] ); +* +* dlagtf( 3, A, 0.0, B, C, 0.0, D, IN ); +* // A => [ 2.0, 2.5, 0.6 ] +* // B => [ 1.0, 1.0 ] +* // C => [ 0.5, 0.4 ] +* // D => [ 0.0 ] +* // IN => [ 0, 0, 0 ] +*/ +function dlagtf( N, A, lambda, B, C, tol, D, IN ) { // eslint-disable-line stdlib/jsdoc-doctest-decimal-point + if ( N < 0 ) { + throw new RangeError( format( 'invalid argument. First argument must be a nonnegative integer. Value: `%d`.', N ) ); + } + return base( N, A, 1, 0, lambda, B, 1, 0, C, 1, 0, tol, D, 1, 0, IN, 1, 0 ); +} + + +// EXPORTS // + +module.exports = dlagtf; diff --git a/lib/node_modules/@stdlib/lapack/base/dlagtf/lib/index.js b/lib/node_modules/@stdlib/lapack/base/dlagtf/lib/index.js new file mode 100644 index 000000000000..72eb087e8048 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlagtf/lib/index.js @@ -0,0 +1,86 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* LAPACK routine to compute an `LU` factorization of a matrix `T - lambda*I`, where `T` is a general real tridiagonal matrix, and `lambda` a scalar, using partial pivoting with row interchanges. +* +* @module @stdlib/lapack/base/dlagtf +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var Int32Array = require( '@stdlib/array/int32' ); +* var dlagtf = require( '@stdlib/lapack/base/dlagtf' ); +* +* var A = new Float64Array( [ 2.0, 3.0, 1.0 ] ); +* var B = new Float64Array( [ 1.0, 1.0 ] ); +* var C = new Float64Array( [ 1.0, 1.0 ] ); +* var D = new Float64Array( [ 0.0 ] ); +* var IN = new Int32Array( [ 0, 0, 0 ] ); +* +* dlagtf( 3, A, 0.0, B, C, 0.0, D, IN ); +* // A => [ 2.0, 2.5, 0.6 ] +* // B => [ 1.0, 1.0 ] +* // C => [ 0.5, 0.4 ] +* // D => [ 0.0 ] +* // IN => [ 0, 0, 0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var Int32Array = require( '@stdlib/array/int32' ); +* var dlagtf = require( '@stdlib/lapack/base/dlagtf' ); +* +* var A = new Float64Array( [ 2.0, 3.0, 1.0 ] ); +* var B = new Float64Array( [ 1.0, 1.0 ] ); +* var C = new Float64Array( [ 1.0, 1.0 ] ); +* var D = new Float64Array( [ 0.0 ] ); +* var IN = new Int32Array( [ 0, 0, 0 ] ); +* +* dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); +* // A => [ 2.0, 2.5, 0.6 ] +* // B => [ 1.0, 1.0 ] +* // C => [ 0.5, 0.4 ] +* // D => [ 0.0 ] +* // IN => [ 0, 0, 0 ] +*/ + +// MODULES // + +var join = require( 'path' ).join; +var tryRequire = require( '@stdlib/utils/try-require' ); +var isError = require( '@stdlib/assert/is-error' ); +var main = require( './main.js' ); + + +// MAIN // + +var dlagtf; +var tmp = tryRequire( join( __dirname, './native.js' ) ); +if ( isError( tmp ) ) { + dlagtf = main; +} else { + dlagtf = tmp; +} + + +// EXPORTS // + +module.exports = dlagtf; + +// exports: { "ndarray": "dlagtf.ndarray" } diff --git a/lib/node_modules/@stdlib/lapack/base/dlagtf/lib/main.js b/lib/node_modules/@stdlib/lapack/base/dlagtf/lib/main.js new file mode 100644 index 000000000000..805fb7a8d405 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlagtf/lib/main.js @@ -0,0 +1,35 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var dlagtf = require( './dlagtf.js' ); +var ndarray = require( './ndarray.js' ); + + +// MAIN // + +setReadOnly( dlagtf, 'ndarray', ndarray ); + + +// EXPORTS // + +module.exports = dlagtf; diff --git a/lib/node_modules/@stdlib/lapack/base/dlagtf/lib/ndarray.js b/lib/node_modules/@stdlib/lapack/base/dlagtf/lib/ndarray.js new file mode 100644 index 000000000000..49761e981c68 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlagtf/lib/ndarray.js @@ -0,0 +1,88 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var format = require( '@stdlib/string/format' ); +var base = require( './base.js' ); + + +// MAIN // + +/** +* Computes an `LU` factorization of a matrix `T - lambda*I`, where `T` is a general real tridiagonal matrix, and `lambda` a scalar, using partial pivoting with row interchanges and alternative indexing semantics. +* +* ## Notes +* +* - `A` should have `N` elements and is overwritten by the diagonal elements of `U`. +* - `B` should have `N-1` elements and is overwritten by the first super-diagonal elements of `U`. +* - `C` should have `N-1` elements and is overwritten by the multipliers that define `L`. +* - `D` should have `N-2` elements and is overwritten by the second super-diagonal elements of `U`. +* - `IN` should have `N` elements and is overwritten by the pivot details and singularity info. +* +* @param {NonNegativeInteger} N - order of the matrix T +* @param {Float64Array} A - diagonal elements of T +* @param {integer} strideA - stride length for A +* @param {NonNegativeInteger} offsetA - starting index of A +* @param {number} lambda - scalar constant +* @param {Float64Array} B - super-diagonal elements of T +* @param {integer} strideB - stride length for B +* @param {NonNegativeInteger} offsetB - starting index of B +* @param {Float64Array} C - sub-diagonal elements of T +* @param {integer} strideC - stride length for C +* @param {NonNegativeInteger} offsetC - starting index of C +* @param {number} tol - tolerance constant +* @param {Float64Array} D - second super-diagonal elements of U +* @param {integer} strideD - stride length for D +* @param {NonNegativeInteger} offsetD - starting index of D +* @param {Int32Array} IN - pivot and singularity indices +* @param {integer} strideIN - stride length for IN +* @param {NonNegativeInteger} offsetIN - starting index of IN +* @throws {RangeError} first argument must be a nonnegative integer +* @returns {integer} status code +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var Int32Array = require( '@stdlib/array/int32' ); +* +* var A = new Float64Array( [ 2.0, 3.0, 1.0 ] ); +* var B = new Float64Array( [ 1.0, 1.0 ] ); +* var C = new Float64Array( [ 1.0, 1.0 ] ); +* var D = new Float64Array( [ 0.0 ] ); +* var IN = new Int32Array( [ 0, 0, 0 ] ); +* +* dlagtf( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 ); +* // A => [ 2.0, 2.5, 0.6 ] +* // B => [ 1.0, 1.0 ] +* // C => [ 0.5, 0.4 ] +* // D => [ 0.0 ] +* // IN => [ 0, 0, 0 ] +*/ +function dlagtf( N, A, strideA, offsetA, lambda, B, strideB, offsetB, C, strideC, offsetC, tol, D, strideD, offsetD, IN, strideIN, offsetIN ) { // eslint-disable-line stdlib/jsdoc-doctest-decimal-point, max-len, max-params + if ( N < 0 ) { + throw new RangeError( format( 'invalid argument. First argument must be a nonnegative integer. Value: `%d`.', N ) ); + } + return base( N, A, strideA, offsetA, lambda, B, strideB, offsetB, C, strideC, offsetC, tol, D, strideD, offsetD, IN, strideIN, offsetIN ); // eslint-disable-line max-len +} + + +// EXPORTS // + +module.exports = dlagtf; diff --git a/lib/node_modules/@stdlib/lapack/base/dlagtf/package.json b/lib/node_modules/@stdlib/lapack/base/dlagtf/package.json new file mode 100644 index 000000000000..44de0eed16cc --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlagtf/package.json @@ -0,0 +1,70 @@ +{ + "name": "@stdlib/lapack/base/dlagtf", + "version": "0.0.0", + "description": "Compute an LU factorization of a matrix T-lambda*I, where T is a general real tridiagonal matrix and lambda is a scalar, using partial pivoting with row interchanges", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "stdmath", + "mathematics", + "math", + "lapack", + "dlagtf", + "factorization", + "lu", + "tridiagonal", + "linear", + "algebra", + "subroutines", + "array", + "ndarray", + "float64", + "double", + "float64array" + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlagtf/test/fixtures/diag_dominant.json b/lib/node_modules/@stdlib/lapack/base/dlagtf/test/fixtures/diag_dominant.json new file mode 100644 index 000000000000..621f5dd9817a --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlagtf/test/fixtures/diag_dominant.json @@ -0,0 +1,68 @@ +{ + "N": 4, + "a": [ + 4, + 4, + 4, + 4 + ], + "strideA": 1, + "offsetA": 0, + "lambda": 0, + "b": [ + 1, + 1, + 1 + ], + "strideB": 1, + "offsetB": 0, + "c": [ + 1, + 1, + 1 + ], + "strideC": 1, + "offsetC": 0, + "tol": 0, + "d": [ + 0, + 0 + ], + "strideD": 1, + "offsetD": 0, + "in": [ + 0, + 0, + 0, + 0 + ], + "info_out": 0, + "a_out": [ + 4, + 3.75, + 3.7333333333333334, + 3.732142857142857 + ], + "b_out": [ + 1, + 1, + 1 + ], + "c_out": [ + 0.25, + 0.26666666666666666, + 0.26785714285714285 + ], + "d_out": [ + 0, + 0 + ], + "in_out": [ + 0, + 0, + 0, + 0 + ], + "strideIN": 1, + "offsetIN": 0 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlagtf/test/fixtures/large_diag.json b/lib/node_modules/@stdlib/lapack/base/dlagtf/test/fixtures/large_diag.json new file mode 100644 index 000000000000..f78c783dee14 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlagtf/test/fixtures/large_diag.json @@ -0,0 +1,68 @@ +{ + "N": 4, + "a": [ + 100, + 100, + 100, + 100 + ], + "strideA": 1, + "offsetA": 0, + "lambda": 0, + "b": [ + 1, + 1, + 1 + ], + "strideB": 1, + "offsetB": 0, + "c": [ + 1, + 1, + 1 + ], + "strideC": 1, + "offsetC": 0, + "tol": 0, + "d": [ + 0, + 0 + ], + "strideD": 1, + "offsetD": 0, + "in": [ + 0, + 0, + 0, + 0 + ], + "info_out": 0, + "a_out": [ + 100, + 99.99, + 99.9899989999, + 99.98999899979997 + ], + "b_out": [ + 1, + 1, + 1 + ], + "c_out": [ + 0.01, + 0.010001000100010001, + 0.010001000200040007 + ], + "d_out": [ + 0, + 0 + ], + "in_out": [ + 0, + 0, + 0, + 0 + ], + "strideIN": 1, + "offsetIN": 0 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlagtf/test/fixtures/large_positive_stride_1.json b/lib/node_modules/@stdlib/lapack/base/dlagtf/test/fixtures/large_positive_stride_1.json new file mode 100644 index 000000000000..d4320fda9843 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlagtf/test/fixtures/large_positive_stride_1.json @@ -0,0 +1,90 @@ +{ + "N": 4, + "a": [ + 4, + 9999, + 4, + 9999, + 4, + 9999, + 4 + ], + "strideA": 2, + "offsetA": 0, + "lambda": 0, + "b": [ + 1, + 9999, + 1, + 9999, + 1 + ], + "strideB": 2, + "offsetB": 0, + "c": [ + 1, + 9999, + 1, + 9999, + 1 + ], + "strideC": 2, + "offsetC": 0, + "tol": 0, + "d": [ + 0, + 9999, + 0 + ], + "strideD": 2, + "offsetD": 0, + "in": [ + 0, + 9999, + 0, + 9999, + 0, + 9999, + 0 + ], + "info_out": 0, + "a_out": [ + 4, + 9999, + 3.75, + 9999, + 3.7333333333333334, + 9999, + 3.732142857142857 + ], + "b_out": [ + 1, + 9999, + 1, + 9999, + 1 + ], + "c_out": [ + 0.25, + 9999, + 0.26666666666666666, + 9999, + 0.26785714285714285 + ], + "d_out": [ + 0, + 9999, + 0 + ], + "in_out": [ + 0, + 9999, + 0, + 9999, + 0, + 9999, + 0 + ], + "strideIN": 2, + "offsetIN": 0 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlagtf/test/fixtures/large_positive_stride_2.json b/lib/node_modules/@stdlib/lapack/base/dlagtf/test/fixtures/large_positive_stride_2.json new file mode 100644 index 000000000000..c2d06e2c9cad --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlagtf/test/fixtures/large_positive_stride_2.json @@ -0,0 +1,90 @@ +{ + "N": 4, + "a": [ + 2, + 9999, + 3, + 9999, + 2, + 9999, + 3 + ], + "strideA": 2, + "offsetA": 0, + "lambda": 2, + "b": [ + 1, + 9999, + 1, + 9999, + 1 + ], + "strideB": 2, + "offsetB": 0, + "c": [ + 5, + 9999, + 5, + 9999, + 5 + ], + "strideC": 2, + "offsetC": 0, + "tol": 0, + "d": [ + 0, + 9999, + 0 + ], + "strideD": 2, + "offsetD": 0, + "in": [ + 0, + 9999, + 0, + 9999, + 0, + 9999, + 0 + ], + "info_out": 0, + "a_out": [ + 5, + 9999, + 1, + 9999, + 5, + 9999, + 1 + ], + "b_out": [ + 1, + 9999, + 0, + 9999, + 1 + ], + "c_out": [ + 0, + 9999, + 5, + 9999, + 0 + ], + "d_out": [ + 1, + 9999, + 0 + ], + "in_out": [ + 1, + 9999, + 0, + 9999, + 1, + 9999, + 0 + ], + "strideIN": 2, + "offsetIN": 0 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlagtf/test/fixtures/mixed_pivoting.json b/lib/node_modules/@stdlib/lapack/base/dlagtf/test/fixtures/mixed_pivoting.json new file mode 100644 index 000000000000..7ae1e4bbd52c --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlagtf/test/fixtures/mixed_pivoting.json @@ -0,0 +1,78 @@ +{ + "N": 5, + "a": [ + 1, + 3, + 1, + 4, + 2 + ], + "strideA": 1, + "offsetA": 0, + "lambda": 1, + "b": [ + 2, + 1, + 3, + 1 + ], + "strideB": 1, + "offsetB": 0, + "c": [ + 3, + 2, + 1, + 5 + ], + "strideC": 1, + "offsetC": 0, + "tol": 0, + "d": [ + 0, + 0, + 0 + ], + "strideD": 1, + "offsetD": 0, + "in": [ + 0, + 0, + 0, + 0, + 0 + ], + "info_out": 0, + "a_out": [ + 3, + 2, + 1, + 5, + -0.6 + ], + "b_out": [ + 2, + 0, + 3, + 1 + ], + "c_out": [ + 0, + 1, + 0, + 0.6 + ], + "d_out": [ + 1, + 0, + 1 + ], + "in_out": [ + 1, + 0, + 1, + 1, + 0 + ], + "strideIN": 1, + "offsetIN": 0 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlagtf/test/fixtures/mixed_strides.json b/lib/node_modules/@stdlib/lapack/base/dlagtf/test/fixtures/mixed_strides.json new file mode 100644 index 000000000000..c3fc5a6262e0 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlagtf/test/fixtures/mixed_strides.json @@ -0,0 +1,82 @@ +{ + "N": 4, + "a": [ + 9999, + 2, + 9999, + 3, + 9999, + 2, + 9999, + 3 + ], + "strideA": 2, + "offsetA": 1, + "lambda": 2, + "b": [ + 1, + 1, + 1 + ], + "strideB": -1, + "offsetB": 2, + "c": [ + 5, + 9999, + 5, + 9999, + 5 + ], + "strideC": 2, + "offsetC": 0, + "tol": 0, + "d": [ + 0, + 9999, + 0 + ], + "strideD": -2, + "offsetD": 2, + "in": [ + 0, + 0, + 0, + 0 + ], + "info_out": 0, + "a_out": [ + 9999, + 5, + 9999, + 1, + 9999, + 5, + 9999, + 1 + ], + "b_out": [ + 1, + 0, + 1 + ], + "c_out": [ + 0, + 9999, + 5, + 9999, + 0 + ], + "d_out": [ + 0, + 9999, + 1 + ], + "in_out": [ + 1, + 0, + 1, + 0 + ], + "strideIN": 1, + "offsetIN": 0 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlagtf/test/fixtures/n_equals_one.json b/lib/node_modules/@stdlib/lapack/base/dlagtf/test/fixtures/n_equals_one.json new file mode 100644 index 000000000000..18dfdf1c5554 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlagtf/test/fixtures/n_equals_one.json @@ -0,0 +1,34 @@ +{ + "N": 1, + "a": [ + 5 + ], + "strideA": 1, + "offsetA": 0, + "lambda": 2, + "b": [], + "strideB": 1, + "offsetB": 0, + "c": [], + "strideC": 1, + "offsetC": 0, + "tol": 0, + "d": [], + "strideD": 1, + "offsetD": 0, + "in": [ + 0 + ], + "info_out": 0, + "a_out": [ + 3 + ], + "b_out": [], + "c_out": [], + "d_out": [], + "in_out": [ + 0 + ], + "strideIN": 1, + "offsetIN": 0 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlagtf/test/fixtures/n_equals_one_singular.json b/lib/node_modules/@stdlib/lapack/base/dlagtf/test/fixtures/n_equals_one_singular.json new file mode 100644 index 000000000000..fcaedcc96538 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlagtf/test/fixtures/n_equals_one_singular.json @@ -0,0 +1,34 @@ +{ + "N": 1, + "a": [ + 3 + ], + "strideA": 1, + "offsetA": 0, + "lambda": 3, + "b": [], + "strideB": 1, + "offsetB": 0, + "c": [], + "strideC": 1, + "offsetC": 0, + "tol": 0, + "d": [], + "strideD": 1, + "offsetD": 0, + "in": [ + 0 + ], + "info_out": 0, + "a_out": [ + 0 + ], + "b_out": [], + "c_out": [], + "d_out": [], + "in_out": [ + 1 + ], + "strideIN": 1, + "offsetIN": 0 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlagtf/test/fixtures/near_singular.json b/lib/node_modules/@stdlib/lapack/base/dlagtf/test/fixtures/near_singular.json new file mode 100644 index 000000000000..362cc14d5a02 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlagtf/test/fixtures/near_singular.json @@ -0,0 +1,68 @@ +{ + "N": 4, + "a": [ + 1, + 1, + 1, + 1 + ], + "strideA": 1, + "offsetA": 0, + "lambda": 1, + "b": [ + 1, + 1, + 1 + ], + "strideB": 1, + "offsetB": 0, + "c": [ + 1, + 1, + 1 + ], + "strideC": 1, + "offsetC": 0, + "tol": 0.0001, + "d": [ + 0, + 0 + ], + "strideD": 1, + "offsetD": 0, + "in": [ + 0, + 0, + 0, + 0 + ], + "info_out": 0, + "a_out": [ + 1, + 1, + 1, + 1 + ], + "b_out": [ + 0, + 0, + 0 + ], + "c_out": [ + 0, + 1, + 0 + ], + "d_out": [ + 1, + 0 + ], + "in_out": [ + 1, + 0, + 1, + 0 + ], + "strideIN": 1, + "offsetIN": 0 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlagtf/test/fixtures/negative_strides.json b/lib/node_modules/@stdlib/lapack/base/dlagtf/test/fixtures/negative_strides.json new file mode 100644 index 000000000000..dd0dfdcd98b0 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlagtf/test/fixtures/negative_strides.json @@ -0,0 +1,90 @@ +{ + "N": 4, + "a": [ + 3, + 9999, + 2, + 9999, + 3, + 9999, + 2 + ], + "strideA": -2, + "offsetA": 6, + "lambda": 2, + "b": [ + 1, + 9999, + 1, + 9999, + 1 + ], + "strideB": -2, + "offsetB": 4, + "c": [ + 5, + 9999, + 5, + 9999, + 5 + ], + "strideC": -2, + "offsetC": 4, + "tol": 0, + "d": [ + 0, + 9999, + 0 + ], + "strideD": -2, + "offsetD": 2, + "in": [ + 0, + 9999, + 0, + 9999, + 0, + 9999, + 0 + ], + "info_out": 0, + "a_out": [ + 1, + 9999, + 5, + 9999, + 1, + 9999, + 5 + ], + "b_out": [ + 1, + 9999, + 0, + 9999, + 1 + ], + "c_out": [ + 0, + 9999, + 5, + 9999, + 0 + ], + "d_out": [ + 0, + 9999, + 1 + ], + "in_out": [ + 0, + 9999, + 1, + 9999, + 0, + 9999, + 1 + ], + "strideIN": -2, + "offsetIN": 6 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlagtf/test/fixtures/positive_stride_offset_1.json b/lib/node_modules/@stdlib/lapack/base/dlagtf/test/fixtures/positive_stride_offset_1.json new file mode 100644 index 000000000000..f2aa6e934f70 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlagtf/test/fixtures/positive_stride_offset_1.json @@ -0,0 +1,78 @@ +{ + "N": 4, + "a": [ + 9999, + 4, + 4, + 4, + 4 + ], + "strideA": 1, + "offsetA": 1, + "lambda": 0, + "b": [ + 9999, + 1, + 1, + 1 + ], + "strideB": 1, + "offsetB": 1, + "c": [ + 9999, + 1, + 1, + 1 + ], + "strideC": 1, + "offsetC": 1, + "tol": 0, + "d": [ + 9999, + 0, + 0 + ], + "strideD": 1, + "offsetD": 1, + "in": [ + 9999, + 0, + 0, + 0, + 0 + ], + "info_out": 0, + "a_out": [ + 9999, + 4, + 3.75, + 3.7333333333333334, + 3.732142857142857 + ], + "b_out": [ + 9999, + 1, + 1, + 1 + ], + "c_out": [ + 9999, + 0.25, + 0.26666666666666666, + 0.26785714285714285 + ], + "d_out": [ + 9999, + 0, + 0 + ], + "in_out": [ + 9999, + 0, + 0, + 0, + 0 + ], + "strideIN": 1, + "offsetIN": 1 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlagtf/test/fixtures/positive_stride_offset_2.json b/lib/node_modules/@stdlib/lapack/base/dlagtf/test/fixtures/positive_stride_offset_2.json new file mode 100644 index 000000000000..1b8a9fa26acb --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlagtf/test/fixtures/positive_stride_offset_2.json @@ -0,0 +1,78 @@ +{ + "N": 4, + "a": [ + 9999, + 2, + 3, + 2, + 3 + ], + "strideA": 1, + "offsetA": 1, + "lambda": 2, + "b": [ + 9999, + 1, + 1, + 1 + ], + "strideB": 1, + "offsetB": 1, + "c": [ + 9999, + 5, + 5, + 5 + ], + "strideC": 1, + "offsetC": 1, + "tol": 0, + "d": [ + 9999, + 0, + 0 + ], + "strideD": 1, + "offsetD": 1, + "in": [ + 9999, + 0, + 0, + 0, + 0 + ], + "info_out": 0, + "a_out": [ + 9999, + 5, + 1, + 5, + 1 + ], + "b_out": [ + 9999, + 1, + 0, + 1 + ], + "c_out": [ + 9999, + 0, + 5, + 0 + ], + "d_out": [ + 9999, + 1, + 0 + ], + "in_out": [ + 9999, + 1, + 0, + 1, + 0 + ], + "strideIN": 1, + "offsetIN": 1 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlagtf/test/fixtures/row_interchange.json b/lib/node_modules/@stdlib/lapack/base/dlagtf/test/fixtures/row_interchange.json new file mode 100644 index 000000000000..e8fda4b6ebe8 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlagtf/test/fixtures/row_interchange.json @@ -0,0 +1,68 @@ +{ + "N": 4, + "a": [ + 2, + 3, + 2, + 3 + ], + "strideA": 1, + "offsetA": 0, + "lambda": 2, + "b": [ + 1, + 1, + 1 + ], + "strideB": 1, + "offsetB": 0, + "c": [ + 5, + 5, + 5 + ], + "strideC": 1, + "offsetC": 0, + "tol": 0, + "d": [ + 0, + 0 + ], + "strideD": 1, + "offsetD": 0, + "in": [ + 0, + 0, + 0, + 0 + ], + "info_out": 0, + "a_out": [ + 5, + 1, + 5, + 1 + ], + "b_out": [ + 1, + 0, + 1 + ], + "c_out": [ + 0, + 5, + 0 + ], + "d_out": [ + 1, + 0 + ], + "in_out": [ + 1, + 0, + 1, + 0 + ], + "strideIN": 1, + "offsetIN": 0 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlagtf/test/fixtures/zero_sub_diagonal.json b/lib/node_modules/@stdlib/lapack/base/dlagtf/test/fixtures/zero_sub_diagonal.json new file mode 100644 index 000000000000..6984453e49bf --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlagtf/test/fixtures/zero_sub_diagonal.json @@ -0,0 +1,68 @@ +{ + "N": 4, + "a": [ + 3, + 2, + 4, + 1 + ], + "strideA": 1, + "offsetA": 0, + "lambda": 1, + "b": [ + 1, + 2, + 3 + ], + "strideB": 1, + "offsetB": 0, + "c": [ + 0, + 0, + 0 + ], + "strideC": 1, + "offsetC": 0, + "tol": 0, + "d": [ + 0, + 0 + ], + "strideD": 1, + "offsetD": 0, + "in": [ + 0, + 0, + 0, + 0 + ], + "info_out": 0, + "a_out": [ + 2, + 1, + 3, + 0 + ], + "b_out": [ + 1, + 2, + 3 + ], + "c_out": [ + 0, + 0, + 0 + ], + "d_out": [ + 0, + 0 + ], + "in_out": [ + 0, + 0, + 0, + 4 + ], + "strideIN": 1, + "offsetIN": 0 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlagtf/test/test.dlagtf.js b/lib/node_modules/@stdlib/lapack/base/dlagtf/test/test.dlagtf.js new file mode 100644 index 000000000000..1327061b5a5c --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlagtf/test/test.dlagtf.js @@ -0,0 +1,457 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Float64Array = require( '@stdlib/array/float64' ); +var Int32Array = require( '@stdlib/array/int32' ); +var dlagtf = require( './../lib/dlagtf.js' ); + + +// FIXTURES // + +var DIAG_DOMINANT = require( './fixtures/diag_dominant.json' ); +var ROW_INTERCHANGE = require( './fixtures/row_interchange.json' ); +var MIXED_PIVOTING = require( './fixtures/mixed_pivoting.json' ); +var N_ONE = require( './fixtures/n_equals_one.json' ); +var N_ONE_SINGULAR = require( './fixtures/n_equals_one_singular.json' ); +var ZERO_SUBDIAG = require( './fixtures/zero_sub_diagonal.json' ); +var LARGE_DIAG = require( './fixtures/large_diag.json' ); +var NEAR_SINGULAR = require( './fixtures/near_singular.json' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof dlagtf, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 8', function test( t ) { + t.strictEqual( dlagtf.length, 8, 'returns expected value' ); + t.end(); +}); + +tape( 'the function throws an error if provided a first argument which is less than zero', function test( t ) { + var values; + var data; + var IN; + var A; + var B; + var C; + var D; + var i; + + data = DIAG_DOMINANT; + + A = new Float64Array( data.a ); + B = new Float64Array( data.b ); + C = new Float64Array( data.c ); + D = new Float64Array( data.d ); + IN = new Int32Array( data.in ); + + values = [ + -1, + -2, + -3 + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + dlagtf( value, A, data.lambda, B, C, data.tol, D, IN ); + }; + } +}); + +tape( 'the function performs the `LU` factorization (diagonal dominant, no interchanges)', function test( t ) { + var expectedIn; + var expectedA; + var expectedB; + var expectedC; + var expectedD; + var data; + var info; + var IN; + var A; + var B; + var C; + var D; + + data = DIAG_DOMINANT; + + A = new Float64Array( data.a ); + B = new Float64Array( data.b ); + C = new Float64Array( data.c ); + D = new Float64Array( data.d ); + IN = new Int32Array( data.in ); + + expectedA = new Float64Array( data.a_out ); + expectedB = new Float64Array( data.b_out ); + expectedC = new Float64Array( data.c_out ); + expectedD = new Float64Array( data.d_out ); + expectedIn = new Int32Array( data.in_out ); + + info = dlagtf( data.N, A, data.lambda, B, C, data.tol, D, IN ); + t.strictEqual( info, data.info_out, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( B, expectedB, 'returns expected value' ); + t.deepEqual( C, expectedC, 'returns expected value' ); + t.deepEqual( D, expectedD, 'returns expected value' ); + t.deepEqual( IN, expectedIn, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs the `LU` factorization (row interchanges)', function test( t ) { + var expectedIn; + var expectedA; + var expectedB; + var expectedC; + var expectedD; + var data; + var info; + var IN; + var A; + var B; + var C; + var D; + + data = ROW_INTERCHANGE; + + A = new Float64Array( data.a ); + B = new Float64Array( data.b ); + C = new Float64Array( data.c ); + D = new Float64Array( data.d ); + IN = new Int32Array( data.in ); + + expectedA = new Float64Array( data.a_out ); + expectedB = new Float64Array( data.b_out ); + expectedC = new Float64Array( data.c_out ); + expectedD = new Float64Array( data.d_out ); + expectedIn = new Int32Array( data.in_out ); + + info = dlagtf( data.N, A, data.lambda, B, C, data.tol, D, IN ); + t.strictEqual( info, data.info_out, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( B, expectedB, 'returns expected value' ); + t.deepEqual( C, expectedC, 'returns expected value' ); + t.deepEqual( D, expectedD, 'returns expected value' ); + t.deepEqual( IN, expectedIn, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs the `LU` factorization (5x5 mixed pivoting)', function test( t ) { + var expectedIn; + var expectedA; + var expectedB; + var expectedC; + var expectedD; + var data; + var info; + var IN; + var A; + var B; + var C; + var D; + + data = MIXED_PIVOTING; + + A = new Float64Array( data.a ); + B = new Float64Array( data.b ); + C = new Float64Array( data.c ); + D = new Float64Array( data.d ); + IN = new Int32Array( data.in ); + + expectedA = new Float64Array( data.a_out ); + expectedB = new Float64Array( data.b_out ); + expectedC = new Float64Array( data.c_out ); + expectedD = new Float64Array( data.d_out ); + expectedIn = new Int32Array( data.in_out ); + + info = dlagtf( data.N, A, data.lambda, B, C, data.tol, D, IN ); + t.strictEqual( info, data.info_out, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( B, expectedB, 'returns expected value' ); + t.deepEqual( C, expectedC, 'returns expected value' ); + t.deepEqual( D, expectedD, 'returns expected value' ); + t.deepEqual( IN, expectedIn, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function handles N=1 (non-singular)', function test( t ) { + var data; + var info; + var IN; + var A; + + data = N_ONE; + + A = new Float64Array( data.a ); + IN = new Int32Array( data.in ); + + info = dlagtf( data.N, A, data.lambda, new Float64Array( 0 ), new Float64Array( 0 ), data.tol, new Float64Array( 0 ), IN ); // eslint-disable-line max-len + t.strictEqual( info, data.info_out, 'returns expected value' ); + t.deepEqual( A, new Float64Array( data.a_out ), 'returns expected value' ); + t.deepEqual( IN, new Int32Array( data.in_out ), 'returns expected value' ); + + t.end(); +}); + +tape( 'the function handles N=1 (singular, A[0] equals lambda)', function test( t ) { + var data; + var info; + var IN; + var A; + + data = N_ONE_SINGULAR; + + A = new Float64Array( data.a ); + IN = new Int32Array( data.in ); + + info = dlagtf( data.N, A, data.lambda, new Float64Array( 0 ), new Float64Array( 0 ), data.tol, new Float64Array( 0 ), IN ); // eslint-disable-line max-len + t.strictEqual( info, data.info_out, 'returns expected value' ); + t.deepEqual( A, new Float64Array( data.a_out ), 'returns expected value' ); + t.deepEqual( IN, new Int32Array( data.in_out ), 'returns expected value' ); + + t.end(); +}); + +tape( 'the function handles zero sub-diagonal (no pivoting needed)', function test( t ) { + var expectedIn; + var expectedA; + var expectedB; + var expectedC; + var expectedD; + var data; + var info; + var IN; + var A; + var B; + var C; + var D; + + data = ZERO_SUBDIAG; + + A = new Float64Array( data.a ); + B = new Float64Array( data.b ); + C = new Float64Array( data.c ); + D = new Float64Array( data.d ); + IN = new Int32Array( data.in ); + + expectedA = new Float64Array( data.a_out ); + expectedB = new Float64Array( data.b_out ); + expectedC = new Float64Array( data.c_out ); + expectedD = new Float64Array( data.d_out ); + expectedIn = new Int32Array( data.in_out ); + + info = dlagtf( data.N, A, data.lambda, B, C, data.tol, D, IN ); + t.strictEqual( info, data.info_out, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( B, expectedB, 'returns expected value' ); + t.deepEqual( C, expectedC, 'returns expected value' ); + t.deepEqual( D, expectedD, 'returns expected value' ); + t.deepEqual( IN, expectedIn, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function handles large diagonal dominance', function test( t ) { + var expectedIn; + var expectedA; + var expectedB; + var expectedC; + var expectedD; + var data; + var info; + var IN; + var A; + var B; + var C; + var D; + + data = LARGE_DIAG; + + A = new Float64Array( data.a ); + B = new Float64Array( data.b ); + C = new Float64Array( data.c ); + D = new Float64Array( data.d ); + IN = new Int32Array( data.in ); + + expectedA = new Float64Array( data.a_out ); + expectedB = new Float64Array( data.b_out ); + expectedC = new Float64Array( data.c_out ); + expectedD = new Float64Array( data.d_out ); + expectedIn = new Int32Array( data.in_out ); + + info = dlagtf( data.N, A, data.lambda, B, C, data.tol, D, IN ); + t.strictEqual( info, data.info_out, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( B, expectedB, 'returns expected value' ); + t.deepEqual( C, expectedC, 'returns expected value' ); + t.deepEqual( D, expectedD, 'returns expected value' ); + t.deepEqual( IN, expectedIn, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function detects near-singular matrices', function test( t ) { + var expectedIn; + var expectedA; + var expectedB; + var expectedC; + var expectedD; + var data; + var info; + var IN; + var A; + var B; + var C; + var D; + + data = NEAR_SINGULAR; + + A = new Float64Array( data.a ); + B = new Float64Array( data.b ); + C = new Float64Array( data.c ); + D = new Float64Array( data.d ); + IN = new Int32Array( data.in ); + + expectedA = new Float64Array( data.a_out ); + expectedB = new Float64Array( data.b_out ); + expectedC = new Float64Array( data.c_out ); + expectedD = new Float64Array( data.d_out ); + expectedIn = new Int32Array( data.in_out ); + + info = dlagtf( data.N, A, data.lambda, B, C, data.tol, D, IN ); + t.strictEqual( info, data.info_out, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( B, expectedB, 'returns expected value' ); + t.deepEqual( C, expectedC, 'returns expected value' ); + t.deepEqual( D, expectedD, 'returns expected value' ); + t.deepEqual( IN, expectedIn, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function leaves the input arrays unchanged when `N` is equal to zero', function test( t ) { + var expectedIn; + var expectedA; + var expectedB; + var expectedC; + var expectedD; + var data; + var info; + var IN; + var A; + var B; + var C; + var D; + + data = DIAG_DOMINANT; + + A = new Float64Array( data.a ); + B = new Float64Array( data.b ); + C = new Float64Array( data.c ); + D = new Float64Array( data.d ); + IN = new Int32Array( data.in ); + + expectedA = new Float64Array( data.a ); + expectedB = new Float64Array( data.b ); + expectedC = new Float64Array( data.c ); + expectedD = new Float64Array( data.d ); + expectedIn = new Int32Array( data.in ); + + info = dlagtf( 0, A, data.lambda, B, C, data.tol, D, IN ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( B, expectedB, 'returns expected value' ); + t.deepEqual( C, expectedC, 'returns expected value' ); + t.deepEqual( D, expectedD, 'returns expected value' ); + t.deepEqual( IN, expectedIn, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function handles early singularity detection (branches)', function test( t ) { + var expectedIn; + var expectedA; + var expectedB; + var expectedC; + var expectedD; + var info; + var IN; + var A; + var B; + var C; + var D; + + // Case 1: First singularity detected at step k = 0 + A = new Float64Array( [ 0.0, 2.0, 2.0 ] ); + B = new Float64Array( [ 1.0, 1.0 ] ); + C = new Float64Array( [ 0.0, 1.0 ] ); + D = new Float64Array( [ 0.0 ] ); + IN = new Int32Array( [ 0, 0, 0 ] ); + + expectedA = new Float64Array( [ 0.0, 2.0, 1.5 ] ); + expectedB = new Float64Array( [ 1.0, 1.0 ] ); + expectedC = new Float64Array( [ 0.0, 0.5 ] ); + expectedD = new Float64Array( [ 0.0 ] ); + expectedIn = new Int32Array( [ 0, 0, 1 ] ); + + info = dlagtf( 3, A, 0.0, B, C, 0.0001, D, IN ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( B, expectedB, 'returns expected value' ); + t.deepEqual( C, expectedC, 'returns expected value' ); + t.deepEqual( D, expectedD, 'returns expected value' ); + t.deepEqual( IN, expectedIn, 'returns expected value' ); + + // Case 2: Subsequent singularity detection skipped if already set + A = new Float64Array( [ 0.0, 0.0, 2.0, 2.0 ] ); + B = new Float64Array( [ 1.0, 1.0, 1.0 ] ); + C = new Float64Array( [ 0.0, 0.0, 1.0 ] ); + D = new Float64Array( [ 0.0, 0.0 ] ); + IN = new Int32Array( [ 0, 0, 0, 0 ] ); + + expectedA = new Float64Array( [ 0.0, 0.0, 2.0, 1.5 ] ); + expectedB = new Float64Array( [ 1.0, 1.0, 1.0 ] ); + expectedC = new Float64Array( [ 0.0, 0.0, 0.5 ] ); + expectedD = new Float64Array( [ 0.0, 0.0 ] ); + expectedIn = new Int32Array( [ 0, 0, 0, 1 ] ); + + info = dlagtf( 4, A, 0.0, B, C, 0.0001, D, IN ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( B, expectedB, 'returns expected value' ); + t.deepEqual( C, expectedC, 'returns expected value' ); + t.deepEqual( D, expectedD, 'returns expected value' ); + t.deepEqual( IN, expectedIn, 'returns expected value' ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/lapack/base/dlagtf/test/test.js b/lib/node_modules/@stdlib/lapack/base/dlagtf/test/test.js new file mode 100644 index 000000000000..70a90c4d5944 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlagtf/test/test.js @@ -0,0 +1,82 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var proxyquire = require( 'proxyquire' ); +var IS_BROWSER = require( '@stdlib/assert/is-browser' ); +var dlagtf = require( './../lib' ); + + +// VARIABLES // + +var opts = { + 'skip': IS_BROWSER +}; + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof dlagtf, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'attached to the main export is a method providing an ndarray interface', function test( t ) { + t.strictEqual( typeof dlagtf.ndarray, 'function', 'method is a function' ); + t.end(); +}); + +tape( 'if a native implementation is available, the main export is the native implementation', opts, function test( t ) { + var dlagtf = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( dlagtf, mock, 'returns expected value' ); + t.end(); + + function tryRequire() { + return mock; + } + + function mock() { + // Mock... + } +}); + +tape( 'if a native implementation is not available, the main export is a JavaScript implementation', opts, function test( t ) { + var dlagtf; + var main; + + main = require( './../lib/dlagtf.js' ); + + dlagtf = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( dlagtf, main, 'returns expected value' ); + t.end(); + + function tryRequire() { + return new Error( 'Cannot find module' ); + } +}); diff --git a/lib/node_modules/@stdlib/lapack/base/dlagtf/test/test.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dlagtf/test/test.ndarray.js new file mode 100644 index 000000000000..ae0d6a40ffeb --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlagtf/test/test.ndarray.js @@ -0,0 +1,503 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Float64Array = require( '@stdlib/array/float64' ); +var Int32Array = require( '@stdlib/array/int32' ); +var dlagtf = require( './../lib/ndarray.js' ); + + +// FIXTURES // + +var DIAG_DOMINANT = require( './fixtures/diag_dominant.json' ); +var ROW_INTERCHANGE = require( './fixtures/row_interchange.json' ); +var MIXED_PIVOTING = require( './fixtures/mixed_pivoting.json' ); +var LARGE_POSITIVE_STRIDE_1 = require( './fixtures/large_positive_stride_1.json' ); +var LARGE_POSITIVE_STRIDE_2 = require( './fixtures/large_positive_stride_2.json' ); +var POSITIVE_STRIDE_OFFSET_1 = require( './fixtures/positive_stride_offset_1.json' ); +var POSITIVE_STRIDE_OFFSET_2 = require( './fixtures/positive_stride_offset_2.json' ); +var NEGATIVE_STRIDES = require( './fixtures/negative_strides.json' ); +var MIXED_STRIDES = require( './fixtures/mixed_strides.json' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof dlagtf, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 18', function test( t ) { + t.strictEqual( dlagtf.length, 18, 'returns expected value' ); + t.end(); +}); + +tape( 'the function throws an error if provided a first argument which is less than zero', function test( t ) { + var values; + var data; + var IN; + var A; + var B; + var C; + var D; + var i; + + data = DIAG_DOMINANT; + + A = new Float64Array( data.a ); + B = new Float64Array( data.b ); + C = new Float64Array( data.c ); + D = new Float64Array( data.d ); + IN = new Int32Array( data.in ); + + values = [ + -1, + -2, + -3 + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + dlagtf( value, A, data.strideA, data.offsetA, data.lambda, B, data.strideB, data.offsetB, C, data.strideC, data.offsetC, data.tol, D, data.strideD, data.offsetD, IN, data.strideIN, data.offsetIN ); // eslint-disable-line max-len + }; + } +}); + +tape( 'the function performs the `LU` factorization (diagonal dominant, no interchanges)', function test( t ) { + var expectedIn; + var expectedA; + var expectedB; + var expectedC; + var expectedD; + var data; + var info; + var IN; + var A; + var B; + var C; + var D; + + data = DIAG_DOMINANT; + + A = new Float64Array( data.a ); + B = new Float64Array( data.b ); + C = new Float64Array( data.c ); + D = new Float64Array( data.d ); + IN = new Int32Array( data.in ); + + expectedA = new Float64Array( data.a_out ); + expectedB = new Float64Array( data.b_out ); + expectedC = new Float64Array( data.c_out ); + expectedD = new Float64Array( data.d_out ); + expectedIn = new Int32Array( data.in_out ); + + info = dlagtf( data.N, A, data.strideA, data.offsetA, data.lambda, B, data.strideB, data.offsetB, C, data.strideC, data.offsetC, data.tol, D, data.strideD, data.offsetD, IN, data.strideIN, data.offsetIN ); // eslint-disable-line max-len + t.strictEqual( info, data.info_out, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( B, expectedB, 'returns expected value' ); + t.deepEqual( C, expectedC, 'returns expected value' ); + t.deepEqual( D, expectedD, 'returns expected value' ); + t.deepEqual( IN, expectedIn, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs the `LU` factorization (row interchanges)', function test( t ) { + var expectedIn; + var expectedA; + var expectedB; + var expectedC; + var expectedD; + var data; + var info; + var IN; + var A; + var B; + var C; + var D; + + data = ROW_INTERCHANGE; + + A = new Float64Array( data.a ); + B = new Float64Array( data.b ); + C = new Float64Array( data.c ); + D = new Float64Array( data.d ); + IN = new Int32Array( data.in ); + + expectedA = new Float64Array( data.a_out ); + expectedB = new Float64Array( data.b_out ); + expectedC = new Float64Array( data.c_out ); + expectedD = new Float64Array( data.d_out ); + expectedIn = new Int32Array( data.in_out ); + + info = dlagtf( data.N, A, data.strideA, data.offsetA, data.lambda, B, data.strideB, data.offsetB, C, data.strideC, data.offsetC, data.tol, D, data.strideD, data.offsetD, IN, data.strideIN, data.offsetIN ); // eslint-disable-line max-len + t.strictEqual( info, data.info_out, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( B, expectedB, 'returns expected value' ); + t.deepEqual( C, expectedC, 'returns expected value' ); + t.deepEqual( D, expectedD, 'returns expected value' ); + t.deepEqual( IN, expectedIn, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function performs the `LU` factorization (5x5 mixed pivoting)', function test( t ) { + var expectedIn; + var expectedA; + var expectedB; + var expectedC; + var expectedD; + var data; + var info; + var IN; + var A; + var B; + var C; + var D; + + data = MIXED_PIVOTING; + + A = new Float64Array( data.a ); + B = new Float64Array( data.b ); + C = new Float64Array( data.c ); + D = new Float64Array( data.d ); + IN = new Int32Array( data.in ); + + expectedA = new Float64Array( data.a_out ); + expectedB = new Float64Array( data.b_out ); + expectedC = new Float64Array( data.c_out ); + expectedD = new Float64Array( data.d_out ); + expectedIn = new Int32Array( data.in_out ); + + info = dlagtf( data.N, A, data.strideA, data.offsetA, data.lambda, B, data.strideB, data.offsetB, C, data.strideC, data.offsetC, data.tol, D, data.strideD, data.offsetD, IN, data.strideIN, data.offsetIN ); // eslint-disable-line max-len + t.strictEqual( info, data.info_out, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( B, expectedB, 'returns expected value' ); + t.deepEqual( C, expectedC, 'returns expected value' ); + t.deepEqual( D, expectedD, 'returns expected value' ); + t.deepEqual( IN, expectedIn, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports providing positive strides', function test( t ) { + var expectedIn; + var expectedA; + var expectedB; + var expectedC; + var expectedD; + var data; + var info; + var IN; + var A; + var B; + var C; + var D; + + data = LARGE_POSITIVE_STRIDE_1; + + A = new Float64Array( data.a ); + B = new Float64Array( data.b ); + C = new Float64Array( data.c ); + D = new Float64Array( data.d ); + IN = new Int32Array( data.in ); + + expectedA = new Float64Array( data.a_out ); + expectedB = new Float64Array( data.b_out ); + expectedC = new Float64Array( data.c_out ); + expectedD = new Float64Array( data.d_out ); + expectedIn = new Int32Array( data.in_out ); + + info = dlagtf( data.N, A, data.strideA, data.offsetA, data.lambda, B, data.strideB, data.offsetB, C, data.strideC, data.offsetC, data.tol, D, data.strideD, data.offsetD, IN, data.strideIN, data.offsetIN ); // eslint-disable-line max-len + t.strictEqual( info, data.info_out, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( B, expectedB, 'returns expected value' ); + t.deepEqual( C, expectedC, 'returns expected value' ); + t.deepEqual( D, expectedD, 'returns expected value' ); + t.deepEqual( IN, expectedIn, 'returns expected value' ); + + data = LARGE_POSITIVE_STRIDE_2; + + A = new Float64Array( data.a ); + B = new Float64Array( data.b ); + C = new Float64Array( data.c ); + D = new Float64Array( data.d ); + IN = new Int32Array( data.in ); + + expectedA = new Float64Array( data.a_out ); + expectedB = new Float64Array( data.b_out ); + expectedC = new Float64Array( data.c_out ); + expectedD = new Float64Array( data.d_out ); + expectedIn = new Int32Array( data.in_out ); + + info = dlagtf( data.N, A, data.strideA, data.offsetA, data.lambda, B, data.strideB, data.offsetB, C, data.strideC, data.offsetC, data.tol, D, data.strideD, data.offsetD, IN, data.strideIN, data.offsetIN ); // eslint-disable-line max-len + t.strictEqual( info, data.info_out, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( B, expectedB, 'returns expected value' ); + t.deepEqual( C, expectedC, 'returns expected value' ); + t.deepEqual( D, expectedD, 'returns expected value' ); + t.deepEqual( IN, expectedIn, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports providing negative strides', function test( t ) { + var expectedIn; + var expectedA; + var expectedB; + var expectedC; + var expectedD; + var data; + var info; + var IN; + var A; + var B; + var C; + var D; + + data = NEGATIVE_STRIDES; + + A = new Float64Array( data.a ); + B = new Float64Array( data.b ); + C = new Float64Array( data.c ); + D = new Float64Array( data.d ); + IN = new Int32Array( data.in ); + + expectedA = new Float64Array( data.a_out ); + expectedB = new Float64Array( data.b_out ); + expectedC = new Float64Array( data.c_out ); + expectedD = new Float64Array( data.d_out ); + expectedIn = new Int32Array( data.in_out ); + + info = dlagtf( data.N, A, data.strideA, data.offsetA, data.lambda, B, data.strideB, data.offsetB, C, data.strideC, data.offsetC, data.tol, D, data.strideD, data.offsetD, IN, data.strideIN, data.offsetIN ); // eslint-disable-line max-len + t.strictEqual( info, data.info_out, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( B, expectedB, 'returns expected value' ); + t.deepEqual( C, expectedC, 'returns expected value' ); + t.deepEqual( D, expectedD, 'returns expected value' ); + t.deepEqual( IN, expectedIn, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports providing mixed strides', function test( t ) { + var expectedIn; + var expectedA; + var expectedB; + var expectedC; + var expectedD; + var data; + var info; + var IN; + var A; + var B; + var C; + var D; + + data = MIXED_STRIDES; + + A = new Float64Array( data.a ); + B = new Float64Array( data.b ); + C = new Float64Array( data.c ); + D = new Float64Array( data.d ); + IN = new Int32Array( data.in ); + + expectedA = new Float64Array( data.a_out ); + expectedB = new Float64Array( data.b_out ); + expectedC = new Float64Array( data.c_out ); + expectedD = new Float64Array( data.d_out ); + expectedIn = new Int32Array( data.in_out ); + + info = dlagtf( data.N, A, data.strideA, data.offsetA, data.lambda, B, data.strideB, data.offsetB, C, data.strideC, data.offsetC, data.tol, D, data.strideD, data.offsetD, IN, data.strideIN, data.offsetIN ); // eslint-disable-line max-len + t.strictEqual( info, data.info_out, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( B, expectedB, 'returns expected value' ); + t.deepEqual( C, expectedC, 'returns expected value' ); + t.deepEqual( D, expectedD, 'returns expected value' ); + t.deepEqual( IN, expectedIn, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports providing index offsets', function test( t ) { + var expectedIn; + var expectedA; + var expectedB; + var expectedC; + var expectedD; + var data; + var info; + var IN; + var A; + var B; + var C; + var D; + + data = POSITIVE_STRIDE_OFFSET_1; + + A = new Float64Array( data.a ); + B = new Float64Array( data.b ); + C = new Float64Array( data.c ); + D = new Float64Array( data.d ); + IN = new Int32Array( data.in ); + + expectedA = new Float64Array( data.a_out ); + expectedB = new Float64Array( data.b_out ); + expectedC = new Float64Array( data.c_out ); + expectedD = new Float64Array( data.d_out ); + expectedIn = new Int32Array( data.in_out ); + + info = dlagtf( data.N, A, data.strideA, data.offsetA, data.lambda, B, data.strideB, data.offsetB, C, data.strideC, data.offsetC, data.tol, D, data.strideD, data.offsetD, IN, data.strideIN, data.offsetIN ); // eslint-disable-line max-len + t.strictEqual( info, data.info_out, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( B, expectedB, 'returns expected value' ); + t.deepEqual( C, expectedC, 'returns expected value' ); + t.deepEqual( D, expectedD, 'returns expected value' ); + t.deepEqual( IN, expectedIn, 'returns expected value' ); + + data = POSITIVE_STRIDE_OFFSET_2; + + A = new Float64Array( data.a ); + B = new Float64Array( data.b ); + C = new Float64Array( data.c ); + D = new Float64Array( data.d ); + IN = new Int32Array( data.in ); + + expectedA = new Float64Array( data.a_out ); + expectedB = new Float64Array( data.b_out ); + expectedC = new Float64Array( data.c_out ); + expectedD = new Float64Array( data.d_out ); + expectedIn = new Int32Array( data.in_out ); + + info = dlagtf( data.N, A, data.strideA, data.offsetA, data.lambda, B, data.strideB, data.offsetB, C, data.strideC, data.offsetC, data.tol, D, data.strideD, data.offsetD, IN, data.strideIN, data.offsetIN ); // eslint-disable-line max-len + t.strictEqual( info, data.info_out, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( B, expectedB, 'returns expected value' ); + t.deepEqual( C, expectedC, 'returns expected value' ); + t.deepEqual( D, expectedD, 'returns expected value' ); + t.deepEqual( IN, expectedIn, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function leaves the input arrays unchanged when `N` is equal to zero', function test( t ) { + var expectedIn; + var expectedA; + var expectedB; + var expectedC; + var expectedD; + var data; + var info; + var IN; + var A; + var B; + var C; + var D; + + data = DIAG_DOMINANT; + + A = new Float64Array( data.a ); + B = new Float64Array( data.b ); + C = new Float64Array( data.c ); + D = new Float64Array( data.d ); + IN = new Int32Array( data.in ); + + expectedA = new Float64Array( data.a ); + expectedB = new Float64Array( data.b ); + expectedC = new Float64Array( data.c ); + expectedD = new Float64Array( data.d ); + expectedIn = new Int32Array( data.in ); + + info = dlagtf( 0, A, data.strideA, data.offsetA, data.lambda, B, data.strideB, data.offsetB, C, data.strideC, data.offsetC, data.tol, D, data.strideD, data.offsetD, IN, data.strideIN, data.offsetIN ); // eslint-disable-line max-len + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( B, expectedB, 'returns expected value' ); + t.deepEqual( C, expectedC, 'returns expected value' ); + t.deepEqual( D, expectedD, 'returns expected value' ); + t.deepEqual( IN, expectedIn, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function handles early singularity detection (branches)', function test( t ) { + var expectedIn; + var expectedA; + var expectedB; + var expectedC; + var expectedD; + var info; + var IN; + var A; + var B; + var C; + var D; + + // Case 1: First singularity detected at step k = 0 + A = new Float64Array( [ 0.0, 2.0, 2.0 ] ); + B = new Float64Array( [ 1.0, 1.0 ] ); + C = new Float64Array( [ 0.0, 1.0 ] ); + D = new Float64Array( [ 0.0 ] ); + IN = new Int32Array( [ 0, 0, 0 ] ); + + expectedA = new Float64Array( [ 0.0, 2.0, 1.5 ] ); + expectedB = new Float64Array( [ 1.0, 1.0 ] ); + expectedC = new Float64Array( [ 0.0, 0.5 ] ); + expectedD = new Float64Array( [ 0.0 ] ); + expectedIn = new Int32Array( [ 0, 0, 1 ] ); + + info = dlagtf( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0001, D, 1, 0, IN, 1, 0 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( B, expectedB, 'returns expected value' ); + t.deepEqual( C, expectedC, 'returns expected value' ); + t.deepEqual( D, expectedD, 'returns expected value' ); + t.deepEqual( IN, expectedIn, 'returns expected value' ); + + // Case 2: Subsequent singularity detection skipped if already set + A = new Float64Array( [ 0.0, 0.0, 2.0, 2.0 ] ); + B = new Float64Array( [ 1.0, 1.0, 1.0 ] ); + C = new Float64Array( [ 0.0, 0.0, 1.0 ] ); + D = new Float64Array( [ 0.0, 0.0 ] ); + IN = new Int32Array( [ 0, 0, 0, 0 ] ); + + expectedA = new Float64Array( [ 0.0, 0.0, 2.0, 1.5 ] ); + expectedB = new Float64Array( [ 1.0, 1.0, 1.0 ] ); + expectedC = new Float64Array( [ 0.0, 0.0, 0.5 ] ); + expectedD = new Float64Array( [ 0.0, 0.0 ] ); + expectedIn = new Int32Array( [ 0, 0, 0, 1 ] ); + + info = dlagtf( 4, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0001, D, 1, 0, IN, 1, 0 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( B, expectedB, 'returns expected value' ); + t.deepEqual( C, expectedC, 'returns expected value' ); + t.deepEqual( D, expectedD, 'returns expected value' ); + t.deepEqual( IN, expectedIn, 'returns expected value' ); + + t.end(); +});