diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqr1/benchmark/benchmark.js b/lib/node_modules/@stdlib/lapack/base/dlaqr1/benchmark/benchmark.js new file mode 100644 index 000000000000..9c97379b387d --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqr1/benchmark/benchmark.js @@ -0,0 +1,112 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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 Float64Array = require( '@stdlib/array/float64' ); +var pkg = require( './../package.json' ).name; +var dlaqr1 = require( './../lib/dlaqr1.js' ); + + +// VARIABLES // + +var LAYOUTS = [ + 'row-major', + 'column-major' +]; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {string} order - storage layout +* @param {PositiveInteger} N - number of elements along each dimension +* @returns {Function} benchmark function +*/ +function createBenchmark( order, N ) { + var values; + var H; + var V; + + H = uniform( N*N, -10.0, 10.0, { + 'dtype': 'float64' + }); + values = uniform( N, -10.0, 10.0, { + 'dtype': 'float64' + }); + V = new Float64Array( N ); + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var z; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + z = dlaqr1( order, N, H, N, values[ i%N ], values[ (i+1)%N ], values[ (i+2)%N ], values[ (i+3)%N ], V ); // eslint-disable-line max-len + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var ord; + var N; + var f; + var i; + + for ( i = 0; i < LAYOUTS.length; i++ ) { + ord = LAYOUTS[ i ]; + for ( N = 2; N <= 3; N++ ) { + f = createBenchmark( ord, N ); + bench( pkg+'::square_matrix:order='+ord+',size='+(N*N), f ); + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqr1/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dlaqr1/benchmark/benchmark.ndarray.js new file mode 100644 index 000000000000..c2a260cfb3a3 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqr1/benchmark/benchmark.ndarray.js @@ -0,0 +1,122 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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 isColumnMajor = require( '@stdlib/ndarray/base/assert/is-column-major-string' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var Float64Array = require( '@stdlib/array/float64' ); +var pkg = require( './../package.json' ).name; +var dlaqr1 = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var LAYOUTS = [ + 'row-major', + 'column-major' +]; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {string} order - storage layout +* @param {PositiveInteger} N - number of elements along each dimension +* @returns {Function} benchmark function +*/ +function createBenchmark( order, N ) { + var values; + var sh1; + var sh2; + var H; + var V; + + if ( isColumnMajor( order ) ) { + sh1 = 1; + sh2 = N; + } else { // order === 'row-major' + sh1 = N; + sh2 = 1; + } + H = uniform( N*N, -10.0, 10.0, { + 'dtype': 'float64' + }); + values = uniform( N, -10.0, 10.0, { + 'dtype': 'float64' + }); + V = new Float64Array( N ); + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var z; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + z = dlaqr1( N, H, sh1, sh2, 0, values[ i%N ], values[ (i+1)%N ], values[ (i+2)%N ], values[ (i+3)%N ], V, 1, 0 ); // eslint-disable-line max-len + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var ord; + var N; + var f; + var i; + + for ( i = 0; i < LAYOUTS.length; i++ ) { + ord = LAYOUTS[ i ]; + for ( N = 2; N <= 3; N++ ) { + f = createBenchmark( ord, N ); + bench( pkg+'::square_matrix:ndarray:order='+ord+',size='+(N*N), f ); + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqr1/docs/types/index.d.ts b/lib/node_modules/@stdlib/lapack/base/dlaqr1/docs/types/index.d.ts new file mode 100644 index 000000000000..9c8490e95c99 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqr1/docs/types/index.d.ts @@ -0,0 +1,138 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/// + +import { Layout } from '@stdlib/types/blas'; + +/** +* Interface describing `dlaqr1`. +*/ +interface Routine { + /** + * Given a 2-by-2 or a 3-by-3 matrix, sets `V` to a scalar multiple of the first column of `K` where `K = (H - (sr1 + i*si1)*I)*(H - (sr2 + i*si2)*I)`. + * + * ## Notes + * + * - It is expected that either `sr1 = sr2` and `si1 + si2 = 0` or `si1 = si2 = 0` (i.e., they represent complex conjugate values). + * - This is useful for starting double implicit shift bulges in the QR algorithm. + * - `V` should have at least `N` indexed elements. + * + * @param order - storage layout + * @param N - number of row/columns in `H` + * @param H - input matrix + * @param LDH - stride of the first dimension of `H` (a.k.a., leading dimension of the matrix `H`) + * @param sr1 - real part of the first conjugate complex shift + * @param si1 - imaginary part of the first conjugate complex shift + * @param sr2 - real part of the second conjugate complex shift + * @param si2 - imaginary part of the second conjugate complex shift + * @param V - output array + * @returns `V` + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * var H = new Float64Array( [ 1.0, 3.0, 2.0, 2.0, 4.0, 6.0, 0.0, 5.0, 7.0 ] ); + * var V = new Float64Array( 3 ); + * + * dlaqr1( 'row-major', 3, H, 3, 1.5, 0.0, 2.5, 0.0, V ); + * // V => [ ~1.93, ~0.57, ~2.86 ] + */ + ( order: Layout, N: number, H: Float64Array, LDH: number, sr1: number, si1: number, sr2: number, si2: number, V: Float64Array ): Float64Array; + + /** + * Given a 2-by-2 or a 3-by-3 matrix, sets `V` to a scalar multiple of the first column of `K` where `K = (H - (sr1 + i*si1)*I)*(H - (sr2 + i*si2)*I)` using alternative indexing semantics. + * + * ## Notes + * + * - It is expected that either `sr1 = sr2` and `si1 + si2 = 0` or `si1 = si2 = 0` (i.e., they represent complex conjugate values). + * - This is useful for starting double implicit shift bulges in the QR algorithm. + * - `V` should have at least `N` indexed elements. + * + * @param N - number of row/columns in `H` + * @param H - input matrix + * @param strideH1 - stride of the first dimension of `H` + * @param strideH2 - stride of the second dimension of `H` + * @param offsetH - index offset for `H` + * @param sr1 - real part of the first conjugate complex shift + * @param si1 - imaginary part of the first conjugate complex shift + * @param sr2 - real part of the second conjugate complex shift + * @param si2 - imaginary part of the second conjugate complex shift + * @param V - output array + * @param strideV - stride length for `V` + * @param offsetV - index offset for `V` + * @returns `V` + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * var H = new Float64Array( [ 1.0, 3.0, 2.0, 2.0, 4.0, 6.0, 0.0, 5.0, 7.0 ] ); + * var V = new Float64Array( 3 ); + * + * dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5, 0.0, 2.5, 0.0, V, 1, 0 ); + * // V => [ ~1.93, ~0.57, ~2.86 ] + */ + ndarray( N: number, H: Float64Array, strideH1: number, strideH2: number, offsetH: number, sr1: number, si1: number, sr2: number, si2: number, V: Float64Array, strideV: number, offsetV: number ): Float64Array; +} + +/** +* Given a 2-by-2 or a 3-by-3 matrix, sets `V` to a scalar multiple of the first column of `K` where `K = (H - (sr1 + i*si1)*I)*(H - (sr2 + i*si2)*I)`. +* +* ## Notes +* +* - It is expected that either `sr1 = sr2` and `si1 + si2 = 0` or `si1 = si2 = 0` (i.e., they represent complex conjugate values). +* - This is useful for starting double implicit shift bulges in the QR algorithm. +* - `V` should have at least `N` indexed elements. +* +* @param order - storage layout +* @param N - number of row/columns in `H` +* @param H - input matrix +* @param LDH - stride of the first dimension of `H` (a.k.a., leading dimension of the matrix `H`) +* @param sr1 - real part of the first conjugate complex shift +* @param si1 - imaginary part of the first conjugate complex shift +* @param sr2 - real part of the second conjugate complex shift +* @param si2 - imaginary part of the second conjugate complex shift +* @param V - output array +* @returns `V` +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var H = new Float64Array( [ 1.0, 3.0, 2.0, 2.0, 4.0, 6.0, 0.0, 5.0, 7.0 ] ); +* var V = new Float64Array( 3 ); +* +* dlaqr1( 'row-major', 3, H, 3, 1.5, 0.0, 2.5, 0.0, V ); +* // V => [ ~1.93, ~0.57, ~2.86 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var H = new Float64Array( [ 1.0, 3.0, 2.0, 2.0, 4.0, 6.0, 0.0, 5.0, 7.0 ] ); +* var V = new Float64Array( 3 ); +* +* dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5, 0.0, 2.5, 0.0, V, 1, 0 ); +* // V => [ ~1.93, ~0.57, ~2.86 ] +*/ +declare var dlaqr1: Routine; + + +// EXPORTS // + +export = dlaqr1; diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqr1/docs/types/test.ts b/lib/node_modules/@stdlib/lapack/base/dlaqr1/docs/types/test.ts new file mode 100644 index 000000000000..9dcd22f3411b --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqr1/docs/types/test.ts @@ -0,0 +1,390 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 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 dlaqr1 = require( './index' ); + + +// TESTS // + +// The function returns a Float64Array... +{ + const H = new Float64Array( 9 ); + const V = new Float64Array( 3 ); + + dlaqr1( 'row-major', 3, H, 3, 1.5, 0.0, 2.5, 0.0, V ); // $ExpectType Float64Array +} + +// The compiler throws an error if the function is provided a first argument which is not a string... +{ + const H = new Float64Array( 9 ); + const V = new Float64Array( 3 ); + + dlaqr1( 123, 3, H, 3, 1.5, 0.0, 2.5, 0.0, V ); // $ExpectError + dlaqr1( true, 3, H, 3, 1.5, 0.0, 2.5, 0.0, V ); // $ExpectError + dlaqr1( false, 3, H, 3, 1.5, 0.0, 2.5, 0.0, V ); // $ExpectError + dlaqr1( null, 3, H, 3, 1.5, 0.0, 2.5, 0.0, V ); // $ExpectError + dlaqr1( undefined, 3, H, 3, 1.5, 0.0, 2.5, 0.0, V ); // $ExpectError + dlaqr1( [], 3, H, 3, 1.5, 0.0, 2.5, 0.0, V ); // $ExpectError + dlaqr1( {}, 3, H, 3, 1.5, 0.0, 2.5, 0.0, V ); // $ExpectError + dlaqr1( ( x: number ): number => x, 3, H, 3, 1.5, 0.0, 2.5, 0.0, V ); // $ExpectError +} + +// The compiler throws an error if the function is provided a second argument which is not a number... +{ + const H = new Float64Array( 9 ); + const V = new Float64Array( 3 ); + + dlaqr1( 'row-major', 'abc', H, 3, 1.5, 0.0, 2.5, 0.0, V ); // $ExpectError + dlaqr1( 'row-major', true, H, 3, 1.5, 0.0, 2.5, 0.0, V ); // $ExpectError + dlaqr1( 'row-major', false, H, 3, 1.5, 0.0, 2.5, 0.0, V ); // $ExpectError + dlaqr1( 'row-major', null, H, 3, 1.5, 0.0, 2.5, 0.0, V ); // $ExpectError + dlaqr1( 'row-major', undefined, H, 3, 1.5, 0.0, 2.5, 0.0, V ); // $ExpectError + dlaqr1( 'row-major', [], H, 3, 1.5, 0.0, 2.5, 0.0, V ); // $ExpectError + dlaqr1( 'row-major', {}, H, 3, 1.5, 0.0, 2.5, 0.0, V ); // $ExpectError + dlaqr1( 'row-major', ( x: number ): number => x, H, 3, 1.5, 0.0, 2.5, 0.0, V ); // $ExpectError +} + +// The compiler throws an error if the function is provided a third argument which is not a Float64Array... +{ + const V = new Float64Array( 3 ); + + dlaqr1( 'row-major', 3, 123, 3, 1.5, 0.0, 2.5, 0.0, V ); // $ExpectError + dlaqr1( 'row-major', 3, 'abc', 3, 1.5, 0.0, 2.5, 0.0, V ); // $ExpectError + dlaqr1( 'row-major', 3, true, 3, 1.5, 0.0, 2.5, 0.0, V ); // $ExpectError + dlaqr1( 'row-major', 3, false, 3, 1.5, 0.0, 2.5, 0.0, V ); // $ExpectError + dlaqr1( 'row-major', 3, null, 3, 1.5, 0.0, 2.5, 0.0, V ); // $ExpectError + dlaqr1( 'row-major', 3, undefined, 3, 1.5, 0.0, 2.5, 0.0, V ); // $ExpectError + dlaqr1( 'row-major', 3, [], 3, 1.5, 0.0, 2.5, 0.0, V ); // $ExpectError + dlaqr1( 'row-major', 3, {}, 3, 1.5, 0.0, 2.5, 0.0, V ); // $ExpectError + dlaqr1( 'row-major', 3, ( x: number ): number => x, 3, 1.5, 0.0, 2.5, 0.0, V ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fourth argument which is not a number... +{ + const H = new Float64Array( 9 ); + const V = new Float64Array( 3 ); + + dlaqr1( 'row-major', 3, H, 'abc', 1.5, 0.0, 2.5, 0.0, V ); // $ExpectError + dlaqr1( 'row-major', 3, H, true, 1.5, 0.0, 2.5, 0.0, V ); // $ExpectError + dlaqr1( 'row-major', 3, H, false, 1.5, 0.0, 2.5, 0.0, V ); // $ExpectError + dlaqr1( 'row-major', 3, H, null, 1.5, 0.0, 2.5, 0.0, V ); // $ExpectError + dlaqr1( 'row-major', 3, H, undefined, 1.5, 0.0, 2.5, 0.0, V ); // $ExpectError + dlaqr1( 'row-major', 3, H, [], 1.5, 0.0, 2.5, 0.0, V ); // $ExpectError + dlaqr1( 'row-major', 3, H, {}, 1.5, 0.0, 2.5, 0.0, V ); // $ExpectError + dlaqr1( 'row-major', 3, H, ( x: number ): number => x, 1.5, 0.0, 2.5, 0.0, V ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fifth argument which is not a number... +{ + const H = new Float64Array( 9 ); + const V = new Float64Array( 3 ); + + dlaqr1( 'row-major', 3, H, 3, 'abc', 0.0, 2.5, 0.0, V ); // $ExpectError + dlaqr1( 'row-major', 3, H, 3, true, 0.0, 2.5, 0.0, V ); // $ExpectError + dlaqr1( 'row-major', 3, H, 3, false, 0.0, 2.5, 0.0, V ); // $ExpectError + dlaqr1( 'row-major', 3, H, 3, null, 0.0, 2.5, 0.0, V ); // $ExpectError + dlaqr1( 'row-major', 3, H, 3, undefined, 0.0, 2.5, 0.0, V ); // $ExpectError + dlaqr1( 'row-major', 3, H, 3, [], 0.0, 2.5, 0.0, V ); // $ExpectError + dlaqr1( 'row-major', 3, H, 3, {}, 0.0, 2.5, 0.0, V ); // $ExpectError + dlaqr1( 'row-major', 3, H, 3, ( x: number ): number => x, 0.0, 2.5, 0.0, V ); // $ExpectError +} + +// The compiler throws an error if the function is provided a sixth argument which is not a number... +{ + const H = new Float64Array( 9 ); + const V = new Float64Array( 3 ); + + dlaqr1( 'row-major', 3, H, 3, 1.5, 'abc', 2.5, 0.0, V ); // $ExpectError + dlaqr1( 'row-major', 3, H, 3, 1.5, true, 2.5, 0.0, V ); // $ExpectError + dlaqr1( 'row-major', 3, H, 3, 1.5, false, 2.5, 0.0, V ); // $ExpectError + dlaqr1( 'row-major', 3, H, 3, 1.5, null, 2.5, 0.0, V ); // $ExpectError + dlaqr1( 'row-major', 3, H, 3, 1.5, undefined, 2.5, 0.0, V ); // $ExpectError + dlaqr1( 'row-major', 3, H, 3, 1.5, [], 2.5, 0.0, V ); // $ExpectError + dlaqr1( 'row-major', 3, H, 3, 1.5, {}, 2.5, 0.0, V ); // $ExpectError + dlaqr1( 'row-major', 3, H, 3, 1.5, ( x: number ): number => x, 2.5, 0.0, V ); // $ExpectError +} + +// The compiler throws an error if the function is provided a seventh argument which is not a number... +{ + const H = new Float64Array( 9 ); + const V = new Float64Array( 3 ); + + dlaqr1( 'row-major', 3, H, 3, 1.5, 0.0, 'abc', 0.0, V ); // $ExpectError + dlaqr1( 'row-major', 3, H, 3, 1.5, 0.0, true, 0.0, V ); // $ExpectError + dlaqr1( 'row-major', 3, H, 3, 1.5, 0.0, false, 0.0, V ); // $ExpectError + dlaqr1( 'row-major', 3, H, 3, 1.5, 0.0, null, 0.0, V ); // $ExpectError + dlaqr1( 'row-major', 3, H, 3, 1.5, 0.0, undefined, 0.0, V ); // $ExpectError + dlaqr1( 'row-major', 3, H, 3, 1.5, 0.0, [], 0.0, V ); // $ExpectError + dlaqr1( 'row-major', 3, H, 3, 1.5, 0.0, {}, 0.0, V ); // $ExpectError + dlaqr1( 'row-major', 3, H, 3, 1.5, 0.0, ( x: number ): number => x, 0.0, V ); // $ExpectError +} + +// The compiler throws an error if the function is provided an eighth argument which is not a number... +{ + const H = new Float64Array( 9 ); + const V = new Float64Array( 3 ); + + dlaqr1( 'row-major', 3, H, 3, 1.5, 0.0, 2.5, 'abc', V ); // $ExpectError + dlaqr1( 'row-major', 3, H, 3, 1.5, 0.0, 2.5, true, V ); // $ExpectError + dlaqr1( 'row-major', 3, H, 3, 1.5, 0.0, 2.5, false, V ); // $ExpectError + dlaqr1( 'row-major', 3, H, 3, 1.5, 0.0, 2.5, null, V ); // $ExpectError + dlaqr1( 'row-major', 3, H, 3, 1.5, 0.0, 2.5, undefined, V ); // $ExpectError + dlaqr1( 'row-major', 3, H, 3, 1.5, 0.0, 2.5, [], V ); // $ExpectError + dlaqr1( 'row-major', 3, H, 3, 1.5, 0.0, 2.5, {}, V ); // $ExpectError + dlaqr1( 'row-major', 3, H, 3, 1.5, 0.0, 2.5, ( x: number ): number => x, V ); // $ExpectError +} + +// The compiler throws an error if the function is provided a ninth argument which is not a Float64Array... +{ + const H = new Float64Array( 9 ); + + dlaqr1( 'row-major', 3, H, 3, 1.5, 0.0, 2.5, 0.0, 123 ); // $ExpectError + dlaqr1( 'row-major', 3, H, 3, 1.5, 0.0, 2.5, 0.0, 'abc' ); // $ExpectError + dlaqr1( 'row-major', 3, H, 3, 1.5, 0.0, 2.5, 0.0, true ); // $ExpectError + dlaqr1( 'row-major', 3, H, 3, 1.5, 0.0, 2.5, 0.0, false ); // $ExpectError + dlaqr1( 'row-major', 3, H, 3, 1.5, 0.0, 2.5, 0.0, null ); // $ExpectError + dlaqr1( 'row-major', 3, H, 3, 1.5, 0.0, 2.5, 0.0, undefined ); // $ExpectError + dlaqr1( 'row-major', 3, H, 3, 1.5, 0.0, 2.5, 0.0, [] ); // $ExpectError + dlaqr1( 'row-major', 3, H, 3, 1.5, 0.0, 2.5, 0.0, {} ); // $ExpectError + dlaqr1( 'row-major', 3, H, 3, 1.5, 0.0, 2.5, 0.0, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + const H = new Float64Array( 9 ); + const V = new Float64Array( 3 ); + + dlaqr1(); // $ExpectError + dlaqr1( 'row-major' ); // $ExpectError + dlaqr1( 'row-major', 3 ); // $ExpectError + dlaqr1( 'row-major', 3, H ); // $ExpectError + dlaqr1( 'row-major', 3, H, 3 ); // $ExpectError + dlaqr1( 'row-major', 3, H, 3, 1.5 ); // $ExpectError + dlaqr1( 'row-major', 3, H, 3, 1.5, 0.0 ); // $ExpectError + dlaqr1( 'row-major', 3, H, 3, 1.5, 0.0, 2.5 ); // $ExpectError + dlaqr1( 'row-major', 3, H, 3, 1.5, 0.0, 2.5, 0.0 ); // $ExpectError + dlaqr1( 'row-major', 3, H, 3, 1.5, 0.0, 2.5, 0.0, V, 10 ); // $ExpectError +} + +// Attached to main export is an `ndarray` method which returns a Float64Array... +{ + const H = new Float64Array( 9 ); + const V = new Float64Array( 3 ); + + dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5, 0.0, 2.5, 0.0, V, 1, 0 ); // $ExpectType Float64Array +} + +// The compiler throws an error if the `ndarray` method is provided a first argument which is not a number... +{ + const H = new Float64Array( 9 ); + const V = new Float64Array( 3 ); + + dlaqr1.ndarray( 'abc', H, 3, 1, 0, 1.5, 0.0, 2.5, 0.0, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( true, H, 3, 1, 0, 1.5, 0.0, 2.5, 0.0, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( false, H, 3, 1, 0, 1.5, 0.0, 2.5, 0.0, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( null, H, 3, 1, 0, 1.5, 0.0, 2.5, 0.0, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( undefined, H, 3, 1, 0, 1.5, 0.0, 2.5, 0.0, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( [], H, 3, 1, 0, 1.5, 0.0, 2.5, 0.0, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( {}, H, 3, 1, 0, 1.5, 0.0, 2.5, 0.0, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( ( x: number ): number => x, H, 3, 1, 0, 1.5, 0.0, 2.5, 0.0, V, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a second argument which is not a Float64Array... +{ + const V = new Float64Array( 3 ); + + dlaqr1.ndarray( 3, 123, 3, 1, 0, 1.5, 0.0, 2.5, 0.0, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, 'abc', 3, 1, 0, 1.5, 0.0, 2.5, 0.0, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, true, 3, 1, 0, 1.5, 0.0, 2.5, 0.0, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, false, 3, 1, 0, 1.5, 0.0, 2.5, 0.0, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, null, 3, 1, 0, 1.5, 0.0, 2.5, 0.0, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, undefined, 3, 1, 0, 1.5, 0.0, 2.5, 0.0, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, [], 3, 1, 0, 1.5, 0.0, 2.5, 0.0, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, {}, 3, 1, 0, 1.5, 0.0, 2.5, 0.0, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, ( x: number ): number => x, 3, 1, 0, 1.5, 0.0, 2.5, 0.0, V, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a third argument which is not a number... +{ + const H = new Float64Array( 9 ); + const V = new Float64Array( 3 ); + + dlaqr1.ndarray( 3, H, 'abc', 1, 0, 1.5, 0.0, 2.5, 0.0, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, true, 1, 0, 1.5, 0.0, 2.5, 0.0, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, false, 1, 0, 1.5, 0.0, 2.5, 0.0, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, null, 1, 0, 1.5, 0.0, 2.5, 0.0, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, undefined, 1, 0, 1.5, 0.0, 2.5, 0.0, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, [], 1, 0, 1.5, 0.0, 2.5, 0.0, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, {}, 1, 0, 1.5, 0.0, 2.5, 0.0, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, ( x: number ): number => x, 1, 0, 1.5, 0.0, 2.5, 0.0, V, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a fourth argument which is not a number... +{ + const H = new Float64Array( 9 ); + const V = new Float64Array( 3 ); + + dlaqr1.ndarray( 3, H, 3, 'abc', 0, 1.5, 0.0, 2.5, 0.0, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, true, 0, 1.5, 0.0, 2.5, 0.0, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, false, 0, 1.5, 0.0, 2.5, 0.0, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, null, 0, 1.5, 0.0, 2.5, 0.0, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, undefined, 0, 1.5, 0.0, 2.5, 0.0, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, [], 0, 1.5, 0.0, 2.5, 0.0, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, {}, 0, 1.5, 0.0, 2.5, 0.0, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, ( x: number ): number => x, 0, 1.5, 0.0, 2.5, 0.0, V, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a fifth argument which is not a number... +{ + const H = new Float64Array( 9 ); + const V = new Float64Array( 3 ); + + dlaqr1.ndarray( 3, H, 3, 1, 'abc', 1.5, 0.0, 2.5, 0.0, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, true, 1.5, 0.0, 2.5, 0.0, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, false, 1.5, 0.0, 2.5, 0.0, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, null, 1.5, 0.0, 2.5, 0.0, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, undefined, 1.5, 0.0, 2.5, 0.0, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, [], 1.5, 0.0, 2.5, 0.0, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, {}, 1.5, 0.0, 2.5, 0.0, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, ( x: number ): number => x, 1.5, 0.0, 2.5, 0.0, V, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a sixth argument which is not a number... +{ + const H = new Float64Array( 9 ); + const V = new Float64Array( 3 ); + + dlaqr1.ndarray( 3, H, 3, 1, 0, 'abc', 0.0, 2.5, 0.0, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, 0, true, 0.0, 2.5, 0.0, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, 0, false, 0.0, 2.5, 0.0, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, 0, null, 0.0, 2.5, 0.0, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, 0, undefined, 0.0, 2.5, 0.0, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, 0, [], 0.0, 2.5, 0.0, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, 0, {}, 0.0, 2.5, 0.0, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, 0, ( x: number ): number => x, 0.0, 2.5, 0.0, V, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a seventh argument which is not a number... +{ + const H = new Float64Array( 9 ); + const V = new Float64Array( 3 ); + + dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5, 'abc', 2.5, 0.0, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5, true, 2.5, 0.0, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5, false, 2.5, 0.0, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5, null, 2.5, 0.0, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5, undefined, 2.5, 0.0, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5, [], 2.5, 0.0, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5, {}, 2.5, 0.0, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5, ( x: number ): number => x, 2.5, 0.0, V, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided an eighth argument which is not a number... +{ + const H = new Float64Array( 9 ); + const V = new Float64Array( 3 ); + + dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5, 0.0, 'abc', 0.0, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5, 0.0, true, 0.0, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5, 0.0, false, 0.0, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5, 0.0, null, 0.0, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5, 0.0, undefined, 0.0, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5, 0.0, [], 0.0, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5, 0.0, {}, 0.0, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5, 0.0, ( x: number ): number => x, 0.0, V, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a ninth argument which is not a number... +{ + const H = new Float64Array( 9 ); + const V = new Float64Array( 3 ); + + dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5, 0.0, 2.5, 'abc', V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5, 0.0, 2.5, true, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5, 0.0, 2.5, false, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5, 0.0, 2.5, null, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5, 0.0, 2.5, undefined, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5, 0.0, 2.5, [], V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5, 0.0, 2.5, {}, V, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5, 0.0, 2.5, ( x: number ): number => x, V, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a tenth argument which is not a Float64Array... +{ + const H = new Float64Array( 9 ); + + dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5, 0.0, 2.5, 0.0, 123, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5, 0.0, 2.5, 0.0, 'abc', 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5, 0.0, 2.5, 0.0, true, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5, 0.0, 2.5, 0.0, false, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5, 0.0, 2.5, 0.0, null, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5, 0.0, 2.5, 0.0, undefined, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5, 0.0, 2.5, 0.0, [], 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5, 0.0, 2.5, 0.0, {}, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5, 0.0, 2.5, 0.0, ( x: number ): number => x, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided an eleventh argument which is not a number... +{ + const H = new Float64Array( 9 ); + const V = new Float64Array( 3 ); + + dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5, 0.0, 2.5, 0.0, V, 'abc', 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5, 0.0, 2.5, 0.0, V, true, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5, 0.0, 2.5, 0.0, V, false, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5, 0.0, 2.5, 0.0, V, null, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5, 0.0, 2.5, 0.0, V, undefined, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5, 0.0, 2.5, 0.0, V, [], 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5, 0.0, 2.5, 0.0, V, {}, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5, 0.0, 2.5, 0.0, V, ( x: number ): number => x, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a twelfth argument which is not a number... +{ + const H = new Float64Array( 9 ); + const V = new Float64Array( 3 ); + + dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5, 0.0, 2.5, 0.0, V, 1, 'abc' ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5, 0.0, 2.5, 0.0, V, 1, true ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5, 0.0, 2.5, 0.0, V, 1, false ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5, 0.0, 2.5, 0.0, V, 1, null ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5, 0.0, 2.5, 0.0, V, 1, undefined ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5, 0.0, 2.5, 0.0, V, 1, [] ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5, 0.0, 2.5, 0.0, V, 1, {} ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5, 0.0, 2.5, 0.0, V, 1, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided an unsupported number of arguments... +{ + const H = new Float64Array( 9 ); + const V = new Float64Array( 3 ); + + dlaqr1.ndarray(); // $ExpectError + dlaqr1.ndarray( 3 ); // $ExpectError + dlaqr1.ndarray( 3, H ); // $ExpectError + dlaqr1.ndarray( 3, H, 3 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, 0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5, 0.0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5, 0.0, 2.5 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5, 0.0, 2.5, 0.0 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5, 0.0, 2.5, 0.0, V ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5, 0.0, 2.5, 0.0, V, 1 ); // $ExpectError + dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5, 0.0, 2.5, 0.0, V, 1, 0, 10 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqr1/lib/base.js b/lib/node_modules/@stdlib/lapack/base/dlaqr1/lib/base.js new file mode 100644 index 000000000000..b7990005af46 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqr1/lib/base.js @@ -0,0 +1,124 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var abs = require( '@stdlib/math/base/special/fast/abs' ); + + +// MAIN // + +/** +* Given a 2-by-2 or a 3-by-3 matrix, this function sets `V` to a scalar multiple of the first column of `K` where `K = (H - (sr1 + i*si1)*I)*(H - (sr2 + i*si2)*I)`. +* +* ## Notes +* +* - It is expected that either `sr1 = sr2` and `si1 + si2 = 0` or `si1 = si2 = 0` (i.e., they represent complex conjugate values). +* - This is useful for starting double implicit shift bulges in the QR algorithm. +* - `V` should have at least `N` indexed elements. +* +* @private +* @param {PositiveInteger} N - number of row/columns in `H` +* @param {Float64Array} H - input matrix +* @param {integer} strideH1 - stride of the first dimension of `H` +* @param {integer} strideH2 - stride of the second dimension of `H` +* @param {NonNegativeInteger} offsetH - index offset for `H` +* @param {number} sr1 - real part of the first conjugate complex shift +* @param {number} si1 - imaginary part of the first conjugate complex shift +* @param {number} sr2 - real part of the second conjugate complex shift +* @param {number} si2 - imaginary part of the second conjugate complex shift +* @param {Float64Array} V - output array +* @param {integer} strideV - stride length for `V` +* @param {NonNegativeInteger} offsetV - index offset for `V` +* @returns {Float64Array} `V` +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var H = new Float64Array( [ 1.0, 3.0, 2.0, 2.0, 4.0, 6.0, 0.0, 5.0, 7.0 ] ); // => [ [ 1.0, 3.0, 2.0 ], [ 2.0, 4.0, 6.0 ], [ 0.0, 5.0, 7.0 ] ] +* var V = new Float64Array( 3 ); +* +* var out = dlaqr1( 3, H, 3, 1, 0, 1.5, 0.0, 2.5, 0.0, V, 1, 0 ); +* // returns [ ~1.93, ~0.57, ~2.86 ] +*/ +function dlaqr1( N, H, strideH1, strideH2, offsetH, sr1, si1, sr2, si2, V, strideV, offsetV ) { // eslint-disable-line max-params, max-len + var h21s; + var h31s; + var h11; + var h12; + var h13; + var h21; + var h22; + var h23; + var h31; + var h32; + var h33; + var iv; + var s; + var i; + + h11 = offsetH; + h12 = offsetH + strideH2; + h21 = offsetH + strideH1; + h22 = h21 + strideH2; + + if ( N === 2 ) { + s = abs( H[ h11 ] - sr2 ) + abs( si2 ) + abs( H[ h21 ] ); + if ( s === 0.0 ) { + V[ offsetV ] = 0.0; + V[ strideV + offsetV ] = 0.0; + return V; + } + h21s = H[ h21 ] / s; + V[ offsetV ] = ( h21s * H[ h12 ] ) + ( ( H[ h11 ]-sr1 ) * ( ( H[ h11 ]-sr2 ) / s ) ) - ( si1*( si2 / s ) ); // eslint-disable-line max-len + V[ offsetV + strideV ] = h21s*( H[ h11 ]+H[ h22 ]-sr1-sr2 ); + return V; + } + + h13 = h12 + strideH2; + h31 = h21 + strideH1; + h33 = h22 + strideH1 + strideH2; + h23 = h22 + strideH2; + h32 = h22 + strideH1; + + s = abs( H[ h11 ]-sr2 ) + abs( si2 ) + abs( H[ h21 ] ) + abs( H[ h31 ] ); + if ( s === 0.0 ) { + iv = offsetV; + for ( i = 0; i < 3; i++ ) { + V[ iv ] = 0.0; + iv += strideV; + } + return V; + } + h21s = H[ h21 ] / s; + h31s = H[ h31 ] / s; + iv = offsetV; + V[ iv ] = (( H[ h11 ]-sr1 )*( ( H[ h11 ]-sr2 ) / s )) - (si1*( si2 / s )) + ((H[ h12 ]*h21s) + (H[ h13 ]*h31s)); // eslint-disable-line max-len + iv += strideV; + V[ iv ] = (h21s*( H[ h11 ]+H[ h22 ]-sr1-sr2 )) + (H[ h23 ]*h31s); + iv += strideV; + V[ iv ] = (h31s*( H[ h11 ]+H[ h33 ]-sr1-sr2 )) + (h21s*H[ h32 ]); + return V; +} + + +// EXPORTS // + +module.exports = dlaqr1; diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqr1/lib/dlaqr1.js b/lib/node_modules/@stdlib/lapack/base/dlaqr1/lib/dlaqr1.js new file mode 100644 index 000000000000..45b5b738ad9f --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqr1/lib/dlaqr1.js @@ -0,0 +1,91 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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 isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major-string' ); +var isColumnMajor = require( '@stdlib/ndarray/base/assert/is-column-major-string' ); +var max = require( '@stdlib/math/base/special/max' ); +var format = require( '@stdlib/string/format' ); +var base = require( './base.js' ); + + +// MAIN // + +/** +* Given a 2-by-2 or a 3-by-3 matrix, this function sets `V` to a scalar multiple of the first column of `K` where `K = (H - (sr1 + i*si1)*I)*(H - (sr2 + i*si2)*I)`. +* +* ## Notes +* +* - It is expected that either `sr1 = sr2` and `si1 + si2 = 0` or `si1 = si2 = 0` (i.e., they represent complex conjugate values). +* - This is useful for starting double implicit shift bulges in the QR algorithm. +* - `V` should have at least `N` indexed elements. +* +* @param {string} order - storage layout +* @param {PositiveInteger} N - number of row/columns in `H` +* @param {Float64Array} H - input matrix +* @param {PositiveInteger} LDH - stride of the first dimension of `H` (a.k.a., leading dimension of the matrix `H`) +* @param {number} sr1 - real part of the first conjugate complex shift +* @param {number} si1 - imaginary part of the first conjugate complex shift +* @param {number} sr2 - real part of the second conjugate complex shift +* @param {number} si2 - imaginary part of the second conjugate complex shift +* @param {Float64Array} V - output array +* @throws {RangeError} second argument must be either 2 or 3 +* @throws {TypeError} first argument must be a valid order +* @throws {RangeError} fourth argument must be greater than or equal to max(1,N) +* @returns {Float64Array} `V` +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var H = new Float64Array( [ 1.0, 3.0, 2.0, 2.0, 4.0, 6.0, 0.0, 5.0, 7.0 ] ); // => [ [ 1.0, 3.0, 2.0 ], [ 2.0, 4.0, 6.0 ], [ 0.0, 5.0, 7.0 ] ] +* var V = new Float64Array( 3 ); +* +* var out = dlaqr1( 'row-major', 3, H, 3, 1.5, 0.0, 2.5, 0.0, V ); +* // returns [ ~1.93, ~0.57, ~2.86 ] +*/ +function dlaqr1( order, N, H, LDH, sr1, si1, sr2, si2, V ) { + var sh1; + var sh2; + + if ( !isLayout( order ) ) { + throw new TypeError( format( 'invalid argument. First argument must be a valid order. Value: `%s`.', order ) ); + } + if ( isRowMajor( order ) && LDH < max( 1, N ) ) { + throw new RangeError( format( 'invalid argument. Fourth argument must be greater than or equal to max(1,%d). Value: `%d`.', N, LDH ) ); + } + if ( N !== 2 && N !== 3 ) { + throw new RangeError( format( 'invalid argument. Second argument must be either %d or %d. Value: `%d`.', 2, 3, N ) ); + } + if ( isColumnMajor( order ) ) { + sh1 = 1; + sh2 = LDH; + } else { // order === 'row-major' + sh1 = LDH; + sh2 = 1; + } + return base( N, H, sh1, sh2, 0, sr1, si1, sr2, si2, V, 1, 0 ); +} + + +// EXPORTS // + +module.exports = dlaqr1; diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqr1/lib/index.js b/lib/node_modules/@stdlib/lapack/base/dlaqr1/lib/index.js new file mode 100644 index 000000000000..0a0de858f664 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqr1/lib/index.js @@ -0,0 +1,64 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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'; + +/** +* Given a 2-by-2 or a 3-by-3 matrix, this LAPACK routine sets `V` to a scalar multiple of the first column of `K` where `K = (H - (sr1 + i*si1)*I)*(H - (sr2 + i*si2)*I)`. +* +* ## Notes +* +* - It is expected that either `sr1 = sr2` and `si1 + si2 = 0` or `si1 = si2 = 0` (i.e., they represent complex conjugate values). +* - This is useful for starting double implicit shift bulges in the QR algorithm. +* - `V` should have at least `N` indexed elements. +* +* @module @stdlib/lapack/base/dlaqr1 +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var dlaqr1 = require( '@stdlib/lapack/base/dlaqr1' ); +* +* var H = new Float64Array( [ 1.0, 3.0, 2.0, 2.0, 4.0, 6.0, 0.0, 5.0, 7.0 ] ); // => [ [ 1.0, 3.0, 2.0 ], [ 2.0, 4.0, 6.0 ], [ 0.0, 5.0, 7.0 ] ] +* var V = new Float64Array( 3 ); +* +* var out = dlaqr1( 'row-major', 3, H, 3, 1.5, 0.0, 2.5, 0.0, V ); +* // returns [ ~1.93, ~0.57, ~2.86 ] +*/ + +// 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 dlaqr1; +var tmp = tryRequire( join( __dirname, './native.js' ) ); +if ( isError( tmp ) ) { + dlaqr1 = main; +} else { + dlaqr1 = tmp; +} + + +// EXPORTS // + +module.exports = dlaqr1; diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqr1/lib/main.js b/lib/node_modules/@stdlib/lapack/base/dlaqr1/lib/main.js new file mode 100644 index 000000000000..16d267215499 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqr1/lib/main.js @@ -0,0 +1,35 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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 dlaqr1 = require( './dlaqr1.js' ); +var ndarray = require( './ndarray.js' ); + + +// MAIN // + +setReadOnly( dlaqr1, 'ndarray', ndarray ); + + +// EXPORTS // + +module.exports = dlaqr1; diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqr1/lib/ndarray.js b/lib/node_modules/@stdlib/lapack/base/dlaqr1/lib/ndarray.js new file mode 100644 index 000000000000..51036ee52877 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqr1/lib/ndarray.js @@ -0,0 +1,73 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var format = require( '@stdlib/string/format' ); +var base = require( './base.js' ); + + +// MAIN // + +/** +* Given a 2-by-2 or a 3-by-3 matrix, this function sets `V` to a scalar multiple of the first column of `K` where `K = (H - (sr1 + i*si1)*I)*(H - (sr2 + i*si2)*I)` using alternative indexing semantics. +* +* ## Notes +* +* - It is expected that either `sr1 = sr2` and `si1 + si2 = 0` or `si1 = si2 = 0` (i.e., they represent complex conjugate values). +* - This is useful for starting double implicit shift bulges in the QR algorithm. +* - `V` should have at least `N` indexed elements. +* +* @param {PositiveInteger} N - number of row/columns in `H` +* @param {Float64Array} H - input matrix +* @param {integer} strideH1 - stride of the first dimension of `H` +* @param {integer} strideH2 - stride of the second dimension of `H` +* @param {NonNegativeInteger} offsetH - index offset for `H` +* @param {number} sr1 - real part of the first conjugate complex shift +* @param {number} si1 - imaginary part of the first conjugate complex shift +* @param {number} sr2 - real part of the second conjugate complex shift +* @param {number} si2 - imaginary part of the second conjugate complex shift +* @param {Float64Array} V - output array +* @param {integer} strideV - stride length for `V` +* @param {NonNegativeInteger} offsetV - index offset for `V` +* @throws {RangeError} first argument must be either 2 or 3 +* @returns {Float64Array} `V` +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var H = new Float64Array( [ 1.0, 3.0, 2.0, 2.0, 4.0, 6.0, 0.0, 5.0, 7.0 ] ); // => [ [ 1.0, 3.0, 2.0 ], [ 2.0, 4.0, 6.0 ], [ 0.0, 5.0, 7.0 ] ] +* var V = new Float64Array( 3 ); +* +* var out = dlaqr1( 3, H, 3, 1, 0, 1.5, 0.0, 2.5, 0.0, V, 1, 0 ); +* // returns [ ~1.93, ~0.57, ~2.86 ] +*/ +function dlaqr1( N, H, strideH1, strideH2, offsetH, sr1, si1, sr2, si2, V, strideV, offsetV ) { // eslint-disable-line max-len, max-params + if ( N !== 2 && N !== 3 ) { + throw new RangeError( format( 'invalid argument. First argument must be either %d or %d. Value: `%d`.', 2, 3, N ) ); + } + + return base( N, H, strideH1, strideH2, offsetH, sr1, si1, sr2, si2, V, strideV, offsetV ); // eslint-disable-line max-len +} + + +// EXPORTS // + +module.exports = dlaqr1; diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqr1/package.json b/lib/node_modules/@stdlib/lapack/base/dlaqr1/package.json new file mode 100644 index 000000000000..6c61db8fa9b7 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqr1/package.json @@ -0,0 +1,72 @@ +{ + "name": "@stdlib/lapack/base/dlaqr1", + "version": "0.0.0", + "description": "Given a 2-by-2 or a 3-by-3 matrix, this LAPACK routine sets `V` to a scalar multiple of the first column of `K` where `K = (H - (sr1 + i*si1)*I)*(H - (sr2 + i*si2)*I)`.", + "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", + "dlaqr1", + "interchange", + "swap", + "exchange", + "permute", + "permutedims", + "linear", + "algebra", + "subroutines", + "array", + "ndarray", + "float64", + "double", + "float64array" + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/large_strides/n_eq_three_nonzero_col_major.json b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/large_strides/n_eq_three_nonzero_col_major.json new file mode 100644 index 000000000000..0db07e54c8e0 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/large_strides/n_eq_three_nonzero_col_major.json @@ -0,0 +1,67 @@ +{ + "order": "column-major", + "N": 3, + "H": [ + 1, + 9999, + 2, + 9999, + 0, + 9999, + 3, + 9999, + 4, + 9999, + 5, + 9999, + 2, + 9999, + 6, + 9999, + 7, + 9999 + ], + "strideH1": 2, + "strideH2": 6, + "offsetH": 0, + "LDH": 3, + "H_mat": [ + [ + 1, + 3, + 2 + ], + [ + 2, + 4, + 6 + ], + [ + 0, + 5, + 7 + ] + ], + "V": [ + 0, + 9999, + 0, + 9999, + 0, + 9999 + ], + "strideV": 2, + "offsetV": 0, + "sr1": 1.5, + "si1": 1, + "sr2": 2.5, + "si2": 2, + "V_out": [ + 0.8636363636363635, + 9999, + 0.36363636363636365, + 9999, + 1.8181818181818183, + 9999 + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/large_strides/n_eq_three_nonzero_row_major.json b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/large_strides/n_eq_three_nonzero_row_major.json new file mode 100644 index 000000000000..14817cc38d68 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/large_strides/n_eq_three_nonzero_row_major.json @@ -0,0 +1,67 @@ +{ + "order": "row-major", + "N": 3, + "H": [ + 1, + 9999, + 3, + 9999, + 2, + 9999, + 0, + 9999, + 4, + 9999, + 6, + 9999, + 0, + 9999, + 5, + 9999, + 7, + 9999 + ], + "strideH1": 6, + "strideH2": 2, + "offsetH": 0, + "LDH": 3, + "H_mat": [ + [ + 1, + 3, + 2 + ], + [ + 0, + 4, + 6 + ], + [ + 0, + 5, + 7 + ] + ], + "V": [ + 0, + 9999, + 0, + 9999, + 0, + 9999 + ], + "strideV": 2, + "offsetV": 0, + "sr1": 1.5, + "si1": 1, + "sr2": 1, + "si2": 0, + "V_out": [ + 0, + 9999, + 0, + 9999, + 0, + 9999 + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/large_strides/n_eq_three_zero_col_major.json b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/large_strides/n_eq_three_zero_col_major.json new file mode 100644 index 000000000000..a8a040f9ebad --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/large_strides/n_eq_three_zero_col_major.json @@ -0,0 +1,67 @@ +{ + "order": "column-major", + "N": 3, + "H": [ + 1, + 9999, + 0, + 9999, + 0, + 9999, + 3, + 9999, + 4, + 9999, + 5, + 9999, + 2, + 9999, + 6, + 9999, + 7, + 9999 + ], + "strideH1": 2, + "strideH2": 6, + "offsetH": 0, + "LDH": 3, + "H_mat": [ + [ + 1, + 3, + 2 + ], + [ + 0, + 4, + 6 + ], + [ + 0, + 5, + 7 + ] + ], + "V": [ + 0, + 9999, + 0, + 9999, + 0, + 9999 + ], + "strideV": 2, + "offsetV": 0, + "sr1": 1.5, + "si1": 1, + "sr2": 1, + "si2": 0, + "V_out": [ + 0, + 9999, + 0, + 9999, + 0, + 9999 + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/large_strides/n_eq_three_zero_row_major.json b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/large_strides/n_eq_three_zero_row_major.json new file mode 100644 index 000000000000..c278b06ec8ba --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/large_strides/n_eq_three_zero_row_major.json @@ -0,0 +1,67 @@ +{ + "order": "row-major", + "N": 3, + "H": [ + 1, + 9999, + 3, + 9999, + 2, + 9999, + 2, + 9999, + 4, + 9999, + 6, + 9999, + 0, + 9999, + 5, + 9999, + 7, + 9999 + ], + "strideH1": 6, + "strideH2": 2, + "offsetH": 0, + "LDH": 3, + "H_mat": [ + [ + 1, + 3, + 2 + ], + [ + 2, + 4, + 6 + ], + [ + 0, + 5, + 7 + ] + ], + "V": [ + 0, + 9999, + 0, + 9999, + 0, + 9999 + ], + "strideV": 2, + "offsetV": 0, + "sr1": 1.5, + "si1": 1, + "sr2": 2.5, + "si2": 2, + "V_out": [ + 0.8636363636363635, + 9999, + 0.36363636363636365, + 9999, + 1.8181818181818183, + 9999 + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/large_strides/n_eq_two_nonzero_col_major.json b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/large_strides/n_eq_two_nonzero_col_major.json new file mode 100644 index 000000000000..bf89b9c394ea --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/large_strides/n_eq_two_nonzero_col_major.json @@ -0,0 +1,46 @@ +{ + "order": "column-major", + "N": 2, + "H": [ + 1, + 9999, + 3, + 9999, + 2, + 9999, + 4, + 9999 + ], + "strideH1": 2, + "strideH2": 4, + "offsetH": 0, + "LDH": 2, + "H_mat": [ + [ + 1, + 2 + ], + [ + 3, + 4 + ] + ], + "V": [ + 0, + 9999, + 0, + 9999 + ], + "strideV": 2, + "offsetV": 0, + "sr1": 1.5, + "si1": 1, + "sr2": 1, + "si2": 2, + "V_out": [ + 0.7999999999999999, + 9999, + 1.5, + 9999 + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/large_strides/n_eq_two_nonzero_row_major.json b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/large_strides/n_eq_two_nonzero_row_major.json new file mode 100644 index 000000000000..b76d42decd8a --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/large_strides/n_eq_two_nonzero_row_major.json @@ -0,0 +1,46 @@ +{ + "order": "row-major", + "N": 2, + "H": [ + 1, + 9999, + 2, + 9999, + 3, + 9999, + 4, + 9999 + ], + "strideH1": 4, + "strideH2": 2, + "offsetH": 0, + "LDH": 2, + "H_mat": [ + [ + 1, + 2 + ], + [ + 3, + 4 + ] + ], + "V": [ + 0, + 9999, + 0, + 9999 + ], + "strideV": 2, + "offsetV": 0, + "sr1": 1.5, + "si1": 1, + "sr2": 1, + "si2": 2, + "V_out": [ + 0.7999999999999999, + 9999, + 1.5, + 9999 + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/large_strides/n_eq_two_zero_col_major.json b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/large_strides/n_eq_two_zero_col_major.json new file mode 100644 index 000000000000..bd81c98891d1 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/large_strides/n_eq_two_zero_col_major.json @@ -0,0 +1,46 @@ +{ + "order": "column-major", + "N": 2, + "H": [ + 1, + 9999, + 0, + 9999, + 2, + 9999, + 4, + 9999 + ], + "strideH1": 2, + "strideH2": 4, + "offsetH": 0, + "LDH": 2, + "H_mat": [ + [ + 1, + 2 + ], + [ + 0, + 4 + ] + ], + "V": [ + 0, + 9999, + 0, + 9999 + ], + "strideV": 2, + "offsetV": 0, + "sr1": 1.5, + "si1": 1, + "sr2": 1, + "si2": 0, + "V_out": [ + 0, + 9999, + 0, + 9999 + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/large_strides/n_eq_two_zero_row_major.json b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/large_strides/n_eq_two_zero_row_major.json new file mode 100644 index 000000000000..77b28392b2a7 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/large_strides/n_eq_two_zero_row_major.json @@ -0,0 +1,46 @@ +{ + "order": "row-major", + "N": 2, + "H": [ + 1, + 9999, + 2, + 9999, + 0, + 9999, + 4, + 9999 + ], + "strideH1": 4, + "strideH2": 2, + "offsetH": 0, + "LDH": 2, + "H_mat": [ + [ + 1, + 2 + ], + [ + 0, + 4 + ] + ], + "V": [ + 0, + 9999, + 0, + 9999 + ], + "strideV": 2, + "offsetV": 0, + "sr1": 1.5, + "si1": 1, + "sr2": 1, + "si2": 0, + "V_out": [ + 0, + 9999, + 0, + 9999 + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/mixed_strides/n_eq_three_nonzero_col_major.json b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/mixed_strides/n_eq_three_nonzero_col_major.json new file mode 100644 index 000000000000..ac2b258b80a0 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/mixed_strides/n_eq_three_nonzero_col_major.json @@ -0,0 +1,52 @@ +{ + "order": "column-major", + "N": 3, + "H": [ + 2, + 6, + 7, + 3, + 4, + 5, + 1, + 2, + 0 + ], + "strideH1": 1, + "strideH2": -3, + "offsetH": 6, + "LDH": 3, + "H_mat": [ + [ + 1, + 3, + 2 + ], + [ + 2, + 4, + 6 + ], + [ + 0, + 5, + 7 + ] + ], + "V": [ + 0, + 0, + 0 + ], + "strideV": 1, + "offsetV": 0, + "sr1": 1.5, + "si1": 1, + "sr2": 2.5, + "si2": 2, + "V_out": [ + 0.8636363636363635, + 0.36363636363636365, + 1.8181818181818183 + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/mixed_strides/n_eq_three_nonzero_row_major.json b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/mixed_strides/n_eq_three_nonzero_row_major.json new file mode 100644 index 000000000000..124cff32ef2c --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/mixed_strides/n_eq_three_nonzero_row_major.json @@ -0,0 +1,52 @@ +{ + "order": "row-major", + "N": 3, + "H": [ + 0, + 5, + 7, + 0, + 4, + 6, + 1, + 3, + 2 + ], + "strideH1": -3, + "strideH2": 1, + "offsetH": 6, + "LDH": 3, + "H_mat": [ + [ + 1, + 3, + 2 + ], + [ + 0, + 4, + 6 + ], + [ + 0, + 5, + 7 + ] + ], + "V": [ + 0, + 0, + 0 + ], + "strideV": 1, + "offsetV": 0, + "sr1": 1.5, + "si1": 1, + "sr2": 1, + "si2": 0, + "V_out": [ + 0, + 0, + 0 + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/mixed_strides/n_eq_three_zero_col_major.json b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/mixed_strides/n_eq_three_zero_col_major.json new file mode 100644 index 000000000000..01cbfa008b84 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/mixed_strides/n_eq_three_zero_col_major.json @@ -0,0 +1,52 @@ +{ + "order": "column-major", + "N": 3, + "H": [ + 2, + 6, + 7, + 3, + 4, + 5, + 1, + 0, + 0 + ], + "strideH1": 1, + "strideH2": -3, + "offsetH": 6, + "LDH": 3, + "H_mat": [ + [ + 1, + 3, + 2 + ], + [ + 0, + 4, + 6 + ], + [ + 0, + 5, + 7 + ] + ], + "V": [ + 0, + 0, + 0 + ], + "strideV": 1, + "offsetV": 0, + "sr1": 1.5, + "si1": 1, + "sr2": 1, + "si2": 0, + "V_out": [ + 0, + 0, + 0 + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/mixed_strides/n_eq_three_zero_row_major.json b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/mixed_strides/n_eq_three_zero_row_major.json new file mode 100644 index 000000000000..4e67fb9cc5a7 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/mixed_strides/n_eq_three_zero_row_major.json @@ -0,0 +1,52 @@ +{ + "order": "row-major", + "N": 3, + "H": [ + 0, + 5, + 7, + 2, + 4, + 6, + 1, + 3, + 2 + ], + "strideH1": -3, + "strideH2": 1, + "offsetH": 6, + "LDH": 3, + "H_mat": [ + [ + 1, + 3, + 2 + ], + [ + 2, + 4, + 6 + ], + [ + 0, + 5, + 7 + ] + ], + "V": [ + 0, + 0, + 0 + ], + "strideV": 1, + "offsetV": 0, + "sr1": 1.5, + "si1": 1, + "sr2": 2.5, + "si2": 2, + "V_out": [ + 0.8636363636363635, + 0.36363636363636365, + 1.8181818181818183 + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/mixed_strides/n_eq_two_nonzero_col_major.json b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/mixed_strides/n_eq_two_nonzero_col_major.json new file mode 100644 index 000000000000..da4a37eb7594 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/mixed_strides/n_eq_two_nonzero_col_major.json @@ -0,0 +1,38 @@ +{ + "order": "column-major", + "N": 2, + "H": [ + 2, + 4, + 1, + 3 + ], + "strideH1": 1, + "strideH2": -2, + "offsetH": 2, + "LDH": 2, + "H_mat": [ + [ + 1, + 2 + ], + [ + 3, + 4 + ] + ], + "V": [ + 0, + 0 + ], + "strideV": 1, + "offsetV": 0, + "sr1": 1.5, + "si1": 1, + "sr2": 1, + "si2": 2, + "V_out": [ + 0.7999999999999999, + 1.5 + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/mixed_strides/n_eq_two_nonzero_row_major.json b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/mixed_strides/n_eq_two_nonzero_row_major.json new file mode 100644 index 000000000000..5611604cac56 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/mixed_strides/n_eq_two_nonzero_row_major.json @@ -0,0 +1,38 @@ +{ + "order": "row-major", + "N": 2, + "H": [ + 3, + 4, + 1, + 2 + ], + "strideH1": -2, + "strideH2": 1, + "offsetH": 2, + "LDH": 2, + "H_mat": [ + [ + 1, + 2 + ], + [ + 3, + 4 + ] + ], + "V": [ + 0, + 0 + ], + "strideV": 1, + "offsetV": 0, + "sr1": 1.5, + "si1": 1, + "sr2": 1, + "si2": 2, + "V_out": [ + 0.7999999999999999, + 1.5 + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/mixed_strides/n_eq_two_zero_col_major.json b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/mixed_strides/n_eq_two_zero_col_major.json new file mode 100644 index 000000000000..59a0217105eb --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/mixed_strides/n_eq_two_zero_col_major.json @@ -0,0 +1,38 @@ +{ + "order": "column-major", + "N": 2, + "H": [ + 2, + 4, + 1, + 0 + ], + "strideH1": 1, + "strideH2": -2, + "offsetH": 2, + "LDH": 2, + "H_mat": [ + [ + 1, + 2 + ], + [ + 0, + 4 + ] + ], + "V": [ + 0, + 0 + ], + "strideV": 1, + "offsetV": 0, + "sr1": 1.5, + "si1": 1, + "sr2": 1, + "si2": 0, + "V_out": [ + 0, + 0 + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/mixed_strides/n_eq_two_zero_row_major.json b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/mixed_strides/n_eq_two_zero_row_major.json new file mode 100644 index 000000000000..98e87e3eaaae --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/mixed_strides/n_eq_two_zero_row_major.json @@ -0,0 +1,38 @@ +{ + "order": "row-major", + "N": 2, + "H": [ + 0, + 4, + 1, + 2 + ], + "strideH1": -2, + "strideH2": 1, + "offsetH": 2, + "LDH": 2, + "H_mat": [ + [ + 1, + 2 + ], + [ + 0, + 4 + ] + ], + "V": [ + 0, + 0 + ], + "strideV": 1, + "offsetV": 0, + "sr1": 1.5, + "si1": 1, + "sr2": 1, + "si2": 0, + "V_out": [ + 0, + 0 + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/n_eq_three_nonzero_col_major.json b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/n_eq_three_nonzero_col_major.json new file mode 100644 index 000000000000..7d01896eb2b6 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/n_eq_three_nonzero_col_major.json @@ -0,0 +1,27 @@ +{ + "order": "column-major", + "N": 3, + + "H": [ 1.0, 2.0, 0.0, 3.0, 4.0, 5.0, 2.0, 6.0, 7.0 ], + "strideH1": 1, + "strideH2": 3, + "offsetH": 0, + "LDH": 3, + + "H_mat": [ + [ 1.0, 3.0, 2.0 ], + [ 2.0, 4.0, 6.0 ], + [ 0.0, 5.0, 7.0 ] + ], + + "V": [ 0.0, 0.0, 0.0 ], + "strideV": 1, + "offsetV": 0, + + "sr1": 1.5, + "si1": 1.0, + "sr2": 2.5, + "si2": 2.0, + + "V_out": [ 0.86363636363636354, 0.36363636363636365, 1.8181818181818183 ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/n_eq_three_nonzero_row_major.json b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/n_eq_three_nonzero_row_major.json new file mode 100644 index 000000000000..0bd8142e0b18 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/n_eq_three_nonzero_row_major.json @@ -0,0 +1,27 @@ +{ + "order": "row-major", + "N": 3, + + "H": [ 1.0, 3.0, 2.0, 0.0, 4.0, 6.0, 0.0, 5.0, 7.0 ], + "strideH1": 3, + "strideH2": 1, + "offsetH": 0, + "LDH": 3, + + "H_mat": [ + [ 1.0, 3.0, 2.0 ], + [ 0.0, 4.0, 6.0 ], + [ 0.0, 5.0, 7.0 ] + ], + + "V": [ 0.0, 0.0, 0.0 ], + "strideV": 1, + "offsetV": 0, + + "sr1": 1.5, + "si1": 1.0, + "sr2": 1.0, + "si2": 0.0, + + "V_out": [ 0.0, 0.0, 0.0 ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/n_eq_three_zero_col_major.json b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/n_eq_three_zero_col_major.json new file mode 100644 index 000000000000..e744c117cd99 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/n_eq_three_zero_col_major.json @@ -0,0 +1,27 @@ +{ + "order": "column-major", + "N": 3, + + "H": [ 1.0, 0.0, 0.0, 3.0, 4.0, 5.0, 2.0, 6.0, 7.0 ], + "strideH1": 1, + "strideH2": 3, + "offsetH": 0, + "LDH": 3, + + "H_mat": [ + [ 1.0, 3.0, 2.0 ], + [ 0.0, 4.0, 6.0 ], + [ 0.0, 5.0, 7.0 ] + ], + + "V": [ 0.0, 0.0, 0.0 ], + "strideV": 1, + "offsetV": 0, + + "sr1": 1.5, + "si1": 1.0, + "sr2": 1.0, + "si2": 0.0, + + "V_out": [ 0.0, 0.0, 0.0 ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/n_eq_three_zero_row_major.json b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/n_eq_three_zero_row_major.json new file mode 100644 index 000000000000..67cf2492b0fc --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/n_eq_three_zero_row_major.json @@ -0,0 +1,27 @@ +{ + "order": "row-major", + "N": 3, + + "H": [ 1.0, 3.0, 2.0, 2.0, 4.0, 6.0, 0.0, 5.0, 7.0 ], + "strideH1": 3, + "strideH2": 1, + "offsetH": 0, + "LDH": 3, + + "H_mat": [ + [ 1.0, 3.0, 2.0 ], + [ 2.0, 4.0, 6.0 ], + [ 0.0, 5.0, 7.0 ] + ], + + "V": [ 0.0, 0.0, 0.0 ], + "strideV": 1, + "offsetV": 0, + + "sr1": 1.5, + "si1": 1.0, + "sr2": 2.5, + "si2": 2.0, + + "V_out": [ 0.86363636363636354, 0.36363636363636365, 1.8181818181818183 ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/n_eq_two_nonzero_col_major.json b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/n_eq_two_nonzero_col_major.json new file mode 100644 index 000000000000..b95f6a97c3da --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/n_eq_two_nonzero_col_major.json @@ -0,0 +1,26 @@ +{ + "order": "column-major", + "N": 2, + + "H": [ 1.0, 3.0, 2.0, 4.0 ], + "strideH1": 1, + "strideH2": 2, + "offsetH": 0, + "LDH": 2, + + "H_mat": [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ], + + "V": [ 0.0, 0.0 ], + "strideV": 1, + "offsetV": 0, + + "sr1": 1.5, + "si1": 1.0, + "sr2": 1.0, + "si2": 2.0, + + "V_out": [ 0.79999999999999993, 1.5000000000000000 ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/n_eq_two_nonzero_row_major.json b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/n_eq_two_nonzero_row_major.json new file mode 100644 index 000000000000..5486db1438e0 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/n_eq_two_nonzero_row_major.json @@ -0,0 +1,26 @@ +{ + "order": "row-major", + "N": 2, + + "H": [ 1.0, 2.0, 3.0, 4.0 ], + "strideH1": 2, + "strideH2": 1, + "offsetH": 0, + "LDH": 2, + + "H_mat": [ + [ 1.0, 2.0 ], + [ 3.0, 4.0 ] + ], + + "V": [ 0.0, 0.0 ], + "strideV": 1, + "offsetV": 0, + + "sr1": 1.5, + "si1": 1.0, + "sr2": 1.0, + "si2": 2.0, + + "V_out": [ 0.79999999999999993, 1.5000000000000000 ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/n_eq_two_zero_col_major.json b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/n_eq_two_zero_col_major.json new file mode 100644 index 000000000000..74b237db1626 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/n_eq_two_zero_col_major.json @@ -0,0 +1,26 @@ +{ + "order": "column-major", + "N": 2, + + "H": [ 1.0, 0.0, 2.0, 4.0 ], + "strideH1": 1, + "strideH2": 2, + "offsetH": 0, + "LDH": 2, + + "H_mat": [ + [ 1.0, 2.0 ], + [ 0.0, 4.0 ] + ], + + "V": [ 0.0, 0.0 ], + "strideV": 1, + "offsetV": 0, + + "sr1": 1.5, + "si1": 1.0, + "sr2": 1.0, + "si2": 0.0, + + "V_out": [ 0.0, 0.0 ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/n_eq_two_zero_row_major.json b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/n_eq_two_zero_row_major.json new file mode 100644 index 000000000000..6dedff534c81 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/n_eq_two_zero_row_major.json @@ -0,0 +1,26 @@ +{ + "order": "row-major", + "N": 2, + + "H": [ 1.0, 2.0, 0.0, 4.0 ], + "strideH1": 2, + "strideH2": 1, + "offsetH": 0, + "LDH": 2, + + "H_mat": [ + [ 1.0, 2.0 ], + [ 0.0, 4.0 ] + ], + + "V": [ 0.0, 0.0 ], + "strideV": 1, + "offsetV": 0, + + "sr1": 1.5, + "si1": 1.0, + "sr2": 1.0, + "si2": 0.0, + + "V_out": [ 0.0, 0.0 ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/negative_strides/n_eq_three_nonzero_col_major.json b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/negative_strides/n_eq_three_nonzero_col_major.json new file mode 100644 index 000000000000..48dd2bb22008 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/negative_strides/n_eq_three_nonzero_col_major.json @@ -0,0 +1,52 @@ +{ + "order": "column-major", + "N": 3, + "H": [ + 7, + 6, + 2, + 5, + 4, + 3, + 0, + 2, + 1 + ], + "strideH1": -1, + "strideH2": -3, + "offsetH": 8, + "LDH": 3, + "H_mat": [ + [ + 1, + 3, + 2 + ], + [ + 2, + 4, + 6 + ], + [ + 0, + 5, + 7 + ] + ], + "V": [ + 0, + 0, + 0 + ], + "strideV": -1, + "offsetV": 2, + "sr1": 1.5, + "si1": 1, + "sr2": 2.5, + "si2": 2, + "V_out": [ + 1.8181818181818183, + 0.36363636363636365, + 0.8636363636363635 + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/negative_strides/n_eq_three_nonzero_row_major.json b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/negative_strides/n_eq_three_nonzero_row_major.json new file mode 100644 index 000000000000..5a21e2e9d8e4 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/negative_strides/n_eq_three_nonzero_row_major.json @@ -0,0 +1,52 @@ +{ + "order": "row-major", + "N": 3, + "H": [ + 7, + 5, + 0, + 6, + 4, + 0, + 2, + 3, + 1 + ], + "strideH1": -3, + "strideH2": -1, + "offsetH": 8, + "LDH": 3, + "H_mat": [ + [ + 1, + 3, + 2 + ], + [ + 0, + 4, + 6 + ], + [ + 0, + 5, + 7 + ] + ], + "V": [ + 0, + 0, + 0 + ], + "strideV": -1, + "offsetV": 2, + "sr1": 1.5, + "si1": 1, + "sr2": 1, + "si2": 0, + "V_out": [ + 0, + 0, + 0 + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/negative_strides/n_eq_three_zero_col_major.json b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/negative_strides/n_eq_three_zero_col_major.json new file mode 100644 index 000000000000..4930fca64a48 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/negative_strides/n_eq_three_zero_col_major.json @@ -0,0 +1,52 @@ +{ + "order": "column-major", + "N": 3, + "H": [ + 7, + 6, + 2, + 5, + 4, + 3, + 0, + 0, + 1 + ], + "strideH1": -1, + "strideH2": -3, + "offsetH": 8, + "LDH": 3, + "H_mat": [ + [ + 1, + 3, + 2 + ], + [ + 0, + 4, + 6 + ], + [ + 0, + 5, + 7 + ] + ], + "V": [ + 0, + 0, + 0 + ], + "strideV": -1, + "offsetV": 2, + "sr1": 1.5, + "si1": 1, + "sr2": 1, + "si2": 0, + "V_out": [ + 0, + 0, + 0 + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/negative_strides/n_eq_three_zero_row_major.json b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/negative_strides/n_eq_three_zero_row_major.json new file mode 100644 index 000000000000..25d7f2c7dc30 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/negative_strides/n_eq_three_zero_row_major.json @@ -0,0 +1,52 @@ +{ + "order": "row-major", + "N": 3, + "H": [ + 7, + 5, + 0, + 6, + 4, + 2, + 2, + 3, + 1 + ], + "strideH1": -3, + "strideH2": -1, + "offsetH": 8, + "LDH": 3, + "H_mat": [ + [ + 1, + 3, + 2 + ], + [ + 2, + 4, + 6 + ], + [ + 0, + 5, + 7 + ] + ], + "V": [ + 0, + 0, + 0 + ], + "strideV": -1, + "offsetV": 2, + "sr1": 1.5, + "si1": 1, + "sr2": 2.5, + "si2": 2, + "V_out": [ + 1.8181818181818183, + 0.36363636363636365, + 0.8636363636363635 + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/negative_strides/n_eq_two_nonzero_col_major.json b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/negative_strides/n_eq_two_nonzero_col_major.json new file mode 100644 index 000000000000..7758693b0fc7 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/negative_strides/n_eq_two_nonzero_col_major.json @@ -0,0 +1,38 @@ +{ + "order": "column-major", + "N": 2, + "H": [ + 4, + 2, + 3, + 1 + ], + "strideH1": -1, + "strideH2": -2, + "offsetH": 3, + "LDH": 2, + "H_mat": [ + [ + 1, + 2 + ], + [ + 3, + 4 + ] + ], + "V": [ + 0, + 0 + ], + "strideV": -1, + "offsetV": 1, + "sr1": 1.5, + "si1": 1, + "sr2": 1, + "si2": 2, + "V_out": [ + 1.5, + 0.7999999999999999 + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/negative_strides/n_eq_two_nonzero_row_major.json b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/negative_strides/n_eq_two_nonzero_row_major.json new file mode 100644 index 000000000000..2b11cbdd0371 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/negative_strides/n_eq_two_nonzero_row_major.json @@ -0,0 +1,38 @@ +{ + "order": "row-major", + "N": 2, + "H": [ + 4, + 3, + 2, + 1 + ], + "strideH1": -2, + "strideH2": -1, + "offsetH": 3, + "LDH": 2, + "H_mat": [ + [ + 1, + 2 + ], + [ + 3, + 4 + ] + ], + "V": [ + 0, + 0 + ], + "strideV": -1, + "offsetV": 1, + "sr1": 1.5, + "si1": 1, + "sr2": 1, + "si2": 2, + "V_out": [ + 1.5, + 0.7999999999999999 + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/negative_strides/n_eq_two_zero_col_major.json b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/negative_strides/n_eq_two_zero_col_major.json new file mode 100644 index 000000000000..2504899f6110 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/negative_strides/n_eq_two_zero_col_major.json @@ -0,0 +1,38 @@ +{ + "order": "column-major", + "N": 2, + "H": [ + 4, + 2, + 0, + 1 + ], + "strideH1": -1, + "strideH2": -2, + "offsetH": 3, + "LDH": 2, + "H_mat": [ + [ + 1, + 2 + ], + [ + 0, + 4 + ] + ], + "V": [ + 0, + 0 + ], + "strideV": -1, + "offsetV": 1, + "sr1": 1.5, + "si1": 1, + "sr2": 1, + "si2": 0, + "V_out": [ + 0, + 0 + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/negative_strides/n_eq_two_zero_row_major.json b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/negative_strides/n_eq_two_zero_row_major.json new file mode 100644 index 000000000000..ae9f5eef7ba3 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/negative_strides/n_eq_two_zero_row_major.json @@ -0,0 +1,38 @@ +{ + "order": "row-major", + "N": 2, + "H": [ + 4, + 0, + 2, + 1 + ], + "strideH1": -2, + "strideH2": -1, + "offsetH": 3, + "LDH": 2, + "H_mat": [ + [ + 1, + 2 + ], + [ + 0, + 4 + ] + ], + "V": [ + 0, + 0 + ], + "strideV": -1, + "offsetV": 1, + "sr1": 1.5, + "si1": 1, + "sr2": 1, + "si2": 0, + "V_out": [ + 0, + 0 + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/offsets/n_eq_three_nonzero_col_major.json b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/offsets/n_eq_three_nonzero_col_major.json new file mode 100644 index 000000000000..09960e18bc3d --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/offsets/n_eq_three_nonzero_col_major.json @@ -0,0 +1,55 @@ +{ + "order": "column-major", + "N": 3, + "H": [ + 9999, + 1, + 2, + 0, + 3, + 4, + 5, + 2, + 6, + 7 + ], + "strideH1": 1, + "strideH2": 3, + "offsetH": 1, + "LDH": 3, + "H_mat": [ + [ + 1, + 3, + 2 + ], + [ + 2, + 4, + 6 + ], + [ + 0, + 5, + 7 + ] + ], + "V": [ + 9999, + 0, + 0, + 0 + ], + "strideV": 1, + "offsetV": 1, + "sr1": 1.5, + "si1": 1, + "sr2": 2.5, + "si2": 2, + "V_out": [ + 9999, + 0.8636363636363635, + 0.36363636363636365, + 1.8181818181818183 + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/offsets/n_eq_three_nonzero_row_major.json b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/offsets/n_eq_three_nonzero_row_major.json new file mode 100644 index 000000000000..87978b4fa53f --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/offsets/n_eq_three_nonzero_row_major.json @@ -0,0 +1,55 @@ +{ + "order": "row-major", + "N": 3, + "H": [ + 9999, + 1, + 3, + 2, + 0, + 4, + 6, + 0, + 5, + 7 + ], + "strideH1": 3, + "strideH2": 1, + "offsetH": 1, + "LDH": 3, + "H_mat": [ + [ + 1, + 3, + 2 + ], + [ + 0, + 4, + 6 + ], + [ + 0, + 5, + 7 + ] + ], + "V": [ + 9999, + 0, + 0, + 0 + ], + "strideV": 1, + "offsetV": 1, + "sr1": 1.5, + "si1": 1, + "sr2": 1, + "si2": 0, + "V_out": [ + 9999, + 0, + 0, + 0 + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/offsets/n_eq_three_zero_col_major.json b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/offsets/n_eq_three_zero_col_major.json new file mode 100644 index 000000000000..daa6ad8bce33 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/offsets/n_eq_three_zero_col_major.json @@ -0,0 +1,55 @@ +{ + "order": "column-major", + "N": 3, + "H": [ + 9999, + 1, + 0, + 0, + 3, + 4, + 5, + 2, + 6, + 7 + ], + "strideH1": 1, + "strideH2": 3, + "offsetH": 1, + "LDH": 3, + "H_mat": [ + [ + 1, + 3, + 2 + ], + [ + 0, + 4, + 6 + ], + [ + 0, + 5, + 7 + ] + ], + "V": [ + 9999, + 0, + 0, + 0 + ], + "strideV": 1, + "offsetV": 1, + "sr1": 1.5, + "si1": 1, + "sr2": 1, + "si2": 0, + "V_out": [ + 9999, + 0, + 0, + 0 + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/offsets/n_eq_three_zero_row_major.json b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/offsets/n_eq_three_zero_row_major.json new file mode 100644 index 000000000000..59a1f24e0dd4 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/offsets/n_eq_three_zero_row_major.json @@ -0,0 +1,55 @@ +{ + "order": "row-major", + "N": 3, + "H": [ + 9999, + 1, + 3, + 2, + 2, + 4, + 6, + 0, + 5, + 7 + ], + "strideH1": 3, + "strideH2": 1, + "offsetH": 1, + "LDH": 3, + "H_mat": [ + [ + 1, + 3, + 2 + ], + [ + 2, + 4, + 6 + ], + [ + 0, + 5, + 7 + ] + ], + "V": [ + 9999, + 0, + 0, + 0 + ], + "strideV": 1, + "offsetV": 1, + "sr1": 1.5, + "si1": 1, + "sr2": 2.5, + "si2": 2, + "V_out": [ + 9999, + 0.8636363636363635, + 0.36363636363636365, + 1.8181818181818183 + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/offsets/n_eq_two_nonzero_col_major.json b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/offsets/n_eq_two_nonzero_col_major.json new file mode 100644 index 000000000000..e90be3fb2556 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/offsets/n_eq_two_nonzero_col_major.json @@ -0,0 +1,41 @@ +{ + "order": "column-major", + "N": 2, + "H": [ + 9999, + 1, + 3, + 2, + 4 + ], + "strideH1": 1, + "strideH2": 2, + "offsetH": 1, + "LDH": 2, + "H_mat": [ + [ + 1, + 2 + ], + [ + 3, + 4 + ] + ], + "V": [ + 9999, + 0, + 0 + ], + "strideV": 1, + "offsetV": 1, + "sr1": 1.5, + "si1": 1, + "sr2": 1, + "si2": 2, + "V_out": [ + 9999, + 0.7999999999999999, + 1.5 + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/offsets/n_eq_two_nonzero_row_major.json b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/offsets/n_eq_two_nonzero_row_major.json new file mode 100644 index 000000000000..4b1fc99662c2 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/offsets/n_eq_two_nonzero_row_major.json @@ -0,0 +1,41 @@ +{ + "order": "row-major", + "N": 2, + "H": [ + 9999, + 1, + 2, + 3, + 4 + ], + "strideH1": 2, + "strideH2": 1, + "offsetH": 1, + "LDH": 2, + "H_mat": [ + [ + 1, + 2 + ], + [ + 3, + 4 + ] + ], + "V": [ + 9999, + 0, + 0 + ], + "strideV": 1, + "offsetV": 1, + "sr1": 1.5, + "si1": 1, + "sr2": 1, + "si2": 2, + "V_out": [ + 9999, + 0.7999999999999999, + 1.5 + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/offsets/n_eq_two_zero_col_major.json b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/offsets/n_eq_two_zero_col_major.json new file mode 100644 index 000000000000..24f6d3ca0beb --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/offsets/n_eq_two_zero_col_major.json @@ -0,0 +1,41 @@ +{ + "order": "column-major", + "N": 2, + "H": [ + 9999, + 1, + 0, + 2, + 4 + ], + "strideH1": 1, + "strideH2": 2, + "offsetH": 1, + "LDH": 2, + "H_mat": [ + [ + 1, + 2 + ], + [ + 0, + 4 + ] + ], + "V": [ + 9999, + 0, + 0 + ], + "strideV": 1, + "offsetV": 1, + "sr1": 1.5, + "si1": 1, + "sr2": 1, + "si2": 0, + "V_out": [ + 9999, + 0, + 0 + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/offsets/n_eq_two_zero_row_major.json b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/offsets/n_eq_two_zero_row_major.json new file mode 100644 index 000000000000..e5e82eec442c --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/fixtures/offsets/n_eq_two_zero_row_major.json @@ -0,0 +1,41 @@ +{ + "order": "row-major", + "N": 2, + "H": [ + 9999, + 1, + 2, + 0, + 4 + ], + "strideH1": 2, + "strideH2": 1, + "offsetH": 1, + "LDH": 2, + "H_mat": [ + [ + 1, + 2 + ], + [ + 0, + 4 + ] + ], + "V": [ + 9999, + 0, + 0 + ], + "strideV": 1, + "offsetV": 1, + "sr1": 1.5, + "si1": 1, + "sr2": 1, + "si2": 0, + "V_out": [ + 9999, + 0, + 0 + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/test.dlaqr1.js b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/test.dlaqr1.js new file mode 100644 index 000000000000..ef0e4d9c6fd2 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/test.dlaqr1.js @@ -0,0 +1,287 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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, id-length */ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Float64Array = require( '@stdlib/array/float64' ); +var dlaqr1 = require( './../lib/dlaqr1.js' ); + + +// FIXTURES // + +var N_EQ_THREE_NONZERO_ROW_MAJOR = require( './fixtures/n_eq_three_nonzero_row_major.json' ); +var N_EQ_THREE_NONZERO_COL_MAJOR = require( './fixtures/n_eq_three_nonzero_col_major.json' ); +var N_EQ_THREE_ZERO_ROW_MAJOR = require( './fixtures/n_eq_three_zero_row_major.json' ); +var N_EQ_THREE_ZERO_COL_MAJOR = require( './fixtures/n_eq_three_zero_col_major.json' ); +var N_EQ_TWO_NONZERO_ROW_MAJOR = require( './fixtures/n_eq_two_nonzero_row_major.json' ); +var N_EQ_TWO_NONZERO_COL_MAJOR = require( './fixtures/n_eq_two_nonzero_col_major.json' ); +var N_EQ_TWO_ZERO_ROW_MAJOR = require( './fixtures/n_eq_two_zero_row_major.json' ); +var N_EQ_TWO_ZERO_COL_MAJOR = require( './fixtures/n_eq_two_zero_col_major.json' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof dlaqr1, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 9', function test( t ) { + t.strictEqual( dlaqr1.length, 9, 'returns expected value' ); + t.end(); +}); + +tape( 'the function throws an error if provided a first argument which is not a valid order', function test( t ) { + var values; + var data; + var H; + var V; + var i; + + data = N_EQ_THREE_NONZERO_COL_MAJOR; + H = new Float64Array( data.H ); + V = new Float64Array( data.V ); + + values = [ + 'foo', + 'bar', + 'beep', + 'boop', + -5, + NaN, + true, + false, + null, + void 0, + [], + {}, + function noop() {} + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + dlaqr1( value, data.N, H, data.LDH, data.sr1, data.si1, data.sr2, data.si2, V ); + }; + } +}); + +tape( 'the function throws an error if provided a fourth argument which is not a valid `LDH` value (row-major)', function test( t ) { + var values; + var data; + var H; + var V; + var i; + + data = N_EQ_THREE_NONZERO_ROW_MAJOR; + H = new Float64Array( data.H ); + V = new Float64Array( data.V ); + + values = [ + 0, + 1, + 2 + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + dlaqr1( data.order, data.N, H, value, data.sr1, data.si1, data.sr2, data.si2, V ); + }; + } +}); + +tape( 'the function throws an error if provided a second argument which is not a valid value for `N`', function test( t ) { + var values; + var data; + var H; + var V; + var i; + + data = N_EQ_THREE_NONZERO_COL_MAJOR; + H = new Float64Array( data.H ); + V = new Float64Array( data.V ); + + values = [ + 0, + 1, + 4, + 5 + ]; + + 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() { + dlaqr1( data.order, value, H, data.LDH, data.sr1, data.si1, data.sr2, data.si2, V ); + }; + } +}); + +tape( 'the function returns expected value for N = 3 (zero vector output) (row-major)', function test( t ) { + var expected; + var data; + var out; + var V; + var H; + + data = N_EQ_THREE_ZERO_ROW_MAJOR; + V = new Float64Array( data.V ); + H = new Float64Array( data.H ); + expected = new Float64Array( data.V_out ); + + out = dlaqr1( data.order, data.N, H, data.LDH, data.sr1, data.si1, data.sr2, data.si2, V ); + t.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected value for N = 3 (zero vector output) (column-major)', function test( t ) { + var expected; + var data; + var out; + var V; + var H; + + data = N_EQ_THREE_ZERO_COL_MAJOR; + V = new Float64Array( data.V ); + H = new Float64Array( data.H ); + expected = new Float64Array( data.V_out ); + + out = dlaqr1( data.order, data.N, H, data.LDH, data.sr1, data.si1, data.sr2, data.si2, V ); + t.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected value for N = 3 (non-zero vector output) (row-major)', function test( t ) { + var expected; + var data; + var out; + var V; + var H; + + data = N_EQ_THREE_NONZERO_ROW_MAJOR; + V = new Float64Array( data.V ); + H = new Float64Array( data.H ); + expected = new Float64Array( data.V_out ); + + out = dlaqr1( data.order, data.N, H, data.LDH, data.sr1, data.si1, data.sr2, data.si2, V ); + t.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected value for N = 3 (non-zero vector output) (column-major)', function test( t ) { + var expected; + var data; + var out; + var V; + var H; + + data = N_EQ_THREE_NONZERO_COL_MAJOR; + V = new Float64Array( data.V ); + H = new Float64Array( data.H ); + expected = new Float64Array( data.V_out ); + + out = dlaqr1( data.order, data.N, H, data.LDH, data.sr1, data.si1, data.sr2, data.si2, V ); + t.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected value for N = 2 (zero vector output) (row-major)', function test( t ) { + var expected; + var data; + var out; + var V; + var H; + + data = N_EQ_TWO_ZERO_ROW_MAJOR; + V = new Float64Array( data.V ); + H = new Float64Array( data.H ); + expected = new Float64Array( data.V_out ); + + out = dlaqr1( data.order, data.N, H, data.LDH, data.sr1, data.si1, data.sr2, data.si2, V ); + t.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected value for N = 2 (zero vector output) (column-major)', function test( t ) { + var expected; + var data; + var out; + var V; + var H; + + data = N_EQ_TWO_ZERO_COL_MAJOR; + V = new Float64Array( data.V ); + H = new Float64Array( data.H ); + expected = new Float64Array( data.V_out ); + + out = dlaqr1( data.order, data.N, H, data.LDH, data.sr1, data.si1, data.sr2, data.si2, V ); + t.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected value for N = 2 (non-zero vector output) (row-major)', function test( t ) { + var expected; + var data; + var out; + var V; + var H; + + data = N_EQ_TWO_NONZERO_ROW_MAJOR; + V = new Float64Array( data.V ); + H = new Float64Array( data.H ); + expected = new Float64Array( data.V_out ); + + out = dlaqr1( data.order, data.N, H, data.LDH, data.sr1, data.si1, data.sr2, data.si2, V ); + t.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected value for N = 2 (non-zero vector output) (column-major)', function test( t ) { + var expected; + var data; + var out; + var V; + var H; + + data = N_EQ_TWO_NONZERO_COL_MAJOR; + V = new Float64Array( data.V ); + H = new Float64Array( data.H ); + expected = new Float64Array( data.V_out ); + + out = dlaqr1( data.order, data.N, H, data.LDH, data.sr1, data.si1, data.sr2, data.si2, V ); + t.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/test.js b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/test.js new file mode 100644 index 000000000000..bf936d2766b1 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/test.js @@ -0,0 +1,82 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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 dlaqr1 = 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 dlaqr1, '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 dlaqr1.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 dlaqr1 = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( dlaqr1, 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 dlaqr1; + var main; + + main = require( './../lib/dlaqr1.js' ); + + dlaqr1 = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( dlaqr1, main, 'returns expected value' ); + t.end(); + + function tryRequire() { + return new Error( 'Cannot find module' ); + } +}); diff --git a/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/test.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/test.ndarray.js new file mode 100644 index 000000000000..25058b4e8e9f --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlaqr1/test/test.ndarray.js @@ -0,0 +1,799 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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, id-length */ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Float64Array = require( '@stdlib/array/float64' ); +var dlaqr1 = require( './../lib/ndarray.js' ); + + +// FIXTURES // + +var N_EQ_THREE_NONZERO_ROW_MAJOR = require( './fixtures/n_eq_three_nonzero_row_major.json' ); +var N_EQ_THREE_NONZERO_COL_MAJOR = require( './fixtures/n_eq_three_nonzero_col_major.json' ); +var N_EQ_THREE_ZERO_ROW_MAJOR = require( './fixtures/n_eq_three_zero_row_major.json' ); +var N_EQ_THREE_ZERO_COL_MAJOR = require( './fixtures/n_eq_three_zero_col_major.json' ); +var N_EQ_TWO_NONZERO_ROW_MAJOR = require( './fixtures/n_eq_two_nonzero_row_major.json' ); +var N_EQ_TWO_NONZERO_COL_MAJOR = require( './fixtures/n_eq_two_nonzero_col_major.json' ); +var N_EQ_TWO_ZERO_ROW_MAJOR = require( './fixtures/n_eq_two_zero_row_major.json' ); +var N_EQ_TWO_ZERO_COL_MAJOR = require( './fixtures/n_eq_two_zero_col_major.json' ); + +var N_EQ_THREE_NONZERO_ROW_MAJOR_LARGE_STRIDES = require( './fixtures/large_strides/n_eq_three_nonzero_row_major.json' ); +var N_EQ_THREE_NONZERO_COL_MAJOR_LARGE_STRIDES = require( './fixtures/large_strides/n_eq_three_nonzero_col_major.json' ); +var N_EQ_THREE_ZERO_ROW_MAJOR_LARGE_STRIDES = require( './fixtures/large_strides/n_eq_three_zero_row_major.json' ); +var N_EQ_THREE_ZERO_COL_MAJOR_LARGE_STRIDES = require( './fixtures/large_strides/n_eq_three_zero_col_major.json' ); +var N_EQ_TWO_NONZERO_ROW_MAJOR_LARGE_STRIDES = require( './fixtures/large_strides/n_eq_two_nonzero_row_major.json' ); +var N_EQ_TWO_NONZERO_COL_MAJOR_LARGE_STRIDES = require( './fixtures/large_strides/n_eq_two_nonzero_col_major.json' ); +var N_EQ_TWO_ZERO_ROW_MAJOR_LARGE_STRIDES = require( './fixtures/large_strides/n_eq_two_zero_row_major.json' ); +var N_EQ_TWO_ZERO_COL_MAJOR_LARGE_STRIDES = require( './fixtures/large_strides/n_eq_two_zero_col_major.json' ); + +var N_EQ_THREE_NONZERO_ROW_MAJOR_MIXED_STRIDES = require( './fixtures/mixed_strides/n_eq_three_nonzero_row_major.json' ); +var N_EQ_THREE_NONZERO_COL_MAJOR_MIXED_STRIDES = require( './fixtures/mixed_strides/n_eq_three_nonzero_col_major.json' ); +var N_EQ_THREE_ZERO_ROW_MAJOR_MIXED_STRIDES = require( './fixtures/mixed_strides/n_eq_three_zero_row_major.json' ); +var N_EQ_THREE_ZERO_COL_MAJOR_MIXED_STRIDES = require( './fixtures/mixed_strides/n_eq_three_zero_col_major.json' ); +var N_EQ_TWO_NONZERO_ROW_MAJOR_MIXED_STRIDES = require( './fixtures/mixed_strides/n_eq_two_nonzero_row_major.json' ); +var N_EQ_TWO_NONZERO_COL_MAJOR_MIXED_STRIDES = require( './fixtures/mixed_strides/n_eq_two_nonzero_col_major.json' ); +var N_EQ_TWO_ZERO_ROW_MAJOR_MIXED_STRIDES = require( './fixtures/mixed_strides/n_eq_two_zero_row_major.json' ); +var N_EQ_TWO_ZERO_COL_MAJOR_MIXED_STRIDES = require( './fixtures/mixed_strides/n_eq_two_zero_col_major.json' ); + +var N_EQ_THREE_NONZERO_ROW_MAJOR_NEGATIVE_STRIDES = require( './fixtures/negative_strides/n_eq_three_nonzero_row_major.json' ); +var N_EQ_THREE_NONZERO_COL_MAJOR_NEGATIVE_STRIDES = require( './fixtures/negative_strides/n_eq_three_nonzero_col_major.json' ); +var N_EQ_THREE_ZERO_ROW_MAJOR_NEGATIVE_STRIDES = require( './fixtures/negative_strides/n_eq_three_zero_row_major.json' ); +var N_EQ_THREE_ZERO_COL_MAJOR_NEGATIVE_STRIDES = require( './fixtures/negative_strides/n_eq_three_zero_col_major.json' ); +var N_EQ_TWO_NONZERO_ROW_MAJOR_NEGATIVE_STRIDES = require( './fixtures/negative_strides/n_eq_two_nonzero_row_major.json' ); +var N_EQ_TWO_NONZERO_COL_MAJOR_NEGATIVE_STRIDES = require( './fixtures/negative_strides/n_eq_two_nonzero_col_major.json' ); +var N_EQ_TWO_ZERO_ROW_MAJOR_NEGATIVE_STRIDES = require( './fixtures/negative_strides/n_eq_two_zero_row_major.json' ); +var N_EQ_TWO_ZERO_COL_MAJOR_NEGATIVE_STRIDES = require( './fixtures/negative_strides/n_eq_two_zero_col_major.json' ); + +var N_EQ_THREE_NONZERO_ROW_MAJOR_OFFSETS = require( './fixtures/offsets/n_eq_three_nonzero_row_major.json' ); +var N_EQ_THREE_NONZERO_COL_MAJOR_OFFSETS = require( './fixtures/offsets/n_eq_three_nonzero_col_major.json' ); +var N_EQ_THREE_ZERO_ROW_MAJOR_OFFSETS = require( './fixtures/offsets/n_eq_three_zero_row_major.json' ); +var N_EQ_THREE_ZERO_COL_MAJOR_OFFSETS = require( './fixtures/offsets/n_eq_three_zero_col_major.json' ); +var N_EQ_TWO_NONZERO_ROW_MAJOR_OFFSETS = require( './fixtures/offsets/n_eq_two_nonzero_row_major.json' ); +var N_EQ_TWO_NONZERO_COL_MAJOR_OFFSETS = require( './fixtures/offsets/n_eq_two_nonzero_col_major.json' ); +var N_EQ_TWO_ZERO_ROW_MAJOR_OFFSETS = require( './fixtures/offsets/n_eq_two_zero_row_major.json' ); +var N_EQ_TWO_ZERO_COL_MAJOR_OFFSETS = require( './fixtures/offsets/n_eq_two_zero_col_major.json' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof dlaqr1, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 12', function test( t ) { + t.strictEqual( dlaqr1.length, 12, 'returns expected value' ); + t.end(); +}); + +tape( 'the function throws an error if provided a first argument which is not a valid value for `N`', function test( t ) { + var values; + var data; + var H; + var V; + var i; + + data = N_EQ_THREE_NONZERO_COL_MAJOR; + H = new Float64Array( data.H ); + V = new Float64Array( data.V ); + + values = [ + 0, + 1, + 4, + 5 + ]; + + 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() { + dlaqr1( value, H, data.strideH1, data.strideH2, data.offsetH, data.sr1, data.si1, data.sr2, data.si2, V, data.strideV, data.offsetV ); + }; + } +}); + +tape( 'the function returns expected value for N = 3 (zero vector output) (row-major)', function test( t ) { + var expected; + var data; + var out; + var V; + var H; + + data = N_EQ_THREE_ZERO_ROW_MAJOR; + V = new Float64Array( data.V ); + H = new Float64Array( data.H ); + expected = new Float64Array( data.V_out ); + + out = dlaqr1( data.N, H, data.strideH1, data.strideH2, data.offsetH, data.sr1, data.si1, data.sr2, data.si2, V, data.strideV, data.offsetV ); + t.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected value for N = 3 (zero vector output) (column-major)', function test( t ) { + var expected; + var data; + var out; + var V; + var H; + + data = N_EQ_THREE_NONZERO_COL_MAJOR; + V = new Float64Array( data.V ); + H = new Float64Array( data.H ); + expected = new Float64Array( data.V_out ); + + out = dlaqr1( data.N, H, data.strideH1, data.strideH2, data.offsetH, data.sr1, data.si1, data.sr2, data.si2, V, data.strideV, data.offsetV ); + t.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected value for N = 3 (non-zero vector output) (row-major)', function test( t ) { + var expected; + var data; + var out; + var V; + var H; + + data = N_EQ_THREE_NONZERO_ROW_MAJOR; + V = new Float64Array( data.V ); + H = new Float64Array( data.H ); + expected = new Float64Array( data.V_out ); + + out = dlaqr1( data.N, H, data.strideH1, data.strideH2, data.offsetH, data.sr1, data.si1, data.sr2, data.si2, V, data.strideV, data.offsetV ); + t.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected value for N = 3 (non-zero vector output) (column-major)', function test( t ) { + var expected; + var data; + var out; + var V; + var H; + + data = N_EQ_THREE_ZERO_COL_MAJOR; + V = new Float64Array( data.V ); + H = new Float64Array( data.H ); + expected = new Float64Array( data.V_out ); + + out = dlaqr1( data.N, H, data.strideH1, data.strideH2, data.offsetH, data.sr1, data.si1, data.sr2, data.si2, V, data.strideV, data.offsetV ); + t.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected value for N = 2 (zero vector output) (row-major)', function test( t ) { + var expected; + var data; + var out; + var V; + var H; + + data = N_EQ_TWO_ZERO_ROW_MAJOR; + V = new Float64Array( data.V ); + H = new Float64Array( data.H ); + expected = new Float64Array( data.V_out ); + + out = dlaqr1( data.N, H, data.strideH1, data.strideH2, data.offsetH, data.sr1, data.si1, data.sr2, data.si2, V, data.strideV, data.offsetV ); + t.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected value for N = 2 (zero vector output) (column-major)', function test( t ) { + var expected; + var data; + var out; + var V; + var H; + + data = N_EQ_TWO_ZERO_COL_MAJOR; + V = new Float64Array( data.V ); + H = new Float64Array( data.H ); + expected = new Float64Array( data.V_out ); + + out = dlaqr1( data.N, H, data.strideH1, data.strideH2, data.offsetH, data.sr1, data.si1, data.sr2, data.si2, V, data.strideV, data.offsetV ); + t.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected value for N = 2 (non-zero vector output) (row-major)', function test( t ) { + var expected; + var data; + var out; + var V; + var H; + + data = N_EQ_TWO_NONZERO_ROW_MAJOR; + V = new Float64Array( data.V ); + H = new Float64Array( data.H ); + expected = new Float64Array( data.V_out ); + + out = dlaqr1( data.N, H, data.strideH1, data.strideH2, data.offsetH, data.sr1, data.si1, data.sr2, data.si2, V, data.strideV, data.offsetV ); + t.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected value for N = 2 (non-zero vector output) (column-major)', function test( t ) { + var expected; + var data; + var out; + var V; + var H; + + data = N_EQ_TWO_NONZERO_COL_MAJOR; + V = new Float64Array( data.V ); + H = new Float64Array( data.H ); + expected = new Float64Array( data.V_out ); + + out = dlaqr1( data.N, H, data.strideH1, data.strideH2, data.offsetH, data.sr1, data.si1, data.sr2, data.si2, V, data.strideV, data.offsetV ); + t.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected value for N = 3 (zero vector output) (row-major, large strides)', function test( t ) { + var expected; + var data; + var out; + var V; + var H; + + data = N_EQ_THREE_ZERO_ROW_MAJOR_LARGE_STRIDES; + V = new Float64Array( data.V ); + H = new Float64Array( data.H ); + expected = new Float64Array( data.V_out ); + + out = dlaqr1( data.N, H, data.strideH1, data.strideH2, data.offsetH, data.sr1, data.si1, data.sr2, data.si2, V, data.strideV, data.offsetV ); + t.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected value for N = 3 (zero vector output) (column-major, large strides)', function test( t ) { + var expected; + var data; + var out; + var V; + var H; + + data = N_EQ_THREE_ZERO_COL_MAJOR_LARGE_STRIDES; + V = new Float64Array( data.V ); + H = new Float64Array( data.H ); + expected = new Float64Array( data.V_out ); + + out = dlaqr1( data.N, H, data.strideH1, data.strideH2, data.offsetH, data.sr1, data.si1, data.sr2, data.si2, V, data.strideV, data.offsetV ); + t.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected value for N = 3 (non-zero vector output) (row-major, large strides)', function test( t ) { + var expected; + var data; + var out; + var V; + var H; + + data = N_EQ_THREE_NONZERO_ROW_MAJOR_LARGE_STRIDES; + V = new Float64Array( data.V ); + H = new Float64Array( data.H ); + expected = new Float64Array( data.V_out ); + + out = dlaqr1( data.N, H, data.strideH1, data.strideH2, data.offsetH, data.sr1, data.si1, data.sr2, data.si2, V, data.strideV, data.offsetV ); + t.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected value for N = 3 (non-zero vector output) (column-major, large strides)', function test( t ) { + var expected; + var data; + var out; + var V; + var H; + + data = N_EQ_THREE_NONZERO_COL_MAJOR_LARGE_STRIDES; + V = new Float64Array( data.V ); + H = new Float64Array( data.H ); + expected = new Float64Array( data.V_out ); + + out = dlaqr1( data.N, H, data.strideH1, data.strideH2, data.offsetH, data.sr1, data.si1, data.sr2, data.si2, V, data.strideV, data.offsetV ); + t.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected value for N = 2 (zero vector output) (row-major, large strides)', function test( t ) { + var expected; + var data; + var out; + var V; + var H; + + data = N_EQ_TWO_ZERO_ROW_MAJOR_LARGE_STRIDES; + V = new Float64Array( data.V ); + H = new Float64Array( data.H ); + expected = new Float64Array( data.V_out ); + + out = dlaqr1( data.N, H, data.strideH1, data.strideH2, data.offsetH, data.sr1, data.si1, data.sr2, data.si2, V, data.strideV, data.offsetV ); + t.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected value for N = 2 (zero vector output) (column-major, large strides)', function test( t ) { + var expected; + var data; + var out; + var V; + var H; + + data = N_EQ_TWO_ZERO_COL_MAJOR_LARGE_STRIDES; + V = new Float64Array( data.V ); + H = new Float64Array( data.H ); + expected = new Float64Array( data.V_out ); + + out = dlaqr1( data.N, H, data.strideH1, data.strideH2, data.offsetH, data.sr1, data.si1, data.sr2, data.si2, V, data.strideV, data.offsetV ); + t.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected value for N = 2 (non-zero vector output) (row-major, large strides)', function test( t ) { + var expected; + var data; + var out; + var V; + var H; + + data = N_EQ_TWO_NONZERO_ROW_MAJOR_LARGE_STRIDES; + V = new Float64Array( data.V ); + H = new Float64Array( data.H ); + expected = new Float64Array( data.V_out ); + + out = dlaqr1( data.N, H, data.strideH1, data.strideH2, data.offsetH, data.sr1, data.si1, data.sr2, data.si2, V, data.strideV, data.offsetV ); + t.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected value for N = 2 (non-zero vector output) (column-major, large strides)', function test( t ) { + var expected; + var data; + var out; + var V; + var H; + + data = N_EQ_TWO_NONZERO_COL_MAJOR_LARGE_STRIDES; + V = new Float64Array( data.V ); + H = new Float64Array( data.H ); + expected = new Float64Array( data.V_out ); + + out = dlaqr1( data.N, H, data.strideH1, data.strideH2, data.offsetH, data.sr1, data.si1, data.sr2, data.si2, V, data.strideV, data.offsetV ); + t.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected value for N = 3 (zero vector output) (row-major, mixed strides)', function test( t ) { + var expected; + var data; + var out; + var V; + var H; + + data = N_EQ_THREE_ZERO_ROW_MAJOR_MIXED_STRIDES; + V = new Float64Array( data.V ); + H = new Float64Array( data.H ); + expected = new Float64Array( data.V_out ); + + out = dlaqr1( data.N, H, data.strideH1, data.strideH2, data.offsetH, data.sr1, data.si1, data.sr2, data.si2, V, data.strideV, data.offsetV ); + t.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected value for N = 3 (zero vector output) (column-major, mixed strides)', function test( t ) { + var expected; + var data; + var out; + var V; + var H; + + data = N_EQ_THREE_ZERO_COL_MAJOR_MIXED_STRIDES; + V = new Float64Array( data.V ); + H = new Float64Array( data.H ); + expected = new Float64Array( data.V_out ); + + out = dlaqr1( data.N, H, data.strideH1, data.strideH2, data.offsetH, data.sr1, data.si1, data.sr2, data.si2, V, data.strideV, data.offsetV ); + t.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected value for N = 3 (non-zero vector output) (row-major, mixed strides)', function test( t ) { + var expected; + var data; + var out; + var V; + var H; + + data = N_EQ_THREE_NONZERO_ROW_MAJOR_MIXED_STRIDES; + V = new Float64Array( data.V ); + H = new Float64Array( data.H ); + expected = new Float64Array( data.V_out ); + + out = dlaqr1( data.N, H, data.strideH1, data.strideH2, data.offsetH, data.sr1, data.si1, data.sr2, data.si2, V, data.strideV, data.offsetV ); + t.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected value for N = 3 (non-zero vector output) (column-major, mixed strides)', function test( t ) { + var expected; + var data; + var out; + var V; + var H; + + data = N_EQ_THREE_NONZERO_COL_MAJOR_MIXED_STRIDES; + V = new Float64Array( data.V ); + H = new Float64Array( data.H ); + expected = new Float64Array( data.V_out ); + + out = dlaqr1( data.N, H, data.strideH1, data.strideH2, data.offsetH, data.sr1, data.si1, data.sr2, data.si2, V, data.strideV, data.offsetV ); + t.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected value for N = 2 (zero vector output) (row-major, mixed strides)', function test( t ) { + var expected; + var data; + var out; + var V; + var H; + + data = N_EQ_TWO_ZERO_ROW_MAJOR_MIXED_STRIDES; + V = new Float64Array( data.V ); + H = new Float64Array( data.H ); + expected = new Float64Array( data.V_out ); + + out = dlaqr1( data.N, H, data.strideH1, data.strideH2, data.offsetH, data.sr1, data.si1, data.sr2, data.si2, V, data.strideV, data.offsetV ); + t.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected value for N = 2 (zero vector output) (column-major, mixed strides)', function test( t ) { + var expected; + var data; + var out; + var V; + var H; + + data = N_EQ_TWO_ZERO_COL_MAJOR_MIXED_STRIDES; + V = new Float64Array( data.V ); + H = new Float64Array( data.H ); + expected = new Float64Array( data.V_out ); + + out = dlaqr1( data.N, H, data.strideH1, data.strideH2, data.offsetH, data.sr1, data.si1, data.sr2, data.si2, V, data.strideV, data.offsetV ); + t.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected value for N = 2 (non-zero vector output) (row-major, mixed strides)', function test( t ) { + var expected; + var data; + var out; + var V; + var H; + + data = N_EQ_TWO_NONZERO_ROW_MAJOR_MIXED_STRIDES; + V = new Float64Array( data.V ); + H = new Float64Array( data.H ); + expected = new Float64Array( data.V_out ); + + out = dlaqr1( data.N, H, data.strideH1, data.strideH2, data.offsetH, data.sr1, data.si1, data.sr2, data.si2, V, data.strideV, data.offsetV ); + t.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected value for N = 2 (non-zero vector output) (column-major, mixed strides)', function test( t ) { + var expected; + var data; + var out; + var V; + var H; + + data = N_EQ_TWO_NONZERO_COL_MAJOR_MIXED_STRIDES; + V = new Float64Array( data.V ); + H = new Float64Array( data.H ); + expected = new Float64Array( data.V_out ); + + out = dlaqr1( data.N, H, data.strideH1, data.strideH2, data.offsetH, data.sr1, data.si1, data.sr2, data.si2, V, data.strideV, data.offsetV ); + t.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected value for N = 3 (zero vector output) (row-major, negative strides)', function test( t ) { + var expected; + var data; + var out; + var V; + var H; + + data = N_EQ_THREE_ZERO_ROW_MAJOR_NEGATIVE_STRIDES; + V = new Float64Array( data.V ); + H = new Float64Array( data.H ); + expected = new Float64Array( data.V_out ); + + out = dlaqr1( data.N, H, data.strideH1, data.strideH2, data.offsetH, data.sr1, data.si1, data.sr2, data.si2, V, data.strideV, data.offsetV ); + t.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected value for N = 3 (zero vector output) (column-major, negative strides)', function test( t ) { + var expected; + var data; + var out; + var V; + var H; + + data = N_EQ_THREE_ZERO_COL_MAJOR_NEGATIVE_STRIDES; + V = new Float64Array( data.V ); + H = new Float64Array( data.H ); + expected = new Float64Array( data.V_out ); + + out = dlaqr1( data.N, H, data.strideH1, data.strideH2, data.offsetH, data.sr1, data.si1, data.sr2, data.si2, V, data.strideV, data.offsetV ); + t.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected value for N = 3 (non-zero vector output) (row-major, negative strides)', function test( t ) { + var expected; + var data; + var out; + var V; + var H; + + data = N_EQ_THREE_NONZERO_ROW_MAJOR_NEGATIVE_STRIDES; + V = new Float64Array( data.V ); + H = new Float64Array( data.H ); + expected = new Float64Array( data.V_out ); + + out = dlaqr1( data.N, H, data.strideH1, data.strideH2, data.offsetH, data.sr1, data.si1, data.sr2, data.si2, V, data.strideV, data.offsetV ); + t.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected value for N = 3 (non-zero vector output) (column-major, negative strides)', function test( t ) { + var expected; + var data; + var out; + var V; + var H; + + data = N_EQ_THREE_NONZERO_COL_MAJOR_NEGATIVE_STRIDES; + V = new Float64Array( data.V ); + H = new Float64Array( data.H ); + expected = new Float64Array( data.V_out ); + + out = dlaqr1( data.N, H, data.strideH1, data.strideH2, data.offsetH, data.sr1, data.si1, data.sr2, data.si2, V, data.strideV, data.offsetV ); + t.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected value for N = 2 (zero vector output) (row-major, negative strides)', function test( t ) { + var expected; + var data; + var out; + var V; + var H; + + data = N_EQ_TWO_ZERO_ROW_MAJOR_NEGATIVE_STRIDES; + V = new Float64Array( data.V ); + H = new Float64Array( data.H ); + expected = new Float64Array( data.V_out ); + + out = dlaqr1( data.N, H, data.strideH1, data.strideH2, data.offsetH, data.sr1, data.si1, data.sr2, data.si2, V, data.strideV, data.offsetV ); + t.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected value for N = 2 (zero vector output) (column-major, negative strides)', function test( t ) { + var expected; + var data; + var out; + var V; + var H; + + data = N_EQ_TWO_ZERO_COL_MAJOR_NEGATIVE_STRIDES; + V = new Float64Array( data.V ); + H = new Float64Array( data.H ); + expected = new Float64Array( data.V_out ); + + out = dlaqr1( data.N, H, data.strideH1, data.strideH2, data.offsetH, data.sr1, data.si1, data.sr2, data.si2, V, data.strideV, data.offsetV ); + t.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected value for N = 2 (non-zero vector output) (row-major, negative strides)', function test( t ) { + var expected; + var data; + var out; + var V; + var H; + + data = N_EQ_TWO_NONZERO_ROW_MAJOR_NEGATIVE_STRIDES; + V = new Float64Array( data.V ); + H = new Float64Array( data.H ); + expected = new Float64Array( data.V_out ); + + out = dlaqr1( data.N, H, data.strideH1, data.strideH2, data.offsetH, data.sr1, data.si1, data.sr2, data.si2, V, data.strideV, data.offsetV ); + t.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected value for N = 2 (non-zero vector output) (column-major, negative strides)', function test( t ) { + var expected; + var data; + var out; + var V; + var H; + + data = N_EQ_TWO_NONZERO_COL_MAJOR_NEGATIVE_STRIDES; + V = new Float64Array( data.V ); + H = new Float64Array( data.H ); + expected = new Float64Array( data.V_out ); + + out = dlaqr1( data.N, H, data.strideH1, data.strideH2, data.offsetH, data.sr1, data.si1, data.sr2, data.si2, V, data.strideV, data.offsetV ); + t.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected value for N = 3 (zero vector output) (row-major, offsets)', function test( t ) { + var expected; + var data; + var out; + var V; + var H; + + data = N_EQ_THREE_ZERO_ROW_MAJOR_OFFSETS; + V = new Float64Array( data.V ); + H = new Float64Array( data.H ); + expected = new Float64Array( data.V_out ); + + out = dlaqr1( data.N, H, data.strideH1, data.strideH2, data.offsetH, data.sr1, data.si1, data.sr2, data.si2, V, data.strideV, data.offsetV ); + t.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected value for N = 3 (zero vector output) (column-major, offsets)', function test( t ) { + var expected; + var data; + var out; + var V; + var H; + + data = N_EQ_THREE_ZERO_COL_MAJOR_OFFSETS; + V = new Float64Array( data.V ); + H = new Float64Array( data.H ); + expected = new Float64Array( data.V_out ); + + out = dlaqr1( data.N, H, data.strideH1, data.strideH2, data.offsetH, data.sr1, data.si1, data.sr2, data.si2, V, data.strideV, data.offsetV ); + t.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected value for N = 3 (non-zero vector output) (row-major, offsets)', function test( t ) { + var expected; + var data; + var out; + var V; + var H; + + data = N_EQ_THREE_NONZERO_ROW_MAJOR_OFFSETS; + V = new Float64Array( data.V ); + H = new Float64Array( data.H ); + expected = new Float64Array( data.V_out ); + + out = dlaqr1( data.N, H, data.strideH1, data.strideH2, data.offsetH, data.sr1, data.si1, data.sr2, data.si2, V, data.strideV, data.offsetV ); + t.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected value for N = 3 (non-zero vector output) (column-major, offsets)', function test( t ) { + var expected; + var data; + var out; + var V; + var H; + + data = N_EQ_THREE_NONZERO_COL_MAJOR_OFFSETS; + V = new Float64Array( data.V ); + H = new Float64Array( data.H ); + expected = new Float64Array( data.V_out ); + + out = dlaqr1( data.N, H, data.strideH1, data.strideH2, data.offsetH, data.sr1, data.si1, data.sr2, data.si2, V, data.strideV, data.offsetV ); + t.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected value for N = 2 (zero vector output) (row-major, offsets)', function test( t ) { + var expected; + var data; + var out; + var V; + var H; + + data = N_EQ_TWO_ZERO_ROW_MAJOR_OFFSETS; + V = new Float64Array( data.V ); + H = new Float64Array( data.H ); + expected = new Float64Array( data.V_out ); + + out = dlaqr1( data.N, H, data.strideH1, data.strideH2, data.offsetH, data.sr1, data.si1, data.sr2, data.si2, V, data.strideV, data.offsetV ); + t.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected value for N = 2 (zero vector output) (column-major, offsets)', function test( t ) { + var expected; + var data; + var out; + var V; + var H; + + data = N_EQ_TWO_ZERO_COL_MAJOR_OFFSETS; + V = new Float64Array( data.V ); + H = new Float64Array( data.H ); + expected = new Float64Array( data.V_out ); + + out = dlaqr1( data.N, H, data.strideH1, data.strideH2, data.offsetH, data.sr1, data.si1, data.sr2, data.si2, V, data.strideV, data.offsetV ); + t.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected value for N = 2 (non-zero vector output) (row-major, offsets)', function test( t ) { + var expected; + var data; + var out; + var V; + var H; + + data = N_EQ_TWO_NONZERO_ROW_MAJOR_OFFSETS; + V = new Float64Array( data.V ); + H = new Float64Array( data.H ); + expected = new Float64Array( data.V_out ); + + out = dlaqr1( data.N, H, data.strideH1, data.strideH2, data.offsetH, data.sr1, data.si1, data.sr2, data.si2, V, data.strideV, data.offsetV ); + t.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected value for N = 2 (non-zero vector output) (column-major, offsets)', function test( t ) { + var expected; + var data; + var out; + var V; + var H; + + data = N_EQ_TWO_NONZERO_COL_MAJOR_OFFSETS; + V = new Float64Array( data.V ); + H = new Float64Array( data.H ); + expected = new Float64Array( data.V_out ); + + out = dlaqr1( data.N, H, data.strideH1, data.strideH2, data.offsetH, data.sr1, data.si1, data.sr2, data.si2, V, data.strideV, data.offsetV ); + t.deepEqual( out, expected, 'returns expected value' ); + t.end(); +});