diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqsp/README.md b/lib/node_modules/@stdlib/lapack/base/dlaqsp/README.md new file mode 100644 index 000000000000..d025d5cc89ec --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqsp/README.md @@ -0,0 +1,224 @@ + + +# dlaqsp + +> Equilibrate a real symmetric matrix stored in packed format. + +
+ +## Usage + +```javascript +var dlaqsp = require( '@stdlib/lapack/base/dlaqsp' ); +``` + +#### dlaqsp( order, uplo, N, AP, S, scond, amax ) + +Equilibrates a real symmetric matrix `A` stored in packed format using scaling factors `S`: +$$A = \text{diag}(S) \times A \times \text{diag}(S)$$ + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); + +var AP = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +var S = new Float64Array( [ 0.05, 2.0, 4.0 ] ); + +var out = dlaqsp( 'column-major', 'upper', 3, AP, S, 0.0125, 6.0 ); +// AP => [ 0.0025, 0.2, 12.0, 0.8, 40.0, 96.0 ] +// out => 'Y' +``` + +The function has the following parameters: + +- **order**: storage layout (either `'row-major'` or `'column-major'`). +- **uplo**: specifies whether the upper or lower triangular part of the symmetric matrix `A` is supplied (either `'upper'` or `'lower'`). +- **N**: order of matrix `A`. +- **AP**: packed form of symmetric matrix `A` as a [`Float64Array`][mdn-float64array]. +- **S**: scale factors vector for `A` as a [`Float64Array`][mdn-float64array]. +- **scond**: ratio of the smallest `S[i]` to the largest `S[i]`. +- **amax**: absolute value of the largest matrix entry. + +Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views. + + + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); + +// Initial arrays: +var AP0 = new Float64Array( [ 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +var S0 = new Float64Array( [ 0.0, 0.05, 2.0, 4.0 ] ); + +// Create offset views: +var AP1 = new Float64Array( AP0.buffer, AP0.BYTES_PER_ELEMENT*1 ); // start at 2nd element +var S1 = new Float64Array( S0.buffer, S0.BYTES_PER_ELEMENT*1 ); // start at 2nd element + +var out = dlaqsp( 'column-major', 'upper', 3, AP1, S1, 0.0125, 6.0 ); +// AP1 => [ 0.0025, 0.2, 12.0, 0.8, 40.0, 96.0 ] +// out => 'Y' +``` + + + +#### dlaqsp.ndarray( order, uplo, N, AP, strideAP, offsetAP, S, strideS, offsetS, scond, amax ) + + + +Equilibrates a real symmetric matrix `A` stored in packed format using alternative indexing semantics. + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); + +var AP = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +var S = new Float64Array( [ 0.05, 2.0, 4.0 ] ); + +var out = dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, 0, S, 1, 0, 0.0125, 6.0 ); +// AP => [ 0.0025, 0.2, 12.0, 0.8, 40.0, 96.0 ] +// out => 'Y' +``` + +The function has the following additional parameters: + +- **strideAP**: stride length for `AP`. +- **offsetAP**: starting index for `AP`. +- **strideS**: stride length for `S`. +- **offsetS**: starting index for `S`. + +While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameters support indexing semantics based on starting indices. For example, + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); + +var AP = new Float64Array( [ 9999.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +var S = new Float64Array( [ 9999.0, 0.05, 2.0, 4.0 ] ); + +var out = dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, 1, S, 1, 1, 0.0125, 6.0 ); +// AP => [ 9999.0, 0.0025, 0.2, 12.0, 0.8, 40.0, 96.0 ] +// out => 'Y' +``` + +
+ + + +
+ +## Notes + +- The function mutates the input array `AP` in-place (if equilibrated). +- `dlaqsp()` corresponds to the [LAPACK][LAPACK] routine [`dlaqsp`][lapack-dlaqsp]. + +
+ + + +
+ +## Examples + +```javascript +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var Float64Array = require( '@stdlib/array/float64' ); +var dlaqsp = require( '@stdlib/lapack/base/dlaqsp' ); + +var opts = { + 'dtype': 'float64' +}; +var AP = discreteUniform( 6, 1, 10, opts ); +var S = new Float64Array( [ 0.05, 2.0, 4.0 ] ); + +console.log( AP ); + +// Perform equilibration: +var out = dlaqsp( 'column-major', 'upper', 3, AP, S, 0.0125, 10.0 ); +console.log( AP ); +console.log( out ); +``` + +
+ + + +* * * + +
+ +## C APIs + +
+ +
+ + + +
+ +### Usage + +```c +// TODO +``` + +
+ + + +
+ +
+ + + +
+ +### Examples + +```c +// TODO +``` + +
+ + + +
+ + + + + + + + + + diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqsp/benchmark/benchmark.js b/lib/node_modules/@stdlib/lapack/base/dlaqsp/benchmark/benchmark.js new file mode 100644 index 000000000000..0a4fc6debb94 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqsp/benchmark/benchmark.js @@ -0,0 +1,107 @@ +/** +* @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 isString = require( '@stdlib/assert/is-string' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; +var dlaqsp = require( './../lib/dlaqsp.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - matrix order +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var AP; + var S; + + AP = uniform( N * ( N + 1 ) / 2, -10.0, 10.0, options ); + S = uniform( N, 0.5, 2.0, options ); + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var equed; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + equed = dlaqsp( 'column-major', 'upper', N, AP, S, 0.01, 10.0 ); + if ( !isString( equed ) ) { + b.fail( 'should return a string' ); + } + } + b.toc(); + if ( !isString( equed ) ) { + b.fail( 'should return a string' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 2; // 10^max + + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + f = createBenchmark( len ); + bench( format( '%s:N=%d', pkg, len ), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqsp/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dlaqsp/benchmark/benchmark.ndarray.js new file mode 100644 index 000000000000..efbe0a511584 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqsp/benchmark/benchmark.ndarray.js @@ -0,0 +1,107 @@ +/** +* @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 isString = require( '@stdlib/assert/is-string' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; +var ndarray = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - matrix order +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var AP; + var S; + + AP = uniform( N * ( N + 1 ) / 2, -10.0, 10.0, options ); + S = uniform( N, 0.5, 2.0, options ); + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var equed; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + equed = ndarray( 'column-major', 'upper', N, AP, 1, 0, S, 1, 0, 0.01, 10.0 ); + if ( !isString( equed ) ) { + b.fail( 'should return a string' ); + } + } + b.toc(); + if ( !isString( equed ) ) { + b.fail( 'should return a string' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 2; // 10^max + + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + f = createBenchmark( len ); + bench( format( '%s:ndarray:N=%d', pkg, len ), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqsp/docs/repl.txt b/lib/node_modules/@stdlib/lapack/base/dlaqsp/docs/repl.txt new file mode 100644 index 000000000000..27330dfae7c7 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqsp/docs/repl.txt @@ -0,0 +1,114 @@ + +{{alias}}( order, uplo, N, AP, S, scond, amax ) + Equilibrates a real symmetric matrix `A` stored in packed format using + scaling factors `S`. + + Indexing is relative to the first index. To introduce an offset, use typed + array views. + + Parameters + ---------- + order: string + Row-major (C-style) or column-major (Fortran-style) order. Must be + either 'row-major' or 'column-major'. + + uplo: string + Specifies whether the upper or lower triangular part of the symmetric + matrix `A` is stored. Must be either 'upper' or 'lower'. + + N: integer + Order of matrix `A`. + + AP: Float64Array + Packed symmetric matrix `A`. + + S: Float64Array + Scale factors vector. + + scond: number + Ratio of smallest `S[i]` to largest `S[i]`. + + amax: number + Absolute value of largest matrix entry. + + Returns + ------- + equed: string + Character flag indicating whether the matrix was equilibrated ('Y') or + not ('N'). + + Examples + -------- + > var Float64Array = require( '@stdlib/array/float64' ); + > var AP = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + > var S = new Float64Array( [ 0.05, 2.0, 4.0 ] ); + > {{alias}}( 'column-major', 'upper', 3, AP, S, 0.0125, 6.0 ) + 'Y' + > AP + [ 0.0025, 0.2, 12.0, 0.8, 40.0, 96.0 ] + + +{{alias}}.ndarray( order, uplo, N, AP, sap, oap, S, ss, os, scond, amax ) + Equilibrates a real symmetric matrix `A` stored in packed format using + scaling factors `S` and alternative indexing semantics. + + While typed array views mandate a view offset based on the underlying + buffer, the offset parameters support indexing semantics based on starting + indices. + + Parameters + ---------- + order: string + Row-major (C-style) or column-major (Fortran-style) order. Must be + either 'row-major' or 'column-major'. + + uplo: string + Specifies whether the upper or lower triangular part of the symmetric + matrix `A` is stored. Must be either 'upper' or 'lower'. + + N: integer + Order of matrix `A`. + + AP: Float64Array + Packed symmetric matrix `A`. + + sap: integer + Stride of `AP`. + + oap: integer + Index offset for `AP`. + + S: Float64Array + Scale factors vector. + + ss: integer + Stride of `S`. + + os: integer + Index offset for `S`. + + scond: number + Ratio of smallest `S[i]` to largest `S[i]`. + + amax: number + Absolute value of largest matrix entry. + + Returns + ------- + equed: string + Character flag indicating whether the matrix was equilibrated ('Y') or + not ('N'). + + Examples + -------- + > var Float64Array = require( '@stdlib/array/float64' ); + > var AP = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + > var S = new Float64Array( [ 0.05, 2.0, 4.0 ] ); + > var v = {{alias}}.ndarray( 'column-major', 'upper', 3, + ... AP, 1, 0, S, 1, 0, 0.0125, 6.0 ) + 'Y' + > AP + [ 0.0025, 0.2, 12.0, 0.8, 40.0, 96.0 ] + + See Also + -------- diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqsp/docs/types/index.d.ts b/lib/node_modules/@stdlib/lapack/base/dlaqsp/docs/types/index.d.ts new file mode 100644 index 000000000000..171af4c23f3f --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqsp/docs/types/index.d.ts @@ -0,0 +1,129 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/// + +import { Layout, MatrixTriangle } from '@stdlib/types/blas'; + +/** +* Interface describing `dlaqsp`. +*/ +interface Routine { + /** + * Equilibrates a real symmetric matrix `A` stored in packed format using scaling factors `S`. + * + * @param order - storage layout + * @param uplo - specifies whether the upper or lower triangular part of the symmetric matrix `A` is stored + * @param N - order of matrix `A` + * @param AP - packed symmetric matrix `A` + * @param S - scale factors vector + * @param scond - ratio of smallest `S[i]` to largest `S[i]` + * @param amax - absolute value of largest matrix entry + * @returns character flag indicating whether the matrix was equilibrated ('Y') or not ('N') + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * var AP = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + * var S = new Float64Array( [ 0.05, 2.0, 4.0 ] ); + * + * var out = dlaqsp( 'column-major', 'upper', 3, AP, S, 0.0125, 6.0 ); + * // AP => [ 0.0025, 0.2, 12.0, 0.8, 40.0, 96.0 ] + * // returns 'Y' + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * var AP = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + * var S = new Float64Array( [ 0.05, 2.0, 4.0 ] ); + * + * var out = dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, 0, S, 1, 0, 0.0125, 6.0 ); + * // AP => [ 0.0025, 0.2, 12.0, 0.8, 40.0, 96.0 ] + * // returns 'Y' + */ + ( order: Layout, uplo: MatrixTriangle, N: number, AP: Float64Array, S: Float64Array, scond: number, amax: number ): string; + + /** + * Equilibrates a real symmetric matrix `A` stored in packed format using scaling factors `S` and alternative indexing semantics. + * + * @param order - storage layout + * @param uplo - specifies whether the upper or lower triangular part of the symmetric matrix `A` is stored + * @param N - order of matrix `A` + * @param AP - packed symmetric matrix `A` + * @param strideAP - `AP` stride length + * @param offsetAP - starting index of `AP` + * @param S - scale factors vector + * @param strideS - `S` stride length + * @param offsetS - starting index of `S` + * @param scond - ratio of smallest `S[i]` to largest `S[i]` + * @param amax - absolute value of largest matrix entry + * @returns character flag indicating whether the matrix was equilibrated ('Y') or not ('N') + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * var AP = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + * var S = new Float64Array( [ 0.05, 2.0, 4.0 ] ); + * + * var out = dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, 0, S, 1, 0, 0.0125, 6.0 ); + * // AP => [ 0.0025, 0.2, 12.0, 0.8, 40.0, 96.0 ] + * // returns 'Y' + */ + ndarray( order: Layout, uplo: MatrixTriangle, N: number, AP: Float64Array, strideAP: number, offsetAP: number, S: Float64Array, strideS: number, offsetS: number, scond: number, amax: number ): string; +} + +/** +* Equilibrates a real symmetric matrix `A` stored in packed format using scaling factors `S`. +* +* @param order - storage layout +* @param uplo - specifies whether the upper or lower triangular part of the symmetric matrix `A` is stored +* @param N - order of matrix `A` +* @param AP - packed symmetric matrix `A` +* @param S - scale factors vector +* @param scond - ratio of smallest `S[i]` to largest `S[i]` +* @param amax - absolute value of largest matrix entry +* @returns character flag indicating whether the matrix was equilibrated ('Y') or not ('N') +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var AP = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* var S = new Float64Array( [ 0.05, 2.0, 4.0 ] ); +* +* var out = dlaqsp( 'column-major', 'upper', 3, AP, S, 0.0125, 6.0 ); +* // AP => [ 0.0025, 0.2, 12.0, 0.8, 40.0, 96.0 ] +* // returns 'Y' +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var AP = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* var S = new Float64Array( [ 0.05, 2.0, 4.0 ] ); +* +* var out = dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, 0, S, 1, 0, 0.0125, 6.0 ); +* // AP => [ 0.0025, 0.2, 12.0, 0.8, 40.0, 96.0 ] +* // returns 'Y' +*/ +declare var dlaqsp: Routine; + + +// EXPORTS // + +export = dlaqsp; diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqsp/docs/types/test.ts b/lib/node_modules/@stdlib/lapack/base/dlaqsp/docs/types/test.ts new file mode 100644 index 000000000000..a4448b5cc470 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqsp/docs/types/test.ts @@ -0,0 +1,342 @@ +/* +* @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 dlaqsp = require( './index' ); + + +// TESTS // + +// The function returns a string... +{ + const AP = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const S = new Float64Array( [ 0.05, 2.0, 4.0 ] ); + + dlaqsp( 'column-major', 'upper', 3, AP, S, 0.0125, 6.0 ); // $ExpectType string +} + +// The compiler throws an error if the function is provided a first argument which is not a string... +{ + const AP = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const S = new Float64Array( [ 0.05, 2.0, 4.0 ] ); + + dlaqsp( 5, 'upper', 3, AP, S, 0.0125, 6.0 ); // $ExpectError + dlaqsp( true, 'upper', 3, AP, S, 0.0125, 6.0 ); // $ExpectError + dlaqsp( false, 'upper', 3, AP, S, 0.0125, 6.0 ); // $ExpectError + dlaqsp( null, 'upper', 3, AP, S, 0.0125, 6.0 ); // $ExpectError + dlaqsp( void 0, 'upper', 3, AP, S, 0.0125, 6.0 ); // $ExpectError + dlaqsp( [], 'upper', 3, AP, S, 0.0125, 6.0 ); // $ExpectError + dlaqsp( {}, 'upper', 3, AP, S, 0.0125, 6.0 ); // $ExpectError + dlaqsp( ( x: number ): number => x, 'upper', 3, AP, S, 0.0125, 6.0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a second argument which is not a string... +{ + const AP = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const S = new Float64Array( [ 0.05, 2.0, 4.0 ] ); + + dlaqsp( 'column-major', 5, 3, AP, S, 0.0125, 6.0 ); // $ExpectError + dlaqsp( 'column-major', true, 3, AP, S, 0.0125, 6.0 ); // $ExpectError + dlaqsp( 'column-major', false, 3, AP, S, 0.0125, 6.0 ); // $ExpectError + dlaqsp( 'column-major', null, 3, AP, S, 0.0125, 6.0 ); // $ExpectError + dlaqsp( 'column-major', void 0, 3, AP, S, 0.0125, 6.0 ); // $ExpectError + dlaqsp( 'column-major', [], 3, AP, S, 0.0125, 6.0 ); // $ExpectError + dlaqsp( 'column-major', {}, 3, AP, S, 0.0125, 6.0 ); // $ExpectError + dlaqsp( 'column-major', ( x: number ): number => x, 3, AP, S, 0.0125, 6.0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a third argument which is not a number... +{ + const AP = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const S = new Float64Array( [ 0.05, 2.0, 4.0 ] ); + + dlaqsp( 'column-major', 'upper', '5', AP, S, 0.0125, 6.0 ); // $ExpectError + dlaqsp( 'column-major', 'upper', true, AP, S, 0.0125, 6.0 ); // $ExpectError + dlaqsp( 'column-major', 'upper', false, AP, S, 0.0125, 6.0 ); // $ExpectError + dlaqsp( 'column-major', 'upper', null, AP, S, 0.0125, 6.0 ); // $ExpectError + dlaqsp( 'column-major', 'upper', void 0, AP, S, 0.0125, 6.0 ); // $ExpectError + dlaqsp( 'column-major', 'upper', [], AP, S, 0.0125, 6.0 ); // $ExpectError + dlaqsp( 'column-major', 'upper', {}, AP, S, 0.0125, 6.0 ); // $ExpectError + dlaqsp( 'column-major', 'upper', ( x: number ): number => x, AP, S, 0.0125, 6.0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fourth argument which is not a Float64Array... +{ + const S = new Float64Array( [ 0.05, 2.0, 4.0 ] ); + + dlaqsp( 'column-major', 'upper', 3, '5', S, 0.0125, 6.0 ); // $ExpectError + dlaqsp( 'column-major', 'upper', 3, 5, S, 0.0125, 6.0 ); // $ExpectError + dlaqsp( 'column-major', 'upper', 3, true, S, 0.0125, 6.0 ); // $ExpectError + dlaqsp( 'column-major', 'upper', 3, false, S, 0.0125, 6.0 ); // $ExpectError + dlaqsp( 'column-major', 'upper', 3, null, S, 0.0125, 6.0 ); // $ExpectError + dlaqsp( 'column-major', 'upper', 3, void 0, S, 0.0125, 6.0 ); // $ExpectError + dlaqsp( 'column-major', 'upper', 3, [], S, 0.0125, 6.0 ); // $ExpectError + dlaqsp( 'column-major', 'upper', 3, {}, S, 0.0125, 6.0 ); // $ExpectError + dlaqsp( 'column-major', 'upper', 3, ( x: number ): number => x, S, 0.0125, 6.0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fifth argument which is not a Float64Array... +{ + const AP = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + + dlaqsp( 'column-major', 'upper', 3, AP, '5', 0.0125, 6.0 ); // $ExpectError + dlaqsp( 'column-major', 'upper', 3, AP, 5, 0.0125, 6.0 ); // $ExpectError + dlaqsp( 'column-major', 'upper', 3, AP, true, 0.0125, 6.0 ); // $ExpectError + dlaqsp( 'column-major', 'upper', 3, AP, false, 0.0125, 6.0 ); // $ExpectError + dlaqsp( 'column-major', 'upper', 3, AP, null, 0.0125, 6.0 ); // $ExpectError + dlaqsp( 'column-major', 'upper', 3, AP, void 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp( 'column-major', 'upper', 3, AP, [], 0.0125, 6.0 ); // $ExpectError + dlaqsp( 'column-major', 'upper', 3, AP, {}, 0.0125, 6.0 ); // $ExpectError + dlaqsp( 'column-major', 'upper', 3, AP, ( x: number ): number => x, 0.0125, 6.0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a sixth argument which is not a number... +{ + const AP = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const S = new Float64Array( [ 0.05, 2.0, 4.0 ] ); + + dlaqsp( 'column-major', 'upper', 3, AP, S, '5', 6.0 ); // $ExpectError + dlaqsp( 'column-major', 'upper', 3, AP, S, true, 6.0 ); // $ExpectError + dlaqsp( 'column-major', 'upper', 3, AP, S, false, 6.0 ); // $ExpectError + dlaqsp( 'column-major', 'upper', 3, AP, S, null, 6.0 ); // $ExpectError + dlaqsp( 'column-major', 'upper', 3, AP, S, void 0, 6.0 ); // $ExpectError + dlaqsp( 'column-major', 'upper', 3, AP, S, [], 6.0 ); // $ExpectError + dlaqsp( 'column-major', 'upper', 3, AP, S, {}, 6.0 ); // $ExpectError + dlaqsp( 'column-major', 'upper', 3, AP, S, ( x: number ): number => x, 6.0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a seventh argument which is not a number... +{ + const AP = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const S = new Float64Array( [ 0.05, 2.0, 4.0 ] ); + + dlaqsp( 'column-major', 'upper', 3, AP, S, 0.0125, '6.0' ); // $ExpectError + dlaqsp( 'column-major', 'upper', 3, AP, S, 0.0125, true ); // $ExpectError + dlaqsp( 'column-major', 'upper', 3, AP, S, 0.0125, false ); // $ExpectError + dlaqsp( 'column-major', 'upper', 3, AP, S, 0.0125, null ); // $ExpectError + dlaqsp( 'column-major', 'upper', 3, AP, S, 0.0125, void 0 ); // $ExpectError + dlaqsp( 'column-major', 'upper', 3, AP, S, 0.0125, [] ); // $ExpectError + dlaqsp( 'column-major', 'upper', 3, AP, S, 0.0125, {} ); // $ExpectError + dlaqsp( 'column-major', 'upper', 3, AP, S, 0.0125, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + const AP = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const S = new Float64Array( [ 0.05, 2.0, 4.0 ] ); + + dlaqsp(); // $ExpectError + dlaqsp( 'column-major' ); // $ExpectError + dlaqsp( 'column-major', 'upper' ); // $ExpectError + dlaqsp( 'column-major', 'upper', 3 ); // $ExpectError + dlaqsp( 'column-major', 'upper', 3, AP ); // $ExpectError + dlaqsp( 'column-major', 'upper', 3, AP, S ); // $ExpectError + dlaqsp( 'column-major', 'upper', 3, AP, S, 0.0125 ); // $ExpectError + dlaqsp( 'column-major', 'upper', 3, AP, S, 0.0125, 6.0, 10 ); // $ExpectError +} + +// Attached to main export is an `ndarray` method which returns a string... +{ + const AP = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const S = new Float64Array( [ 0.05, 2.0, 4.0 ] ); + + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, 0, S, 1, 0, 0.0125, 6.0 ); // $ExpectType string +} + +// The compiler throws an error if the `ndarray` method is provided a first argument which is not a string... +{ + const AP = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const S = new Float64Array( [ 0.05, 2.0, 4.0 ] ); + + dlaqsp.ndarray( 5, 'upper', 3, AP, 1, 0, S, 1, 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( true, 'upper', 3, AP, 1, 0, S, 1, 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( false, 'upper', 3, AP, 1, 0, S, 1, 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( null, 'upper', 3, AP, 1, 0, S, 1, 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( void 0, 'upper', 3, AP, 1, 0, S, 1, 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( [], 'upper', 3, AP, 1, 0, S, 1, 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( {}, 'upper', 3, AP, 1, 0, S, 1, 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( ( x: number ): number => x, 'upper', 3, AP, 1, 0, S, 1, 0, 0.0125, 6.0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a second argument which is not a string... +{ + const AP = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const S = new Float64Array( [ 0.05, 2.0, 4.0 ] ); + + dlaqsp.ndarray( 'column-major', 5, 3, AP, 1, 0, S, 1, 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', true, 3, AP, 1, 0, S, 1, 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', false, 3, AP, 1, 0, S, 1, 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', null, 3, AP, 1, 0, S, 1, 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', void 0, 3, AP, 1, 0, S, 1, 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', [], 3, AP, 1, 0, S, 1, 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', {}, 3, AP, 1, 0, S, 1, 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', ( x: number ): number => x, 3, AP, 1, 0, S, 1, 0, 0.0125, 6.0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a third argument which is not a number... +{ + const AP = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const S = new Float64Array( [ 0.05, 2.0, 4.0 ] ); + + dlaqsp.ndarray( 'column-major', 'upper', '5', AP, 1, 0, S, 1, 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', true, AP, 1, 0, S, 1, 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', false, AP, 1, 0, S, 1, 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', null, AP, 1, 0, S, 1, 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', void 0, AP, 1, 0, S, 1, 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', [], AP, 1, 0, S, 1, 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', {}, AP, 1, 0, S, 1, 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', ( x: number ): number => x, AP, 1, 0, S, 1, 0, 0.0125, 6.0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a fourth argument which is not a Float64Array... +{ + const S = new Float64Array( [ 0.05, 2.0, 4.0 ] ); + + dlaqsp.ndarray( 'column-major', 'upper', 3, '5', 1, 0, S, 1, 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, 5, 1, 0, S, 1, 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, true, 1, 0, S, 1, 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, false, 1, 0, S, 1, 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, null, 1, 0, S, 1, 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, void 0, 1, 0, S, 1, 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, [], 1, 0, S, 1, 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, {}, 1, 0, S, 1, 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, ( x: number ): number => x, 1, 0, S, 1, 0, 0.0125, 6.0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a fifth argument which is not a number... +{ + const AP = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const S = new Float64Array( [ 0.05, 2.0, 4.0 ] ); + + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, '5', 0, S, 1, 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, true, 0, S, 1, 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, false, 0, S, 1, 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, null, 0, S, 1, 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, void 0, 0, S, 1, 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, [], 0, S, 1, 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, {}, 0, S, 1, 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, ( x: number ): number => x, 0, S, 1, 0, 0.0125, 6.0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a sixth argument which is not a number... +{ + const AP = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const S = new Float64Array( [ 0.05, 2.0, 4.0 ] ); + + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, '5', S, 1, 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, true, S, 1, 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, false, S, 1, 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, null, S, 1, 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, void 0, S, 1, 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, [], S, 1, 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, {}, S, 1, 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, ( x: number ): number => x, S, 1, 0, 0.0125, 6.0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a seventh argument which is not a Float64Array... +{ + const AP = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, 0, '5', 1, 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, 0, 5, 1, 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, 0, true, 1, 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, 0, false, 1, 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, 0, null, 1, 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, 0, void 0, 1, 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, 0, [], 1, 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, 0, {}, 1, 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, 0, ( x: number ): number => x, 1, 0, 0.0125, 6.0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided an eighth argument which is not a number... +{ + const AP = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const S = new Float64Array( [ 0.05, 2.0, 4.0 ] ); + + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, 0, S, '5', 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, 0, S, true, 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, 0, S, false, 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, 0, S, null, 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, 0, S, void 0, 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, 0, S, [], 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, 0, S, {}, 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, 0, S, ( x: number ): number => x, 0, 0.0125, 6.0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a ninth argument which is not a number... +{ + const AP = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const S = new Float64Array( [ 0.05, 2.0, 4.0 ] ); + + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, 0, S, 1, '5', 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, 0, S, 1, true, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, 0, S, 1, false, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, 0, S, 1, null, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, 0, S, 1, void 0, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, 0, S, 1, [], 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, 0, S, 1, {}, 0.0125, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, 0, S, 1, ( x: number ): number => x, 0.0125, 6.0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a tenth argument which is not a number... +{ + const AP = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const S = new Float64Array( [ 0.05, 2.0, 4.0 ] ); + + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, 0, S, 1, 0, '5', 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, 0, S, 1, 0, true, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, 0, S, 1, 0, false, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, 0, S, 1, 0, null, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, 0, S, 1, 0, void 0, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, 0, S, 1, 0, [], 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, 0, S, 1, 0, {}, 6.0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, 0, S, 1, 0, ( x: number ): number => x, 6.0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided an eleventh argument which is not a number... +{ + const AP = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const S = new Float64Array( [ 0.05, 2.0, 4.0 ] ); + + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, 0, S, 1, 0, 0.0125, '6.0' ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, 0, S, 1, 0, 0.0125, true ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, 0, S, 1, 0, 0.0125, false ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, 0, S, 1, 0, 0.0125, null ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, 0, S, 1, 0, 0.0125, void 0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, 0, S, 1, 0, 0.0125, [] ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, 0, S, 1, 0, 0.0125, {} ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, 0, S, 1, 0, 0.0125, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided an unsupported number of arguments... +{ + const AP = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const S = new Float64Array( [ 0.05, 2.0, 4.0 ] ); + + dlaqsp.ndarray(); // $ExpectError + dlaqsp.ndarray( 'column-major' ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper' ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, AP ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, 0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, 0, S ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, 0, S, 1 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, 0, S, 1, 0 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, 0, S, 1, 0, 0.0125 ); // $ExpectError + dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, 0, S, 1, 0, 0.0125, 6.0, 10 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqsp/examples/index.js b/lib/node_modules/@stdlib/lapack/base/dlaqsp/examples/index.js new file mode 100644 index 000000000000..a7697ca0881a --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqsp/examples/index.js @@ -0,0 +1,36 @@ +/** +* @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 dlaqsp = require( './../lib' ); + +var AP = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +var S = new Float64Array( [ 0.05, 2.0, 4.0 ] ); + +var out = dlaqsp( 'column-major', 'upper', 3, AP, S, 0.0125, 6.0 ); +console.log( out ); +console.log( AP ); + +AP = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +S = new Float64Array( [ 0.05, 2.0, 4.0 ] ); + +out = dlaqsp.ndarray( 'column-major', 'lower', 3, AP, 1, 0, S, 1, 0, 0.0125, 6.0 ); +console.log( out ); +console.log( AP ); diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqsp/lib/base.js b/lib/node_modules/@stdlib/lapack/base/dlaqsp/lib/base.js new file mode 100644 index 000000000000..8581317ab6f3 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqsp/lib/base.js @@ -0,0 +1,110 @@ +/** +* @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 dlamch = require( '@stdlib/lapack/base/dlamch' ); + + +// MAIN // + +/** +* Equilibrates a real symmetric matrix `A` stored in packed format using scaling factors `S`. +* +* @private +* @param {boolean} isUpper - boolean indicating whether the upper triangular part of `A` is stored +* @param {NonNegativeInteger} N - order of matrix `A` +* @param {Float64Array} AP - packed symmetric matrix `A` +* @param {integer} strideAP - `AP` stride length +* @param {NonNegativeInteger} offsetAP - starting index of `AP` +* @param {Float64Array} S - scale factors vector +* @param {integer} strideS - `S` stride length +* @param {NonNegativeInteger} offsetS - starting index of `S` +* @param {number} scond - ratio of smallest `S[i]` to largest `S[i]` +* @param {number} amax - absolute value of largest matrix entry +* @returns {string} character flag indicating whether the matrix was equilibrated ('Y') or not ('N') +*/ +function dlaqsp( isUpper, N, AP, strideAP, offsetAP, S, strideS, offsetS, scond, amax ) { + var thresh; + var small; + var large; + var equed; + var iap; + var cj; + var jc; + var is; + var js; + var i; + var j; + + if ( N <= 0 ) { + return 'N'; + } + + thresh = 0.1; + small = dlamch( 'Safe minimum' ) / dlamch( 'Precision' ); + large = 1.0 / small; + + if ( scond >= thresh && amax >= small && amax <= large ) { + equed = 'N'; + } else { + // Replace A by diag(S) * A * diag(S): + if ( isUpper ) { + // Upper triangle of A is stored: + jc = 0; + js = offsetS; + for ( j = 0; j < N; j++ ) { + cj = S[ js ]; + iap = offsetAP + ( jc * strideAP ); + is = offsetS; + for ( i = 0; i <= j; i++ ) { + AP[ iap ] *= cj * S[ is ]; + iap += strideAP; + is += strideS; + } + jc += j + 1; + js += strideS; + } + } else { + // Lower triangle of A is stored: + jc = 0; + js = offsetS; + for ( j = 0; j < N; j++ ) { + cj = S[ js ]; + iap = offsetAP + ( jc * strideAP ); + is = js; + for ( i = j; i < N; i++ ) { + AP[ iap ] *= cj * S[ is ]; + iap += strideAP; + is += strideS; + } + jc += N - j; + js += strideS; + } + } + equed = 'Y'; + } + return equed; +} + + +// EXPORTS // + +module.exports = dlaqsp; diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqsp/lib/dlaqsp.js b/lib/node_modules/@stdlib/lapack/base/dlaqsp/lib/dlaqsp.js new file mode 100644 index 000000000000..1d558d3baf6c --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqsp/lib/dlaqsp.js @@ -0,0 +1,60 @@ +/** +* @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 ndarray = require( './ndarray.js' ); + + +// MAIN // + +/** +* Equilibrates a real symmetric matrix `A` stored in packed format using scaling factors `S`. +* +* @param {string} order - storage layout +* @param {string} uplo - specifies whether the upper or lower triangular part of the symmetric matrix `A` is stored +* @param {NonNegativeInteger} N - order of matrix `A` +* @param {Float64Array} AP - packed symmetric matrix `A` +* @param {Float64Array} S - scale factors vector +* @param {number} scond - ratio of smallest `S[i]` to largest `S[i]` +* @param {number} amax - absolute value of largest matrix entry +* @throws {TypeError} first argument must be a valid order +* @throws {TypeError} second argument must specify whether the lower or upper triangular matrix is supplied +* @throws {RangeError} third argument must be a nonnegative integer +* @returns {string} character flag indicating whether the matrix was equilibrated ('Y') or not ('N') +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var dlaqsp = require( '@stdlib/lapack/base/dlaqsp' ); +* +* var AP = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* var S = new Float64Array( [ 0.05, 2.0, 4.0 ] ); +* +* var out = dlaqsp( 'column-major', 'upper', 3, AP, S, 0.0125, 6.0 ); +* // returns 'Y' +*/ +function dlaqsp( order, uplo, N, AP, S, scond, amax ) { + return ndarray( order, uplo, N, AP, 1, 0, S, 1, 0, scond, amax ); +} + + +// EXPORTS // + +module.exports = dlaqsp; diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqsp/lib/index.js b/lib/node_modules/@stdlib/lapack/base/dlaqsp/lib/index.js new file mode 100644 index 000000000000..d0a7ed4abf0e --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqsp/lib/index.js @@ -0,0 +1,61 @@ +/** +* @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 equilibrate a real symmetric matrix stored in packed format. +* +* @module @stdlib/lapack/base/dlaqsp +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var dlaqsp = require( '@stdlib/lapack/base/dlaqsp' ); +* +* var AP = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* var S = new Float64Array( [ 0.05, 2.0, 4.0 ] ); +* +* var out = dlaqsp( 'column-major', 'upper', 3, AP, S, 0.0125, 6.0 ); +* // AP => [ 0.0025, 0.2, 12.0, 0.8, 40.0, 96.0 ] +* // returns 'Y' +*/ + +// 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 dlaqsp; +var tmp = tryRequire( join( __dirname, './native.js' ) ); +if ( isError( tmp ) ) { + dlaqsp = main; +} else { + dlaqsp = tmp; +} + + +// EXPORTS // + +module.exports = dlaqsp; + +// exports: { "ndarray": "dlaqsp.ndarray" } diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqsp/lib/main.js b/lib/node_modules/@stdlib/lapack/base/dlaqsp/lib/main.js new file mode 100644 index 000000000000..a6864d940801 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqsp/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 dlaqsp = require( './dlaqsp.js' ); +var ndarray = require( './ndarray.js' ); + + +// MAIN // + +setReadOnly( dlaqsp, 'ndarray', ndarray ); + + +// EXPORTS // + +module.exports = dlaqsp; diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqsp/lib/ndarray.js b/lib/node_modules/@stdlib/lapack/base/dlaqsp/lib/ndarray.js new file mode 100644 index 000000000000..53ca60a96802 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqsp/lib/ndarray.js @@ -0,0 +1,90 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var isLayout = require( '@stdlib/blas/base/assert/is-layout' ); +var isMatrixTriangle = require( '@stdlib/blas/base/assert/is-matrix-triangle' ); +var isColumnMajor = require( '@stdlib/ndarray/base/assert/is-column-major-string' ); +var format = require( '@stdlib/string/format' ); +var base = require( './base.js' ); + + +// MAIN // + +/** +* Equilibrates a real symmetric matrix `A` stored in packed format using scaling factors `S` and alternative indexing semantics. +* +* @param {string} order - storage layout +* @param {string} uplo - specifies whether the upper or lower triangular part of the symmetric matrix `A` is stored +* @param {NonNegativeInteger} N - order of matrix `A` +* @param {Float64Array} AP - packed symmetric matrix `A` +* @param {integer} strideAP - `AP` stride length +* @param {NonNegativeInteger} offsetAP - starting index of `AP` +* @param {Float64Array} S - scale factors vector +* @param {integer} strideS - `S` stride length +* @param {NonNegativeInteger} offsetS - starting index of `S` +* @param {number} scond - ratio of smallest `S[i]` to largest `S[i]` +* @param {number} amax - absolute value of largest matrix entry +* @throws {TypeError} first argument must be a valid order +* @throws {TypeError} second argument must specify whether the lower or upper triangular matrix is supplied +* @throws {RangeError} third argument must be a nonnegative integer +* @throws {RangeError} fifth argument must be non-zero +* @throws {RangeError} eighth argument must be non-zero +* @returns {string} character flag indicating whether the matrix was equilibrated ('Y') or not ('N') +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var dlaqsp = require( '@stdlib/lapack/base/dlaqsp' ); +* +* var AP = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* var S = new Float64Array( [ 0.05, 2.0, 4.0 ] ); +* +* var out = dlaqsp.ndarray( 'column-major', 'upper', 3, AP, 1, 0, S, 1, 0, 0.0125, 6.0 ); +* // returns 'Y' +*/ +function ndarray( order, uplo, N, AP, strideAP, offsetAP, S, strideS, offsetS, scond, amax ) { // eslint-disable-line max-len, max-params + var isUpper; + + if ( !isLayout( order ) ) { + throw new TypeError( format( 'invalid argument. First argument must be a valid order. Value: `%s`.', order ) ); + } + if ( !isMatrixTriangle( uplo ) ) { + throw new TypeError( format( 'invalid argument. Second argument must specify whether the lower or upper triangular matrix is supplied. Value: `%s`.', uplo ) ); + } + if ( N < 0 ) { + throw new RangeError( format( 'invalid argument. Third argument must be a nonnegative integer. Value: `%d`.', N ) ); + } + if ( strideAP === 0 ) { + throw new RangeError( format( 'invalid argument. Fifth argument must be non-zero. Value: `%d`.', strideAP ) ); + } + if ( strideS === 0 ) { + throw new RangeError( format( 'invalid argument. Eighth argument must be non-zero. Value: `%d`.', strideS ) ); + } + + isUpper = ( ( isColumnMajor( order ) && uplo === 'upper' ) || ( !isColumnMajor( order ) && uplo === 'lower' ) ); + + return base( isUpper, N, AP, strideAP, offsetAP, S, strideS, offsetS, scond, amax ); +} + + +// EXPORTS // + +module.exports = ndarray; diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqsp/package.json b/lib/node_modules/@stdlib/lapack/base/dlaqsp/package.json new file mode 100644 index 000000000000..bacc5e0ac2dd --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqsp/package.json @@ -0,0 +1,72 @@ +{ + "name": "@stdlib/lapack/base/dlaqsp", + "version": "0.0.0", + "description": "Equilibrate a real symmetric matrix stored in packed format.", + "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", + "dlaqsp", + "equilibration", + "matrix", + "symmetric", + "packed", + "scaling", + "linear", + "algebra", + "subroutines", + "array", + "ndarray", + "float64", + "double", + "float64array" + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqsp/test/fixtures/column_major_lower.json b/lib/node_modules/@stdlib/lapack/base/dlaqsp/test/fixtures/column_major_lower.json new file mode 100644 index 000000000000..8f0b826c3e65 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqsp/test/fixtures/column_major_lower.json @@ -0,0 +1,33 @@ +{ + "order": "column-major", + "uplo": "lower", + "N": 3, + "AP": [ + 1, + 2, + 3, + 4, + 5, + 6 + ], + "strideAP": 1, + "offsetAP": 0, + "S": [ + 0.05, + 2, + 4 + ], + "strideS": 1, + "offsetS": 0, + "scond": 0.0125, + "amax": 6, + "AP_out": [ + 0.0025, + 0.2, + 0.6, + 16, + 40, + 96 + ], + "equed_out": "Y" +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqsp/test/fixtures/column_major_lower_large_strides.json b/lib/node_modules/@stdlib/lapack/base/dlaqsp/test/fixtures/column_major_lower_large_strides.json new file mode 100644 index 000000000000..260c03a4b55d --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqsp/test/fixtures/column_major_lower_large_strides.json @@ -0,0 +1,48 @@ +{ + "order": "column-major", + "uplo": "lower", + "N": 3, + "AP": [ + 1, + 9999, + 2, + 9999, + 3, + 9999, + 4, + 9999, + 5, + 9999, + 6, + 9999 + ], + "strideAP": 2, + "offsetAP": 0, + "S": [ + 0.05, + 9999, + 2, + 9999, + 4, + 9999 + ], + "strideS": 2, + "offsetS": 0, + "scond": 0.0125, + "amax": 6, + "AP_out": [ + 0.0025, + 9999, + 0.2, + 9999, + 0.6, + 9999, + 16, + 9999, + 40, + 9999, + 96, + 9999 + ], + "equed_out": "Y" +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqsp/test/fixtures/column_major_lower_negative_strides.json b/lib/node_modules/@stdlib/lapack/base/dlaqsp/test/fixtures/column_major_lower_negative_strides.json new file mode 100644 index 000000000000..5bf2467128dd --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqsp/test/fixtures/column_major_lower_negative_strides.json @@ -0,0 +1,33 @@ +{ + "order": "column-major", + "uplo": "lower", + "N": 3, + "AP": [ + 6, + 5, + 4, + 3, + 2, + 1 + ], + "strideAP": -1, + "offsetAP": 5, + "S": [ + 4, + 2, + 0.05 + ], + "strideS": -1, + "offsetS": 2, + "scond": 0.0125, + "amax": 6, + "AP_out": [ + 96, + 40, + 16, + 0.6, + 0.2, + 0.0025 + ], + "equed_out": "Y" +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqsp/test/fixtures/column_major_lower_offsets.json b/lib/node_modules/@stdlib/lapack/base/dlaqsp/test/fixtures/column_major_lower_offsets.json new file mode 100644 index 000000000000..5e7962d908ec --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqsp/test/fixtures/column_major_lower_offsets.json @@ -0,0 +1,36 @@ +{ + "order": "column-major", + "uplo": "lower", + "N": 3, + "AP": [ + 9999, + 1, + 2, + 3, + 4, + 5, + 6 + ], + "strideAP": 1, + "offsetAP": 1, + "S": [ + 9999, + 0.05, + 2, + 4 + ], + "strideS": 1, + "offsetS": 1, + "scond": 0.0125, + "amax": 6, + "AP_out": [ + 9999, + 0.0025, + 0.2, + 0.6, + 16, + 40, + 96 + ], + "equed_out": "Y" +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqsp/test/fixtures/column_major_upper.json b/lib/node_modules/@stdlib/lapack/base/dlaqsp/test/fixtures/column_major_upper.json new file mode 100644 index 000000000000..36d03457d73a --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqsp/test/fixtures/column_major_upper.json @@ -0,0 +1,33 @@ +{ + "order": "column-major", + "uplo": "upper", + "N": 3, + "AP": [ + 1, + 2, + 3, + 4, + 5, + 6 + ], + "strideAP": 1, + "offsetAP": 0, + "S": [ + 0.05, + 2, + 4 + ], + "strideS": 1, + "offsetS": 0, + "scond": 0.0125, + "amax": 6, + "AP_out": [ + 0.0025, + 0.2, + 12, + 0.8, + 40, + 96 + ], + "equed_out": "Y" +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqsp/test/fixtures/column_major_upper_large_strides.json b/lib/node_modules/@stdlib/lapack/base/dlaqsp/test/fixtures/column_major_upper_large_strides.json new file mode 100644 index 000000000000..b88a0b2bc2e2 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqsp/test/fixtures/column_major_upper_large_strides.json @@ -0,0 +1,48 @@ +{ + "order": "column-major", + "uplo": "upper", + "N": 3, + "AP": [ + 1, + 9999, + 2, + 9999, + 3, + 9999, + 4, + 9999, + 5, + 9999, + 6, + 9999 + ], + "strideAP": 2, + "offsetAP": 0, + "S": [ + 0.05, + 9999, + 2, + 9999, + 4, + 9999 + ], + "strideS": 2, + "offsetS": 0, + "scond": 0.0125, + "amax": 6, + "AP_out": [ + 0.0025, + 9999, + 0.2, + 9999, + 12, + 9999, + 0.8, + 9999, + 40, + 9999, + 96, + 9999 + ], + "equed_out": "Y" +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqsp/test/fixtures/column_major_upper_negative_strides.json b/lib/node_modules/@stdlib/lapack/base/dlaqsp/test/fixtures/column_major_upper_negative_strides.json new file mode 100644 index 000000000000..9d002abadba5 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqsp/test/fixtures/column_major_upper_negative_strides.json @@ -0,0 +1,33 @@ +{ + "order": "column-major", + "uplo": "upper", + "N": 3, + "AP": [ + 6, + 5, + 4, + 3, + 2, + 1 + ], + "strideAP": -1, + "offsetAP": 5, + "S": [ + 4, + 2, + 0.05 + ], + "strideS": -1, + "offsetS": 2, + "scond": 0.0125, + "amax": 6, + "AP_out": [ + 96, + 40, + 0.8, + 12, + 0.2, + 0.0025 + ], + "equed_out": "Y" +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqsp/test/fixtures/column_major_upper_offsets.json b/lib/node_modules/@stdlib/lapack/base/dlaqsp/test/fixtures/column_major_upper_offsets.json new file mode 100644 index 000000000000..c6caac311f7a --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqsp/test/fixtures/column_major_upper_offsets.json @@ -0,0 +1,36 @@ +{ + "order": "column-major", + "uplo": "upper", + "N": 3, + "AP": [ + 9999, + 1, + 2, + 3, + 4, + 5, + 6 + ], + "strideAP": 1, + "offsetAP": 1, + "S": [ + 9999, + 0.05, + 2, + 4 + ], + "strideS": 1, + "offsetS": 1, + "scond": 0.0125, + "amax": 6, + "AP_out": [ + 9999, + 0.0025, + 0.2, + 12, + 0.8, + 40, + 96 + ], + "equed_out": "Y" +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqsp/test/test.dlaqsp.js b/lib/node_modules/@stdlib/lapack/base/dlaqsp/test/test.dlaqsp.js new file mode 100644 index 000000000000..c3550ddfcbe0 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqsp/test/test.dlaqsp.js @@ -0,0 +1,276 @@ +/** +* @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 dlaqsp = require( './../lib/dlaqsp.js' ); + + +// FIXTURES // + +var fixtureU = require( './fixtures/column_major_upper.json' ); +var fixtureL = require( './fixtures/column_major_lower.json' ); + + +// FUNCTIONS // + +/** +* Tests for element-wise approximate equality. +* +* @private +* @param {Object} t - test object +* @param {Collection} actual - actual values +* @param {Collection} expected - expected values +* @param {number} rtol - relative tolerance +*/ +function isApprox( t, actual, expected, rtol ) { + var delta; + var tol; + var i; + + t.strictEqual( actual.length, expected.length, 'returns expected value' ); + for ( i = 0; i < expected.length; i++ ) { + if ( actual[ i ] === expected[ i ] ) { + t.strictEqual( actual[ i ], expected[ i ], 'returns expected value' ); + } else { + delta = abs( actual[ i ] - expected[ i ] ); + tol = rtol * EPS * abs( expected[ i ] ); + t.ok( delta <= tol, 'within tolerance. actual: ' + actual[ i ] + '. expected: ' + expected[ i ] + '. delta: ' + delta + '. tol: ' + tol + '.' ); + } + } +} + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof dlaqsp, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 7', function test( t ) { + t.strictEqual( dlaqsp.length, 7, 'returns expected value' ); + t.end(); +}); + +tape( 'the function throws an error if provided an invalid first argument', function test( t ) { + var values; + var AP; + var S; + var i; + + values = [ + 'foo', + 'bar', + 'row-major-invalid', + 123, + true, + null, + void 0, + {} + ]; + + AP = new Float64Array( 6 ); + S = new Float64Array( 3 ); + + 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() { + dlaqsp( value, 'upper', 3, AP, S, 0.0125, 6.0 ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid second argument', function test( t ) { + var values; + var AP; + var S; + var i; + + values = [ + 'foo', + 'bar', + 'upper-invalid', + 123, + true, + null, + void 0, + {} + ]; + + AP = new Float64Array( 6 ); + S = new Float64Array( 3 ); + + 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() { + dlaqsp( 'column-major', value, 3, AP, S, 0.0125, 6.0 ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid third argument', function test( t ) { + var values; + var AP; + var S; + var i; + + values = [ + -1, + -2, + -3, + -100 + ]; + + AP = new Float64Array( 6 ); + S = new Float64Array( 3 ); + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + dlaqsp( 'column-major', 'upper', value, AP, S, 0.0125, 6.0 ); + }; + } +}); + +tape( 'the function equilibrates a real symmetric matrix stored in packed format (upper triangle)', function test( t ) { + var expectedAP; + var equed; + var AP; + var S; + var N; + + N = fixtureU.N; + AP = new Float64Array( fixtureU.AP ); + S = new Float64Array( fixtureU.S ); + + expectedAP = new Float64Array( fixtureU.AP_out ); + + equed = dlaqsp( 'column-major', 'upper', N, AP, S, fixtureU.scond, fixtureU.amax ); + t.strictEqual( equed, fixtureU.equed_out, 'returns expected value' ); + isApprox( t, AP, expectedAP, 2.0 ); + t.end(); +}); + +tape( 'the function equilibrates a real symmetric matrix stored in packed format (lower triangle)', function test( t ) { + var expectedAP; + var equed; + var AP; + var S; + var N; + + N = fixtureL.N; + AP = new Float64Array( fixtureL.AP ); + S = new Float64Array( fixtureL.S ); + + expectedAP = new Float64Array( fixtureL.AP_out ); + + equed = dlaqsp( 'column-major', 'lower', N, AP, S, fixtureL.scond, fixtureL.amax ); + t.strictEqual( equed, fixtureL.equed_out, 'returns expected value' ); + isApprox( t, AP, expectedAP, 2.0 ); + t.end(); +}); + +tape( 'the function supports row-major layout (upper triangle)', function test( t ) { + var expectedAP; + var equed; + var AP; + var S; + var N; + + N = fixtureL.N; + AP = new Float64Array( fixtureL.AP ); + S = new Float64Array( fixtureL.S ); + + expectedAP = new Float64Array( fixtureL.AP_out ); + + // Note: row-major upper uses lower triangle column-major values/logic: + equed = dlaqsp( 'row-major', 'upper', N, AP, S, fixtureL.scond, fixtureL.amax ); + t.strictEqual( equed, fixtureL.equed_out, 'returns expected value' ); + isApprox( t, AP, expectedAP, 2.0 ); + t.end(); +}); + +tape( 'the function supports row-major layout (lower triangle)', function test( t ) { + var expectedAP; + var equed; + var AP; + var S; + var N; + + N = fixtureU.N; + AP = new Float64Array( fixtureU.AP ); + S = new Float64Array( fixtureU.S ); + + expectedAP = new Float64Array( fixtureU.AP_out ); + + // Note: row-major lower uses upper triangle column-major values/logic: + equed = dlaqsp( 'row-major', 'lower', N, AP, S, fixtureU.scond, fixtureU.amax ); + t.strictEqual( equed, fixtureU.equed_out, 'returns expected value' ); + isApprox( t, AP, expectedAP, 2.0 ); + t.end(); +}); + +tape( 'the function returns \'N\' when N is 0', function test( t ) { + var equed; + var AP; + var S; + + AP = new Float64Array( 0 ); + S = new Float64Array( 0 ); + + equed = dlaqsp( 'column-major', 'upper', 0, AP, S, 0.0125, 6.0 ); + t.strictEqual( equed, 'N', 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns \'N\' and does not modify the matrix when equilibration is not needed', function test( t ) { + var expectedAP; + var equed; + var AP; + var S; + + AP = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + S = new Float64Array( [ 1.0, 1.0, 1.0 ] ); + + expectedAP = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + + equed = dlaqsp( 'column-major', 'upper', 3, AP, S, 0.5, 6.0 ); + t.strictEqual( equed, 'N', 'returns expected value' ); + isApprox( t, AP, expectedAP, 2.0 ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqsp/test/test.js b/lib/node_modules/@stdlib/lapack/base/dlaqsp/test/test.js new file mode 100644 index 000000000000..772997c8c7f0 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqsp/test/test.js @@ -0,0 +1,84 @@ +/** +* @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 dlaqsp = 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 dlaqsp, '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 dlaqsp.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 dlaqsp; + + dlaqsp = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( dlaqsp, 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 dlaqsp; + var main; + + main = require( './../lib/dlaqsp.js' ); + + dlaqsp = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( dlaqsp, main, 'returns expected value' ); + t.end(); + + function tryRequire() { + return new Error( 'Cannot find module' ); + } +}); diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqsp/test/test.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dlaqsp/test/test.ndarray.js new file mode 100644 index 000000000000..51baedcbfb19 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqsp/test/test.ndarray.js @@ -0,0 +1,420 @@ +/** +* @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 ndarray = require( './../lib/ndarray.js' ); + + +// FIXTURES // + +var fixtureU = require( './fixtures/column_major_upper.json' ); +var fixtureL = require( './fixtures/column_major_lower.json' ); +var offsetsU = require( './fixtures/column_major_upper_offsets.json' ); +var offsetsL = require( './fixtures/column_major_lower_offsets.json' ); +var negativeStridesU = require( './fixtures/column_major_upper_negative_strides.json' ); +var negativeStridesL = require( './fixtures/column_major_lower_negative_strides.json' ); +var largeStridesU = require( './fixtures/column_major_upper_large_strides.json' ); +var largeStridesL = require( './fixtures/column_major_lower_large_strides.json' ); + + +// FUNCTIONS // + +/** +* Tests for element-wise approximate equality. +* +* @private +* @param {Object} t - test object +* @param {Collection} actual - actual values +* @param {Collection} expected - expected values +* @param {number} rtol - relative tolerance +*/ +function isApprox( t, actual, expected, rtol ) { + var delta; + var tol; + var i; + + t.strictEqual( actual.length, expected.length, 'returns expected value' ); + for ( i = 0; i < expected.length; i++ ) { + if ( actual[ i ] === expected[ i ] ) { + t.strictEqual( actual[ i ], expected[ i ], 'returns expected value' ); + } else { + delta = abs( actual[ i ] - expected[ i ] ); + tol = rtol * EPS * abs( expected[ i ] ); + t.ok( delta <= tol, 'within tolerance. actual: ' + actual[ i ] + '. expected: ' + expected[ i ] + '. delta: ' + delta + '. tol: ' + tol + '.' ); + } + } +} + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof ndarray, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 11', function test( t ) { + t.strictEqual( ndarray.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 AP; + var S; + var i; + + values = [ + 'foo', + 'bar', + 'row-major-invalid', + 123, + true, + null, + void 0, + {} + ]; + + AP = new Float64Array( 6 ); + S = new Float64Array( 3 ); + + 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() { + ndarray( value, 'upper', 3, AP, 1, 0, S, 1, 0, 0.0125, 6.0 ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid second argument', function test( t ) { + var values; + var AP; + var S; + var i; + + values = [ + 'foo', + 'bar', + 'upper-invalid', + 123, + true, + null, + void 0, + {} + ]; + + AP = new Float64Array( 6 ); + S = new Float64Array( 3 ); + + 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() { + ndarray( 'column-major', value, 3, AP, 1, 0, S, 1, 0, 0.0125, 6.0 ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid third argument', function test( t ) { + var values; + var AP; + var S; + var i; + + values = [ + -1, + -2, + -3, + -100 + ]; + + AP = new Float64Array( 6 ); + S = new Float64Array( 3 ); + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + ndarray( 'column-major', 'upper', value, AP, 1, 0, S, 1, 0, 0.0125, 6.0 ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid fifth argument (strideAP === 0)', function test( t ) { + var AP; + var S; + + AP = new Float64Array( 6 ); + S = new Float64Array( 3 ); + + t.throws( function badValue() { + ndarray( 'column-major', 'upper', 3, AP, 0, 0, S, 1, 0, 0.0125, 6.0 ); + }, RangeError ); + t.end(); +}); + +tape( 'the function throws an error if provided an invalid eighth argument (strideS === 0)', function test( t ) { + var AP; + var S; + + AP = new Float64Array( 6 ); + S = new Float64Array( 3 ); + + t.throws( function badValue() { + ndarray( 'column-major', 'upper', 3, AP, 1, 0, S, 0, 0, 0.0125, 6.0 ); + }, RangeError ); + t.end(); +}); + +tape( 'the function equilibrates a real symmetric matrix stored in packed format (upper triangle)', function test( t ) { + var expectedAP; + var equed; + var AP; + var S; + var N; + + N = fixtureU.N; + AP = new Float64Array( fixtureU.AP ); + S = new Float64Array( fixtureU.S ); + + expectedAP = new Float64Array( fixtureU.AP_out ); + + equed = ndarray( 'column-major', 'upper', N, AP, fixtureU.strideAP, fixtureU.offsetAP, S, fixtureU.strideS, fixtureU.offsetS, fixtureU.scond, fixtureU.amax ); + t.strictEqual( equed, fixtureU.equed_out, 'returns expected value' ); + isApprox( t, AP, expectedAP, 2.0 ); + t.end(); +}); + +tape( 'the function equilibrates a real symmetric matrix stored in packed format (lower triangle)', function test( t ) { + var expectedAP; + var equed; + var AP; + var S; + var N; + + N = fixtureL.N; + AP = new Float64Array( fixtureL.AP ); + S = new Float64Array( fixtureL.S ); + + expectedAP = new Float64Array( fixtureL.AP_out ); + + equed = ndarray( 'column-major', 'lower', N, AP, fixtureL.strideAP, fixtureL.offsetAP, S, fixtureL.strideS, fixtureL.offsetS, fixtureL.scond, fixtureL.amax ); + t.strictEqual( equed, fixtureL.equed_out, 'returns expected value' ); + isApprox( t, AP, expectedAP, 2.0 ); + t.end(); +}); + +tape( 'the function supports providing offsets (upper triangle)', function test( t ) { + var expectedAP; + var equed; + var AP; + var S; + var N; + + N = offsetsU.N; + AP = new Float64Array( offsetsU.AP ); + S = new Float64Array( offsetsU.S ); + + expectedAP = new Float64Array( offsetsU.AP_out ); + + equed = ndarray( 'column-major', 'upper', N, AP, offsetsU.strideAP, offsetsU.offsetAP, S, offsetsU.strideS, offsetsU.offsetS, offsetsU.scond, offsetsU.amax ); + t.strictEqual( equed, offsetsU.equed_out, 'returns expected value' ); + isApprox( t, AP, expectedAP, 2.0 ); + t.end(); +}); + +tape( 'the function supports providing offsets (lower triangle)', function test( t ) { + var expectedAP; + var equed; + var AP; + var S; + var N; + + N = offsetsL.N; + AP = new Float64Array( offsetsL.AP ); + S = new Float64Array( offsetsL.S ); + + expectedAP = new Float64Array( offsetsL.AP_out ); + + equed = ndarray( 'column-major', 'lower', N, AP, offsetsL.strideAP, offsetsL.offsetAP, S, offsetsL.strideS, offsetsL.offsetS, offsetsL.scond, offsetsL.amax ); + t.strictEqual( equed, offsetsL.equed_out, 'returns expected value' ); + isApprox( t, AP, expectedAP, 2.0 ); + t.end(); +}); + +tape( 'the function supports positive strides (upper triangle)', function test( t ) { + var expectedAP; + var equed; + var AP; + var S; + var N; + + N = largeStridesU.N; + AP = new Float64Array( largeStridesU.AP ); + S = new Float64Array( largeStridesU.S ); + + expectedAP = new Float64Array( largeStridesU.AP_out ); + + equed = ndarray( 'column-major', 'upper', N, AP, largeStridesU.strideAP, largeStridesU.offsetAP, S, largeStridesU.strideS, largeStridesU.offsetS, largeStridesU.scond, largeStridesU.amax ); + t.strictEqual( equed, largeStridesU.equed_out, 'returns expected value' ); + isApprox( t, AP, expectedAP, 2.0 ); + t.end(); +}); + +tape( 'the function supports positive strides (lower triangle)', function test( t ) { + var expectedAP; + var equed; + var AP; + var S; + var N; + + N = largeStridesL.N; + AP = new Float64Array( largeStridesL.AP ); + S = new Float64Array( largeStridesL.S ); + + expectedAP = new Float64Array( largeStridesL.AP_out ); + + equed = ndarray( 'column-major', 'lower', N, AP, largeStridesL.strideAP, largeStridesL.offsetAP, S, largeStridesL.strideS, largeStridesL.offsetS, largeStridesL.scond, largeStridesL.amax ); + t.strictEqual( equed, largeStridesL.equed_out, 'returns expected value' ); + isApprox( t, AP, expectedAP, 2.0 ); + t.end(); +}); + +tape( 'the function supports negative strides (upper triangle)', function test( t ) { + var expectedAP; + var equed; + var AP; + var S; + var N; + + N = negativeStridesU.N; + AP = new Float64Array( negativeStridesU.AP ); + S = new Float64Array( negativeStridesU.S ); + + expectedAP = new Float64Array( negativeStridesU.AP_out ); + + equed = ndarray( 'column-major', 'upper', N, AP, negativeStridesU.strideAP, negativeStridesU.offsetAP, S, negativeStridesU.strideS, negativeStridesU.offsetS, negativeStridesU.scond, negativeStridesU.amax ); + t.strictEqual( equed, negativeStridesU.equed_out, 'returns expected value' ); + isApprox( t, AP, expectedAP, 2.0 ); + t.end(); +}); + +tape( 'the function supports negative strides (lower triangle)', function test( t ) { + var expectedAP; + var equed; + var AP; + var S; + var N; + + N = negativeStridesL.N; + AP = new Float64Array( negativeStridesL.AP ); + S = new Float64Array( negativeStridesL.S ); + + expectedAP = new Float64Array( negativeStridesL.AP_out ); + + equed = ndarray( 'column-major', 'lower', N, AP, negativeStridesL.strideAP, negativeStridesL.offsetAP, S, negativeStridesL.strideS, negativeStridesL.offsetS, negativeStridesL.scond, negativeStridesL.amax ); + t.strictEqual( equed, negativeStridesL.equed_out, 'returns expected value' ); + isApprox( t, AP, expectedAP, 2.0 ); + t.end(); +}); + +tape( 'the function supports row-major layout (upper triangle)', function test( t ) { + var expectedAP; + var equed; + var AP; + var S; + var N; + + N = fixtureL.N; + AP = new Float64Array( fixtureL.AP ); + S = new Float64Array( fixtureL.S ); + + expectedAP = new Float64Array( fixtureL.AP_out ); + + equed = ndarray( 'row-major', 'upper', N, AP, 1, 0, S, 1, 0, fixtureL.scond, fixtureL.amax ); + t.strictEqual( equed, fixtureL.equed_out, 'returns expected value' ); + isApprox( t, AP, expectedAP, 2.0 ); + t.end(); +}); + +tape( 'the function supports row-major layout (lower triangle)', function test( t ) { + var expectedAP; + var equed; + var AP; + var S; + var N; + + N = fixtureU.N; + AP = new Float64Array( fixtureU.AP ); + S = new Float64Array( fixtureU.S ); + + expectedAP = new Float64Array( fixtureU.AP_out ); + + equed = ndarray( 'row-major', 'lower', N, AP, 1, 0, S, 1, 0, fixtureU.scond, fixtureU.amax ); + t.strictEqual( equed, fixtureU.equed_out, 'returns expected value' ); + isApprox( t, AP, expectedAP, 2.0 ); + t.end(); +}); + +tape( 'the function returns \'N\' when N is 0', function test( t ) { + var equed; + var AP; + var S; + + AP = new Float64Array( 0 ); + S = new Float64Array( 0 ); + + equed = ndarray( 'column-major', 'upper', 0, AP, 1, 0, S, 1, 0, 0.0125, 6.0 ); + t.strictEqual( equed, 'N', 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns \'N\' and does not modify the matrix when equilibration is not needed', function test( t ) { + var expectedAP; + var equed; + var AP; + var S; + + AP = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + S = new Float64Array( [ 1.0, 1.0, 1.0 ] ); + + expectedAP = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + + equed = ndarray( 'column-major', 'upper', 3, AP, 1, 0, S, 1, 0, 0.5, 6.0 ); + t.strictEqual( equed, 'N', 'returns expected value' ); + isApprox( t, AP, expectedAP, 2.0 ); + t.end(); +});