diff --git a/lib/node_modules/@stdlib/lapack/base/dgbequ/README.md b/lib/node_modules/@stdlib/lapack/base/dgbequ/README.md new file mode 100644 index 000000000000..d285b0caa268 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgbequ/README.md @@ -0,0 +1,341 @@ + + +# dgbequ + +> Compute row and column scale factors intended to equilibrate an M-by-N band matrix `A` and reduce its condition number. + +
+ +The band matrix `A`, having `KL` subdiagonals and `KU` superdiagonals, is stored in a band array `AB` having `KL+KU+1` rows and `N` columns, such that the element `A(i,j)` is stored in row `KU+i-j` and column `j` of `AB` (zero-based), for `max(0,j-KU) <= i <= min(M-1,j+KL)`. For example, for a 4-by-4 matrix with `KL = 1` and `KU = 2`, + +```text + A = [ AB = [ + [ a00, a01, a02, 0 ], [ *, *, a02, a13 ], + [ a10, a11, a12, a13 ], => [ *, a01, a12, a23 ], + [ 0, a21, a22, a23 ], [ a00, a11, a22, a33 ], + [ 0, 0, a32, a33 ] [ a10, a21, a32, * ] + ] ] +``` + +where `*` denotes an element which is not referenced. In column-major order, element `(b,j)` of `AB` is `AB[b+j*LDAB]`; in row-major order, it is `AB[b*LDAB+j]`. + +The computed scale factors `R` and `C` are chosen such that each element of the scaled matrix `B(i,j) = R(i)*A(i,j)*C(j)` has an absolute value of at most one, and each row and column of `B` has at least one element with an absolute value of one (barring underflow and overflow). + +
+ + + +
+ +## Usage + +```javascript +var dgbequ = require( '@stdlib/lapack/base/dgbequ' ); +``` + +#### dgbequ( order, M, N, KL, KU, AB, LDAB, R, C, out ) + +Computes row and column scale factors intended to equilibrate an M-by-N band matrix `A` and reduce its condition number. + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); + +/* + A = [ + [ 1.0, 2.0, 0.0 ], + [ 3.0, 4.0, 5.0 ], + [ 0.0, 6.0, 8.0 ] + ] +*/ + +// Store the band of `A` (KL = 1, KU = 1) as a column-major band array: +var AB = new Float64Array( [ 0.0, 1.0, 3.0, 2.0, 4.0, 6.0, 5.0, 8.0, 0.0 ] ); +var R = new Float64Array( 3 ); +var C = new Float64Array( 3 ); +var out = new Float64Array( 3 ); + +var info = dgbequ( 'column-major', 3, 3, 1, 1, AB, 3, R, C, out ); +// returns 0 + +console.log( R ); +// => [ 0.5, 0.2, 0.125 ] + +console.log( C ); +// => [ ~1.67, 1.0, 1.0 ] + +console.log( out ); +// => [ 0.25, ~0.6, 8.0 ] +``` + +The function has the following parameters: + +- **order**: storage layout of the band array `AB` (either `'row-major'` or `'column-major'`). +- **M**: number of rows in `A`. +- **N**: number of columns in `A`. +- **KL**: number of subdiagonals within the band of `A`. +- **KU**: number of superdiagonals within the band of `A`. +- **AB**: band array as a [`Float64Array`][mdn-float64array], having `KL+KU+1` rows and `N` columns. +- **LDAB**: leading dimension of the band array `AB`. Must be greater than or equal to `KL+KU+1` when `order` is `'column-major'` and greater than or equal to `max(1,N)` when `order` is `'row-major'`. +- **R**: output vector for the row scale factors as a [`Float64Array`][mdn-float64array] having `M` indexed elements. +- **C**: output vector for the column scale factors as a [`Float64Array`][mdn-float64array] having `N` indexed elements. +- **out**: three element output [`Float64Array`][mdn-float64array] whose elements are set to `[ ROWCND, COLCND, AMAX ]`. + +The elements of `out` are + +- **ROWCND**: ratio of the smallest `R[i]` to the largest `R[i]`. +- **COLCND**: ratio of the smallest `C[j]` to the largest `C[j]`. +- **AMAX**: absolute value of the largest element of `A`. + +The function returns a status code. If `0`, the scale factors were successfully computed. If `> 0` and `<= M`, the `info`-th row of `A` is exactly zero; if `> M`, the `(info-M)`-th column of `A` is exactly zero. The status code uses one-based indexing to match the LAPACK convention, so the corresponding zero-based JavaScript index is `info-1` for a zero row and `info-M-1` for a zero column. + +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' ); + +// Initial array... +var AB0 = new Float64Array( [ 0.0, 0.0, 1.0, 3.0, 2.0, 4.0, 6.0, 5.0, 8.0, 0.0 ] ); + +// Create an offset view... +var AB = new Float64Array( AB0.buffer, AB0.BYTES_PER_ELEMENT*1 ); // start at 2nd element + +var R = new Float64Array( 3 ); +var C = new Float64Array( 3 ); +var out = new Float64Array( 3 ); + +var info = dgbequ( 'column-major', 3, 3, 1, 1, AB, 3, R, C, out ); +// returns 0 + +console.log( out ); +// => [ 0.25, ~0.6, 8.0 ] +``` + + + +#### dgbequ.ndarray( M, N, KL, KU, AB, sab1, sab2, oab, R, sr, or, C, sc, oc, out, so, oo ) + +Computes row and column scale factors intended to equilibrate an M-by-N band matrix `A` and reduce its condition number using alternative indexing semantics. + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); + +var AB = new Float64Array( [ 0.0, 1.0, 3.0, 2.0, 4.0, 6.0, 5.0, 8.0, 0.0 ] ); +var R = new Float64Array( 3 ); +var C = new Float64Array( 3 ); +var out = new Float64Array( 3 ); + +var info = dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); +// returns 0 + +console.log( out ); +// => [ 0.25, ~0.6, 8.0 ] +``` + +The function has the following additional parameters: + +- **sab1**: stride of the first dimension of `AB` (i.e., between band rows). +- **sab2**: stride of the second dimension of `AB` (i.e., between columns). +- **oab**: starting index for `AB`. +- **sr**: stride length for `R`. +- **or**: starting index for `R`. +- **sc**: stride length for `C`. +- **oc**: starting index for `C`. +- **so**: stride length for `out`. +- **oo**: starting index for `out`. + +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 AB = new Float64Array( [ 0.0, 0.0, 1.0, 3.0, 2.0, 4.0, 6.0, 5.0, 8.0, 0.0 ] ); +var R = new Float64Array( 3 ); +var C = new Float64Array( 3 ); +var out = new Float64Array( 3 ); + +var info = dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 1, R, 1, 0, C, 1, 0, out, 1, 0 ); +// returns 0 + +console.log( R ); +// => [ 0.5, 0.2, 0.125 ] +``` + +
+ + + +
+ +## Notes + +- Both functions mutate the output arrays `R`, `C`, and `out`. The band array `AB` is not modified. +- If the status code is `0`, `R`, `C`, and all three elements of `out` contain valid values. If the status code is greater than `M`, `R`, `ROWCND`, and `AMAX` contain valid values, but `C` and `COLCND` do not. If the status code is greater than `0` and less than or equal to `M`, only `AMAX` contains a valid value. Elements which do not contain valid values are left unmodified, matching the LAPACK reference implementation. +- When the status code is greater than `0` and less than or equal to `M`, the routine exits before scaling, and `R` holds the maximum absolute value of each row, prior to inversion. When the status code is greater than `M`, `C` holds the maximum absolute value of each column, as scaled by `R` and prior to inversion. +- Row and column maxima are clamped to the interval `[smlnum, bignum]` before being inverted, where `smlnum` is the smallest normal double-precision number and `bignum` is its reciprocal. Accordingly, scale factors neither overflow to infinity nor underflow to zero, and `ROWCND` may exceed `1` when every row maximum is subnormal. +- Only the elements of `AB` within the band are referenced. `KL` and `KU` may exceed the matrix dimensions. +- `dgbequ()` corresponds to the [LAPACK][lapack] routine [`dgbequ`][lapack-dgbequ]. + +
+ + + +
+ +## Examples + + + + + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); +var dgbequ = require( '@stdlib/lapack/base/dgbequ' ); + +/* + Tridiagonal matrix (KL = 1, KU = 1) whose rows differ greatly in scale: + + A = [ + [ 2.0, 1.0, 0.0, 0.0 ], + [ 10.0, 40.0, 20.0, 0.0 ], + [ 0.0, 100.0, 400.0, 300.0 ], + [ 0.0, 0.0, 3000.0, 4000.0 ] + ] +*/ + +// Store the band of `A` as a column-major band array: +var AB = new Float64Array( [ 0.0, 2.0, 10.0, 1.0, 40.0, 100.0, 20.0, 400.0, 3000.0, 300.0, 4000.0, 0.0 ] ); +var R = new Float64Array( 4 ); +var C = new Float64Array( 4 ); +var out = new Float64Array( 3 ); + +var info = dgbequ( 'column-major', 4, 4, 1, 1, AB, 3, R, C, out ); +console.log( info ); +// => 0 + +console.log( R ); +// => [ 0.5, 0.025, 0.0025, 0.00025 ] + +console.log( C ); +// => [ 1.0, 1.0, 1.0, 1.0 ] + +console.log( out ); +// => [ 0.0005, 1.0, 4000.0 ] +``` + +
+ + + + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +TODO +``` + +#### TODO + +TODO. + +```c +TODO +``` + +TODO + +```c +TODO +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +TODO +``` + +
+ + + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/lapack/base/dgbequ/benchmark/benchmark.js b/lib/node_modules/@stdlib/lapack/base/dgbequ/benchmark/benchmark.js new file mode 100644 index 000000000000..256221690847 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgbequ/benchmark/benchmark.js @@ -0,0 +1,111 @@ +/** +* @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 isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var Float64Array = require( '@stdlib/array/float64' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; +var dgbequ = require( './../lib/dgbequ.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + +// Number of subdiagonals and superdiagonals: +var KL = 2; +var KU = 2; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - order of the matrix +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var out = new Float64Array( 3 ); + var AB = uniform( ( KL+KU+1 ) * N, 1.0, 10.0, options ); + var R = new Float64Array( N ); + var C = new Float64Array( N ); + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var info; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + info = dgbequ( 'column-major', N, N, KL, KU, AB, KL+KU+1, R, C, out ); + if ( info !== 0 || isnan( out[ i%3 ] ) ) { + b.fail( 'should return a valid result' ); + } + } + b.toc(); + if ( info !== 0 || isnan( out[ i%3 ] ) ) { + b.fail( 'should return a valid result' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var min; + var max; + var N; + var f; + var i; + + min = 1; // 10^min + max = 3; // 10^max + + for ( i = min; i <= max; i++ ) { + N = pow( 10, i ); + f = createBenchmark( N ); + bench( format( '%s:N=%d', pkg, N ), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/lapack/base/dgbequ/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dgbequ/benchmark/benchmark.ndarray.js new file mode 100644 index 000000000000..809c53b764d6 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgbequ/benchmark/benchmark.ndarray.js @@ -0,0 +1,111 @@ +/** +* @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 isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var Float64Array = require( '@stdlib/array/float64' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; +var dgbequ = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + +// Number of subdiagonals and superdiagonals: +var KL = 2; +var KU = 2; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - order of the matrix +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var out = new Float64Array( 3 ); + var AB = uniform( ( KL+KU+1 ) * N, 1.0, 10.0, options ); + var R = new Float64Array( N ); + var C = new Float64Array( N ); + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var info; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + info = dgbequ( N, N, KL, KU, AB, 1, KL+KU+1, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); // eslint-disable-line max-len + if ( info !== 0 || isnan( out[ i%3 ] ) ) { + b.fail( 'should return a valid result' ); + } + } + b.toc(); + if ( info !== 0 || isnan( out[ i%3 ] ) ) { + b.fail( 'should return a valid result' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var min; + var max; + var N; + var f; + var i; + + min = 1; // 10^min + max = 3; // 10^max + + for ( i = min; i <= max; i++ ) { + N = pow( 10, i ); + f = createBenchmark( N ); + bench( format( '%s:ndarray:N=%d', pkg, N ), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/lapack/base/dgbequ/docs/repl.txt b/lib/node_modules/@stdlib/lapack/base/dgbequ/docs/repl.txt new file mode 100644 index 000000000000..a36f4baf0c6d --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgbequ/docs/repl.txt @@ -0,0 +1,183 @@ + +{{alias}}( order, M, N, KL, KU, AB, LDAB, R, C, out ) + Computes row and column scale factors intended to equilibrate an M-by-N + band matrix `A` and reduce its condition number. + + The band matrix `A` is stored in the band array `AB`, which has `KL+KU+1` + rows and `N` columns, such that the element `A(i,j)` is stored in row + `KU+i-j` and column `j` of `AB` (zero-based). In column-major order, + element `(b,j)` of `AB` is `AB[b+j*LDAB]`; in row-major order, it is + `AB[b*LDAB+j]`. + + Indexing is relative to the first index. To introduce an offset, use typed + array views. + + The row scale factors are stored in `R` (which should have `M` indexed + elements) and the column scale factors are stored in `C` (which should + have `N` indexed elements). + + If the status code is zero, `R`, `C`, and all three elements of `out` + contain valid values. If the status code is greater than `M`, `R`, + `ROWCND`, and `AMAX` contain valid values, but `C` and `COLCND` do not. + If the status code is greater than zero and less than or equal to `M`, + only `AMAX` contains a valid value. Elements which do not contain valid + values are left unmodified. + + Parameters + ---------- + order: string + Row-major (C-style) or column-major (Fortran-style) order of the band + array `AB`. Must be either 'row-major' or 'column-major'. + + M: integer + Number of rows in `A`. + + N: integer + Number of columns in `A`. + + KL: integer + Number of subdiagonals within the band of `A`. + + KU: integer + Number of superdiagonals within the band of `A`. + + AB: Float64Array + Band array having `KL+KU+1` rows and `N` columns. + + LDAB: integer + Stride of the first dimension of `AB` (a.k.a., leading dimension of + the band array `AB`). Must be greater than or equal to `KL+KU+1` for + column-major order and `max(1,N)` for row-major order. + + R: Float64Array + Output vector for the row scale factors. + + C: Float64Array + Output vector for the column scale factors. + + out: Float64Array + Three element output array whose elements are set to + `[ ROWCND, COLCND, AMAX ]`, where `ROWCND` is the ratio of the + smallest to the largest row scale factor, `COLCND` is the ratio of + the smallest to the largest column scale factor, and `AMAX` is the + absolute value of the largest element of `A`. + + Returns + ------- + info: integer + Status code. If zero, the scale factors were successfully computed. + If greater than zero and less than or equal to `M`, the info-th row + of `A` is exactly zero. If greater than `M`, the (info-M)-th column + of `A` is exactly zero. Row and column indices are one-based, + matching the LAPACK convention. + + Examples + -------- + > var v = [ 0.0, 1.0, 3.0, 2.0, 4.0, 6.0, 5.0, 8.0, 0.0 ]; + > var AB = new {{alias:@stdlib/array/float64}}( v ); + > var R = new {{alias:@stdlib/array/float64}}( 3 ); + > var C = new {{alias:@stdlib/array/float64}}( 3 ); + > var out = new {{alias:@stdlib/array/float64}}( 3 ); + > {{alias}}( 'column-major', 3, 3, 1, 1, AB, 3, R, C, out ) + 0 + > R + [ 0.5, 0.2, 0.125 ] + > C + [ ~1.6667, 1.0, 1.0 ] + > out + [ 0.25, ~0.6, 8.0 ] + + +{{alias}}.ndarray(M,N, KL,KU, AB,sab1,sab2,oab, R,sr,or, C,sc,oc, out,so,oo) + Computes row and column scale factors intended to equilibrate an M-by-N + band matrix `A` and reduce its condition number using alternative + indexing semantics. + + The band matrix `A` is stored in the band array `AB`, which has `KL+KU+1` + rows and `N` columns, such that the element `A(i,j)` is stored in row + `KU+i-j` and column `j` of `AB` (zero-based). The layout of `AB` is + specified by the strides `sab1` (between band rows) and `sab2` (between + columns). + + While typed array views mandate a view offset based on the underlying + buffer, the offset parameters support indexing semantics based on starting + indices. + + Parameters + ---------- + M: integer + Number of rows in `A`. + + N: integer + Number of columns in `A`. + + KL: integer + Number of subdiagonals within the band of `A`. + + KU: integer + Number of superdiagonals within the band of `A`. + + AB: Float64Array + Band array having `KL+KU+1` rows and `N` columns. + + sab1: integer + Stride of the first dimension of `AB`. + + sab2: integer + Stride of the second dimension of `AB`. + + oab: integer + Starting index for `AB`. + + R: Float64Array + Output vector for the row scale factors. + + sr: integer + Stride length for `R`. + + or: integer + Starting index for `R`. + + C: Float64Array + Output vector for the column scale factors. + + sc: integer + Stride length for `C`. + + oc: integer + Starting index for `C`. + + out: Float64Array + Three element output array whose elements are set to + `[ ROWCND, COLCND, AMAX ]`. + + so: integer + Stride length for `out`. + + oo: integer + Starting index for `out`. + + Returns + ------- + info: integer + Status code. If zero, the scale factors were successfully computed. + If greater than zero and less than or equal to `M`, the info-th row + of `A` is exactly zero. If greater than `M`, the (info-M)-th column + of `A` is exactly zero. Row and column indices are one-based, + matching the LAPACK convention. + + Examples + -------- + > var v = [ 0.0, 1.0, 3.0, 2.0, 4.0, 6.0, 5.0, 8.0, 0.0 ]; + > var AB = new {{alias:@stdlib/array/float64}}( v ); + > var R = new {{alias:@stdlib/array/float64}}( 3 ); + > var C = new {{alias:@stdlib/array/float64}}( 3 ); + > var out = new {{alias:@stdlib/array/float64}}( 3 ); + > {{alias}}.ndarray( 3,3, 1,1, AB,1,3,0, R,1,0, C,1,0, out,1,0 ) + 0 + > out + [ 0.25, ~0.6, 8.0 ] + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/lapack/base/dgbequ/docs/types/index.d.ts b/lib/node_modules/@stdlib/lapack/base/dgbequ/docs/types/index.d.ts new file mode 100644 index 000000000000..975ca8d94d51 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgbequ/docs/types/index.d.ts @@ -0,0 +1,170 @@ +/* +* @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 { Layout } from '@stdlib/types/blas'; + +/** +* Status code. +* +* ## Notes +* +* The status code indicates the following conditions: +* +* - if equal to zero, then the scale factors were successfully computed. +* - if equal to `i` (a value in the range `[ 1, M ]`), then the row at zero-based index `i-1` is exactly zero. +* - if equal to `M+j` (a value in the range `[ M+1, M+N ]`), then the column at zero-based index `j-1` is exactly zero. +*/ +type StatusCode = number; + +/** +* Interface describing `dgbequ`. +*/ +interface Routine { + /** + * Computes row and column scale factors intended to equilibrate an M-by-N band matrix `A` and reduce its condition number. + * + * ## Notes + * + * - The band matrix `A` is stored in the band array `AB`, which has `KL+KU+1` rows and `N` columns, such that the element `A(i,j)` is stored in row `KU+i-j` and column `j` of `AB` (zero-based). In column-major order, element `(b,j)` of `AB` is `AB[b+j*LDAB]`; in row-major order, it is `AB[b*LDAB+j]`. + * - `out` is set to `[ ROWCND, COLCND, AMAX ]`. + * + * @param order - storage layout of the band array `AB` + * @param M - number of rows in `A` + * @param N - number of columns in `A` + * @param KL - number of subdiagonals within the band of `A` + * @param KU - number of superdiagonals within the band of `A` + * @param AB - band array + * @param LDAB - stride of the first dimension of `AB` (a.k.a., leading dimension of the band array `AB`) + * @param R - output array for the row scale factors + * @param C - output array for the column scale factors + * @param out - output array for `[ ROWCND, COLCND, AMAX ]` + * @returns status code + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * var AB = new Float64Array( [ 0.0, 1.0, 3.0, 2.0, 4.0, 6.0, 5.0, 8.0, 0.0 ] ); + * var R = new Float64Array( 3 ); + * var C = new Float64Array( 3 ); + * var out = new Float64Array( 3 ); + * + * var info = dgbequ( 'column-major', 3, 3, 1, 1, AB, 3, R, C, out ); + * // returns 0 + * + * // R => [ 0.5, 0.2, 0.125 ] + * // C => [ ~1.67, 1.0, 1.0 ] + * // out => [ 0.25, ~0.6, 8.0 ] + */ + ( order: Layout, M: number, N: number, KL: number, KU: number, AB: Float64Array, LDAB: number, R: Float64Array, C: Float64Array, out: Float64Array ): StatusCode; + + /** + * Computes row and column scale factors intended to equilibrate an M-by-N band matrix `A` and reduce its condition number using alternative indexing semantics. + * + * ## Notes + * + * - The band matrix `A` is stored in the band array `AB`, which has `KL+KU+1` rows and `N` columns, such that the element `A(i,j)` is stored in row `KU+i-j` and column `j` of `AB` (zero-based). The layout of `AB` is specified by `strideAB1` (between band rows) and `strideAB2` (between columns). + * - `out` is set to `[ ROWCND, COLCND, AMAX ]`. + * + * @param M - number of rows in `A` + * @param N - number of columns in `A` + * @param KL - number of subdiagonals within the band of `A` + * @param KU - number of superdiagonals within the band of `A` + * @param AB - band array + * @param strideAB1 - stride of the first dimension of `AB` + * @param strideAB2 - stride of the second dimension of `AB` + * @param offsetAB - starting index for `AB` + * @param R - output array for the row scale factors + * @param strideR - stride length for `R` + * @param offsetR - starting index for `R` + * @param C - output array for the column scale factors + * @param strideC - stride length for `C` + * @param offsetC - starting index for `C` + * @param out - output array for `[ ROWCND, COLCND, AMAX ]` + * @param strideOut - stride length for `out` + * @param offsetOut - starting index for `out` + * @returns status code + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * var AB = new Float64Array( [ 0.0, 1.0, 3.0, 2.0, 4.0, 6.0, 5.0, 8.0, 0.0 ] ); + * var R = new Float64Array( 3 ); + * var C = new Float64Array( 3 ); + * var out = new Float64Array( 3 ); + * + * var info = dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); + * // returns 0 + * + * // out => [ 0.25, ~0.6, 8.0 ] + */ + ndarray( M: number, N: number, KL: number, KU: number, AB: Float64Array, strideAB1: number, strideAB2: number, offsetAB: number, R: Float64Array, strideR: number, offsetR: number, C: Float64Array, strideC: number, offsetC: number, out: Float64Array, strideOut: number, offsetOut: number ): StatusCode; +} + +/** +* Computes row and column scale factors intended to equilibrate an M-by-N band matrix `A` and reduce its condition number. +* +* @param order - storage layout of the band array `AB` +* @param M - number of rows in `A` +* @param N - number of columns in `A` +* @param KL - number of subdiagonals within the band of `A` +* @param KU - number of superdiagonals within the band of `A` +* @param AB - band array +* @param LDAB - stride of the first dimension of `AB` (a.k.a., leading dimension of the band array `AB`) +* @param R - output array for the row scale factors +* @param C - output array for the column scale factors +* @param out - output array for `[ ROWCND, COLCND, AMAX ]` +* @returns status code +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var AB = new Float64Array( [ 0.0, 1.0, 3.0, 2.0, 4.0, 6.0, 5.0, 8.0, 0.0 ] ); +* var R = new Float64Array( 3 ); +* var C = new Float64Array( 3 ); +* var out = new Float64Array( 3 ); +* +* var info = dgbequ( 'column-major', 3, 3, 1, 1, AB, 3, R, C, out ); +* // returns 0 +* +* // R => [ 0.5, 0.2, 0.125 ] +* // C => [ ~1.67, 1.0, 1.0 ] +* // out => [ 0.25, ~0.6, 8.0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var AB = new Float64Array( [ 0.0, 1.0, 3.0, 2.0, 4.0, 6.0, 5.0, 8.0, 0.0 ] ); +* var R = new Float64Array( 3 ); +* var C = new Float64Array( 3 ); +* var out = new Float64Array( 3 ); +* +* var info = dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); +* // returns 0 +* +* // out => [ 0.25, ~0.6, 8.0 ] +*/ +declare var dgbequ: Routine; + + +// EXPORTS // + +export = dgbequ; diff --git a/lib/node_modules/@stdlib/lapack/base/dgbequ/docs/types/test.ts b/lib/node_modules/@stdlib/lapack/base/dgbequ/docs/types/test.ts new file mode 100644 index 000000000000..a3a02e4453ff --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgbequ/docs/types/test.ts @@ -0,0 +1,542 @@ +/* +* @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 dgbequ = require( './index' ); + + +// TESTS // + +// The function returns a number... +{ + const AB = new Float64Array( 9 ); + const R = new Float64Array( 3 ); + const C = new Float64Array( 3 ); + const out = new Float64Array( 3 ); + + dgbequ( 'column-major', 3, 3, 1, 1, AB, 3, R, C, out ); // $ExpectType number +} + +// The compiler throws an error if the function is provided a first argument which is not a string... +{ + const AB = new Float64Array( 9 ); + const R = new Float64Array( 3 ); + const C = new Float64Array( 3 ); + const out = new Float64Array( 3 ); + + dgbequ( 10, 3, 3, 1, 1, AB, 3, R, C, out ); // $ExpectError + dgbequ( true, 3, 3, 1, 1, AB, 3, R, C, out ); // $ExpectError + dgbequ( false, 3, 3, 1, 1, AB, 3, R, C, out ); // $ExpectError + dgbequ( null, 3, 3, 1, 1, AB, 3, R, C, out ); // $ExpectError + dgbequ( void 0, 3, 3, 1, 1, AB, 3, R, C, out ); // $ExpectError + dgbequ( [], 3, 3, 1, 1, AB, 3, R, C, out ); // $ExpectError + dgbequ( {}, 3, 3, 1, 1, AB, 3, R, C, out ); // $ExpectError + dgbequ( ( x: number ): number => x, 3, 3, 1, 1, AB, 3, R, C, out ); // $ExpectError +} + +// The compiler throws an error if the function is provided a second argument which is not a number... +{ + const AB = new Float64Array( 9 ); + const R = new Float64Array( 3 ); + const C = new Float64Array( 3 ); + const out = new Float64Array( 3 ); + + dgbequ( 'column-major', '5', 3, 1, 1, AB, 3, R, C, out ); // $ExpectError + dgbequ( 'column-major', true, 3, 1, 1, AB, 3, R, C, out ); // $ExpectError + dgbequ( 'column-major', false, 3, 1, 1, AB, 3, R, C, out ); // $ExpectError + dgbequ( 'column-major', null, 3, 1, 1, AB, 3, R, C, out ); // $ExpectError + dgbequ( 'column-major', void 0, 3, 1, 1, AB, 3, R, C, out ); // $ExpectError + dgbequ( 'column-major', [], 3, 1, 1, AB, 3, R, C, out ); // $ExpectError + dgbequ( 'column-major', {}, 3, 1, 1, AB, 3, R, C, out ); // $ExpectError + dgbequ( 'column-major', ( x: number ): number => x, 3, 1, 1, AB, 3, R, C, out ); // $ExpectError +} + +// The compiler throws an error if the function is provided a third argument which is not a number... +{ + const AB = new Float64Array( 9 ); + const R = new Float64Array( 3 ); + const C = new Float64Array( 3 ); + const out = new Float64Array( 3 ); + + dgbequ( 'column-major', 3, '5', 1, 1, AB, 3, R, C, out ); // $ExpectError + dgbequ( 'column-major', 3, true, 1, 1, AB, 3, R, C, out ); // $ExpectError + dgbequ( 'column-major', 3, false, 1, 1, AB, 3, R, C, out ); // $ExpectError + dgbequ( 'column-major', 3, null, 1, 1, AB, 3, R, C, out ); // $ExpectError + dgbequ( 'column-major', 3, void 0, 1, 1, AB, 3, R, C, out ); // $ExpectError + dgbequ( 'column-major', 3, [], 1, 1, AB, 3, R, C, out ); // $ExpectError + dgbequ( 'column-major', 3, {}, 1, 1, AB, 3, R, C, out ); // $ExpectError + dgbequ( 'column-major', 3, ( x: number ): number => x, 1, 1, AB, 3, R, C, out ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fourth argument which is not a number... +{ + const AB = new Float64Array( 9 ); + const R = new Float64Array( 3 ); + const C = new Float64Array( 3 ); + const out = new Float64Array( 3 ); + + dgbequ( 'column-major', 3, 3, '5', 1, AB, 3, R, C, out ); // $ExpectError + dgbequ( 'column-major', 3, 3, true, 1, AB, 3, R, C, out ); // $ExpectError + dgbequ( 'column-major', 3, 3, false, 1, AB, 3, R, C, out ); // $ExpectError + dgbequ( 'column-major', 3, 3, null, 1, AB, 3, R, C, out ); // $ExpectError + dgbequ( 'column-major', 3, 3, void 0, 1, AB, 3, R, C, out ); // $ExpectError + dgbequ( 'column-major', 3, 3, [], 1, AB, 3, R, C, out ); // $ExpectError + dgbequ( 'column-major', 3, 3, {}, 1, AB, 3, R, C, out ); // $ExpectError + dgbequ( 'column-major', 3, 3, ( x: number ): number => x, 1, AB, 3, R, C, out ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fifth argument which is not a number... +{ + const AB = new Float64Array( 9 ); + const R = new Float64Array( 3 ); + const C = new Float64Array( 3 ); + const out = new Float64Array( 3 ); + + dgbequ( 'column-major', 3, 3, 1, '5', AB, 3, R, C, out ); // $ExpectError + dgbequ( 'column-major', 3, 3, 1, true, AB, 3, R, C, out ); // $ExpectError + dgbequ( 'column-major', 3, 3, 1, false, AB, 3, R, C, out ); // $ExpectError + dgbequ( 'column-major', 3, 3, 1, null, AB, 3, R, C, out ); // $ExpectError + dgbequ( 'column-major', 3, 3, 1, void 0, AB, 3, R, C, out ); // $ExpectError + dgbequ( 'column-major', 3, 3, 1, [], AB, 3, R, C, out ); // $ExpectError + dgbequ( 'column-major', 3, 3, 1, {}, AB, 3, R, C, out ); // $ExpectError + dgbequ( 'column-major', 3, 3, 1, ( x: number ): number => x, AB, 3, R, C, out ); // $ExpectError +} + +// The compiler throws an error if the function is provided a sixth argument which is not a Float64Array... +{ + const R = new Float64Array( 3 ); + const C = new Float64Array( 3 ); + const out = new Float64Array( 3 ); + + dgbequ( 'column-major', 3, 3, 1, 1, '5', 3, R, C, out ); // $ExpectError + dgbequ( 'column-major', 3, 3, 1, 1, 5, 3, R, C, out ); // $ExpectError + dgbequ( 'column-major', 3, 3, 1, 1, true, 3, R, C, out ); // $ExpectError + dgbequ( 'column-major', 3, 3, 1, 1, false, 3, R, C, out ); // $ExpectError + dgbequ( 'column-major', 3, 3, 1, 1, null, 3, R, C, out ); // $ExpectError + dgbequ( 'column-major', 3, 3, 1, 1, void 0, 3, R, C, out ); // $ExpectError + dgbequ( 'column-major', 3, 3, 1, 1, {}, 3, R, C, out ); // $ExpectError + dgbequ( 'column-major', 3, 3, 1, 1, ( x: number ): number => x, 3, R, C, out ); // $ExpectError +} + +// The compiler throws an error if the function is provided a seventh argument which is not a number... +{ + const AB = new Float64Array( 9 ); + const R = new Float64Array( 3 ); + const C = new Float64Array( 3 ); + const out = new Float64Array( 3 ); + + dgbequ( 'column-major', 3, 3, 1, 1, AB, '5', R, C, out ); // $ExpectError + dgbequ( 'column-major', 3, 3, 1, 1, AB, true, R, C, out ); // $ExpectError + dgbequ( 'column-major', 3, 3, 1, 1, AB, false, R, C, out ); // $ExpectError + dgbequ( 'column-major', 3, 3, 1, 1, AB, null, R, C, out ); // $ExpectError + dgbequ( 'column-major', 3, 3, 1, 1, AB, void 0, R, C, out ); // $ExpectError + dgbequ( 'column-major', 3, 3, 1, 1, AB, [], R, C, out ); // $ExpectError + dgbequ( 'column-major', 3, 3, 1, 1, AB, {}, R, C, out ); // $ExpectError + dgbequ( 'column-major', 3, 3, 1, 1, AB, ( x: number ): number => x, R, C, out ); // $ExpectError +} + +// The compiler throws an error if the function is provided a eighth argument which is not a Float64Array... +{ + const AB = new Float64Array( 9 ); + const C = new Float64Array( 3 ); + const out = new Float64Array( 3 ); + + dgbequ( 'column-major', 3, 3, 1, 1, AB, 3, '5', C, out ); // $ExpectError + dgbequ( 'column-major', 3, 3, 1, 1, AB, 3, 5, C, out ); // $ExpectError + dgbequ( 'column-major', 3, 3, 1, 1, AB, 3, true, C, out ); // $ExpectError + dgbequ( 'column-major', 3, 3, 1, 1, AB, 3, false, C, out ); // $ExpectError + dgbequ( 'column-major', 3, 3, 1, 1, AB, 3, null, C, out ); // $ExpectError + dgbequ( 'column-major', 3, 3, 1, 1, AB, 3, void 0, C, out ); // $ExpectError + dgbequ( 'column-major', 3, 3, 1, 1, AB, 3, {}, C, out ); // $ExpectError + dgbequ( 'column-major', 3, 3, 1, 1, AB, 3, ( x: number ): number => x, C, out ); // $ExpectError +} + +// The compiler throws an error if the function is provided a ninth argument which is not a Float64Array... +{ + const AB = new Float64Array( 9 ); + const R = new Float64Array( 3 ); + const out = new Float64Array( 3 ); + + dgbequ( 'column-major', 3, 3, 1, 1, AB, 3, R, '5', out ); // $ExpectError + dgbequ( 'column-major', 3, 3, 1, 1, AB, 3, R, 5, out ); // $ExpectError + dgbequ( 'column-major', 3, 3, 1, 1, AB, 3, R, true, out ); // $ExpectError + dgbequ( 'column-major', 3, 3, 1, 1, AB, 3, R, false, out ); // $ExpectError + dgbequ( 'column-major', 3, 3, 1, 1, AB, 3, R, null, out ); // $ExpectError + dgbequ( 'column-major', 3, 3, 1, 1, AB, 3, R, void 0, out ); // $ExpectError + dgbequ( 'column-major', 3, 3, 1, 1, AB, 3, R, {}, out ); // $ExpectError + dgbequ( 'column-major', 3, 3, 1, 1, AB, 3, R, ( x: number ): number => x, out ); // $ExpectError +} + +// The compiler throws an error if the function is provided a tenth argument which is not a Float64Array... +{ + const AB = new Float64Array( 9 ); + const R = new Float64Array( 3 ); + const C = new Float64Array( 3 ); + + dgbequ( 'column-major', 3, 3, 1, 1, AB, 3, R, C, '5' ); // $ExpectError + dgbequ( 'column-major', 3, 3, 1, 1, AB, 3, R, C, 5 ); // $ExpectError + dgbequ( 'column-major', 3, 3, 1, 1, AB, 3, R, C, true ); // $ExpectError + dgbequ( 'column-major', 3, 3, 1, 1, AB, 3, R, C, false ); // $ExpectError + dgbequ( 'column-major', 3, 3, 1, 1, AB, 3, R, C, null ); // $ExpectError + dgbequ( 'column-major', 3, 3, 1, 1, AB, 3, R, C, void 0 ); // $ExpectError + dgbequ( 'column-major', 3, 3, 1, 1, AB, 3, R, C, {} ); // $ExpectError + dgbequ( 'column-major', 3, 3, 1, 1, AB, 3, R, C, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + const AB = new Float64Array( 9 ); + const R = new Float64Array( 3 ); + const C = new Float64Array( 3 ); + const out = new Float64Array( 3 ); + + dgbequ(); // $ExpectError + dgbequ( 'column-major' ); // $ExpectError + dgbequ( 'column-major', 3 ); // $ExpectError + dgbequ( 'column-major', 3, 3 ); // $ExpectError + dgbequ( 'column-major', 3, 3, 1 ); // $ExpectError + dgbequ( 'column-major', 3, 3, 1, 1 ); // $ExpectError + dgbequ( 'column-major', 3, 3, 1, 1, AB ); // $ExpectError + dgbequ( 'column-major', 3, 3, 1, 1, AB, 3 ); // $ExpectError + dgbequ( 'column-major', 3, 3, 1, 1, AB, 3, R ); // $ExpectError + dgbequ( 'column-major', 3, 3, 1, 1, AB, 3, R, C ); // $ExpectError + dgbequ( 'column-major', 3, 3, 1, 1, AB, 3, R, C, out, 10 ); // $ExpectError +} + +// Attached to main export is an `ndarray` method which returns a number... +{ + const AB = new Float64Array( 9 ); + const R = new Float64Array( 3 ); + const C = new Float64Array( 3 ); + const out = new Float64Array( 3 ); + + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectType number +} + +// The compiler throws an error if the `ndarray` method is provided a first argument which is not a number... +{ + const AB = new Float64Array( 9 ); + const R = new Float64Array( 3 ); + const C = new Float64Array( 3 ); + const out = new Float64Array( 3 ); + + dgbequ.ndarray( '5', 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( true, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( false, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( null, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( void 0, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( [], 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( {}, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( ( x: number ): number => x, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a second argument which is not a number... +{ + const AB = new Float64Array( 9 ); + const R = new Float64Array( 3 ); + const C = new Float64Array( 3 ); + const out = new Float64Array( 3 ); + + dgbequ.ndarray( 3, '5', 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, true, 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, false, 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, null, 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, void 0, 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, [], 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, {}, 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, ( x: number ): number => x, 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a third argument which is not a number... +{ + const AB = new Float64Array( 9 ); + const R = new Float64Array( 3 ); + const C = new Float64Array( 3 ); + const out = new Float64Array( 3 ); + + dgbequ.ndarray( 3, 3, '5', 1, AB, 1, 3, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, true, 1, AB, 1, 3, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, false, 1, AB, 1, 3, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, null, 1, AB, 1, 3, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, void 0, 1, AB, 1, 3, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, [], 1, AB, 1, 3, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, {}, 1, AB, 1, 3, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, ( x: number ): number => x, 1, AB, 1, 3, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a fourth argument which is not a number... +{ + const AB = new Float64Array( 9 ); + const R = new Float64Array( 3 ); + const C = new Float64Array( 3 ); + const out = new Float64Array( 3 ); + + dgbequ.ndarray( 3, 3, 1, '5', AB, 1, 3, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, true, AB, 1, 3, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, false, AB, 1, 3, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, null, AB, 1, 3, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, void 0, AB, 1, 3, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, [], AB, 1, 3, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, {}, AB, 1, 3, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, ( x: number ): number => x, AB, 1, 3, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a fifth argument which is not a Float64Array... +{ + const R = new Float64Array( 3 ); + const C = new Float64Array( 3 ); + const out = new Float64Array( 3 ); + + dgbequ.ndarray( 3, 3, 1, 1, '5', 1, 3, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, 5, 1, 3, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, true, 1, 3, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, false, 1, 3, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, null, 1, 3, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, void 0, 1, 3, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, {}, 1, 3, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, ( x: number ): number => x, 1, 3, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a sixth argument which is not a number... +{ + const AB = new Float64Array( 9 ); + const R = new Float64Array( 3 ); + const C = new Float64Array( 3 ); + const out = new Float64Array( 3 ); + + dgbequ.ndarray( 3, 3, 1, 1, AB, '5', 3, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, true, 3, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, false, 3, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, null, 3, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, void 0, 3, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, [], 3, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, {}, 3, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, ( x: number ): number => x, 3, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a seventh argument which is not a number... +{ + const AB = new Float64Array( 9 ); + const R = new Float64Array( 3 ); + const C = new Float64Array( 3 ); + const out = new Float64Array( 3 ); + + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, '5', 0, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, true, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, false, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, null, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, void 0, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, [], 0, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, {}, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, ( x: number ): number => x, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a eighth argument which is not a number... +{ + const AB = new Float64Array( 9 ); + const R = new Float64Array( 3 ); + const C = new Float64Array( 3 ); + const out = new Float64Array( 3 ); + + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, '5', R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, true, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, false, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, null, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, void 0, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, [], R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, {}, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, ( x: number ): number => x, R, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a ninth argument which is not a Float64Array... +{ + const AB = new Float64Array( 9 ); + const C = new Float64Array( 3 ); + const out = new Float64Array( 3 ); + + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, '5', 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, 5, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, true, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, false, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, null, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, void 0, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, {}, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, ( x: number ): number => x, 1, 0, C, 1, 0, out, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a tenth argument which is not a number... +{ + const AB = new Float64Array( 9 ); + const R = new Float64Array( 3 ); + const C = new Float64Array( 3 ); + const out = new Float64Array( 3 ); + + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, '5', 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, true, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, false, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, null, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, void 0, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, [], 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, {}, 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, ( x: number ): number => x, 0, C, 1, 0, out, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a eleventh argument which is not a number... +{ + const AB = new Float64Array( 9 ); + const R = new Float64Array( 3 ); + const C = new Float64Array( 3 ); + const out = new Float64Array( 3 ); + + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, '5', C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, true, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, false, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, null, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, void 0, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, [], C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, {}, C, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, ( x: number ): number => x, C, 1, 0, out, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a twelfth argument which is not a Float64Array... +{ + const AB = new Float64Array( 9 ); + const R = new Float64Array( 3 ); + const out = new Float64Array( 3 ); + + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, '5', 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, 5, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, true, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, false, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, null, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, void 0, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, {}, 1, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, ( x: number ): number => x, 1, 0, out, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a thirteenth argument which is not a number... +{ + const AB = new Float64Array( 9 ); + const R = new Float64Array( 3 ); + const C = new Float64Array( 3 ); + const out = new Float64Array( 3 ); + + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, '5', 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, true, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, false, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, null, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, void 0, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, [], 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, {}, 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, ( x: number ): number => x, 0, out, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a fourteenth argument which is not a number... +{ + const AB = new Float64Array( 9 ); + const R = new Float64Array( 3 ); + const C = new Float64Array( 3 ); + const out = new Float64Array( 3 ); + + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1, '5', out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1, true, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1, false, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1, null, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1, void 0, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1, [], out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1, {}, out, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1, ( x: number ): number => x, out, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a fifteenth argument which is not a Float64Array... +{ + const AB = new Float64Array( 9 ); + const R = new Float64Array( 3 ); + const C = new Float64Array( 3 ); + + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1, 0, '5', 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1, 0, 5, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1, 0, true, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1, 0, false, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1, 0, null, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1, 0, void 0, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1, 0, {}, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1, 0, ( x: number ): number => x, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a sixteenth argument which is not a number... +{ + const AB = new Float64Array( 9 ); + const R = new Float64Array( 3 ); + const C = new Float64Array( 3 ); + const out = new Float64Array( 3 ); + + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1, 0, out, '5', 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1, 0, out, true, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1, 0, out, false, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1, 0, out, null, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1, 0, out, void 0, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1, 0, out, [], 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1, 0, out, {}, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1, 0, out, ( x: number ): number => x, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a seventeenth argument which is not a number... +{ + const AB = new Float64Array( 9 ); + const R = new Float64Array( 3 ); + const C = new Float64Array( 3 ); + const out = new Float64Array( 3 ); + + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1, 0, out, 1, '5' ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1, 0, out, 1, true ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1, 0, out, 1, false ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1, 0, out, 1, null ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1, 0, out, 1, void 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1, 0, out, 1, [] ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1, 0, out, 1, {} ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1, 0, out, 1, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided an unsupported number of arguments... +{ + const AB = new Float64Array( 9 ); + const R = new Float64Array( 3 ); + const C = new Float64Array( 3 ); + const out = new Float64Array( 3 ); + + dgbequ.ndarray(); // $ExpectError + dgbequ.ndarray( 3 ); // $ExpectError + dgbequ.ndarray( 3, 3 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1, 0 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1, 0, out ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1, 0, out, 1 ); // $ExpectError + dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1, 0, out, 1, 0, 10 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/lapack/base/dgbequ/examples/index.js b/lib/node_modules/@stdlib/lapack/base/dgbequ/examples/index.js new file mode 100644 index 000000000000..327729c02ef5 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgbequ/examples/index.js @@ -0,0 +1,52 @@ +/** +* @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 Float64Array = require( '@stdlib/array/float64' ); +var dgbequ = require( './../lib' ); + +/* + Tridiagonal matrix (KL = 1, KU = 1) whose rows differ greatly in scale: + + A = [ + [ 2.0, 1.0, 0.0, 0.0 ], + [ 10.0, 40.0, 20.0, 0.0 ], + [ 0.0, 100.0, 400.0, 300.0 ], + [ 0.0, 0.0, 3000.0, 4000.0 ] + ] +*/ + +// Store the band of `A` as a column-major band array: +var AB = new Float64Array( [ 0.0, 2.0, 10.0, 1.0, 40.0, 100.0, 20.0, 400.0, 3000.0, 300.0, 4000.0, 0.0 ] ); // eslint-disable-line max-len +var R = new Float64Array( 4 ); +var C = new Float64Array( 4 ); +var out = new Float64Array( 3 ); + +var info = dgbequ( 'column-major', 4, 4, 1, 1, AB, 3, R, C, out ); +console.log( info ); +// => 0 + +console.log( R ); +// => [ 0.5, 0.025, 0.0025, 0.00025 ] + +console.log( C ); +// => [ 1.0, 1.0, 1.0, 1.0 ] + +console.log( out ); +// => [ 0.0005, 1.0, 4000.0 ] diff --git a/lib/node_modules/@stdlib/lapack/base/dgbequ/lib/base.js b/lib/node_modules/@stdlib/lapack/base/dgbequ/lib/base.js new file mode 100644 index 000000000000..822c0eb93e46 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgbequ/lib/base.js @@ -0,0 +1,204 @@ +/** +* @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 FLOAT64_SMALLEST_NORMAL = require( '@stdlib/constants/float64/smallest-normal' ); +var abs = require( '@stdlib/math/base/special/abs' ); +var max = require( '@stdlib/math/base/special/max' ); +var min = require( '@stdlib/math/base/special/min' ); + + +// VARIABLES // + +var SMLNUM = FLOAT64_SMALLEST_NORMAL; +var BIGNUM = 1.0 / SMLNUM; + + +// MAIN // + +/** +* Computes row and column scale factors intended to equilibrate an `M`-by-`N` band matrix `A` and reduce its condition number. +* +* ## Notes +* +* - The band matrix `A` is stored in the band array `AB`, which has `KL+KU+1` rows and `N` columns, such that the element `A(i,j)` (zero-based) is stored in row `KU+i-j` and column `j` of `AB`, for `max(0,j-KU) <= i <= min(M-1,j+KL)`. +* - `R` returns the row scale factors and `C` returns the column scale factors, chosen such that each element of the scaled matrix `B(i,j) = R(i)*A(i,j)*C(j)` has an absolute value of at most one and each row and column of `B` has at least one element with an absolute value of one (barring underflow and overflow). +* - `out` is set to `[ ROWCND, COLCND, AMAX ]`, where `ROWCND` is the ratio of the smallest `R(i)` to the largest `R(i)`, `COLCND` is the ratio of the smallest `C(j)` to the largest `C(j)`, and `AMAX` is the absolute value of the largest matrix element. +* - The status code is `0` on success, `i` (one-based) if row `i` of `A` is exactly zero, and `M+j` (one-based) if column `j` of `A` is exactly zero. +* +* @private +* @param {NonNegativeInteger} M - number of rows in the matrix `A` +* @param {NonNegativeInteger} N - number of columns in the matrix `A` +* @param {NonNegativeInteger} KL - number of subdiagonals within the band of `A` +* @param {NonNegativeInteger} KU - number of superdiagonals within the band of `A` +* @param {Float64Array} AB - band array containing the band matrix `A` +* @param {integer} strideAB1 - stride of the first dimension of `AB` (i.e., between band rows) +* @param {integer} strideAB2 - stride of the second dimension of `AB` (i.e., between columns) +* @param {NonNegativeInteger} offsetAB - starting index for `AB` +* @param {Float64Array} R - output array for the row scale factors +* @param {integer} strideR - stride length for `R` +* @param {NonNegativeInteger} offsetR - starting index for `R` +* @param {Float64Array} C - output array for the column scale factors +* @param {integer} strideC - stride length for `C` +* @param {NonNegativeInteger} offsetC - starting index for `C` +* @param {Float64Array} out - output array for `[ ROWCND, COLCND, AMAX ]` +* @param {integer} strideOut - stride length for `out` +* @param {NonNegativeInteger} offsetOut - starting index for `out` +* @returns {integer} status code +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* // A = [ [ 1, 2, 0 ], [ 3, 4, 5 ], [ 0, 6, 8 ] ] (KL = 1, KU = 1), stored as a column-major band array: +* var AB = new Float64Array( [ 0.0, 1.0, 3.0, 2.0, 4.0, 6.0, 5.0, 8.0, 0.0 ] ); +* var R = new Float64Array( 3 ); +* var C = new Float64Array( 3 ); +* var out = new Float64Array( 3 ); +* +* var info = dgbequ( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); +* // returns 0 +* +* // R => [ 0.5, 0.2, 0.125 ] +* // C => [ ~1.67, 1.0, 1.0 ] +* // out => [ 0.25, ~0.6, 8.0 ] +*/ +function dgbequ( M, N, KL, KU, AB, strideAB1, strideAB2, offsetAB, R, strideR, offsetR, C, strideC, offsetC, out, strideOut, offsetOut ) { // eslint-disable-line max-len, max-params + var rcmin; + var rcmax; + var iab; + var ir; + var ic; + var i0; + var i1; + var i; + var j; + + // Quick return if possible... + if ( M === 0 || N === 0 ) { + out[ offsetOut ] = 1.0; + out[ offsetOut + strideOut ] = 1.0; + out[ offsetOut + ( 2*strideOut ) ] = 0.0; + return 0; + } + // Initialize the row scale factors... + ir = offsetR; + for ( i = 0; i < M; i++ ) { + R[ ir ] = 0.0; + ir += strideR; + } + // Find the maximum element in each row, visiting only the elements within the band of each column `j`, which lie in rows `i0` through `i1` (zero-based)... + for ( j = 0; j < N; j++ ) { + i0 = max( j-KU, 0 ); + i1 = min( j+KL, M-1 ); + + // `A(i0,j)` is stored in band row `KU+i0-j` of column `j`, and moving down a column of `A` moves down a row of `AB`... + iab = offsetAB + ( ( KU+i0-j ) * strideAB1 ) + ( j * strideAB2 ); + ir = offsetR + ( i0 * strideR ); + for ( i = i0; i <= i1; i++ ) { + R[ ir ] = max( R[ ir ], abs( AB[ iab ] ) ); + iab += strideAB1; + ir += strideR; + } + } + // Find the maximum and minimum row scale factors... + rcmin = BIGNUM; + rcmax = 0.0; + ir = offsetR; + for ( i = 0; i < M; i++ ) { + rcmax = max( rcmax, R[ ir ] ); + rcmin = min( rcmin, R[ ir ] ); + ir += strideR; + } + out[ offsetOut + ( 2*strideOut ) ] = rcmax; // AMAX + + if ( rcmin === 0.0 ) { + // Find the first zero scale factor and return an error code... + ir = offsetR; + for ( i = 0; i < M; i++ ) { + if ( R[ ir ] === 0.0 ) { + return i + 1; + } + ir += strideR; + } + } + // Invert the row scale factors... + ir = offsetR; + for ( i = 0; i < M; i++ ) { + R[ ir ] = 1.0 / min( max( R[ ir ], SMLNUM ), BIGNUM ); + ir += strideR; + } + // Compute `ROWCND = min(R)/max(R)`... + out[ offsetOut ] = max( rcmin, SMLNUM ) / min( rcmax, BIGNUM ); + + // Initialize the column scale factors... + ic = offsetC; + for ( j = 0; j < N; j++ ) { + C[ ic ] = 0.0; + ic += strideC; + } + // Find the largest (row-scaled) element in each column... + ic = offsetC; + for ( j = 0; j < N; j++ ) { + i0 = max( j-KU, 0 ); + i1 = min( j+KL, M-1 ); + iab = offsetAB + ( ( KU+i0-j ) * strideAB1 ) + ( j * strideAB2 ); + ir = offsetR + ( i0 * strideR ); + for ( i = i0; i <= i1; i++ ) { + C[ ic ] = max( C[ ic ], abs( AB[ iab ] ) * R[ ir ] ); + iab += strideAB1; + ir += strideR; + } + ic += strideC; + } + // Find the maximum and minimum column scale factors... + rcmin = BIGNUM; + rcmax = 0.0; + ic = offsetC; + for ( j = 0; j < N; j++ ) { + rcmin = min( rcmin, C[ ic ] ); + rcmax = max( rcmax, C[ ic ] ); + ic += strideC; + } + if ( rcmin === 0.0 ) { + // Find the first zero scale factor and return an error code... + ic = offsetC; + for ( j = 0; j < N; j++ ) { + if ( C[ ic ] === 0.0 ) { + return M + j + 1; + } + ic += strideC; + } + } + // Invert the column scale factors... + ic = offsetC; + for ( j = 0; j < N; j++ ) { + C[ ic ] = 1.0 / min( max( C[ ic ], SMLNUM ), BIGNUM ); + ic += strideC; + } + // Compute `COLCND = min(C)/max(C)`... + out[ offsetOut + strideOut ] = max( rcmin, SMLNUM ) / min( rcmax, BIGNUM ); + return 0; +} + + +// EXPORTS // + +module.exports = dgbequ; diff --git a/lib/node_modules/@stdlib/lapack/base/dgbequ/lib/dgbequ.js b/lib/node_modules/@stdlib/lapack/base/dgbequ/lib/dgbequ.js new file mode 100644 index 000000000000..4485fd23e2fe --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgbequ/lib/dgbequ.js @@ -0,0 +1,127 @@ +/** +* @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 isLayout = require( '@stdlib/blas/base/assert/is-layout' ); +var isColumnMajor = require( '@stdlib/ndarray/base/assert/is-column-major-string' ); +var max = require( '@stdlib/math/base/special/fast/max' ); +var format = require( '@stdlib/string/format' ); +var base = require( './base.js' ); + + +// MAIN // + +/** +* Computes row and column scale factors intended to equilibrate an `M`-by-`N` band matrix `A` and reduce its condition number. +* +* ## Notes +* +* - The band matrix `A` is stored in the band array `AB`, which has `KL+KU+1` rows and `N` columns, such that the element `A(i,j)` (zero-based) is stored in row `KU+i-j` and column `j` of `AB`, for `max(0,j-KU) <= i <= min(M-1,j+KL)`. For column-major order, row `b` and column `j` of `AB` is `AB[b+j*LDAB]`; for row-major order, it is `AB[b*LDAB+j]`. +* - `out` is set to `[ ROWCND, COLCND, AMAX ]`. +* +* @param {string} order - storage layout of the band array `AB` +* @param {NonNegativeInteger} M - number of rows in the matrix `A` +* @param {NonNegativeInteger} N - number of columns in the matrix `A` +* @param {NonNegativeInteger} KL - number of subdiagonals within the band of `A` +* @param {NonNegativeInteger} KU - number of superdiagonals within the band of `A` +* @param {Float64Array} AB - band array containing the band matrix `A` +* @param {PositiveInteger} LDAB - stride of the first dimension of `AB` (a.k.a., leading dimension of the band array `AB`) +* @param {Float64Array} R - output array for the row scale factors +* @param {Float64Array} C - output array for the column scale factors +* @param {Float64Array} out - output array for `[ ROWCND, COLCND, AMAX ]` +* @throws {TypeError} first argument must be a valid order +* @throws {RangeError} second argument must be a nonnegative integer +* @throws {RangeError} third argument must be a nonnegative integer +* @throws {RangeError} fourth argument must be a nonnegative integer +* @throws {RangeError} fifth argument must be a nonnegative integer +* @throws {RangeError} seventh argument must be greater than or equal to `KL+KU+1` (column-major) or `max(1,N)` (row-major) +* @returns {integer} status code +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* // A = [ [ 1, 2, 0 ], [ 3, 4, 5 ], [ 0, 6, 8 ] ] (KL = 1, KU = 1), stored as a column-major band array: +* var AB = new Float64Array( [ 0.0, 1.0, 3.0, 2.0, 4.0, 6.0, 5.0, 8.0, 0.0 ] ); +* var R = new Float64Array( 3 ); +* var C = new Float64Array( 3 ); +* var out = new Float64Array( 3 ); +* +* var info = dgbequ( 'column-major', 3, 3, 1, 1, AB, 3, R, C, out ); +* // returns 0 +* +* // R => [ 0.5, 0.2, 0.125 ] +* // C => [ ~1.67, 1.0, 1.0 ] +* // out => [ 0.25, ~0.6, 8.0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* // A = [ [ 1, 2, 0 ], [ 3, 4, 5 ], [ 0, 6, 8 ] ] (KL = 1, KU = 1), stored as a row-major band array: +* var AB = new Float64Array( [ 0.0, 2.0, 5.0, 1.0, 4.0, 8.0, 3.0, 6.0, 0.0 ] ); +* var R = new Float64Array( 3 ); +* var C = new Float64Array( 3 ); +* var out = new Float64Array( 3 ); +* +* var info = dgbequ( 'row-major', 3, 3, 1, 1, AB, 3, R, C, out ); +* // returns 0 +* +* // R => [ 0.5, 0.2, 0.125 ] +* // C => [ ~1.67, 1.0, 1.0 ] +* // out => [ 0.25, ~0.6, 8.0 ] +*/ +function dgbequ( order, M, N, KL, KU, AB, LDAB, R, C, out ) { + var sab1; + var sab2; + if ( !isLayout( order ) ) { + throw new TypeError( format( 'invalid argument. First argument must be a valid order. Value: `%s`.', order ) ); + } + if ( M < 0 ) { + throw new RangeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%d`.', M ) ); + } + if ( N < 0 ) { + throw new RangeError( format( 'invalid argument. Third argument must be a nonnegative integer. Value: `%d`.', N ) ); + } + if ( KL < 0 ) { + throw new RangeError( format( 'invalid argument. Fourth argument must be a nonnegative integer. Value: `%d`.', KL ) ); + } + if ( KU < 0 ) { + throw new RangeError( format( 'invalid argument. Fifth argument must be a nonnegative integer. Value: `%d`.', KU ) ); + } + if ( isColumnMajor( order ) ) { + if ( LDAB < KL+KU+1 ) { + throw new RangeError( format( 'invalid argument. Seventh argument must be greater than or equal to %d. Value: `%d`.', KL+KU+1, LDAB ) ); + } + sab1 = 1; + sab2 = LDAB; + } else { // order === 'row-major' + if ( LDAB < max( 1, N ) ) { + throw new RangeError( format( 'invalid argument. Seventh argument must be greater than or equal to max(1,%d). Value: `%d`.', N, LDAB ) ); + } + sab1 = LDAB; + sab2 = 1; + } + return base( M, N, KL, KU, AB, sab1, sab2, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); +} + + +// EXPORTS // + +module.exports = dgbequ; diff --git a/lib/node_modules/@stdlib/lapack/base/dgbequ/lib/index.js b/lib/node_modules/@stdlib/lapack/base/dgbequ/lib/index.js new file mode 100644 index 000000000000..d0ede61cf6a7 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgbequ/lib/index.js @@ -0,0 +1,80 @@ +/** +* @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 row and column scale factors intended to equilibrate an M-by-N band matrix `A` and reduce its condition number. +* +* @module @stdlib/lapack/base/dgbequ +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var dgbequ = require( '@stdlib/lapack/base/dgbequ' ); +* +* // A = [ [ 1, 2, 0 ], [ 3, 4, 5 ], [ 0, 6, 8 ] ] (KL = 1, KU = 1), stored as a column-major band array: +* var AB = new Float64Array( [ 0.0, 1.0, 3.0, 2.0, 4.0, 6.0, 5.0, 8.0, 0.0 ] ); +* var R = new Float64Array( 3 ); +* var C = new Float64Array( 3 ); +* var out = new Float64Array( 3 ); +* +* dgbequ( 'column-major', 3, 3, 1, 1, AB, 3, R, C, out ); +* // R => [ 0.5, 0.2, 0.125 ] +* // C => [ ~1.67, 1.0, 1.0 ] +* // out => [ 0.25, ~0.6, 8.0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var dgbequ = require( '@stdlib/lapack/base/dgbequ' ); +* +* // A = [ [ 1, 2, 0 ], [ 3, 4, 5 ], [ 0, 6, 8 ] ] (KL = 1, KU = 1), stored as a column-major band array: +* var AB = new Float64Array( [ 0.0, 1.0, 3.0, 2.0, 4.0, 6.0, 5.0, 8.0, 0.0 ] ); +* var R = new Float64Array( 3 ); +* var C = new Float64Array( 3 ); +* var out = new Float64Array( 3 ); +* +* dgbequ.ndarray( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); +* // R => [ 0.5, 0.2, 0.125 ] +* // C => [ ~1.67, 1.0, 1.0 ] +* // out => [ 0.25, ~0.6, 8.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 dgbequ; +var tmp = tryRequire( join( __dirname, './native.js' ) ); +if ( isError( tmp ) ) { + dgbequ = main; +} else { + dgbequ = tmp; +} + + +// EXPORTS // + +module.exports = dgbequ; + +// exports: { "ndarray": "dgbequ.ndarray" } diff --git a/lib/node_modules/@stdlib/lapack/base/dgbequ/lib/main.js b/lib/node_modules/@stdlib/lapack/base/dgbequ/lib/main.js new file mode 100644 index 000000000000..4f010b6175cf --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgbequ/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 dgbequ = require( './dgbequ.js' ); +var ndarray = require( './ndarray.js' ); + + +// MAIN // + +setReadOnly( dgbequ, 'ndarray', ndarray ); + + +// EXPORTS // + +module.exports = dgbequ; diff --git a/lib/node_modules/@stdlib/lapack/base/dgbequ/lib/ndarray.js b/lib/node_modules/@stdlib/lapack/base/dgbequ/lib/ndarray.js new file mode 100644 index 000000000000..0c8ee6a9132f --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgbequ/lib/ndarray.js @@ -0,0 +1,95 @@ +/** +* @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 row and column scale factors intended to equilibrate an `M`-by-`N` band matrix `A` and reduce its condition number using alternative indexing semantics. +* +* ## Notes +* +* - The band matrix `A` is stored in the band array `AB`, which has `KL+KU+1` rows and `N` columns, such that the element `A(i,j)` (zero-based) is stored in row `KU+i-j` and column `j` of `AB`, for `max(0,j-KU) <= i <= min(M-1,j+KL)`. The layout of `AB` is specified by `strideAB1` (between band rows) and `strideAB2` (between columns). +* - `out` is set to `[ ROWCND, COLCND, AMAX ]`. +* +* @param {NonNegativeInteger} M - number of rows in the matrix `A` +* @param {NonNegativeInteger} N - number of columns in the matrix `A` +* @param {NonNegativeInteger} KL - number of subdiagonals within the band of `A` +* @param {NonNegativeInteger} KU - number of superdiagonals within the band of `A` +* @param {Float64Array} AB - band array containing the band matrix `A` +* @param {integer} strideAB1 - stride of the first dimension of `AB` (i.e., between band rows) +* @param {integer} strideAB2 - stride of the second dimension of `AB` (i.e., between columns) +* @param {NonNegativeInteger} offsetAB - starting index for `AB` +* @param {Float64Array} R - output array for the row scale factors +* @param {integer} strideR - stride length for `R` +* @param {NonNegativeInteger} offsetR - starting index for `R` +* @param {Float64Array} C - output array for the column scale factors +* @param {integer} strideC - stride length for `C` +* @param {NonNegativeInteger} offsetC - starting index for `C` +* @param {Float64Array} out - output array for `[ ROWCND, COLCND, AMAX ]` +* @param {integer} strideOut - stride length for `out` +* @param {NonNegativeInteger} offsetOut - starting index for `out` +* @throws {RangeError} first argument must be a nonnegative integer +* @throws {RangeError} second argument must be a nonnegative integer +* @throws {RangeError} third argument must be a nonnegative integer +* @throws {RangeError} fourth argument must be a nonnegative integer +* @returns {integer} status code +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* // A = [ [ 1, 2, 0 ], [ 3, 4, 5 ], [ 0, 6, 8 ] ] (KL = 1, KU = 1), stored as a column-major band array: +* var AB = new Float64Array( [ 0.0, 1.0, 3.0, 2.0, 4.0, 6.0, 5.0, 8.0, 0.0 ] ); +* var R = new Float64Array( 3 ); +* var C = new Float64Array( 3 ); +* var out = new Float64Array( 3 ); +* +* var info = dgbequ( 3, 3, 1, 1, AB, 1, 3, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); +* // returns 0 +* +* // R => [ 0.5, 0.2, 0.125 ] +* // C => [ ~1.67, 1.0, 1.0 ] +* // out => [ 0.25, ~0.6, 8.0 ] +*/ +function dgbequ( M, N, KL, KU, AB, strideAB1, strideAB2, offsetAB, R, strideR, offsetR, C, strideC, offsetC, out, strideOut, offsetOut ) { // eslint-disable-line max-len, max-params + if ( M < 0 ) { + throw new RangeError( format( 'invalid argument. First argument must be a nonnegative integer. Value: `%d`.', M ) ); + } + if ( N < 0 ) { + throw new RangeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%d`.', N ) ); + } + if ( KL < 0 ) { + throw new RangeError( format( 'invalid argument. Third argument must be a nonnegative integer. Value: `%d`.', KL ) ); + } + if ( KU < 0 ) { + throw new RangeError( format( 'invalid argument. Fourth argument must be a nonnegative integer. Value: `%d`.', KU ) ); + } + return base( M, N, KL, KU, AB, strideAB1, strideAB2, offsetAB, R, strideR, offsetR, C, strideC, offsetC, out, strideOut, offsetOut ); // eslint-disable-line max-len +} + + +// EXPORTS // + +module.exports = dgbequ; diff --git a/lib/node_modules/@stdlib/lapack/base/dgbequ/package.json b/lib/node_modules/@stdlib/lapack/base/dgbequ/package.json new file mode 100644 index 000000000000..51162e6a5b44 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgbequ/package.json @@ -0,0 +1,73 @@ +{ + "name": "@stdlib/lapack/base/dgbequ", + "version": "0.0.0", + "description": "Compute row and column scale factors intended to equilibrate an M-by-N band matrix A and reduce its condition number.", + "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", + "dgbequ", + "equilibrate", + "equilibration", + "scaling", + "band", + "banded", + "matrix", + "linear", + "algebra", + "subroutines", + "array", + "ndarray", + "float64", + "double", + "float64array" + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dgbequ/test/fixtures/column_major.json b/lib/node_modules/@stdlib/lapack/base/dgbequ/test/fixtures/column_major.json new file mode 100644 index 000000000000..be0bca8548d0 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgbequ/test/fixtures/column_major.json @@ -0,0 +1,44 @@ +{ + "order": "column-major", + "M": 4, + "N": 4, + "KL": 1, + "KU": 2, + + "A_mat": [ + [ 1.0, 2.0, 3.0, 0.0 ], + [ 4.0, 5.0, 6.0, 7.0 ], + [ 0.0, 800.0, 9.0, 10.0 ], + [ 0.0, 0.0, 0.01, 12.0 ] + ], + "AB_mat": [ + [ 0.0, 0.0, 3.0, 7.0 ], + [ 0.0, 2.0, 6.0, 10.0 ], + [ 1.0, 5.0, 9.0, 12.0 ], + [ 4.0, 800.0, 0.01, 0.0 ] + ], + + "AB": [ 0.0, 0.0, 1.0, 4.0, 0.0, 2.0, 5.0, 800.0, 3.0, 6.0, 9.0, 0.01, 7.0, 10.0, 12.0, 0.0 ], + "LDAB": 4, + "strideAB1": 1, + "strideAB2": 4, + "offsetAB": 0, + + "R": [ 0.0, 0.0, 0.0, 0.0 ], + "strideR": 1, + "offsetR": 0, + + "C": [ 0.0, 0.0, 0.0, 0.0 ], + "strideC": 1, + "offsetC": 0, + + "out": [ 0.0, 0.0, 0.0 ], + "strideOut": 1, + "offsetOut": 0, + + "info": 0, + + "R_expected": [ 0.3333333333333333, 0.14285714285714285, 0.00125, 0.08333333333333333 ], + "C_expected": [ 1.75, 1.0, 1.0, 1.0 ], + "out_expected": [ 0.00375, 0.5714285714285714, 800.0 ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dgbequ/test/fixtures/column_major_column_underflow.json b/lib/node_modules/@stdlib/lapack/base/dgbequ/test/fixtures/column_major_column_underflow.json new file mode 100644 index 000000000000..c561eb36b64a --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgbequ/test/fixtures/column_major_column_underflow.json @@ -0,0 +1,42 @@ +{ + "order": "column-major", + "M": 3, + "N": 3, + "KL": 1, + "KU": 1, + + "A_mat": [ + [ 1.0, 1e-310, 0.0 ], + [ 2.0, 1e-312, 3.0 ], + [ 0.0, 1e-311, 4.0 ] + ], + "AB_mat": [ + [ 0.0, 1e-310, 3.0 ], + [ 1.0, 1e-312, 4.0 ], + [ 2.0, 1e-311, 0.0 ] + ], + + "AB": [ 0.0, 1.0, 2.0, 1e-310, 1e-312, 1e-311, 3.0, 4.0, 0.0 ], + "LDAB": 3, + "strideAB1": 1, + "strideAB2": 3, + "offsetAB": 0, + + "R": [ 0.0, 0.0, 0.0 ], + "strideR": 1, + "offsetR": 0, + + "C": [ 0.0, 0.0, 0.0 ], + "strideC": 1, + "offsetC": 0, + + "out": [ 0.0, 0.0, 0.0 ], + "strideOut": 1, + "offsetOut": 0, + + "info": 0, + + "R_expected": [ 1.0, 0.3333333333333333, 0.25 ], + "C_expected": [ 1.0, 4.49423283715579e+307, 1.0 ], + "out_expected": [ 0.25, 2.2250738585072014e-308, 4.0 ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dgbequ/test/fixtures/column_major_diagonal.json b/lib/node_modules/@stdlib/lapack/base/dgbequ/test/fixtures/column_major_diagonal.json new file mode 100644 index 000000000000..3b2ddebb3c76 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgbequ/test/fixtures/column_major_diagonal.json @@ -0,0 +1,40 @@ +{ + "order": "column-major", + "M": 3, + "N": 3, + "KL": 0, + "KU": 0, + + "A_mat": [ + [ 2.0, 0.0, 0.0 ], + [ 0.0, -0.5, 0.0 ], + [ 0.0, 0.0, 4.0 ] + ], + "AB_mat": [ + [ 2.0, -0.5, 4.0 ] + ], + + "AB": [ 2.0, -0.5, 4.0 ], + "LDAB": 1, + "strideAB1": 1, + "strideAB2": 1, + "offsetAB": 0, + + "R": [ 0.0, 0.0, 0.0 ], + "strideR": 1, + "offsetR": 0, + + "C": [ 0.0, 0.0, 0.0 ], + "strideC": 1, + "offsetC": 0, + + "out": [ 0.0, 0.0, 0.0 ], + "strideOut": 1, + "offsetOut": 0, + + "info": 0, + + "R_expected": [ 0.5, 2.0, 0.25 ], + "C_expected": [ 1.0, 1.0, 1.0 ], + "out_expected": [ 0.125, 1.0, 4.0 ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dgbequ/test/fixtures/column_major_ldab.json b/lib/node_modules/@stdlib/lapack/base/dgbequ/test/fixtures/column_major_ldab.json new file mode 100644 index 000000000000..c2e70c4d4873 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgbequ/test/fixtures/column_major_ldab.json @@ -0,0 +1,42 @@ +{ + "order": "column-major", + "M": 3, + "N": 3, + "KL": 1, + "KU": 1, + + "A_mat": [ + [ 1.0, 2.0, 0.0 ], + [ 3.0, 4.0, 5.0 ], + [ 0.0, 6.0, 8.0 ] + ], + "AB_mat": [ + [ 0.0, 2.0, 5.0 ], + [ 1.0, 4.0, 8.0 ], + [ 3.0, 6.0, 0.0 ] + ], + + "AB": [ 0.0, 1.0, 3.0, 9999.0, 9999.0, 2.0, 4.0, 6.0, 9999.0, 9999.0, 5.0, 8.0, 0.0 ], + "LDAB": 5, + "strideAB1": 1, + "strideAB2": 5, + "offsetAB": 0, + + "R": [ 0.0, 0.0, 0.0 ], + "strideR": 1, + "offsetR": 0, + + "C": [ 0.0, 0.0, 0.0 ], + "strideC": 1, + "offsetC": 0, + + "out": [ 0.0, 0.0, 0.0 ], + "strideOut": 1, + "offsetOut": 0, + + "info": 0, + + "R_expected": [ 0.5, 0.2, 0.125 ], + "C_expected": [ 1.6666666666666665, 1.0, 1.0 ], + "out_expected": [ 0.25, 0.6000000000000001, 8.0 ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dgbequ/test/fixtures/column_major_overflow.json b/lib/node_modules/@stdlib/lapack/base/dgbequ/test/fixtures/column_major_overflow.json new file mode 100644 index 000000000000..23b692382260 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgbequ/test/fixtures/column_major_overflow.json @@ -0,0 +1,42 @@ +{ + "order": "column-major", + "M": 3, + "N": 3, + "KL": 1, + "KU": 1, + + "A_mat": [ + [ 1e+308, 2e+307, 0.0 ], + [ 3e+306, 1.0, 5.0 ], + [ 0.0, 6e+305, 8e+307 ] + ], + "AB_mat": [ + [ 0.0, 2e+307, 5.0 ], + [ 1e+308, 1.0, 8e+307 ], + [ 3e+306, 6e+305, 0.0 ] + ], + + "AB": [ 0.0, 1e+308, 3e+306, 2e+307, 1.0, 6e+305, 5.0, 8e+307, 0.0 ], + "LDAB": 3, + "strideAB1": 1, + "strideAB2": 3, + "offsetAB": 0, + + "R": [ 0.0, 0.0, 0.0 ], + "strideR": 1, + "offsetR": 0, + + "C": [ 0.0, 0.0, 0.0 ], + "strideC": 1, + "offsetC": 0, + + "out": [ 0.0, 0.0, 0.0 ], + "strideOut": 1, + "offsetOut": 0, + + "info": 0, + + "R_expected": [ 2.2250738585072014e-308, 3.333333333333333e-307, 2.2250738585072014e-308 ], + "C_expected": [ 0.449423283715579, 2.247116418577895, 0.5617791046444738 ], + "out_expected": [ 0.06675221575521605, 0.19999999999999998, 1e+308 ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dgbequ/test/fixtures/column_major_underflow.json b/lib/node_modules/@stdlib/lapack/base/dgbequ/test/fixtures/column_major_underflow.json new file mode 100644 index 000000000000..75ce4f5e98d7 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgbequ/test/fixtures/column_major_underflow.json @@ -0,0 +1,42 @@ +{ + "order": "column-major", + "M": 3, + "N": 3, + "KL": 1, + "KU": 1, + + "A_mat": [ + [ 1e-310, 2e-312, 0.0 ], + [ 3e-311, 1e-309, 5e-311 ], + [ 0.0, 6e-310, 1e-320 ] + ], + "AB_mat": [ + [ 0.0, 2e-312, 5e-311 ], + [ 1e-310, 1e-309, 1e-320 ], + [ 3e-311, 6e-310, 0.0 ] + ], + + "AB": [ 0.0, 1e-310, 3e-311, 2e-312, 1e-309, 6e-310, 5e-311, 1e-320, 0.0 ], + "LDAB": 3, + "strideAB1": 1, + "strideAB2": 3, + "offsetAB": 0, + + "R": [ 0.0, 0.0, 0.0 ], + "strideR": 1, + "offsetR": 0, + + "C": [ 0.0, 0.0, 0.0 ], + "strideC": 1, + "offsetC": 0, + + "out": [ 0.0, 0.0, 0.0 ], + "strideOut": 1, + "offsetOut": 0, + + "info": 0, + + "R_expected": [ 4.49423283715579e+307, 4.49423283715579e+307, 4.49423283715579e+307 ], + "C_expected": [ 222.50738585072082, 22.25073858507197, 445.01477170141965 ], + "out_expected": [ 22.25073858507197, 0.05000000000000222, 1e-309 ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dgbequ/test/fixtures/column_major_wide.json b/lib/node_modules/@stdlib/lapack/base/dgbequ/test/fixtures/column_major_wide.json new file mode 100644 index 000000000000..2bbbf728f629 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgbequ/test/fixtures/column_major_wide.json @@ -0,0 +1,43 @@ +{ + "order": "column-major", + "M": 3, + "N": 5, + "KL": 1, + "KU": 2, + + "A_mat": [ + [ 2.0, -1.0, 3.0, 0.0, 0.0 ], + [ 5.0, 4.0, 0.5, -6.0, 0.0 ], + [ 0.0, 7.0, 8.0, 9.0, 10.0 ] + ], + "AB_mat": [ + [ 0.0, 0.0, 3.0, -6.0, 10.0 ], + [ 0.0, -1.0, 0.5, 9.0, 0.0 ], + [ 2.0, 4.0, 8.0, 0.0, 0.0 ], + [ 5.0, 7.0, 0.0, 0.0, 0.0 ] + ], + + "AB": [ 0.0, 0.0, 2.0, 5.0, 0.0, -1.0, 4.0, 7.0, 3.0, 0.5, 8.0, 0.0, -6.0, 9.0, 0.0, 0.0, 10.0, 0.0, 0.0, 0.0 ], + "LDAB": 4, + "strideAB1": 1, + "strideAB2": 4, + "offsetAB": 0, + + "R": [ 0.0, 0.0, 0.0 ], + "strideR": 1, + "offsetR": 0, + + "C": [ 0.0, 0.0, 0.0, 0.0, 0.0 ], + "strideC": 1, + "offsetC": 0, + + "out": [ 0.0, 0.0, 0.0 ], + "strideOut": 1, + "offsetOut": 0, + + "info": 0, + + "R_expected": [ 0.3333333333333333, 0.16666666666666666, 0.1 ], + "C_expected": [ 1.2000000000000002, 1.4285714285714284, 1.0, 1.0, 1.0 ], + "out_expected": [ 0.3, 0.7000000000000001, 10.0 ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dgbequ/test/fixtures/column_major_zero_row.json b/lib/node_modules/@stdlib/lapack/base/dgbequ/test/fixtures/column_major_zero_row.json new file mode 100644 index 000000000000..6a26b18bab66 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgbequ/test/fixtures/column_major_zero_row.json @@ -0,0 +1,42 @@ +{ + "order": "column-major", + "M": 3, + "N": 3, + "KL": 1, + "KU": 1, + + "A_mat": [ + [ 1.0, 2.0, 0.0 ], + [ 0.0, 0.0, 0.0 ], + [ 0.0, 6.0, 8.0 ] + ], + "AB_mat": [ + [ 0.0, 2.0, 0.0 ], + [ 1.0, 0.0, 8.0 ], + [ 0.0, 6.0, 0.0 ] + ], + + "AB": [ 0.0, 1.0, 0.0, 2.0, 0.0, 6.0, 0.0, 8.0, 0.0 ], + "LDAB": 3, + "strideAB1": 1, + "strideAB2": 3, + "offsetAB": 0, + + "R": [ 0.0, 0.0, 0.0 ], + "strideR": 1, + "offsetR": 0, + + "C": [ 0.0, 0.0, 0.0 ], + "strideC": 1, + "offsetC": 0, + + "out": [ 0.0, 0.0, 0.0 ], + "strideOut": 1, + "offsetOut": 0, + + "info": 2, + + "R_expected": [ 2.0, 0.0, 8.0 ], + "C_expected": [ 0.0, 0.0, 0.0 ], + "out_expected": [ 0.0, 0.0, 8.0 ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dgbequ/test/fixtures/mixed_strides.json b/lib/node_modules/@stdlib/lapack/base/dgbequ/test/fixtures/mixed_strides.json new file mode 100644 index 000000000000..bd382d0885ba --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgbequ/test/fixtures/mixed_strides.json @@ -0,0 +1,45 @@ +{ + "order": "column-major", + "M": 5, + "N": 3, + "KL": 2, + "KU": 1, + + "A_mat": [ + [ 3.0, 1.0, 0.0 ], + [ -2.0, 5.0, 4.0 ], + [ 6.0, 7.0, 8.0 ], + [ 0.0, -9.0, 10.0 ], + [ 0.0, 0.0, 0.25 ] + ], + "AB_mat": [ + [ 0.0, 1.0, 4.0 ], + [ 3.0, 5.0, 8.0 ], + [ -2.0, 7.0, 10.0 ], + [ 6.0, -9.0, 0.25 ] + ], + + "AB": [ 4.0, 1.0, 0.0, 9999.0, 9999.0, 8.0, 5.0, 3.0, 9999.0, 9999.0, 10.0, 7.0, -2.0, 9999.0, 9999.0, 0.25, -9.0, 6.0 ], + "LDAB": null, + "strideAB1": 5, + "strideAB2": -1, + "offsetAB": 2, + + "R": [ 0.0, 9999.0, 0.0, 9999.0, 0.0, 9999.0, 0.0, 9999.0, 0.0 ], + "strideR": -2, + "offsetR": 8, + + "C": [ 0.0, 0.0, 0.0 ], + "strideC": 1, + "offsetC": 0, + + "out": [ 9999.0, 0.0, 0.0, 0.0 ], + "strideOut": 1, + "offsetOut": 1, + + "info": 0, + + "R_expected": [ 4.0, 9999.0, 0.1, 9999.0, 0.125, 9999.0, 0.2, 9999.0, 0.3333333333333333 ], + "C_expected": [ 1.0, 1.0, 1.0 ], + "out_expected": [ 9999.0, 0.025, 1.0, 10.0 ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dgbequ/test/fixtures/negative_strides.json b/lib/node_modules/@stdlib/lapack/base/dgbequ/test/fixtures/negative_strides.json new file mode 100644 index 000000000000..884b7e0f1174 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgbequ/test/fixtures/negative_strides.json @@ -0,0 +1,44 @@ +{ + "order": "column-major", + "M": 4, + "N": 4, + "KL": 1, + "KU": 2, + + "A_mat": [ + [ 1.0, 2.0, 3.0, 0.0 ], + [ 4.0, 5.0, 6.0, 7.0 ], + [ 0.0, 800.0, 9.0, 10.0 ], + [ 0.0, 0.0, 0.01, 12.0 ] + ], + "AB_mat": [ + [ 0.0, 0.0, 3.0, 7.0 ], + [ 0.0, 2.0, 6.0, 10.0 ], + [ 1.0, 5.0, 9.0, 12.0 ], + [ 4.0, 800.0, 0.01, 0.0 ] + ], + + "AB": [ 0.0, 12.0, 10.0, 7.0, 0.01, 9.0, 6.0, 3.0, 800.0, 5.0, 2.0, 0.0, 4.0, 1.0, 0.0, 0.0 ], + "LDAB": null, + "strideAB1": -1, + "strideAB2": -4, + "offsetAB": 15, + + "R": [ 0.0, 0.0, 0.0, 0.0 ], + "strideR": -1, + "offsetR": 3, + + "C": [ 0.0, 9999.0, 0.0, 9999.0, 0.0, 9999.0, 0.0 ], + "strideC": -2, + "offsetC": 6, + + "out": [ 0.0, 0.0, 0.0 ], + "strideOut": -1, + "offsetOut": 2, + + "info": 0, + + "R_expected": [ 0.08333333333333333, 0.00125, 0.14285714285714285, 0.3333333333333333 ], + "C_expected": [ 1.0, 9999.0, 1.0, 9999.0, 1.0, 9999.0, 1.75 ], + "out_expected": [ 800.0, 0.5714285714285714, 0.00375 ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dgbequ/test/fixtures/offsets.json b/lib/node_modules/@stdlib/lapack/base/dgbequ/test/fixtures/offsets.json new file mode 100644 index 000000000000..56fb17e66acd --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgbequ/test/fixtures/offsets.json @@ -0,0 +1,44 @@ +{ + "order": "column-major", + "M": 4, + "N": 4, + "KL": 1, + "KU": 2, + + "A_mat": [ + [ 1.0, 2.0, 3.0, 0.0 ], + [ 4.0, 5.0, 6.0, 7.0 ], + [ 0.0, 800.0, 9.0, 10.0 ], + [ 0.0, 0.0, 0.01, 12.0 ] + ], + "AB_mat": [ + [ 0.0, 0.0, 3.0, 7.0 ], + [ 0.0, 2.0, 6.0, 10.0 ], + [ 1.0, 5.0, 9.0, 12.0 ], + [ 4.0, 800.0, 0.01, 0.0 ] + ], + + "AB": [ 9999.0, 9999.0, 0.0, 0.0, 1.0, 4.0, 0.0, 2.0, 5.0, 800.0, 3.0, 6.0, 9.0, 0.01, 7.0, 10.0, 12.0, 0.0 ], + "LDAB": null, + "strideAB1": 1, + "strideAB2": 4, + "offsetAB": 2, + + "R": [ 9999.0, 9999.0, 9999.0, 0.0, 0.0, 0.0, 0.0 ], + "strideR": 1, + "offsetR": 3, + + "C": [ 9999.0, 0.0, 0.0, 0.0, 0.0 ], + "strideC": 1, + "offsetC": 1, + + "out": [ 9999.0, 9999.0, 0.0, 0.0, 0.0 ], + "strideOut": 1, + "offsetOut": 2, + + "info": 0, + + "R_expected": [ 9999.0, 9999.0, 9999.0, 0.3333333333333333, 0.14285714285714285, 0.00125, 0.08333333333333333 ], + "C_expected": [ 9999.0, 1.75, 1.0, 1.0, 1.0 ], + "out_expected": [ 9999.0, 9999.0, 0.00375, 0.5714285714285714, 800.0 ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dgbequ/test/fixtures/row_major.json b/lib/node_modules/@stdlib/lapack/base/dgbequ/test/fixtures/row_major.json new file mode 100644 index 000000000000..c5e9ff936344 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgbequ/test/fixtures/row_major.json @@ -0,0 +1,44 @@ +{ + "order": "row-major", + "M": 4, + "N": 4, + "KL": 1, + "KU": 2, + + "A_mat": [ + [ 1.0, 2.0, 3.0, 0.0 ], + [ 4.0, 5.0, 6.0, 7.0 ], + [ 0.0, 800.0, 9.0, 10.0 ], + [ 0.0, 0.0, 0.01, 12.0 ] + ], + "AB_mat": [ + [ 0.0, 0.0, 3.0, 7.0 ], + [ 0.0, 2.0, 6.0, 10.0 ], + [ 1.0, 5.0, 9.0, 12.0 ], + [ 4.0, 800.0, 0.01, 0.0 ] + ], + + "AB": [ 0.0, 0.0, 3.0, 7.0, 0.0, 2.0, 6.0, 10.0, 1.0, 5.0, 9.0, 12.0, 4.0, 800.0, 0.01, 0.0 ], + "LDAB": 4, + "strideAB1": 4, + "strideAB2": 1, + "offsetAB": 0, + + "R": [ 0.0, 0.0, 0.0, 0.0 ], + "strideR": 1, + "offsetR": 0, + + "C": [ 0.0, 0.0, 0.0, 0.0 ], + "strideC": 1, + "offsetC": 0, + + "out": [ 0.0, 0.0, 0.0 ], + "strideOut": 1, + "offsetOut": 0, + + "info": 0, + + "R_expected": [ 0.3333333333333333, 0.14285714285714285, 0.00125, 0.08333333333333333 ], + "C_expected": [ 1.75, 1.0, 1.0, 1.0 ], + "out_expected": [ 0.00375, 0.5714285714285714, 800.0 ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dgbequ/test/fixtures/row_major_ldab.json b/lib/node_modules/@stdlib/lapack/base/dgbequ/test/fixtures/row_major_ldab.json new file mode 100644 index 000000000000..490cd4ba370f --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgbequ/test/fixtures/row_major_ldab.json @@ -0,0 +1,42 @@ +{ + "order": "row-major", + "M": 3, + "N": 3, + "KL": 1, + "KU": 1, + + "A_mat": [ + [ 1.0, 2.0, 0.0 ], + [ 3.0, 4.0, 5.0 ], + [ 0.0, 6.0, 8.0 ] + ], + "AB_mat": [ + [ 0.0, 2.0, 5.0 ], + [ 1.0, 4.0, 8.0 ], + [ 3.0, 6.0, 0.0 ] + ], + + "AB": [ 0.0, 2.0, 5.0, 9999.0, 9999.0, 9999.0, 1.0, 4.0, 8.0, 9999.0, 9999.0, 9999.0, 3.0, 6.0, 0.0 ], + "LDAB": 6, + "strideAB1": 6, + "strideAB2": 1, + "offsetAB": 0, + + "R": [ 0.0, 0.0, 0.0 ], + "strideR": 1, + "offsetR": 0, + + "C": [ 0.0, 0.0, 0.0 ], + "strideC": 1, + "offsetC": 0, + + "out": [ 0.0, 0.0, 0.0 ], + "strideOut": 1, + "offsetOut": 0, + + "info": 0, + + "R_expected": [ 0.5, 0.2, 0.125 ], + "C_expected": [ 1.6666666666666665, 1.0, 1.0 ], + "out_expected": [ 0.25, 0.6000000000000001, 8.0 ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dgbequ/test/fixtures/row_major_tall.json b/lib/node_modules/@stdlib/lapack/base/dgbequ/test/fixtures/row_major_tall.json new file mode 100644 index 000000000000..7e8494eddb11 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgbequ/test/fixtures/row_major_tall.json @@ -0,0 +1,45 @@ +{ + "order": "row-major", + "M": 5, + "N": 3, + "KL": 2, + "KU": 1, + + "A_mat": [ + [ 3.0, 1.0, 0.0 ], + [ -2.0, 5.0, 4.0 ], + [ 6.0, 7.0, 8.0 ], + [ 0.0, -9.0, 10.0 ], + [ 0.0, 0.0, 0.25 ] + ], + "AB_mat": [ + [ 0.0, 1.0, 4.0 ], + [ 3.0, 5.0, 8.0 ], + [ -2.0, 7.0, 10.0 ], + [ 6.0, -9.0, 0.25 ] + ], + + "AB": [ 0.0, 1.0, 4.0, 3.0, 5.0, 8.0, -2.0, 7.0, 10.0, 6.0, -9.0, 0.25 ], + "LDAB": 3, + "strideAB1": 3, + "strideAB2": 1, + "offsetAB": 0, + + "R": [ 0.0, 0.0, 0.0, 0.0, 0.0 ], + "strideR": 1, + "offsetR": 0, + + "C": [ 0.0, 0.0, 0.0 ], + "strideC": 1, + "offsetC": 0, + + "out": [ 0.0, 0.0, 0.0 ], + "strideOut": 1, + "offsetOut": 0, + + "info": 0, + + "R_expected": [ 0.3333333333333333, 0.2, 0.125, 0.1, 4.0 ], + "C_expected": [ 1.0, 1.0, 1.0 ], + "out_expected": [ 0.025, 1.0, 10.0 ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dgbequ/test/fixtures/row_major_wide_bandwidths.json b/lib/node_modules/@stdlib/lapack/base/dgbequ/test/fixtures/row_major_wide_bandwidths.json new file mode 100644 index 000000000000..412170c19fcc --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgbequ/test/fixtures/row_major_wide_bandwidths.json @@ -0,0 +1,51 @@ +{ + "order": "row-major", + "M": 3, + "N": 4, + "KL": 5, + "KU": 6, + + "A_mat": [ + [ 1.0, 2.0, 3.0, 4.0 ], + [ 5.0, 6.0, 7.0, 8.0 ], + [ 9.0, 10.0, 11.0, 12.0 ] + ], + "AB_mat": [ + [ 0.0, 0.0, 0.0, 0.0 ], + [ 0.0, 0.0, 0.0, 0.0 ], + [ 0.0, 0.0, 0.0, 0.0 ], + [ 0.0, 0.0, 0.0, 4.0 ], + [ 0.0, 0.0, 3.0, 8.0 ], + [ 0.0, 2.0, 7.0, 12.0 ], + [ 1.0, 6.0, 11.0, 0.0 ], + [ 5.0, 10.0, 0.0, 0.0 ], + [ 9.0, 0.0, 0.0, 0.0 ], + [ 0.0, 0.0, 0.0, 0.0 ], + [ 0.0, 0.0, 0.0, 0.0 ], + [ 0.0, 0.0, 0.0, 0.0 ] + ], + + "AB": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 4.0, 0.0, 0.0, 3.0, 8.0, 0.0, 2.0, 7.0, 12.0, 1.0, 6.0, 11.0, 0.0, 5.0, 10.0, 0.0, 0.0, 9.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + "LDAB": 4, + "strideAB1": 4, + "strideAB2": 1, + "offsetAB": 0, + + "R": [ 0.0, 0.0, 0.0 ], + "strideR": 1, + "offsetR": 0, + + "C": [ 0.0, 0.0, 0.0, 0.0 ], + "strideC": 1, + "offsetC": 0, + + "out": [ 0.0, 0.0, 0.0 ], + "strideOut": 1, + "offsetOut": 0, + + "info": 0, + + "R_expected": [ 0.25, 0.125, 0.08333333333333333 ], + "C_expected": [ 1.3333333333333333, 1.2000000000000002, 1.090909090909091, 1.0 ], + "out_expected": [ 0.3333333333333333, 0.75, 12.0 ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dgbequ/test/fixtures/row_major_zero_column.json b/lib/node_modules/@stdlib/lapack/base/dgbequ/test/fixtures/row_major_zero_column.json new file mode 100644 index 000000000000..9776b057b0a5 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgbequ/test/fixtures/row_major_zero_column.json @@ -0,0 +1,42 @@ +{ + "order": "row-major", + "M": 3, + "N": 3, + "KL": 1, + "KU": 1, + + "A_mat": [ + [ 1.0, 0.0, 0.0 ], + [ 3.0, 0.0, 5.0 ], + [ 0.0, 0.0, 8.0 ] + ], + "AB_mat": [ + [ 0.0, 0.0, 5.0 ], + [ 1.0, 0.0, 8.0 ], + [ 3.0, 0.0, 0.0 ] + ], + + "AB": [ 0.0, 0.0, 5.0, 1.0, 0.0, 8.0, 3.0, 0.0, 0.0 ], + "LDAB": 3, + "strideAB1": 3, + "strideAB2": 1, + "offsetAB": 0, + + "R": [ 0.0, 0.0, 0.0 ], + "strideR": 1, + "offsetR": 0, + + "C": [ 0.0, 0.0, 0.0 ], + "strideC": 1, + "offsetC": 0, + + "out": [ 0.0, 0.0, 0.0 ], + "strideOut": 1, + "offsetOut": 0, + + "info": 5, + + "R_expected": [ 1.0, 0.2, 0.125 ], + "C_expected": [ 1.0, 0.0, 1.0 ], + "out_expected": [ 0.125, 0.0, 8.0 ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dgbequ/test/fixtures/strides.json b/lib/node_modules/@stdlib/lapack/base/dgbequ/test/fixtures/strides.json new file mode 100644 index 000000000000..065d1a2eaa9b --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgbequ/test/fixtures/strides.json @@ -0,0 +1,44 @@ +{ + "order": "column-major", + "M": 4, + "N": 4, + "KL": 1, + "KU": 2, + + "A_mat": [ + [ 1.0, 2.0, 3.0, 0.0 ], + [ 4.0, 5.0, 6.0, 7.0 ], + [ 0.0, 800.0, 9.0, 10.0 ], + [ 0.0, 0.0, 0.01, 12.0 ] + ], + "AB_mat": [ + [ 0.0, 0.0, 3.0, 7.0 ], + [ 0.0, 2.0, 6.0, 10.0 ], + [ 1.0, 5.0, 9.0, 12.0 ], + [ 4.0, 800.0, 0.01, 0.0 ] + ], + + "AB": [ 0.0, 9999.0, 0.0, 9999.0, 1.0, 9999.0, 4.0, 9999.0, 9999.0, 0.0, 9999.0, 2.0, 9999.0, 5.0, 9999.0, 800.0, 9999.0, 9999.0, 3.0, 9999.0, 6.0, 9999.0, 9.0, 9999.0, 0.01, 9999.0, 9999.0, 7.0, 9999.0, 10.0, 9999.0, 12.0, 9999.0, 0.0 ], + "LDAB": null, + "strideAB1": 2, + "strideAB2": 9, + "offsetAB": 0, + + "R": [ 0.0, 9999.0, 0.0, 9999.0, 0.0, 9999.0, 0.0 ], + "strideR": 2, + "offsetR": 0, + + "C": [ 0.0, 9999.0, 9999.0, 0.0, 9999.0, 9999.0, 0.0, 9999.0, 9999.0, 0.0 ], + "strideC": 3, + "offsetC": 0, + + "out": [ 0.0, 9999.0, 0.0, 9999.0, 0.0 ], + "strideOut": 2, + "offsetOut": 0, + + "info": 0, + + "R_expected": [ 0.3333333333333333, 9999.0, 0.14285714285714285, 9999.0, 0.00125, 9999.0, 0.08333333333333333 ], + "C_expected": [ 1.75, 9999.0, 9999.0, 1.0, 9999.0, 9999.0, 1.0, 9999.0, 9999.0, 1.0 ], + "out_expected": [ 0.00375, 9999.0, 0.5714285714285714, 9999.0, 800.0 ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dgbequ/test/test.dgbequ.js b/lib/node_modules/@stdlib/lapack/base/dgbequ/test/test.dgbequ.js new file mode 100644 index 000000000000..016c6cc036d7 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgbequ/test/test.dgbequ.js @@ -0,0 +1,327 @@ +/** +* @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. +*/ + +/* eslint-disable id-length, max-len */ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Float64Array = require( '@stdlib/array/float64' ); +var isSameFloat64Array = require( '@stdlib/assert/is-same-float64array' ); +var dgbequ = require( './../lib/dgbequ.js' ); + + +// FIXTURES // + +var COLUMN_MAJOR = require( './fixtures/column_major.json' ); +var ROW_MAJOR = require( './fixtures/row_major.json' ); +var COLUMN_MAJOR_WIDE = require( './fixtures/column_major_wide.json' ); +var ROW_MAJOR_TALL = require( './fixtures/row_major_tall.json' ); +var COLUMN_MAJOR_DIAGONAL = require( './fixtures/column_major_diagonal.json' ); +var ROW_MAJOR_WIDE_BANDWIDTHS = require( './fixtures/row_major_wide_bandwidths.json' ); +var COLUMN_MAJOR_LDAB = require( './fixtures/column_major_ldab.json' ); +var ROW_MAJOR_LDAB = require( './fixtures/row_major_ldab.json' ); +var COLUMN_MAJOR_ZERO_ROW = require( './fixtures/column_major_zero_row.json' ); +var ROW_MAJOR_ZERO_COLUMN = require( './fixtures/row_major_zero_column.json' ); +var COLUMN_MAJOR_UNDERFLOW = require( './fixtures/column_major_underflow.json' ); +var COLUMN_MAJOR_COLUMN_UNDERFLOW = require( './fixtures/column_major_column_underflow.json' ); +var COLUMN_MAJOR_OVERFLOW = require( './fixtures/column_major_overflow.json' ); + + +// FUNCTIONS // + +/** +* Runs a fixture and checks the status code and outputs. +* +* @private +* @param {Object} t - test object +* @param {Object} data - fixture data +*/ +function check( t, data ) { + var info; + var out; + var AB; + var R; + var C; + + AB = new Float64Array( data.AB ); + R = new Float64Array( data.R ); + C = new Float64Array( data.C ); + out = new Float64Array( data.out ); + + info = dgbequ( data.order, data.M, data.N, data.KL, data.KU, AB, data.LDAB, R, C, out ); + + t.strictEqual( info, data.info, 'returns expected value' ); + t.strictEqual( isSameFloat64Array( R, new Float64Array( data.R_expected ) ), true, 'returns expected value' ); + t.strictEqual( isSameFloat64Array( C, new Float64Array( data.C_expected ) ), true, 'returns expected value' ); + t.strictEqual( isSameFloat64Array( out, new Float64Array( data.out_expected ) ), true, 'returns expected value' ); + t.strictEqual( isSameFloat64Array( AB, new Float64Array( data.AB ) ), true, 'does not mutate the band array' ); +} + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof dgbequ, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 10', function test( t ) { + t.strictEqual( dgbequ.length, 10, 'returns expected value' ); + t.end(); +}); + +tape( 'the function throws an error if provided an invalid first argument (order)', function test( t ) { + var values; + var i; + + values = [ + 'foo', + 'bar', + '', + 1, + true, + null, + void 0, + [], + {}, + function noop() {} + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + dgbequ( value, 3, 3, 1, 1, new Float64Array( 9 ), 3, new Float64Array( 3 ), new Float64Array( 3 ), new Float64Array( 3 ) ); + }; + } +}); + +tape( 'the function throws an error if provided a second argument (M) which is less than zero', function test( t ) { + var values; + var i; + + 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() { + dgbequ( 'column-major', value, 3, 1, 1, new Float64Array( 9 ), 3, new Float64Array( 3 ), new Float64Array( 3 ), new Float64Array( 3 ) ); + }; + } +}); + +tape( 'the function throws an error if provided a third argument (N) which is less than zero', function test( t ) { + var values; + var i; + + 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() { + dgbequ( 'column-major', 3, value, 1, 1, new Float64Array( 9 ), 3, new Float64Array( 3 ), new Float64Array( 3 ), new Float64Array( 3 ) ); + }; + } +}); + +tape( 'the function throws an error if provided a fourth argument (KL) which is less than zero', function test( t ) { + var values; + var i; + + 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() { + dgbequ( 'column-major', 3, 3, value, 1, new Float64Array( 9 ), 3, new Float64Array( 3 ), new Float64Array( 3 ), new Float64Array( 3 ) ); + }; + } +}); + +tape( 'the function throws an error if provided a fifth argument (KU) which is less than zero', function test( t ) { + var values; + var i; + + 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() { + dgbequ( 'column-major', 3, 3, 1, value, new Float64Array( 9 ), 3, new Float64Array( 3 ), new Float64Array( 3 ), new Float64Array( 3 ) ); + }; + } +}); + +tape( 'the function throws an error if provided a seventh argument (LDAB) which is less than `KL+KU+1` (column-major)', function test( t ) { + var values; + var i; + + values = [ + 0, + 1, + 2 + ]; + + 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() { + dgbequ( 'column-major', 3, 4, 1, 1, new Float64Array( 12 ), value, new Float64Array( 3 ), new Float64Array( 4 ), new Float64Array( 3 ) ); + }; + } +}); + +tape( 'the function throws an error if provided a seventh argument (LDAB) which is less than `max(1,N)` (row-major)', function test( t ) { + var values; + var i; + + values = [ + 0, + 1, + 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() { + dgbequ( 'row-major', 3, 4, 1, 1, new Float64Array( 12 ), value, new Float64Array( 3 ), new Float64Array( 4 ), new Float64Array( 3 ) ); + }; + } +}); + +tape( 'the function computes row and column scale factors for a band matrix (column-major)', function test( t ) { + check( t, COLUMN_MAJOR ); + t.end(); +}); + +tape( 'the function computes row and column scale factors for a band matrix (row-major)', function test( t ) { + check( t, ROW_MAJOR ); + t.end(); +}); + +tape( 'the function computes row and column scale factors for rectangular band matrices', function test( t ) { + check( t, COLUMN_MAJOR_WIDE ); + check( t, ROW_MAJOR_TALL ); + t.end(); +}); + +tape( 'the function computes row and column scale factors for a diagonal matrix (KL = KU = 0)', function test( t ) { + check( t, COLUMN_MAJOR_DIAGONAL ); + t.end(); +}); + +tape( 'the function supports bandwidths which exceed the matrix dimensions', function test( t ) { + check( t, ROW_MAJOR_WIDE_BANDWIDTHS ); + t.end(); +}); + +tape( 'the function supports a band array having a leading dimension greater than required', function test( t ) { + check( t, COLUMN_MAJOR_LDAB ); + check( t, ROW_MAJOR_LDAB ); + t.end(); +}); + +tape( 'the function returns a status code equal to the (one-based) index of the first row which is exactly zero', function test( t ) { + check( t, COLUMN_MAJOR_ZERO_ROW ); + t.end(); +}); + +tape( 'the function returns a status code equal to `M` plus the (one-based) index of the first column which is exactly zero', function test( t ) { + check( t, ROW_MAJOR_ZERO_COLUMN ); + t.end(); +}); + +tape( 'the function clamps row and column maxima which underflow to the smallest normal number', function test( t ) { + check( t, COLUMN_MAJOR_UNDERFLOW ); + t.end(); +}); + +tape( 'the function clamps (row-scaled) column maxima which underflow to the smallest normal number', function test( t ) { + check( t, COLUMN_MAJOR_COLUMN_UNDERFLOW ); + t.end(); +}); + +tape( 'the function supports matrices having elements near the overflow threshold', function test( t ) { + check( t, COLUMN_MAJOR_OVERFLOW ); + t.end(); +}); + +tape( 'the function returns early if `M` or `N` is equal to zero', function test( t ) { + var expected; + var info; + var out; + + expected = new Float64Array( [ 1.0, 1.0, 0.0 ] ); + + out = new Float64Array( 3 ); + info = dgbequ( 'column-major', 0, 2, 1, 1, new Float64Array( 6 ), 3, new Float64Array( 2 ), new Float64Array( 2 ), out ); + t.strictEqual( info, 0, 'returns expected value' ); + t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); + + out = new Float64Array( 3 ); + info = dgbequ( 'row-major', 2, 0, 1, 1, new Float64Array( 6 ), 1, new Float64Array( 2 ), new Float64Array( 2 ), out ); + t.strictEqual( info, 0, 'returns expected value' ); + t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/lapack/base/dgbequ/test/test.js b/lib/node_modules/@stdlib/lapack/base/dgbequ/test/test.js new file mode 100644 index 000000000000..a1ebd3aeacf9 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgbequ/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 dgbequ = 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 dgbequ, '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 dgbequ.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 dgbequ = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( dgbequ, 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 dgbequ; + var main; + + main = require( './../lib/dgbequ.js' ); + + dgbequ = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( dgbequ, main, 'returns expected value' ); + t.end(); + + function tryRequire() { + return new Error( 'Cannot find module' ); + } +}); diff --git a/lib/node_modules/@stdlib/lapack/base/dgbequ/test/test.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dgbequ/test/test.ndarray.js new file mode 100644 index 000000000000..fcbfaa8e159b --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgbequ/test/test.ndarray.js @@ -0,0 +1,284 @@ +/** +* @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. +*/ + +/* eslint-disable id-length, max-len */ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Float64Array = require( '@stdlib/array/float64' ); +var isSameFloat64Array = require( '@stdlib/assert/is-same-float64array' ); +var dgbequ = require( './../lib/ndarray.js' ); + + +// FIXTURES // + +var COLUMN_MAJOR = require( './fixtures/column_major.json' ); +var ROW_MAJOR = require( './fixtures/row_major.json' ); +var COLUMN_MAJOR_WIDE = require( './fixtures/column_major_wide.json' ); +var ROW_MAJOR_TALL = require( './fixtures/row_major_tall.json' ); +var COLUMN_MAJOR_DIAGONAL = require( './fixtures/column_major_diagonal.json' ); +var ROW_MAJOR_WIDE_BANDWIDTHS = require( './fixtures/row_major_wide_bandwidths.json' ); +var COLUMN_MAJOR_LDAB = require( './fixtures/column_major_ldab.json' ); +var ROW_MAJOR_LDAB = require( './fixtures/row_major_ldab.json' ); +var COLUMN_MAJOR_ZERO_ROW = require( './fixtures/column_major_zero_row.json' ); +var ROW_MAJOR_ZERO_COLUMN = require( './fixtures/row_major_zero_column.json' ); +var COLUMN_MAJOR_UNDERFLOW = require( './fixtures/column_major_underflow.json' ); +var COLUMN_MAJOR_COLUMN_UNDERFLOW = require( './fixtures/column_major_column_underflow.json' ); +var COLUMN_MAJOR_OVERFLOW = require( './fixtures/column_major_overflow.json' ); +var OFFSETS = require( './fixtures/offsets.json' ); +var STRIDES = require( './fixtures/strides.json' ); +var NEGATIVE_STRIDES = require( './fixtures/negative_strides.json' ); +var MIXED_STRIDES = require( './fixtures/mixed_strides.json' ); + + +// FUNCTIONS // + +/** +* Runs a fixture and checks the status code and outputs. +* +* @private +* @param {Object} t - test object +* @param {Object} data - fixture data +*/ +function check( t, data ) { + var info; + var out; + var AB; + var R; + var C; + + AB = new Float64Array( data.AB ); + R = new Float64Array( data.R ); + C = new Float64Array( data.C ); + out = new Float64Array( data.out ); + + info = dgbequ( data.M, data.N, data.KL, data.KU, AB, data.strideAB1, data.strideAB2, data.offsetAB, R, data.strideR, data.offsetR, C, data.strideC, data.offsetC, out, data.strideOut, data.offsetOut ); + + t.strictEqual( info, data.info, 'returns expected value' ); + t.strictEqual( isSameFloat64Array( R, new Float64Array( data.R_expected ) ), true, 'returns expected value' ); + t.strictEqual( isSameFloat64Array( C, new Float64Array( data.C_expected ) ), true, 'returns expected value' ); + t.strictEqual( isSameFloat64Array( out, new Float64Array( data.out_expected ) ), true, 'returns expected value' ); + t.strictEqual( isSameFloat64Array( AB, new Float64Array( data.AB ) ), true, 'does not mutate the band array' ); +} + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof dgbequ, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 17', function test( t ) { + t.strictEqual( dgbequ.length, 17, 'returns expected value' ); + t.end(); +}); + +tape( 'the function throws an error if provided a first argument (M) which is less than zero', function test( t ) { + var values; + var i; + + 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() { + dgbequ( value, 3, 1, 1, new Float64Array( 9 ), 1, 3, 0, new Float64Array( 3 ), 1, 0, new Float64Array( 3 ), 1, 0, new Float64Array( 3 ), 1, 0 ); + }; + } +}); + +tape( 'the function throws an error if provided a second argument (N) which is less than zero', function test( t ) { + var values; + var i; + + 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() { + dgbequ( 3, value, 1, 1, new Float64Array( 9 ), 1, 3, 0, new Float64Array( 3 ), 1, 0, new Float64Array( 3 ), 1, 0, new Float64Array( 3 ), 1, 0 ); + }; + } +}); + +tape( 'the function throws an error if provided a third argument (KL) which is less than zero', function test( t ) { + var values; + var i; + + 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() { + dgbequ( 3, 3, value, 1, new Float64Array( 9 ), 1, 3, 0, new Float64Array( 3 ), 1, 0, new Float64Array( 3 ), 1, 0, new Float64Array( 3 ), 1, 0 ); + }; + } +}); + +tape( 'the function throws an error if provided a fourth argument (KU) which is less than zero', function test( t ) { + var values; + var i; + + 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() { + dgbequ( 3, 3, 1, value, new Float64Array( 9 ), 1, 3, 0, new Float64Array( 3 ), 1, 0, new Float64Array( 3 ), 1, 0, new Float64Array( 3 ), 1, 0 ); + }; + } +}); + +tape( 'the function computes row and column scale factors for a band matrix (column-major)', function test( t ) { + check( t, COLUMN_MAJOR ); + t.end(); +}); + +tape( 'the function computes row and column scale factors for a band matrix (row-major)', function test( t ) { + check( t, ROW_MAJOR ); + t.end(); +}); + +tape( 'the function computes row and column scale factors for rectangular band matrices', function test( t ) { + check( t, COLUMN_MAJOR_WIDE ); + check( t, ROW_MAJOR_TALL ); + t.end(); +}); + +tape( 'the function computes row and column scale factors for a diagonal matrix (KL = KU = 0)', function test( t ) { + check( t, COLUMN_MAJOR_DIAGONAL ); + t.end(); +}); + +tape( 'the function supports bandwidths which exceed the matrix dimensions', function test( t ) { + check( t, ROW_MAJOR_WIDE_BANDWIDTHS ); + t.end(); +}); + +tape( 'the function supports a band array having a leading dimension greater than required', function test( t ) { + check( t, COLUMN_MAJOR_LDAB ); + check( t, ROW_MAJOR_LDAB ); + t.end(); +}); + +tape( 'the function returns a status code equal to the (one-based) index of the first row which is exactly zero', function test( t ) { + check( t, COLUMN_MAJOR_ZERO_ROW ); + t.end(); +}); + +tape( 'the function returns a status code equal to `M` plus the (one-based) index of the first column which is exactly zero', function test( t ) { + check( t, ROW_MAJOR_ZERO_COLUMN ); + t.end(); +}); + +tape( 'the function clamps row and column maxima which underflow to the smallest normal number', function test( t ) { + check( t, COLUMN_MAJOR_UNDERFLOW ); + t.end(); +}); + +tape( 'the function clamps (row-scaled) column maxima which underflow to the smallest normal number', function test( t ) { + check( t, COLUMN_MAJOR_COLUMN_UNDERFLOW ); + t.end(); +}); + +tape( 'the function supports matrices having elements near the overflow threshold', function test( t ) { + check( t, COLUMN_MAJOR_OVERFLOW ); + t.end(); +}); + +tape( 'the function supports index offsets', function test( t ) { + check( t, OFFSETS ); + t.end(); +}); + +tape( 'the function supports non-unit strides', function test( t ) { + check( t, STRIDES ); + t.end(); +}); + +tape( 'the function supports negative strides', function test( t ) { + check( t, NEGATIVE_STRIDES ); + t.end(); +}); + +tape( 'the function supports mixed strides', function test( t ) { + check( t, MIXED_STRIDES ); + t.end(); +}); + +tape( 'the function returns early if `M` or `N` is equal to zero', function test( t ) { + var expected; + var info; + var out; + var R; + var C; + + expected = new Float64Array( [ 1.0, 1.0, 0.0 ] ); + + R = new Float64Array( [ 5.0, 5.0 ] ); + C = new Float64Array( [ 5.0, 5.0 ] ); + out = new Float64Array( 3 ); + info = dgbequ( 0, 2, 1, 1, new Float64Array( 6 ), 1, 3, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); + t.strictEqual( isSameFloat64Array( R, new Float64Array( [ 5.0, 5.0 ] ) ), true, 'returns expected value' ); + t.strictEqual( isSameFloat64Array( C, new Float64Array( [ 5.0, 5.0 ] ) ), true, 'returns expected value' ); + + out = new Float64Array( 3 ); + info = dgbequ( 2, 0, 1, 1, new Float64Array( 6 ), 1, 3, 0, R, 1, 0, C, 1, 0, out, 1, 0 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.strictEqual( isSameFloat64Array( out, expected ), true, 'returns expected value' ); + t.end(); +});