diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/README.md b/lib/node_modules/@stdlib/lapack/base/dlangt/README.md new file mode 100644 index 000000000000..6f7f985edf4f --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/README.md @@ -0,0 +1,215 @@ + + +# dlangt + +> Return the value of the one-norm, Frobenius norm, infinity-norm, or the largest absolute value of any element of a real tridiagonal matrix. + +
+ +## Usage + +```javascript +var dlangt = require( '@stdlib/lapack/base/dlangt' ); +``` + +#### dlangt( norm, N, DL, strideDL, D, strideD, DU, strideDU ) + +Returns the value of the specified norm of a real tridiagonal matrix `A`. + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); + +var DL = new Float64Array( [ 1.0, 2.0, 3.0 ] ); +var D = new Float64Array( [ 4.0, 5.0, 6.0, 7.0 ] ); +var DU = new Float64Array( [ 1.0, 1.0, 1.0 ] ); + +var norm = dlangt( 'M', 4, DL, 1, D, 1, DU, 1 ); +// returns 7.0 +``` + +The function has the following parameters: + +- **norm**: specifies the norm type (`'M'`/`'m'`: max norm, `'1'`/`'O'`/`'o'`: one norm, `'I'`/`'i'`: infinity norm, `'F'`/`'f'`/`'E'`/`'e'`: Frobenius norm). +- **N**: order of the matrix `A`. When `N = 0`, the function returns `0`. +- **DL**: [`Float64Array`][mdn-float64array] containing the `(N-1)` sub-diagonal elements. +- **strideDL**: stride length for `DL`. +- **D**: [`Float64Array`][mdn-float64array] containing the `N` diagonal elements. +- **strideD**: stride length for `D`. +- **DU**: [`Float64Array`][mdn-float64array] containing the `(N-1)` super-diagonal elements. +- **strideDU**: stride length for `DU`. + +Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views. + +#### dlangt.ndarray( norm, N, DL, sdl, odl, D, sd, od, DU, sdu, odu ) + +Returns the value of the specified norm using alternative indexing semantics. + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); + +var DL = new Float64Array( [ 1.0, 2.0, 3.0 ] ); +var D = new Float64Array( [ 4.0, 5.0, 6.0, 7.0 ] ); +var DU = new Float64Array( [ 1.0, 1.0, 1.0 ] ); + +var norm = dlangt.ndarray( 'M', 4, DL, 1, 0, D, 1, 0, DU, 1, 0 ); +// returns 7.0 +``` + +The function has the following additional parameters: + +- **sdl**: stride length for `DL`. +- **odl**: starting index for `DL`. +- **sd**: stride length for `D`. +- **od**: starting index for `D`. +- **sdu**: stride length for `DU`. +- **odu**: starting index for `DU`. + +
+ + + +
+ +## Notes + +- `dlangt()` corresponds to the [LAPACK][LAPACK] function [`dlangt`][lapack-dlangt]. + +
+ + + +
+ +## Examples + + + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); +var dlangt = require( '@stdlib/lapack/base/dlangt' ); + +var DL = new Float64Array( [ 3.0, -2.0, 1.0, 4.0 ] ); +var D = new Float64Array( [ -1.0, 5.0, -3.0, 2.0, 7.0 ] ); +var DU = new Float64Array( [ 2.0, -1.0, 4.0, -3.0 ] ); + +console.log( 'Max norm:', dlangt( 'M', 5, DL, 1, D, 1, DU, 1 ) ); +console.log( 'One norm:', dlangt( '1', 5, DL, 1, D, 1, DU, 1 ) ); +console.log( 'Infinity norm:', dlangt( 'I', 5, DL, 1, D, 1, DU, 1 ) ); +console.log( 'Frobenius norm:', dlangt( 'F', 5, DL, 1, D, 1, DU, 1 ) ); +``` + +
+ + + + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +TODO +``` + +#### TODO + +TODO. + +```c +TODO +``` + +TODO + +```c +TODO +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +TODO +``` + +
+ + + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/benchmark/benchmark.js b/lib/node_modules/@stdlib/lapack/base/dlangt/benchmark/benchmark.js new file mode 100644 index 000000000000..e3be6d4e6838 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/benchmark/benchmark.js @@ -0,0 +1,109 @@ +/** +* @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 format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; +var dlangt = require( './../lib/dlangt.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - matrix order +* @returns {Function} benchmark function +*/ +function createBenchmark( len ) { + var DL; + var DU; + var D; + + D = uniform( len, -100.0, 100.0, options ); + DL = uniform( len - 1, -100.0, 100.0, options ); + DU = uniform( len - 1, -100.0, 100.0, options ); + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var v; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = dlangt( 'M', len, DL, 1, D, 1, DU, 1 ); + if ( isnan( v ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( v ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var max; + var min; + var f; + var i; + + min = 1; // 10^min + max = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + f = createBenchmark( len ); + bench( format( '%s:len=%d', pkg, len ), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dlangt/benchmark/benchmark.ndarray.js new file mode 100644 index 000000000000..8a84f3ec6138 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/benchmark/benchmark.ndarray.js @@ -0,0 +1,109 @@ +/** +* @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 format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; +var dlangt = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - matrix order +* @returns {Function} benchmark function +*/ +function createBenchmark( len ) { + var DL; + var DU; + var D; + + D = uniform( len, -100.0, 100.0, options ); + DL = uniform( len - 1, -100.0, 100.0, options ); + DU = uniform( len - 1, -100.0, 100.0, options ); + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var v; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = dlangt( 'M', len, DL, 1, 0, D, 1, 0, DU, 1, 0 ); + if ( isnan( v ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( v ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var max; + var min; + var f; + var i; + + min = 1; // 10^min + max = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + f = createBenchmark( len ); + bench( format( '%s::ndarray:len=%d', pkg, len ), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/docs/repl.txt b/lib/node_modules/@stdlib/lapack/base/dlangt/docs/repl.txt new file mode 100644 index 000000000000..341e66dff205 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/docs/repl.txt @@ -0,0 +1,100 @@ + +{{alias}}( norm, N, DL, strideDL, D, strideD, DU, strideDU ) + Returns the value of the one-norm, Frobenius norm, infinity-norm, or the + largest absolute value of any element of a real tridiagonal matrix. + + Parameters + ---------- + norm: string + Norm type. + + N: integer + Order of the matrix. + + DL: Float64Array + Sub-diagonal elements (length N-1). + + strideDL: integer + Stride length for `DL`. + + D: Float64Array + Diagonal elements (length N). + + strideD: integer + Stride length for `D`. + + DU: Float64Array + Super-diagonal elements (length N-1). + + strideDU: integer + Stride length for `DU`. + + Returns + ------- + out: number + Matrix norm value. + + Examples + -------- + > var DL = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0 ] ); + > var D = new {{alias:@stdlib/array/float64}}( [ 4.0, 5.0, 6.0, 7.0 ] ); + > var DU = new {{alias:@stdlib/array/float64}}( [ 1.0, 1.0, 1.0 ] ); + > {{alias}}( 'M', 4, DL, 1, D, 1, DU, 1 ) + 7.0 + + +{{alias}}.ndarray( norm, N, DL, sdl, odl, D, sd, od, DU, sdu, odu ) + Returns the value of the one-norm, Frobenius norm, infinity-norm, or the + largest absolute value of any element of a real tridiagonal matrix using + alternative indexing semantics. + + Parameters + ---------- + norm: string + Norm type. + + N: integer + Order of the matrix. + + DL: Float64Array + Sub-diagonal elements (length N-1). + + sdl: integer + Stride length for `DL`. + + odl: integer + Starting index for `DL`. + + D: Float64Array + Diagonal elements (length N). + + sd: integer + Stride length for `D`. + + od: integer + Starting index for `D`. + + DU: Float64Array + Super-diagonal elements (length N-1). + + sdu: integer + Stride length for `DU`. + + odu: integer + Starting index for `DU`. + + Returns + ------- + out: number + Matrix norm value. + + Examples + -------- + > var DL = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0 ] ); + > var D = new {{alias:@stdlib/array/float64}}( [ 4.0, 5.0, 6.0, 7.0 ] ); + > var DU = new {{alias:@stdlib/array/float64}}( [ 1.0, 1.0, 1.0 ] ); + > {{alias}}.ndarray( 'M', 4, DL, 1, 0, D, 1, 0, DU, 1, 0 ) + 7.0 + + See Also + -------- diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/docs/types/index.d.ts b/lib/node_modules/@stdlib/lapack/base/dlangt/docs/types/index.d.ts new file mode 100644 index 000000000000..98e3dc280e3f --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/docs/types/index.d.ts @@ -0,0 +1,119 @@ +/* +* @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 + +/// + +/** +* Interface describing `dlangt`. +*/ +interface Routine { + /** + * Returns the value of the one-norm, Frobenius norm, infinity-norm, or the largest absolute value of any element of a real tridiagonal matrix. + * + * @param norm - norm type: 'M', '1'/'O', 'I', or 'F'/'E' + * @param N - order of the matrix + * @param DL - sub-diagonal elements (length N-1) + * @param strideDL - stride length for `DL` + * @param D - diagonal elements (length N) + * @param strideD - stride length for `D` + * @param DU - super-diagonal elements (length N-1) + * @param strideDU - stride length for `DU` + * @returns matrix norm value + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * var DL = new Float64Array( [ 1.0, 2.0, 3.0 ] ); + * var D = new Float64Array( [ 4.0, 5.0, 6.0, 7.0 ] ); + * var DU = new Float64Array( [ 1.0, 1.0, 1.0 ] ); + * + * var v = dlangt( 'M', 4, DL, 1, D, 1, DU, 1 ); + * // returns 7.0 + */ + ( norm: string, N: number, DL: Float64Array, strideDL: number, D: Float64Array, strideD: number, DU: Float64Array, strideDU: number ): number; + + /** + * Returns the value of the one-norm, Frobenius norm, infinity-norm, or the largest absolute value of any element of a real tridiagonal matrix using alternative indexing semantics. + * + * @param norm - norm type: 'M', '1'/'O', 'I', or 'F'/'E' + * @param N - order of the matrix + * @param DL - sub-diagonal elements (length N-1) + * @param strideDL - stride length for `DL` + * @param offsetDL - starting index for `DL` + * @param D - diagonal elements (length N) + * @param strideD - stride length for `D` + * @param offsetD - starting index for `D` + * @param DU - super-diagonal elements (length N-1) + * @param strideDU - stride length for `DU` + * @param offsetDU - starting index for `DU` + * @returns matrix norm value + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * var DL = new Float64Array( [ 1.0, 2.0, 3.0 ] ); + * var D = new Float64Array( [ 4.0, 5.0, 6.0, 7.0 ] ); + * var DU = new Float64Array( [ 1.0, 1.0, 1.0 ] ); + * + * var v = dlangt.ndarray( 'M', 4, DL, 1, 0, D, 1, 0, DU, 1, 0 ); + * // returns 7.0 + */ + ndarray( norm: string, N: number, DL: Float64Array, strideDL: number, offsetDL: number, D: Float64Array, strideD: number, offsetD: number, DU: Float64Array, strideDU: number, offsetDU: number ): number; +} + +/** +* Returns the value of the one-norm, Frobenius norm, infinity-norm, or the largest absolute value of any element of a real tridiagonal matrix. +* +* @param norm - norm type: 'M', '1'/'O', 'I', or 'F'/'E' +* @param N - order of the matrix +* @param DL - sub-diagonal elements (length N-1) +* @param strideDL - stride length for `DL` +* @param D - diagonal elements (length N) +* @param strideD - stride length for `D` +* @param DU - super-diagonal elements (length N-1) +* @param strideDU - stride length for `DU` +* @returns matrix norm value +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var DL = new Float64Array( [ 1.0, 2.0, 3.0 ] ); +* var D = new Float64Array( [ 4.0, 5.0, 6.0, 7.0 ] ); +* var DU = new Float64Array( [ 1.0, 1.0, 1.0 ] ); +* +* var v = dlangt( 'M', 4, DL, 1, D, 1, DU, 1 ); +* // returns 7.0 +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var DL = new Float64Array( [ 1.0, 2.0, 3.0 ] ); +* var D = new Float64Array( [ 4.0, 5.0, 6.0, 7.0 ] ); +* var DU = new Float64Array( [ 1.0, 1.0, 1.0 ] ); +* +* var v = dlangt.ndarray( 'M', 4, DL, 1, 0, D, 1, 0, DU, 1, 0 ); +* // returns 7.0 +*/ +declare var dlangt: Routine; + + +// EXPORTS // + +export = dlangt; diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/docs/types/test.ts b/lib/node_modules/@stdlib/lapack/base/dlangt/docs/types/test.ts new file mode 100644 index 000000000000..695f267ced6d --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/docs/types/test.ts @@ -0,0 +1,125 @@ +/* +* @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. +*/ + +import dlangt = require( './index' ); + + +// TESTS // + +// The function returns a number... +{ + const DL = new Float64Array( [ 1.0, 2.0, 3.0 ] ); + const D = new Float64Array( [ 4.0, 5.0, 6.0, 7.0 ] ); + const DU = new Float64Array( [ 1.0, 1.0, 1.0 ] ); + + dlangt( 'M', 4, DL, 1, D, 1, DU, 1 ); // $ExpectType number +} + +// The compiler throws an error if the function is provided a first argument which is not a string... +{ + const DL = new Float64Array( [ 1.0, 2.0, 3.0 ] ); + const D = new Float64Array( [ 4.0, 5.0, 6.0, 7.0 ] ); + const DU = new Float64Array( [ 1.0, 1.0, 1.0 ] ); + + dlangt( 5, 4, DL, 1, D, 1, DU, 1 ); // $ExpectError + dlangt( true, 4, DL, 1, D, 1, DU, 1 ); // $ExpectError + dlangt( false, 4, DL, 1, D, 1, DU, 1 ); // $ExpectError + dlangt( null, 4, DL, 1, D, 1, DU, 1 ); // $ExpectError + dlangt( void 0, 4, DL, 1, D, 1, DU, 1 ); // $ExpectError + dlangt( [], 4, DL, 1, D, 1, DU, 1 ); // $ExpectError + dlangt( {}, 4, DL, 1, D, 1, DU, 1 ); // $ExpectError + dlangt( ( x: number ): number => x, 4, DL, 1, D, 1, DU, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a second argument which is not a number... +{ + const DL = new Float64Array( [ 1.0, 2.0, 3.0 ] ); + const D = new Float64Array( [ 4.0, 5.0, 6.0, 7.0 ] ); + const DU = new Float64Array( [ 1.0, 1.0, 1.0 ] ); + + dlangt( 'M', '4', DL, 1, D, 1, DU, 1 ); // $ExpectError + dlangt( 'M', true, DL, 1, D, 1, DU, 1 ); // $ExpectError + dlangt( 'M', false, DL, 1, D, 1, DU, 1 ); // $ExpectError + dlangt( 'M', null, DL, 1, D, 1, DU, 1 ); // $ExpectError + dlangt( 'M', void 0, DL, 1, D, 1, DU, 1 ); // $ExpectError + dlangt( 'M', [], DL, 1, D, 1, DU, 1 ); // $ExpectError + dlangt( 'M', {}, DL, 1, D, 1, DU, 1 ); // $ExpectError + dlangt( 'M', ( x: number ): number => x, DL, 1, D, 1, DU, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + const DL = new Float64Array( [ 1.0, 2.0, 3.0 ] ); + const D = new Float64Array( [ 4.0, 5.0, 6.0, 7.0 ] ); + const DU = new Float64Array( [ 1.0, 1.0, 1.0 ] ); + + dlangt(); // $ExpectError + dlangt( 'M' ); // $ExpectError + dlangt( 'M', 4 ); // $ExpectError + dlangt( 'M', 4, DL ); // $ExpectError + dlangt( 'M', 4, DL, 1 ); // $ExpectError + dlangt( 'M', 4, DL, 1, D ); // $ExpectError + dlangt( 'M', 4, DL, 1, D, 1 ); // $ExpectError + dlangt( 'M', 4, DL, 1, D, 1, DU ); // $ExpectError + dlangt( 'M', 4, DL, 1, D, 1, DU, 1, 10 ); // $ExpectError +} + +// Attached to main export is an `ndarray` method which returns a number... +{ + const DL = new Float64Array( [ 1.0, 2.0, 3.0 ] ); + const D = new Float64Array( [ 4.0, 5.0, 6.0, 7.0 ] ); + const DU = new Float64Array( [ 1.0, 1.0, 1.0 ] ); + + dlangt.ndarray( 'M', 4, DL, 1, 0, D, 1, 0, DU, 1, 0 ); // $ExpectType number +} + +// The compiler throws an error if the `ndarray` method is provided a first argument which is not a string... +{ + const DL = new Float64Array( [ 1.0, 2.0, 3.0 ] ); + const D = new Float64Array( [ 4.0, 5.0, 6.0, 7.0 ] ); + const DU = new Float64Array( [ 1.0, 1.0, 1.0 ] ); + + dlangt.ndarray( 5, 4, DL, 1, 0, D, 1, 0, DU, 1, 0 ); // $ExpectError + dlangt.ndarray( true, 4, DL, 1, 0, D, 1, 0, DU, 1, 0 ); // $ExpectError + dlangt.ndarray( false, 4, DL, 1, 0, D, 1, 0, DU, 1, 0 ); // $ExpectError + dlangt.ndarray( null, 4, DL, 1, 0, D, 1, 0, DU, 1, 0 ); // $ExpectError + dlangt.ndarray( void 0, 4, DL, 1, 0, D, 1, 0, DU, 1, 0 ); // $ExpectError + dlangt.ndarray( [], 4, DL, 1, 0, D, 1, 0, DU, 1, 0 ); // $ExpectError + dlangt.ndarray( {}, 4, DL, 1, 0, D, 1, 0, DU, 1, 0 ); // $ExpectError + dlangt.ndarray( ( x: number ): number => x, 4, DL, 1, 0, D, 1, 0, DU, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided an unsupported number of arguments... +{ + const DL = new Float64Array( [ 1.0, 2.0, 3.0 ] ); + const D = new Float64Array( [ 4.0, 5.0, 6.0, 7.0 ] ); + const DU = new Float64Array( [ 1.0, 1.0, 1.0 ] ); + + dlangt.ndarray(); // $ExpectError + dlangt.ndarray( 'M' ); // $ExpectError + dlangt.ndarray( 'M', 4 ); // $ExpectError + dlangt.ndarray( 'M', 4, DL ); // $ExpectError + dlangt.ndarray( 'M', 4, DL, 1 ); // $ExpectError + dlangt.ndarray( 'M', 4, DL, 1, 0 ); // $ExpectError + dlangt.ndarray( 'M', 4, DL, 1, 0, D ); // $ExpectError + dlangt.ndarray( 'M', 4, DL, 1, 0, D, 1 ); // $ExpectError + dlangt.ndarray( 'M', 4, DL, 1, 0, D, 1, 0 ); // $ExpectError + dlangt.ndarray( 'M', 4, DL, 1, 0, D, 1, 0, DU ); // $ExpectError + dlangt.ndarray( 'M', 4, DL, 1, 0, D, 1, 0, DU, 1 ); // $ExpectError + dlangt.ndarray( 'M', 4, DL, 1, 0, D, 1, 0, DU, 1, 0, 10 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/examples/index.js b/lib/node_modules/@stdlib/lapack/base/dlangt/examples/index.js new file mode 100644 index 000000000000..60f10d7f6cb1 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/examples/index.js @@ -0,0 +1,38 @@ +/** +* @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 dlangt = require( './../lib' ); + +var DL = new Float64Array( [ 3.0, -2.0, 1.0, 4.0 ] ); +var D = new Float64Array( [ -1.0, 5.0, -3.0, 2.0, 7.0 ] ); +var DU = new Float64Array( [ 2.0, -1.0, 4.0, -3.0 ] ); + +// Max absolute value: +console.log( 'Max norm:', dlangt( 'M', 5, DL, 1, D, 1, DU, 1 ) ); + +// One norm (max column sum): +console.log( 'One norm:', dlangt( '1', 5, DL, 1, D, 1, DU, 1 ) ); + +// Infinity norm (max row sum): +console.log( 'Infinity norm:', dlangt( 'I', 5, DL, 1, D, 1, DU, 1 ) ); + +// Frobenius norm: +console.log( 'Frobenius norm:', dlangt( 'F', 5, DL, 1, D, 1, DU, 1 ) ); diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/lib/base.js b/lib/node_modules/@stdlib/lapack/base/dlangt/lib/base.js new file mode 100644 index 000000000000..05550aa26bfa --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/lib/base.js @@ -0,0 +1,158 @@ +/** +* @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 max-len, max-params */ + +'use strict'; + +// MODULES // + +var abs = require( '@stdlib/math/base/special/abs' ); +var sqrt = require( '@stdlib/math/base/special/sqrt' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var Float64Array = require( '@stdlib/array/float64' ); +var dlassq = require( '@stdlib/lapack/base/dlassq' ).ndarray; + + +// MAIN // + +/** +* Returns the value of the one-norm, Frobenius norm, infinity-norm, or the largest absolute value of any element of a real tridiagonal matrix `A`. +* +* @private +* @param {string} norm - specifies the norm: 'M' (max abs), '1'/'O' (one-norm), 'I' (infinity-norm), 'F'/'E' (Frobenius) +* @param {NonNegativeInteger} N - order of the matrix +* @param {Float64Array} DL - sub-diagonal elements (length N-1) +* @param {integer} strideDL - stride length for `DL` +* @param {NonNegativeInteger} offsetDL - starting index for `DL` +* @param {Float64Array} D - diagonal elements (length N) +* @param {integer} strideD - stride length for `D` +* @param {NonNegativeInteger} offsetD - starting index for `D` +* @param {Float64Array} DU - super-diagonal elements (length N-1) +* @param {integer} strideDU - stride length for `DU` +* @param {NonNegativeInteger} offsetDU - starting index for `DU` +* @returns {number} matrix norm +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var DL = new Float64Array( [ 1.0, 2.0, 3.0 ] ); +* var D = new Float64Array( [ 4.0, 5.0, 6.0, 7.0 ] ); +* var DU = new Float64Array( [ 1.0, 1.0, 1.0 ] ); +* +* var norm = dlangt( 'M', 4, DL, 1, 0, D, 1, 0, DU, 1, 0 ); +* // returns 7.0 +*/ +function dlangt( norm, N, DL, strideDL, offsetDL, D, strideD, offsetD, DU, strideDU, offsetDU ) { + var anorm; + var scale; + var sumsq; + var temp; + var out; + var odl; + var odu; + var od; + var i; + + if ( N <= 0 ) { + return 0.0; + } + odl = offsetDL; + od = offsetD; + odu = offsetDU; + + if ( norm === 'M' || norm === 'm' ) { + // Find max(abs(A(i,j))) + anorm = abs( D[ od + ( ( N - 1 ) * strideD ) ] ); + for ( i = 0; i < N - 1; i++ ) { + temp = abs( DL[ odl + ( i * strideDL ) ] ); + if ( anorm < temp || isnan( temp ) ) { + anorm = temp; + } + temp = abs( D[ od + ( i * strideD ) ] ); + if ( anorm < temp || isnan( temp ) ) { + anorm = temp; + } + temp = abs( DU[ odu + ( i * strideDU ) ] ); + if ( anorm < temp || isnan( temp ) ) { + anorm = temp; + } + } + } else if ( norm === 'O' || norm === 'o' || norm === '1' ) { + // Find norm1(A) = max column sum + if ( N === 1 ) { + anorm = abs( D[ od ] ); + } else { + // First column: D[0] + DL[0] + anorm = abs( D[ od ] ) + abs( DL[ odl ] ); + + // Last column: D[N-1] + DU[N-2] + temp = abs( D[ od + ( ( N - 1 ) * strideD ) ] ) + abs( DU[ odu + ( ( N - 2 ) * strideDU ) ] ); + if ( anorm < temp || isnan( temp ) ) { + anorm = temp; + } + + // Middle columns: D[i] + DL[i] + DU[i-1] + for ( i = 1; i < N - 1; i++ ) { + temp = abs( D[ od + ( i * strideD ) ] ) + abs( DL[ odl + ( i * strideDL ) ] ) + abs( DU[ odu + ( ( i - 1 ) * strideDU ) ] ); + if ( anorm < temp || isnan( temp ) ) { + anorm = temp; + } + } + } + } else if ( norm === 'I' || norm === 'i' ) { + // Find normI(A) = max row sum + if ( N === 1 ) { + anorm = abs( D[ od ] ); + } else { + // First row: D[0] + DU[0] + anorm = abs( D[ od ] ) + abs( DU[ odu ] ); + + // Last row: D[N-1] + DL[N-2] + temp = abs( D[ od + ( ( N - 1 ) * strideD ) ] ) + abs( DL[ odl + ( ( N - 2 ) * strideDL ) ] ); + if ( anorm < temp || isnan( temp ) ) { + anorm = temp; + } + + // Middle rows: D[i] + DU[i] + DL[i-1] + for ( i = 1; i < N - 1; i++ ) { + temp = abs( D[ od + ( i * strideD ) ] ) + abs( DU[ odu + ( i * strideDU ) ] ) + abs( DL[ odl + ( ( i - 1 ) * strideDL ) ] ); + if ( anorm < temp || isnan( temp ) ) { + anorm = temp; + } + } + } + } else if ( norm === 'F' || norm === 'f' || norm === 'E' || norm === 'e' ) { + // Find normF(A) = Frobenius norm + out = new Float64Array( 2 ); + scale = 0.0; + sumsq = 1.0; + dlassq( N, D, strideD, offsetD, scale, sumsq, out, 1, 0 ); + if ( N > 1 ) { + dlassq( N - 1, DL, strideDL, offsetDL, out[ 0 ], out[ 1 ], out, 1, 0 ); + dlassq( N - 1, DU, strideDU, offsetDU, out[ 0 ], out[ 1 ], out, 1, 0 ); + } + anorm = out[ 0 ] * sqrt( out[ 1 ] ); + } + return anorm; +} + + +// EXPORTS // + +module.exports = dlangt; diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/lib/dlangt.js b/lib/node_modules/@stdlib/lapack/base/dlangt/lib/dlangt.js new file mode 100644 index 000000000000..e62eff196117 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/lib/dlangt.js @@ -0,0 +1,72 @@ +/** +* @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 stride2offset = require( '@stdlib/strided/base/stride2offset' ); +var format = require( '@stdlib/string/format' ); +var base = require( './base.js' ); + + +// VARIABLES // + +var NORMS = [ 'M', 'm', '1', 'O', 'o', 'I', 'i', 'F', 'f', 'E', 'e' ]; + + +// MAIN // + +/** +* Returns the value of the one-norm, Frobenius norm, infinity-norm, or the largest absolute value of any element of a real tridiagonal matrix `A`. +* +* @param {string} norm - specifies the norm type +* @param {NonNegativeInteger} N - order of the matrix +* @param {Float64Array} DL - sub-diagonal elements (length N-1) +* @param {integer} strideDL - stride length for `DL` +* @param {Float64Array} D - diagonal elements (length N) +* @param {integer} strideD - stride length for `D` +* @param {Float64Array} DU - super-diagonal elements (length N-1) +* @param {integer} strideDU - stride length for `DU` +* @throws {TypeError} first argument must be a valid norm type +* @returns {number} matrix norm +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var DL = new Float64Array( [ 1.0, 2.0, 3.0 ] ); +* var D = new Float64Array( [ 4.0, 5.0, 6.0, 7.0 ] ); +* var DU = new Float64Array( [ 1.0, 1.0, 1.0 ] ); +* +* var norm = dlangt( 'M', 4, DL, 1, D, 1, DU, 1 ); +* // returns 7.0 +*/ +function dlangt( norm, N, DL, strideDL, D, strideD, DU, strideDU ) { + if ( NORMS.indexOf( norm ) === -1 ) { + throw new TypeError( format( 'invalid argument. First argument must be a valid norm type. Value: `%s`.', norm ) ); + } + if ( N <= 0 ) { + return 0.0; + } + return base( norm, N, DL, strideDL, stride2offset( N - 1, strideDL ), D, strideD, stride2offset( N, strideD ), DU, strideDU, stride2offset( N - 1, strideDU ) ); +} + + +// EXPORTS // + +module.exports = dlangt; diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/lib/index.js b/lib/node_modules/@stdlib/lapack/base/dlangt/lib/index.js new file mode 100644 index 000000000000..533b39867454 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/lib/index.js @@ -0,0 +1,72 @@ +/** +* @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 return the value of the one-norm, Frobenius norm, infinity-norm, or the largest absolute value of any element of a real tridiagonal matrix. +* +* @module @stdlib/lapack/base/dlangt +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var dlangt = require( '@stdlib/lapack/base/dlangt' ); +* +* var DL = new Float64Array( [ 1.0, 2.0, 3.0 ] ); +* var D = new Float64Array( [ 4.0, 5.0, 6.0, 7.0 ] ); +* var DU = new Float64Array( [ 1.0, 1.0, 1.0 ] ); +* +* var norm = dlangt( 'M', 4, DL, 1, D, 1, DU, 1 ); +* // returns 7.0 +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var dlangt = require( '@stdlib/lapack/base/dlangt' ); +* +* var DL = new Float64Array( [ 1.0, 2.0, 3.0 ] ); +* var D = new Float64Array( [ 4.0, 5.0, 6.0, 7.0 ] ); +* var DU = new Float64Array( [ 1.0, 1.0, 1.0 ] ); +* +* var norm = dlangt.ndarray( 'M', 4, DL, 1, 0, D, 1, 0, DU, 1, 0 ); +* // returns 7.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 dlangt; +var tmp = tryRequire( join( __dirname, './native.js' ) ); +if ( isError( tmp ) ) { + dlangt = main; +} else { + dlangt = tmp; +} + + +// EXPORTS // + +module.exports = dlangt; + +// exports: { "ndarray": "dlangt.ndarray" } diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/lib/main.js b/lib/node_modules/@stdlib/lapack/base/dlangt/lib/main.js new file mode 100644 index 000000000000..d7eb017692b9 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/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 dlangt = require( './dlangt.js' ); +var ndarray = require( './ndarray.js' ); + + +// MAIN // + +setReadOnly( dlangt, 'ndarray', ndarray ); + + +// EXPORTS // + +module.exports = dlangt; diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/lib/ndarray.js b/lib/node_modules/@stdlib/lapack/base/dlangt/lib/ndarray.js new file mode 100644 index 000000000000..d108cc9de263 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/lib/ndarray.js @@ -0,0 +1,73 @@ +/** +* @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 max-params */ + +'use strict'; + +// MODULES // + +var format = require( '@stdlib/string/format' ); +var base = require( './base.js' ); + + +// VARIABLES // + +var NORMS = ['M', 'm', '1', 'O', 'o', 'I', 'i', 'F', 'f', 'E', 'e']; + + +// MAIN // + +/** +* Returns the value of the one-norm, Frobenius norm, infinity-norm, or the largest absolute value of any element of a real tridiagonal matrix `A` using alternative indexing semantics. +* +* @param {string} norm - specifies the norm type +* @param {NonNegativeInteger} N - order of the matrix +* @param {Float64Array} DL - sub-diagonal elements (length N-1) +* @param {integer} strideDL - stride length for `DL` +* @param {NonNegativeInteger} offsetDL - starting index for `DL` +* @param {Float64Array} D - diagonal elements (length N) +* @param {integer} strideD - stride length for `D` +* @param {NonNegativeInteger} offsetD - starting index for `D` +* @param {Float64Array} DU - super-diagonal elements (length N-1) +* @param {integer} strideDU - stride length for `DU` +* @param {NonNegativeInteger} offsetDU - starting index for `DU` +* @throws {TypeError} first argument must be a valid norm type +* @returns {number} matrix norm +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var DL = new Float64Array( [ 1.0, 2.0, 3.0 ] ); +* var D = new Float64Array( [ 4.0, 5.0, 6.0, 7.0 ] ); +* var DU = new Float64Array( [ 1.0, 1.0, 1.0 ] ); +* +* var norm = dlangt( 'M', 4, DL, 1, 0, D, 1, 0, DU, 1, 0 ); +* // returns 7.0 +*/ +function dlangt( norm, N, DL, strideDL, offsetDL, D, strideD, offsetD, DU, strideDU, offsetDU ) { + if ( NORMS.indexOf( norm ) === -1 ) { + throw new TypeError( format( 'invalid argument. First argument must be a valid norm type. Value: `%s`.', norm ) ); + } + return base( norm, N, DL, strideDL, offsetDL, D, strideD, offsetD, DU, strideDU, offsetDU ); +} + + +// EXPORTS // + +module.exports = dlangt; diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/package.json b/lib/node_modules/@stdlib/lapack/base/dlangt/package.json new file mode 100644 index 000000000000..570a8bb1c8c0 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/package.json @@ -0,0 +1,73 @@ +{ + "name": "@stdlib/lapack/base/dlangt", + "version": "0.0.0", + "description": "Return the value of the one-norm, Frobenius norm, infinity-norm, or the largest absolute value of any element of a real tridiagonal matrix.", + "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", + "dlangt", + "norm", + "matrix", + "tridiagonal", + "one-norm", + "frobenius", + "infinity-norm", + "linear", + "algebra", + "subroutines", + "array", + "ndarray", + "float64", + "double", + "float64array" + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/frobenius_norm.json b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/frobenius_norm.json new file mode 100644 index 000000000000..905ed1ab5788 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/frobenius_norm.json @@ -0,0 +1,30 @@ +{ + "norm": "F", + "N": 5, + "DL": [ + 3, + -2, + 1, + 4 + ], + "strideDL": 1, + "offsetDL": 0, + "D": [ + -1, + 5, + -3, + 2, + 7 + ], + "strideD": 1, + "offsetD": 0, + "DU": [ + 2, + -1, + 4, + -3 + ], + "strideDU": 1, + "offsetDU": 0, + "expected": 12.165525060596439 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/inf_norm.json b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/inf_norm.json new file mode 100644 index 000000000000..925078a6b911 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/inf_norm.json @@ -0,0 +1,30 @@ +{ + "norm": "I", + "N": 5, + "DL": [ + 3, + -2, + 1, + 4 + ], + "strideDL": 1, + "offsetDL": 0, + "D": [ + -1, + 5, + -3, + 2, + 7 + ], + "strideD": 1, + "offsetD": 0, + "DU": [ + 2, + -1, + 4, + -3 + ], + "strideDU": 1, + "offsetDU": 0, + "expected": 11 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/large_frobenius_norm.json b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/large_frobenius_norm.json new file mode 100644 index 000000000000..bcfe4972a9c3 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/large_frobenius_norm.json @@ -0,0 +1,45 @@ +{ + "norm": "F", + "N": 10, + "DL": [ + 1, + -2, + 3, + -4, + 5, + -6, + 7, + -8, + 9 + ], + "strideDL": 1, + "offsetDL": 0, + "D": [ + 10, + -9, + 8, + -7, + 6, + -5, + 4, + -3, + 2, + -1 + ], + "strideD": 1, + "offsetD": 0, + "DU": [ + -1, + 2, + -3, + 4, + -5, + 6, + -7, + 8, + -9 + ], + "strideDU": 1, + "offsetDU": 0, + "expected": 30.903074280724887 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/large_inf_norm.json b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/large_inf_norm.json new file mode 100644 index 000000000000..e832f28d0780 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/large_inf_norm.json @@ -0,0 +1,45 @@ +{ + "norm": "I", + "N": 10, + "DL": [ + 1, + -2, + 3, + -4, + 5, + -6, + 7, + -8, + 9 + ], + "strideDL": 1, + "offsetDL": 0, + "D": [ + 10, + -9, + 8, + -7, + 6, + -5, + 4, + -3, + 2, + -1 + ], + "strideD": 1, + "offsetD": 0, + "DU": [ + -1, + 2, + -3, + 4, + -5, + 6, + -7, + 8, + -9 + ], + "strideDU": 1, + "offsetDU": 0, + "expected": 19 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/large_n.json b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/large_n.json new file mode 100644 index 000000000000..2f607e1a55ed --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/large_n.json @@ -0,0 +1,45 @@ +{ + "norm": "M", + "N": 10, + "DL": [ + 1, + -2, + 3, + -4, + 5, + -6, + 7, + -8, + 9 + ], + "strideDL": 1, + "offsetDL": 0, + "D": [ + 10, + -9, + 8, + -7, + 6, + -5, + 4, + -3, + 2, + -1 + ], + "strideD": 1, + "offsetD": 0, + "DU": [ + -1, + 2, + -3, + 4, + -5, + 6, + -7, + 8, + -9 + ], + "strideDU": 1, + "offsetDU": 0, + "expected": 10 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/large_one_norm.json b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/large_one_norm.json new file mode 100644 index 000000000000..4568a6a4d889 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/large_one_norm.json @@ -0,0 +1,45 @@ +{ + "norm": "1", + "N": 10, + "DL": [ + 1, + -2, + 3, + -4, + 5, + -6, + 7, + -8, + 9 + ], + "strideDL": 1, + "offsetDL": 0, + "D": [ + 10, + -9, + 8, + -7, + 6, + -5, + 4, + -3, + 2, + -1 + ], + "strideD": 1, + "offsetD": 0, + "DU": [ + -1, + 2, + -3, + 4, + -5, + 6, + -7, + 8, + -9 + ], + "strideDU": 1, + "offsetDU": 0, + "expected": 19 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/large_strides/frobenius_norm.json b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/large_strides/frobenius_norm.json new file mode 100644 index 000000000000..e08164d4f1e3 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/large_strides/frobenius_norm.json @@ -0,0 +1,43 @@ +{ + "norm": "F", + "N": 5, + "DL": [ + 3, + 9999, + -2, + 9999, + 1, + 9999, + 4, + 9999 + ], + "strideDL": 2, + "offsetDL": 0, + "D": [ + -1, + 9999, + 5, + 9999, + -3, + 9999, + 2, + 9999, + 7, + 9999 + ], + "strideD": 2, + "offsetD": 0, + "DU": [ + 2, + 9999, + -1, + 9999, + 4, + 9999, + -3, + 9999 + ], + "strideDU": 2, + "offsetDU": 0, + "expected": 12.165525060596439 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/large_strides/inf_norm.json b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/large_strides/inf_norm.json new file mode 100644 index 000000000000..dc77ccbbbad1 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/large_strides/inf_norm.json @@ -0,0 +1,43 @@ +{ + "norm": "I", + "N": 5, + "DL": [ + 3, + 9999, + -2, + 9999, + 1, + 9999, + 4, + 9999 + ], + "strideDL": 2, + "offsetDL": 0, + "D": [ + -1, + 9999, + 5, + 9999, + -3, + 9999, + 2, + 9999, + 7, + 9999 + ], + "strideD": 2, + "offsetD": 0, + "DU": [ + 2, + 9999, + -1, + 9999, + 4, + 9999, + -3, + 9999 + ], + "strideDU": 2, + "offsetDU": 0, + "expected": 11 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/large_strides/large_frobenius_norm.json b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/large_strides/large_frobenius_norm.json new file mode 100644 index 000000000000..975bdf6489c3 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/large_strides/large_frobenius_norm.json @@ -0,0 +1,73 @@ +{ + "norm": "F", + "N": 10, + "DL": [ + 1, + 9999, + -2, + 9999, + 3, + 9999, + -4, + 9999, + 5, + 9999, + -6, + 9999, + 7, + 9999, + -8, + 9999, + 9, + 9999 + ], + "strideDL": 2, + "offsetDL": 0, + "D": [ + 10, + 9999, + -9, + 9999, + 8, + 9999, + -7, + 9999, + 6, + 9999, + -5, + 9999, + 4, + 9999, + -3, + 9999, + 2, + 9999, + -1, + 9999 + ], + "strideD": 2, + "offsetD": 0, + "DU": [ + -1, + 9999, + 2, + 9999, + -3, + 9999, + 4, + 9999, + -5, + 9999, + 6, + 9999, + -7, + 9999, + 8, + 9999, + -9, + 9999 + ], + "strideDU": 2, + "offsetDU": 0, + "expected": 30.903074280724887 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/large_strides/large_inf_norm.json b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/large_strides/large_inf_norm.json new file mode 100644 index 000000000000..5a7ea553e908 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/large_strides/large_inf_norm.json @@ -0,0 +1,73 @@ +{ + "norm": "I", + "N": 10, + "DL": [ + 1, + 9999, + -2, + 9999, + 3, + 9999, + -4, + 9999, + 5, + 9999, + -6, + 9999, + 7, + 9999, + -8, + 9999, + 9, + 9999 + ], + "strideDL": 2, + "offsetDL": 0, + "D": [ + 10, + 9999, + -9, + 9999, + 8, + 9999, + -7, + 9999, + 6, + 9999, + -5, + 9999, + 4, + 9999, + -3, + 9999, + 2, + 9999, + -1, + 9999 + ], + "strideD": 2, + "offsetD": 0, + "DU": [ + -1, + 9999, + 2, + 9999, + -3, + 9999, + 4, + 9999, + -5, + 9999, + 6, + 9999, + -7, + 9999, + 8, + 9999, + -9, + 9999 + ], + "strideDU": 2, + "offsetDU": 0, + "expected": 19 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/large_strides/large_n.json b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/large_strides/large_n.json new file mode 100644 index 000000000000..679232198bc7 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/large_strides/large_n.json @@ -0,0 +1,73 @@ +{ + "norm": "M", + "N": 10, + "DL": [ + 1, + 9999, + -2, + 9999, + 3, + 9999, + -4, + 9999, + 5, + 9999, + -6, + 9999, + 7, + 9999, + -8, + 9999, + 9, + 9999 + ], + "strideDL": 2, + "offsetDL": 0, + "D": [ + 10, + 9999, + -9, + 9999, + 8, + 9999, + -7, + 9999, + 6, + 9999, + -5, + 9999, + 4, + 9999, + -3, + 9999, + 2, + 9999, + -1, + 9999 + ], + "strideD": 2, + "offsetD": 0, + "DU": [ + -1, + 9999, + 2, + 9999, + -3, + 9999, + 4, + 9999, + -5, + 9999, + 6, + 9999, + -7, + 9999, + 8, + 9999, + -9, + 9999 + ], + "strideDU": 2, + "offsetDU": 0, + "expected": 10 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/large_strides/large_one_norm.json b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/large_strides/large_one_norm.json new file mode 100644 index 000000000000..f603888707ac --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/large_strides/large_one_norm.json @@ -0,0 +1,73 @@ +{ + "norm": "1", + "N": 10, + "DL": [ + 1, + 9999, + -2, + 9999, + 3, + 9999, + -4, + 9999, + 5, + 9999, + -6, + 9999, + 7, + 9999, + -8, + 9999, + 9, + 9999 + ], + "strideDL": 2, + "offsetDL": 0, + "D": [ + 10, + 9999, + -9, + 9999, + 8, + 9999, + -7, + 9999, + 6, + 9999, + -5, + 9999, + 4, + 9999, + -3, + 9999, + 2, + 9999, + -1, + 9999 + ], + "strideD": 2, + "offsetD": 0, + "DU": [ + -1, + 9999, + 2, + 9999, + -3, + 9999, + 4, + 9999, + -5, + 9999, + 6, + 9999, + -7, + 9999, + 8, + 9999, + -9, + 9999 + ], + "strideDU": 2, + "offsetDU": 0, + "expected": 19 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/large_strides/max_norm.json b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/large_strides/max_norm.json new file mode 100644 index 000000000000..6529bd20d3da --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/large_strides/max_norm.json @@ -0,0 +1,43 @@ +{ + "norm": "M", + "N": 5, + "DL": [ + 3, + 9999, + -2, + 9999, + 1, + 9999, + 4, + 9999 + ], + "strideDL": 2, + "offsetDL": 0, + "D": [ + -1, + 9999, + 5, + 9999, + -3, + 9999, + 2, + 9999, + 7, + 9999 + ], + "strideD": 2, + "offsetD": 0, + "DU": [ + 2, + 9999, + -1, + 9999, + 4, + 9999, + -3, + 9999 + ], + "strideDU": 2, + "offsetDU": 0, + "expected": 7 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/large_strides/n_equals_one.json b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/large_strides/n_equals_one.json new file mode 100644 index 000000000000..3026f14c2762 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/large_strides/n_equals_one.json @@ -0,0 +1,17 @@ +{ + "norm": "M", + "N": 1, + "DL": [], + "strideDL": 2, + "offsetDL": 0, + "D": [ + 42, + 9999 + ], + "strideD": 2, + "offsetD": 0, + "DU": [], + "strideDU": 2, + "offsetDU": 0, + "expected": 42 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/large_strides/one_norm.json b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/large_strides/one_norm.json new file mode 100644 index 000000000000..9bf5671fa654 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/large_strides/one_norm.json @@ -0,0 +1,43 @@ +{ + "norm": "1", + "N": 5, + "DL": [ + 3, + 9999, + -2, + 9999, + 1, + 9999, + 4, + 9999 + ], + "strideDL": 2, + "offsetDL": 0, + "D": [ + -1, + 9999, + 5, + 9999, + -3, + 9999, + 2, + 9999, + 7, + 9999 + ], + "strideD": 2, + "offsetD": 0, + "DU": [ + 2, + 9999, + -1, + 9999, + 4, + 9999, + -3, + 9999 + ], + "strideDU": 2, + "offsetDU": 0, + "expected": 10 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/max_norm.json b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/max_norm.json new file mode 100644 index 000000000000..8509aecc0b93 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/max_norm.json @@ -0,0 +1,30 @@ +{ + "norm": "M", + "N": 5, + "DL": [ + 3, + -2, + 1, + 4 + ], + "strideDL": 1, + "offsetDL": 0, + "D": [ + -1, + 5, + -3, + 2, + 7 + ], + "strideD": 1, + "offsetD": 0, + "DU": [ + 2, + -1, + 4, + -3 + ], + "strideDU": 1, + "offsetDU": 0, + "expected": 7 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/mixed_strides/frobenius_norm.json b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/mixed_strides/frobenius_norm.json new file mode 100644 index 000000000000..aaa6f921cc2d --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/mixed_strides/frobenius_norm.json @@ -0,0 +1,30 @@ +{ + "norm": "F", + "N": 5, + "DL": [ + 4, + 1, + -2, + 3 + ], + "strideDL": -1, + "offsetDL": 3, + "D": [ + -1, + 5, + -3, + 2, + 7 + ], + "strideD": 1, + "offsetD": 0, + "DU": [ + -3, + 4, + -1, + 2 + ], + "strideDU": -1, + "offsetDU": 3, + "expected": 12.165525060596439 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/mixed_strides/inf_norm.json b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/mixed_strides/inf_norm.json new file mode 100644 index 000000000000..3273c4528532 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/mixed_strides/inf_norm.json @@ -0,0 +1,30 @@ +{ + "norm": "I", + "N": 5, + "DL": [ + 4, + 1, + -2, + 3 + ], + "strideDL": -1, + "offsetDL": 3, + "D": [ + -1, + 5, + -3, + 2, + 7 + ], + "strideD": 1, + "offsetD": 0, + "DU": [ + -3, + 4, + -1, + 2 + ], + "strideDU": -1, + "offsetDU": 3, + "expected": 11 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/mixed_strides/large_frobenius_norm.json b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/mixed_strides/large_frobenius_norm.json new file mode 100644 index 000000000000..596e7a7ee839 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/mixed_strides/large_frobenius_norm.json @@ -0,0 +1,45 @@ +{ + "norm": "F", + "N": 10, + "DL": [ + 9, + -8, + 7, + -6, + 5, + -4, + 3, + -2, + 1 + ], + "strideDL": -1, + "offsetDL": 8, + "D": [ + 10, + -9, + 8, + -7, + 6, + -5, + 4, + -3, + 2, + -1 + ], + "strideD": 1, + "offsetD": 0, + "DU": [ + -9, + 8, + -7, + 6, + -5, + 4, + -3, + 2, + -1 + ], + "strideDU": -1, + "offsetDU": 8, + "expected": 30.903074280724887 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/mixed_strides/large_inf_norm.json b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/mixed_strides/large_inf_norm.json new file mode 100644 index 000000000000..ffcc67256cc5 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/mixed_strides/large_inf_norm.json @@ -0,0 +1,45 @@ +{ + "norm": "I", + "N": 10, + "DL": [ + 9, + -8, + 7, + -6, + 5, + -4, + 3, + -2, + 1 + ], + "strideDL": -1, + "offsetDL": 8, + "D": [ + 10, + -9, + 8, + -7, + 6, + -5, + 4, + -3, + 2, + -1 + ], + "strideD": 1, + "offsetD": 0, + "DU": [ + -9, + 8, + -7, + 6, + -5, + 4, + -3, + 2, + -1 + ], + "strideDU": -1, + "offsetDU": 8, + "expected": 19 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/mixed_strides/large_n.json b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/mixed_strides/large_n.json new file mode 100644 index 000000000000..30fc9123af59 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/mixed_strides/large_n.json @@ -0,0 +1,45 @@ +{ + "norm": "M", + "N": 10, + "DL": [ + 9, + -8, + 7, + -6, + 5, + -4, + 3, + -2, + 1 + ], + "strideDL": -1, + "offsetDL": 8, + "D": [ + 10, + -9, + 8, + -7, + 6, + -5, + 4, + -3, + 2, + -1 + ], + "strideD": 1, + "offsetD": 0, + "DU": [ + -9, + 8, + -7, + 6, + -5, + 4, + -3, + 2, + -1 + ], + "strideDU": -1, + "offsetDU": 8, + "expected": 10 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/mixed_strides/large_one_norm.json b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/mixed_strides/large_one_norm.json new file mode 100644 index 000000000000..211390db1463 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/mixed_strides/large_one_norm.json @@ -0,0 +1,45 @@ +{ + "norm": "1", + "N": 10, + "DL": [ + 9, + -8, + 7, + -6, + 5, + -4, + 3, + -2, + 1 + ], + "strideDL": -1, + "offsetDL": 8, + "D": [ + 10, + -9, + 8, + -7, + 6, + -5, + 4, + -3, + 2, + -1 + ], + "strideD": 1, + "offsetD": 0, + "DU": [ + -9, + 8, + -7, + 6, + -5, + 4, + -3, + 2, + -1 + ], + "strideDU": -1, + "offsetDU": 8, + "expected": 19 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/mixed_strides/max_norm.json b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/mixed_strides/max_norm.json new file mode 100644 index 000000000000..27381b306362 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/mixed_strides/max_norm.json @@ -0,0 +1,30 @@ +{ + "norm": "M", + "N": 5, + "DL": [ + 4, + 1, + -2, + 3 + ], + "strideDL": -1, + "offsetDL": 3, + "D": [ + -1, + 5, + -3, + 2, + 7 + ], + "strideD": 1, + "offsetD": 0, + "DU": [ + -3, + 4, + -1, + 2 + ], + "strideDU": -1, + "offsetDU": 3, + "expected": 7 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/mixed_strides/n_equals_one.json b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/mixed_strides/n_equals_one.json new file mode 100644 index 000000000000..2d0e1a8de4ac --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/mixed_strides/n_equals_one.json @@ -0,0 +1,16 @@ +{ + "norm": "M", + "N": 1, + "DL": [], + "strideDL": 1, + "offsetDL": 0, + "D": [ + 42 + ], + "strideD": 1, + "offsetD": 0, + "DU": [], + "strideDU": 1, + "offsetDU": 0, + "expected": 42 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/mixed_strides/one_norm.json b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/mixed_strides/one_norm.json new file mode 100644 index 000000000000..44215828bc79 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/mixed_strides/one_norm.json @@ -0,0 +1,30 @@ +{ + "norm": "1", + "N": 5, + "DL": [ + 4, + 1, + -2, + 3 + ], + "strideDL": -1, + "offsetDL": 3, + "D": [ + -1, + 5, + -3, + 2, + 7 + ], + "strideD": 1, + "offsetD": 0, + "DU": [ + -3, + 4, + -1, + 2 + ], + "strideDU": -1, + "offsetDU": 3, + "expected": 10 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/n_equals_one.json b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/n_equals_one.json new file mode 100644 index 000000000000..2d0e1a8de4ac --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/n_equals_one.json @@ -0,0 +1,16 @@ +{ + "norm": "M", + "N": 1, + "DL": [], + "strideDL": 1, + "offsetDL": 0, + "D": [ + 42 + ], + "strideD": 1, + "offsetD": 0, + "DU": [], + "strideDU": 1, + "offsetDU": 0, + "expected": 42 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/negative_strides/frobenius_norm.json b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/negative_strides/frobenius_norm.json new file mode 100644 index 000000000000..1eee4adc23d0 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/negative_strides/frobenius_norm.json @@ -0,0 +1,30 @@ +{ + "norm": "F", + "N": 5, + "DL": [ + 4, + 1, + -2, + 3 + ], + "strideDL": -1, + "offsetDL": 3, + "D": [ + 7, + 2, + -3, + 5, + -1 + ], + "strideD": -1, + "offsetD": 4, + "DU": [ + -3, + 4, + -1, + 2 + ], + "strideDU": -1, + "offsetDU": 3, + "expected": 12.165525060596439 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/negative_strides/inf_norm.json b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/negative_strides/inf_norm.json new file mode 100644 index 000000000000..c8f8ee3bf024 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/negative_strides/inf_norm.json @@ -0,0 +1,30 @@ +{ + "norm": "I", + "N": 5, + "DL": [ + 4, + 1, + -2, + 3 + ], + "strideDL": -1, + "offsetDL": 3, + "D": [ + 7, + 2, + -3, + 5, + -1 + ], + "strideD": -1, + "offsetD": 4, + "DU": [ + -3, + 4, + -1, + 2 + ], + "strideDU": -1, + "offsetDU": 3, + "expected": 11 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/negative_strides/large_frobenius_norm.json b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/negative_strides/large_frobenius_norm.json new file mode 100644 index 000000000000..33db45df8cfb --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/negative_strides/large_frobenius_norm.json @@ -0,0 +1,45 @@ +{ + "norm": "F", + "N": 10, + "DL": [ + 9, + -8, + 7, + -6, + 5, + -4, + 3, + -2, + 1 + ], + "strideDL": -1, + "offsetDL": 8, + "D": [ + -1, + 2, + -3, + 4, + -5, + 6, + -7, + 8, + -9, + 10 + ], + "strideD": -1, + "offsetD": 9, + "DU": [ + -9, + 8, + -7, + 6, + -5, + 4, + -3, + 2, + -1 + ], + "strideDU": -1, + "offsetDU": 8, + "expected": 30.903074280724887 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/negative_strides/large_inf_norm.json b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/negative_strides/large_inf_norm.json new file mode 100644 index 000000000000..7945873e30b1 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/negative_strides/large_inf_norm.json @@ -0,0 +1,45 @@ +{ + "norm": "I", + "N": 10, + "DL": [ + 9, + -8, + 7, + -6, + 5, + -4, + 3, + -2, + 1 + ], + "strideDL": -1, + "offsetDL": 8, + "D": [ + -1, + 2, + -3, + 4, + -5, + 6, + -7, + 8, + -9, + 10 + ], + "strideD": -1, + "offsetD": 9, + "DU": [ + -9, + 8, + -7, + 6, + -5, + 4, + -3, + 2, + -1 + ], + "strideDU": -1, + "offsetDU": 8, + "expected": 19 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/negative_strides/large_n.json b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/negative_strides/large_n.json new file mode 100644 index 000000000000..e17688750f7b --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/negative_strides/large_n.json @@ -0,0 +1,45 @@ +{ + "norm": "M", + "N": 10, + "DL": [ + 9, + -8, + 7, + -6, + 5, + -4, + 3, + -2, + 1 + ], + "strideDL": -1, + "offsetDL": 8, + "D": [ + -1, + 2, + -3, + 4, + -5, + 6, + -7, + 8, + -9, + 10 + ], + "strideD": -1, + "offsetD": 9, + "DU": [ + -9, + 8, + -7, + 6, + -5, + 4, + -3, + 2, + -1 + ], + "strideDU": -1, + "offsetDU": 8, + "expected": 10 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/negative_strides/large_one_norm.json b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/negative_strides/large_one_norm.json new file mode 100644 index 000000000000..1c5ac1e8aa37 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/negative_strides/large_one_norm.json @@ -0,0 +1,45 @@ +{ + "norm": "1", + "N": 10, + "DL": [ + 9, + -8, + 7, + -6, + 5, + -4, + 3, + -2, + 1 + ], + "strideDL": -1, + "offsetDL": 8, + "D": [ + -1, + 2, + -3, + 4, + -5, + 6, + -7, + 8, + -9, + 10 + ], + "strideD": -1, + "offsetD": 9, + "DU": [ + -9, + 8, + -7, + 6, + -5, + 4, + -3, + 2, + -1 + ], + "strideDU": -1, + "offsetDU": 8, + "expected": 19 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/negative_strides/max_norm.json b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/negative_strides/max_norm.json new file mode 100644 index 000000000000..2049c55321d6 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/negative_strides/max_norm.json @@ -0,0 +1,30 @@ +{ + "norm": "M", + "N": 5, + "DL": [ + 4, + 1, + -2, + 3 + ], + "strideDL": -1, + "offsetDL": 3, + "D": [ + 7, + 2, + -3, + 5, + -1 + ], + "strideD": -1, + "offsetD": 4, + "DU": [ + -3, + 4, + -1, + 2 + ], + "strideDU": -1, + "offsetDU": 3, + "expected": 7 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/negative_strides/n_equals_one.json b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/negative_strides/n_equals_one.json new file mode 100644 index 000000000000..d8065e57c87d --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/negative_strides/n_equals_one.json @@ -0,0 +1,16 @@ +{ + "norm": "M", + "N": 1, + "DL": [], + "strideDL": -1, + "offsetDL": -1, + "D": [ + 42 + ], + "strideD": -1, + "offsetD": 0, + "DU": [], + "strideDU": -1, + "offsetDU": -1, + "expected": 42 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/negative_strides/one_norm.json b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/negative_strides/one_norm.json new file mode 100644 index 000000000000..2a7dfb8256a4 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/negative_strides/one_norm.json @@ -0,0 +1,30 @@ +{ + "norm": "1", + "N": 5, + "DL": [ + 4, + 1, + -2, + 3 + ], + "strideDL": -1, + "offsetDL": 3, + "D": [ + 7, + 2, + -3, + 5, + -1 + ], + "strideD": -1, + "offsetD": 4, + "DU": [ + -3, + 4, + -1, + 2 + ], + "strideDU": -1, + "offsetDU": 3, + "expected": 10 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/offsets/frobenius_norm.json b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/offsets/frobenius_norm.json new file mode 100644 index 000000000000..cc142b6e09d0 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/offsets/frobenius_norm.json @@ -0,0 +1,33 @@ +{ + "norm": "F", + "N": 5, + "DL": [ + 9999, + 3, + -2, + 1, + 4 + ], + "strideDL": 1, + "offsetDL": 1, + "D": [ + 9999, + -1, + 5, + -3, + 2, + 7 + ], + "strideD": 1, + "offsetD": 1, + "DU": [ + 9999, + 2, + -1, + 4, + -3 + ], + "strideDU": 1, + "offsetDU": 1, + "expected": 12.165525060596439 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/offsets/inf_norm.json b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/offsets/inf_norm.json new file mode 100644 index 000000000000..eefe719c19b0 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/offsets/inf_norm.json @@ -0,0 +1,33 @@ +{ + "norm": "I", + "N": 5, + "DL": [ + 9999, + 3, + -2, + 1, + 4 + ], + "strideDL": 1, + "offsetDL": 1, + "D": [ + 9999, + -1, + 5, + -3, + 2, + 7 + ], + "strideD": 1, + "offsetD": 1, + "DU": [ + 9999, + 2, + -1, + 4, + -3 + ], + "strideDU": 1, + "offsetDU": 1, + "expected": 11 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/offsets/large_frobenius_norm.json b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/offsets/large_frobenius_norm.json new file mode 100644 index 000000000000..009343660818 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/offsets/large_frobenius_norm.json @@ -0,0 +1,48 @@ +{ + "norm": "F", + "N": 10, + "DL": [ + 9999, + 1, + -2, + 3, + -4, + 5, + -6, + 7, + -8, + 9 + ], + "strideDL": 1, + "offsetDL": 1, + "D": [ + 9999, + 10, + -9, + 8, + -7, + 6, + -5, + 4, + -3, + 2, + -1 + ], + "strideD": 1, + "offsetD": 1, + "DU": [ + 9999, + -1, + 2, + -3, + 4, + -5, + 6, + -7, + 8, + -9 + ], + "strideDU": 1, + "offsetDU": 1, + "expected": 30.903074280724887 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/offsets/large_inf_norm.json b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/offsets/large_inf_norm.json new file mode 100644 index 000000000000..6758ce0c955c --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/offsets/large_inf_norm.json @@ -0,0 +1,48 @@ +{ + "norm": "I", + "N": 10, + "DL": [ + 9999, + 1, + -2, + 3, + -4, + 5, + -6, + 7, + -8, + 9 + ], + "strideDL": 1, + "offsetDL": 1, + "D": [ + 9999, + 10, + -9, + 8, + -7, + 6, + -5, + 4, + -3, + 2, + -1 + ], + "strideD": 1, + "offsetD": 1, + "DU": [ + 9999, + -1, + 2, + -3, + 4, + -5, + 6, + -7, + 8, + -9 + ], + "strideDU": 1, + "offsetDU": 1, + "expected": 19 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/offsets/large_n.json b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/offsets/large_n.json new file mode 100644 index 000000000000..9601bdc81552 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/offsets/large_n.json @@ -0,0 +1,48 @@ +{ + "norm": "M", + "N": 10, + "DL": [ + 9999, + 1, + -2, + 3, + -4, + 5, + -6, + 7, + -8, + 9 + ], + "strideDL": 1, + "offsetDL": 1, + "D": [ + 9999, + 10, + -9, + 8, + -7, + 6, + -5, + 4, + -3, + 2, + -1 + ], + "strideD": 1, + "offsetD": 1, + "DU": [ + 9999, + -1, + 2, + -3, + 4, + -5, + 6, + -7, + 8, + -9 + ], + "strideDU": 1, + "offsetDU": 1, + "expected": 10 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/offsets/large_one_norm.json b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/offsets/large_one_norm.json new file mode 100644 index 000000000000..7396bfcc4ee8 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/offsets/large_one_norm.json @@ -0,0 +1,48 @@ +{ + "norm": "1", + "N": 10, + "DL": [ + 9999, + 1, + -2, + 3, + -4, + 5, + -6, + 7, + -8, + 9 + ], + "strideDL": 1, + "offsetDL": 1, + "D": [ + 9999, + 10, + -9, + 8, + -7, + 6, + -5, + 4, + -3, + 2, + -1 + ], + "strideD": 1, + "offsetD": 1, + "DU": [ + 9999, + -1, + 2, + -3, + 4, + -5, + 6, + -7, + 8, + -9 + ], + "strideDU": 1, + "offsetDU": 1, + "expected": 19 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/offsets/max_norm.json b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/offsets/max_norm.json new file mode 100644 index 000000000000..4e6531e5e403 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/offsets/max_norm.json @@ -0,0 +1,33 @@ +{ + "norm": "M", + "N": 5, + "DL": [ + 9999, + 3, + -2, + 1, + 4 + ], + "strideDL": 1, + "offsetDL": 1, + "D": [ + 9999, + -1, + 5, + -3, + 2, + 7 + ], + "strideD": 1, + "offsetD": 1, + "DU": [ + 9999, + 2, + -1, + 4, + -3 + ], + "strideDU": 1, + "offsetDU": 1, + "expected": 7 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/offsets/n_equals_one.json b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/offsets/n_equals_one.json new file mode 100644 index 000000000000..4d91fdb46b0d --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/offsets/n_equals_one.json @@ -0,0 +1,21 @@ +{ + "norm": "M", + "N": 1, + "DL": [ + 9999 + ], + "strideDL": 1, + "offsetDL": 1, + "D": [ + 9999, + 42 + ], + "strideD": 1, + "offsetD": 1, + "DU": [ + 9999 + ], + "strideDU": 1, + "offsetDU": 1, + "expected": 42 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/offsets/one_norm.json b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/offsets/one_norm.json new file mode 100644 index 000000000000..faec20d01e6c --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/offsets/one_norm.json @@ -0,0 +1,33 @@ +{ + "norm": "1", + "N": 5, + "DL": [ + 9999, + 3, + -2, + 1, + 4 + ], + "strideDL": 1, + "offsetDL": 1, + "D": [ + 9999, + -1, + 5, + -3, + 2, + 7 + ], + "strideD": 1, + "offsetD": 1, + "DU": [ + 9999, + 2, + -1, + 4, + -3 + ], + "strideDU": 1, + "offsetDU": 1, + "expected": 10 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/one_norm.json b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/one_norm.json new file mode 100644 index 000000000000..a69ebbcf7b06 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/test/fixtures/one_norm.json @@ -0,0 +1,30 @@ +{ + "norm": "1", + "N": 5, + "DL": [ + 3, + -2, + 1, + 4 + ], + "strideDL": 1, + "offsetDL": 0, + "D": [ + -1, + 5, + -3, + 2, + 7 + ], + "strideD": 1, + "offsetD": 0, + "DU": [ + 2, + -1, + 4, + -3 + ], + "strideDU": 1, + "offsetDU": 0, + "expected": 10 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/test/test.dlangt.js b/lib/node_modules/@stdlib/lapack/base/dlangt/test/test.dlangt.js new file mode 100644 index 000000000000..ff57fc96d6c5 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/test/test.dlangt.js @@ -0,0 +1,312 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Float64Array = require( '@stdlib/array/float64' ); +var EPS = require( '@stdlib/constants/float64/eps' ); +var abs = require( '@stdlib/math/base/special/abs' ); +var dlangt = require( './../lib/dlangt.js' ); + + +// FIXTURES // + +var MAX_NORM = require( './fixtures/max_norm.json' ); +var ONE_NORM = require( './fixtures/one_norm.json' ); +var INF_NORM = require( './fixtures/inf_norm.json' ); +var FROBENIUS_NORM = require( './fixtures/frobenius_norm.json' ); +var LARGE_N = require( './fixtures/large_n.json' ); +var N_EQUALS_ONE = require( './fixtures/n_equals_one.json' ); +var LARGE_ONE_NORM = require( './fixtures/large_one_norm.json' ); +var LARGE_INF_NORM = require( './fixtures/large_inf_norm.json' ); +var LARGE_FROBENIUS_NORM = require( './fixtures/large_frobenius_norm.json' ); + + +// FUNCTIONS // + +/** +* Tests whether two values are approximately equal. +* +* @private +* @param {number} actual - actual value +* @param {number} expected - expected value +* @param {number} tol - tolerance +* @returns {boolean} boolean indicating whether values are approximately equal +*/ +function isApprox( actual, expected, tol ) { + var delta; + if ( actual === expected ) { + return true; + } + delta = abs( actual - expected ); + return ( delta <= tol ); +} + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof dlangt, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 8', function test( t ) { + t.strictEqual( dlangt.length, 8, 'returns expected value' ); + t.end(); +}); + +tape( 'the function throws an error if provided an invalid first argument', function test( t ) { + var values; + var DL; + var DU; + var D; + var i; + + values = [ + 'X', + 'Z', + '2', + 'max', + 'frobenius' + ]; + + DL = new Float64Array( [ 1.0, 2.0, 3.0 ] ); + D = new Float64Array( [ 4.0, 5.0, 6.0, 7.0 ] ); + DU = new Float64Array( [ 1.0, 1.0, 1.0 ] ); + + 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() { + dlangt( value, 4, DL, 1, D, 1, DU, 1 ); + }; + } +}); + +tape( 'the function returns 0 when N is 0', function test( t ) { + var DL = new Float64Array( 0 ); + var DU = new Float64Array( 0 ); + var D = new Float64Array( 0 ); + var v; + + v = dlangt( 'M', 0, DL, 1, D, 1, DU, 1 ); + t.strictEqual( v, 0.0, 'returns expected value' ); + + v = dlangt( '1', 0, DL, 1, D, 1, DU, 1 ); + t.strictEqual( v, 0.0, 'returns expected value' ); + + v = dlangt( 'I', 0, DL, 1, D, 1, DU, 1 ); + t.strictEqual( v, 0.0, 'returns expected value' ); + + v = dlangt( 'F', 0, DL, 1, D, 1, DU, 1 ); + t.strictEqual( v, 0.0, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function computes the max norm (N=5)', function test( t ) { + var data = MAX_NORM; + var DL = new Float64Array( data.DL ); + var DU = new Float64Array( data.DU ); + var D = new Float64Array( data.D ); + var v; + + v = dlangt( data.norm, data.N, DL, 1, D, 1, DU, 1 ); + t.strictEqual( v, data.expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function computes the one norm (N=5)', function test( t ) { + var data = ONE_NORM; + var DL = new Float64Array( data.DL ); + var DU = new Float64Array( data.DU ); + var D = new Float64Array( data.D ); + var v; + + v = dlangt( data.norm, data.N, DL, 1, D, 1, DU, 1 ); + t.strictEqual( v, data.expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function computes the infinity norm (N=5)', function test( t ) { + var data = INF_NORM; + var DL = new Float64Array( data.DL ); + var DU = new Float64Array( data.DU ); + var D = new Float64Array( data.D ); + var v; + + v = dlangt( data.norm, data.N, DL, 1, D, 1, DU, 1 ); + t.strictEqual( v, data.expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function computes the Frobenius norm (N=5)', function test( t ) { + var data = FROBENIUS_NORM; + var DL = new Float64Array( data.DL ); + var DU = new Float64Array( data.DU ); + var D = new Float64Array( data.D ); + var v; + + v = dlangt( data.norm, data.N, DL, 1, D, 1, DU, 1 ); + t.ok( isApprox( v, data.expected, 2.0 * EPS * abs( data.expected ) ), 'returns expected value' ); + + t.end(); +}); + +tape( 'the function computes the max norm (N=10)', function test( t ) { + var data = LARGE_N; + var DL = new Float64Array( data.DL ); + var DU = new Float64Array( data.DU ); + var D = new Float64Array( data.D ); + var v; + + v = dlangt( data.norm, data.N, DL, 1, D, 1, DU, 1 ); + t.strictEqual( v, data.expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function computes the one norm (N=10)', function test( t ) { + var data = LARGE_ONE_NORM; + var DL = new Float64Array( data.DL ); + var DU = new Float64Array( data.DU ); + var D = new Float64Array( data.D ); + var v; + + v = dlangt( data.norm, data.N, DL, 1, D, 1, DU, 1 ); + t.strictEqual( v, data.expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function computes the infinity norm (N=10)', function test( t ) { + var data = LARGE_INF_NORM; + var DL = new Float64Array( data.DL ); + var DU = new Float64Array( data.DU ); + var D = new Float64Array( data.D ); + var v; + + v = dlangt( data.norm, data.N, DL, 1, D, 1, DU, 1 ); + t.strictEqual( v, data.expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function computes the Frobenius norm (N=10)', function test( t ) { + var data = LARGE_FROBENIUS_NORM; + var DL = new Float64Array( data.DL ); + var DU = new Float64Array( data.DU ); + var D = new Float64Array( data.D ); + var v; + + v = dlangt( data.norm, data.N, DL, 1, D, 1, DU, 1 ); + t.ok( isApprox( v, data.expected, 2.0 * EPS * abs( data.expected ) ), 'returns expected value' ); + + t.end(); +}); + +tape( 'the function handles N=1 edge case', function test( t ) { + var data = N_EQUALS_ONE; + var DL = new Float64Array( 0 ); + var DU = new Float64Array( 0 ); + var D = new Float64Array( data.D ); + var v; + + v = dlangt( 'M', data.N, DL, 1, D, 1, DU, 1 ); + t.strictEqual( v, data.expected, 'returns expected value for max norm' ); + + v = dlangt( '1', data.N, DL, 1, D, 1, DU, 1 ); + t.strictEqual( v, data.expected, 'returns expected value for one norm' ); + + v = dlangt( 'I', data.N, DL, 1, D, 1, DU, 1 ); + t.strictEqual( v, data.expected, 'returns expected value for infinity norm' ); + + v = dlangt( 'F', data.N, DL, 1, D, 1, DU, 1 ); + t.strictEqual( v, data.expected, 'returns expected value for Frobenius norm' ); + + t.end(); +}); + +tape( 'the function computes the infinity norm when a middle row has the largest sum', function test( t ) { + var DL = new Float64Array( [ 5.0, 1.0 ] ); + var DU = new Float64Array( [ 1.0, 5.0 ] ); + var D = new Float64Array( [ 1.0, 10.0, 1.0 ] ); + var v; + + v = dlangt( 'I', 3, DL, 1, D, 1, DU, 1 ); + t.strictEqual( v, 20.0, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function computes the max norm when the largest element is in the sub-diagonal', function test( t ) { + // DL has the max element (20), larger than any D or DU element + var DL = new Float64Array( [ 1.0, 20.0, 1.0 ] ); + var DU = new Float64Array( [ 1.0, 1.0, 1.0 ] ); + var D = new Float64Array( [ 2.0, 3.0, 4.0, 5.0 ] ); + var v; + + v = dlangt( 'M', 4, DL, 1, D, 1, DU, 1 ); + t.strictEqual( v, 20.0, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function computes the max norm when the largest element is in the super-diagonal', function test( t ) { + // DU has the max element (30), larger than any D or DL element + var DL = new Float64Array( [ 1.0, 1.0, 1.0 ] ); + var DU = new Float64Array( [ 1.0, 30.0, 1.0 ] ); + var D = new Float64Array( [ 2.0, 3.0, 4.0, 5.0 ] ); + var v; + + v = dlangt( 'M', 4, DL, 1, D, 1, DU, 1 ); + t.strictEqual( v, 30.0, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports lowercase and alternate Frobenius norm characters', function test( t ) { + var expected; + var DL = new Float64Array( [ 1.0, 2.0, 3.0 ] ); + var DU = new Float64Array( [ 1.0, 1.0, 1.0 ] ); + var D = new Float64Array( [ 4.0, 5.0, 6.0, 7.0 ] ); + var v; + + expected = dlangt( 'F', 4, DL, 1, D, 1, DU, 1 ); + + v = dlangt( 'f', 4, DL, 1, D, 1, DU, 1 ); + t.strictEqual( v, expected, 'returns expected value for lowercase f' ); + + v = dlangt( 'E', 4, DL, 1, D, 1, DU, 1 ); + t.strictEqual( v, expected, 'returns expected value for E' ); + + v = dlangt( 'e', 4, DL, 1, D, 1, DU, 1 ); + t.strictEqual( v, expected, 'returns expected value for lowercase e' ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/test/test.js b/lib/node_modules/@stdlib/lapack/base/dlangt/test/test.js new file mode 100644 index 000000000000..a848381128c2 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/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 dlangt = 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 dlangt, '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 dlangt.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 dlangt = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( dlangt, 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 dlangt; + var main; + + main = require( './../lib/main.js' ); + + dlangt = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( dlangt, main, 'returns expected value' ); + t.end(); + + function tryRequire() { + return new Error( 'Cannot find module' ); + } +}); diff --git a/lib/node_modules/@stdlib/lapack/base/dlangt/test/test.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dlangt/test/test.ndarray.js new file mode 100644 index 000000000000..599402890dd8 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlangt/test/test.ndarray.js @@ -0,0 +1,304 @@ +/** +* @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 max-len */ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Float64Array = require( '@stdlib/array/float64' ); +var EPS = require( '@stdlib/constants/float64/eps' ); +var abs = require( '@stdlib/math/base/special/abs' ); +var dlangt = require( './../lib/ndarray.js' ); + + +// FIXTURES // + +var MAX_NORM = require( './fixtures/max_norm.json' ); +var ONE_NORM = require( './fixtures/one_norm.json' ); +var INF_NORM = require( './fixtures/inf_norm.json' ); +var FROBENIUS_NORM = require( './fixtures/frobenius_norm.json' ); +var LARGE_N = require( './fixtures/large_n.json' ); +var LARGE_ONE_NORM = require( './fixtures/large_one_norm.json' ); +var LARGE_INF_NORM = require( './fixtures/large_inf_norm.json' ); +var LARGE_FROBENIUS_NORM = require( './fixtures/large_frobenius_norm.json' ); +var N_EQUALS_ONE = require( './fixtures/n_equals_one.json' ); +var OFFSET_MAX_NORM = require( './fixtures/offsets/max_norm.json' ); +var OFFSET_ONE_NORM = require( './fixtures/offsets/one_norm.json' ); +var OFFSET_INF_NORM = require( './fixtures/offsets/inf_norm.json' ); +var OFFSET_FROBENIUS_NORM = require( './fixtures/offsets/frobenius_norm.json' ); +var NEG_MAX_NORM = require( './fixtures/negative_strides/max_norm.json' ); +var NEG_ONE_NORM = require( './fixtures/negative_strides/one_norm.json' ); +var NEG_INF_NORM = require( './fixtures/negative_strides/inf_norm.json' ); +var NEG_FROBENIUS_NORM = require( './fixtures/negative_strides/frobenius_norm.json' ); +var LARGE_STRIDE_MAX_NORM = require( './fixtures/large_strides/max_norm.json' ); +var LARGE_STRIDE_ONE_NORM = require( './fixtures/large_strides/one_norm.json' ); +var LARGE_STRIDE_INF_NORM = require( './fixtures/large_strides/inf_norm.json' ); +var LARGE_STRIDE_FROBENIUS_NORM = require( './fixtures/large_strides/frobenius_norm.json' ); +var MIXED_STRIDES_MAX_NORM = require( './fixtures/mixed_strides/max_norm.json' ); +var MIXED_STRIDES_ONE_NORM = require( './fixtures/mixed_strides/one_norm.json' ); +var MIXED_STRIDES_INF_NORM = require( './fixtures/mixed_strides/inf_norm.json' ); +var MIXED_STRIDES_FROBENIUS_NORM = require( './fixtures/mixed_strides/frobenius_norm.json' ); + + +// FUNCTIONS // + +function isApprox( actual, expected, tol ) { + var delta; + if ( actual === expected ) { + return true; + } + delta = abs( actual - expected ); + return ( delta <= tol ); +} + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof dlangt, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 11', function test( t ) { + t.strictEqual( dlangt.length, 11, 'returns expected value' ); + t.end(); +}); + +tape( 'the function throws an error if provided an invalid first argument', function test( t ) { + var values; + var DL; + var DU; + var D; + var i; + + values = [ 'X', 'Z', '2', 'max' ]; + + DL = new Float64Array( [ 1.0, 2.0, 3.0 ] ); + D = new Float64Array( [ 4.0, 5.0, 6.0, 7.0 ] ); + DU = new Float64Array( [ 1.0, 1.0, 1.0 ] ); + + 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() { + dlangt( value, 4, DL, 1, 0, D, 1, 0, DU, 1, 0 ); + }; + } +}); + +tape( 'the function returns 0 when N is 0', function test( t ) { + var DL = new Float64Array( 0 ); + var DU = new Float64Array( 0 ); + var D = new Float64Array( 0 ); + + t.strictEqual( dlangt( 'M', 0, DL, 1, 0, D, 1, 0, DU, 1, 0 ), 0.0, 'returns expected value' ); + t.strictEqual( dlangt( '1', 0, DL, 1, 0, D, 1, 0, DU, 1, 0 ), 0.0, 'returns expected value' ); + t.strictEqual( dlangt( 'I', 0, DL, 1, 0, D, 1, 0, DU, 1, 0 ), 0.0, 'returns expected value' ); + t.strictEqual( dlangt( 'F', 0, DL, 1, 0, D, 1, 0, DU, 1, 0 ), 0.0, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function computes the max norm (N=5)', function test( t ) { + var data = MAX_NORM; + var v = dlangt( data.norm, data.N, new Float64Array( data.DL ), data.strideDL, data.offsetDL, new Float64Array( data.D ), data.strideD, data.offsetD, new Float64Array( data.DU ), data.strideDU, data.offsetDU ); + t.strictEqual( v, data.expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function computes the one norm (N=5)', function test( t ) { + var data = ONE_NORM; + var v = dlangt( data.norm, data.N, new Float64Array( data.DL ), data.strideDL, data.offsetDL, new Float64Array( data.D ), data.strideD, data.offsetD, new Float64Array( data.DU ), data.strideDU, data.offsetDU ); + t.strictEqual( v, data.expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function computes the infinity norm (N=5)', function test( t ) { + var data = INF_NORM; + var v = dlangt( data.norm, data.N, new Float64Array( data.DL ), data.strideDL, data.offsetDL, new Float64Array( data.D ), data.strideD, data.offsetD, new Float64Array( data.DU ), data.strideDU, data.offsetDU ); + t.strictEqual( v, data.expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function computes the Frobenius norm (N=5)', function test( t ) { + var data = FROBENIUS_NORM; + var v = dlangt( data.norm, data.N, new Float64Array( data.DL ), data.strideDL, data.offsetDL, new Float64Array( data.D ), data.strideD, data.offsetD, new Float64Array( data.DU ), data.strideDU, data.offsetDU ); + t.ok( isApprox( v, data.expected, 2.0 * EPS * abs( data.expected ) ), 'returns expected value' ); + t.end(); +}); + +tape( 'the function computes the max norm (N=10)', function test( t ) { + var data = LARGE_N; + var v = dlangt( data.norm, data.N, new Float64Array( data.DL ), data.strideDL, data.offsetDL, new Float64Array( data.D ), data.strideD, data.offsetD, new Float64Array( data.DU ), data.strideDU, data.offsetDU ); + t.strictEqual( v, data.expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function computes the one norm (N=10)', function test( t ) { + var data = LARGE_ONE_NORM; + var v = dlangt( data.norm, data.N, new Float64Array( data.DL ), data.strideDL, data.offsetDL, new Float64Array( data.D ), data.strideD, data.offsetD, new Float64Array( data.DU ), data.strideDU, data.offsetDU ); + t.strictEqual( v, data.expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function computes the infinity norm (N=10)', function test( t ) { + var data = LARGE_INF_NORM; + var v = dlangt( data.norm, data.N, new Float64Array( data.DL ), data.strideDL, data.offsetDL, new Float64Array( data.D ), data.strideD, data.offsetD, new Float64Array( data.DU ), data.strideDU, data.offsetDU ); + t.strictEqual( v, data.expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function computes the Frobenius norm (N=10)', function test( t ) { + var data = LARGE_FROBENIUS_NORM; + var v = dlangt( data.norm, data.N, new Float64Array( data.DL ), data.strideDL, data.offsetDL, new Float64Array( data.D ), data.strideD, data.offsetD, new Float64Array( data.DU ), data.strideDU, data.offsetDU ); + t.ok( isApprox( v, data.expected, 2.0 * EPS * abs( data.expected ) ), 'returns expected value' ); + t.end(); +}); + +tape( 'the function handles N=1 edge case', function test( t ) { + var data = N_EQUALS_ONE; + var DL = new Float64Array( 0 ); + var DU = new Float64Array( 0 ); + var D = new Float64Array( data.D ); + + t.strictEqual( dlangt( 'M', 1, DL, 1, 0, D, 1, 0, DU, 1, 0 ), 42.0, 'returns expected value' ); + t.strictEqual( dlangt( '1', 1, DL, 1, 0, D, 1, 0, DU, 1, 0 ), 42.0, 'returns expected value' ); + t.strictEqual( dlangt( 'I', 1, DL, 1, 0, D, 1, 0, DU, 1, 0 ), 42.0, 'returns expected value' ); + t.strictEqual( dlangt( 'F', 1, DL, 1, 0, D, 1, 0, DU, 1, 0 ), 42.0, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports providing index offsets (max norm)', function test( t ) { + var data = OFFSET_MAX_NORM; + var v = dlangt( data.norm, data.N, new Float64Array( data.DL ), data.strideDL, data.offsetDL, new Float64Array( data.D ), data.strideD, data.offsetD, new Float64Array( data.DU ), data.strideDU, data.offsetDU ); + t.strictEqual( v, data.expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports providing index offsets (one norm)', function test( t ) { + var data = OFFSET_ONE_NORM; + var v = dlangt( data.norm, data.N, new Float64Array( data.DL ), data.strideDL, data.offsetDL, new Float64Array( data.D ), data.strideD, data.offsetD, new Float64Array( data.DU ), data.strideDU, data.offsetDU ); + t.strictEqual( v, data.expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports providing index offsets (infinity norm)', function test( t ) { + var data = OFFSET_INF_NORM; + var v = dlangt( data.norm, data.N, new Float64Array( data.DL ), data.strideDL, data.offsetDL, new Float64Array( data.D ), data.strideD, data.offsetD, new Float64Array( data.DU ), data.strideDU, data.offsetDU ); + t.strictEqual( v, data.expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports providing index offsets (Frobenius norm)', function test( t ) { + var data = OFFSET_FROBENIUS_NORM; + var v = dlangt( data.norm, data.N, new Float64Array( data.DL ), data.strideDL, data.offsetDL, new Float64Array( data.D ), data.strideD, data.offsetD, new Float64Array( data.DU ), data.strideDU, data.offsetDU ); + t.ok( isApprox( v, data.expected, 2.0 * EPS * abs( data.expected ) ), 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports negative strides (max norm)', function test( t ) { + var data = NEG_MAX_NORM; + var v = dlangt( data.norm, data.N, new Float64Array( data.DL ), data.strideDL, data.offsetDL, new Float64Array( data.D ), data.strideD, data.offsetD, new Float64Array( data.DU ), data.strideDU, data.offsetDU ); + t.strictEqual( v, data.expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports negative strides (one norm)', function test( t ) { + var data = NEG_ONE_NORM; + var v = dlangt( data.norm, data.N, new Float64Array( data.DL ), data.strideDL, data.offsetDL, new Float64Array( data.D ), data.strideD, data.offsetD, new Float64Array( data.DU ), data.strideDU, data.offsetDU ); + t.strictEqual( v, data.expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports negative strides (infinity norm)', function test( t ) { + var data = NEG_INF_NORM; + var v = dlangt( data.norm, data.N, new Float64Array( data.DL ), data.strideDL, data.offsetDL, new Float64Array( data.D ), data.strideD, data.offsetD, new Float64Array( data.DU ), data.strideDU, data.offsetDU ); + t.strictEqual( v, data.expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports negative strides (Frobenius norm)', function test( t ) { + var data = NEG_FROBENIUS_NORM; + var v = dlangt( data.norm, data.N, new Float64Array( data.DL ), data.strideDL, data.offsetDL, new Float64Array( data.D ), data.strideD, data.offsetD, new Float64Array( data.DU ), data.strideDU, data.offsetDU ); + t.ok( isApprox( v, data.expected, 2.0 * EPS * abs( data.expected ) ), 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports large strides (max norm)', function test( t ) { + var data = LARGE_STRIDE_MAX_NORM; + var v = dlangt( data.norm, data.N, new Float64Array( data.DL ), data.strideDL, data.offsetDL, new Float64Array( data.D ), data.strideD, data.offsetD, new Float64Array( data.DU ), data.strideDU, data.offsetDU ); + t.strictEqual( v, data.expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports large strides (one norm)', function test( t ) { + var data = LARGE_STRIDE_ONE_NORM; + var v = dlangt( data.norm, data.N, new Float64Array( data.DL ), data.strideDL, data.offsetDL, new Float64Array( data.D ), data.strideD, data.offsetD, new Float64Array( data.DU ), data.strideDU, data.offsetDU ); + t.strictEqual( v, data.expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports large strides (infinity norm)', function test( t ) { + var data = LARGE_STRIDE_INF_NORM; + var v = dlangt( data.norm, data.N, new Float64Array( data.DL ), data.strideDL, data.offsetDL, new Float64Array( data.D ), data.strideD, data.offsetD, new Float64Array( data.DU ), data.strideDU, data.offsetDU ); + t.strictEqual( v, data.expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports large strides (Frobenius norm)', function test( t ) { + var data = LARGE_STRIDE_FROBENIUS_NORM; + var v = dlangt( data.norm, data.N, new Float64Array( data.DL ), data.strideDL, data.offsetDL, new Float64Array( data.D ), data.strideD, data.offsetD, new Float64Array( data.DU ), data.strideDU, data.offsetDU ); + t.ok( isApprox( v, data.expected, 2.0 * EPS * abs( data.expected ) ), 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports mixed strides (max norm)', function test( t ) { + var data = MIXED_STRIDES_MAX_NORM; + var v = dlangt( data.norm, data.N, new Float64Array( data.DL ), data.strideDL, data.offsetDL, new Float64Array( data.D ), data.strideD, data.offsetD, new Float64Array( data.DU ), data.strideDU, data.offsetDU ); + t.strictEqual( v, data.expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports mixed strides (one norm)', function test( t ) { + var data = MIXED_STRIDES_ONE_NORM; + var v = dlangt( data.norm, data.N, new Float64Array( data.DL ), data.strideDL, data.offsetDL, new Float64Array( data.D ), data.strideD, data.offsetD, new Float64Array( data.DU ), data.strideDU, data.offsetDU ); + t.strictEqual( v, data.expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports mixed strides (infinity norm)', function test( t ) { + var data = MIXED_STRIDES_INF_NORM; + var v = dlangt( data.norm, data.N, new Float64Array( data.DL ), data.strideDL, data.offsetDL, new Float64Array( data.D ), data.strideD, data.offsetD, new Float64Array( data.DU ), data.strideDU, data.offsetDU ); + t.strictEqual( v, data.expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports mixed strides (Frobenius norm)', function test( t ) { + var data = MIXED_STRIDES_FROBENIUS_NORM; + var v = dlangt( data.norm, data.N, new Float64Array( data.DL ), data.strideDL, data.offsetDL, new Float64Array( data.D ), data.strideD, data.offsetD, new Float64Array( data.DU ), data.strideDU, data.offsetDU ); + t.ok( isApprox( v, data.expected, 2.0 * EPS * abs( data.expected ) ), 'returns expected value' ); + t.end(); +});