diff --git a/lib/node_modules/@stdlib/lapack/base/dgebd2/README.md b/lib/node_modules/@stdlib/lapack/base/dgebd2/README.md new file mode 100644 index 000000000000..48eea032ca04 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgebd2/README.md @@ -0,0 +1,431 @@ + + +# dgebd2 + +> LAPACK routine to reduce a real general `M` by `N` matrix `A` to upper or lower bi-diagonal form `B` by an orthogonal transformation: `Q**T * A * P = B`. + +
+ +The `dgebd2` routine reduces an `M` by `N` real matrix `A` to upper or lower bi-diagonal form `B` by an orthogonal transformation: + + + +```math +Q^{\top} A P = B +``` + + + +where `Q` and `P^{\top}` are orthogonal matrices. + +The matrices `Q` and `P` are represented as products of elementary reflectors. + +If `M >= N`, + +```math +Q = H(1) H(2) \dots H(N) \quad \text{and} \quad P = G(1) G(2) \dots G(N-1) +``` + +If `M < N`, + +```math +Q = H(1) H(2) \dots H(M-1) \quad \text{and} \quad P = G(1) G(2) \dots G(M) +``` + +Each `H(i)` and `G(i)` has the form: + +```math +\begin{aligned} +H(i) &= I - \tau_q v v^{\top} \\ +G(i) &= I - \tau_p u u^{\top} +\end{aligned} +``` + +where `tauq` and `taup` are real scalars, and `v` and `u` are real vectors. + +**If `M >= N`**: + +- `v(1:i-1) = 0`, `v(i) = 1`, and `v(i+1:M)` is stored on exit in `A(i+1:M, i)`. +- `u(1:i) = 0`, `u(i+1) = 1`, and `u(i+2:N)` is stored on exit in `A(i, i+2:N)`. +- `tauq` is stored in `TAUQ(i)` and `taup` in `TAUP(i)`. + +**If `M < N`**: + +- `v(1:i) = 0`, `v(i+1) = 1`, and `v(i+2:M)` is stored on exit in `A(i+2:M, i)`. +- `u(1:i-1) = 0`, `u(i) = 1`, and `u(i+1:N)` is stored on exit in `A(i, i+1:N)`. +- `tauq` is stored in `TAUQ(i)` and `taup` in `TAUP(i)`. + +The contents of `A` on exit are illustrated by the following examples (`d` and `e` denote diagonal and off-diagonal elements of `B`, `vi` denotes an element of the vector defining `H(i)`, and `ui` an element of the vector defining `G(i)`): + +`M = 6` and `N = 5` (`M > N`): + + + +```math +\begin{array}{c} +\left( +\begin{array}{rrrrr} +d & e & u_1 & u_1 & u_1 \\ +v_1 & d & e & u_2 & u_2 \\ +v_1 & v_2 & d & e & u_3 \\ +v_1 & v_2 & v_3 & d & e \\ +v_1 & v_2 & v_3 & v_4 & d \\ +v_1 & v_2 & v_3 & v_4 & v_5 +\end{array} +\right) +\end{array} +``` + + + +`M = 5` and `N = 6` (`M < N`): + + + +```math +\begin{array}{c} +\left( +\begin{array}{rrrrrr} +d & u_1 & u_1 & u_1 & u_1 & u_1 \\ +e & d & u_2 & u_2 & u_2 & u_2 \\ +v_1 & e & d & u_3 & u_3 & u_3 \\ +v_1 & v_2 & e & d & u_4 & u_4 \\ +v_1 & v_2 & v_3 & e & d & u_5 +\end{array} +\right) +\end{array} +``` + + + +The diagonal elements of `B` are stored in `D`. The off-diagonal elements of `B` are stored in `E`. + +
+ + + +
+ +## Usage + +```javascript +var dgebd2 = require( '@stdlib/lapack/base/dgebd2' ); +``` + +#### dgebd2( order, M, N, A, LDA, D, E, TAUQ, TAUP, WORK ) + +Reduces a real general `M` by `N` matrix `A` to upper or lower bi-diagonal form `B` by an orthogonal transformation: `Q**T * A * P = B`. + + + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); + +var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +var D = new Float64Array( [ 0.0, 0.0 ] ); +var E = new Float64Array( [ 0.0 ] ); +var TAUQ = new Float64Array( [ 0.0, 0.0 ] ); +var TAUP = new Float64Array( [ 0.0, 0.0 ] ); +var WORK = new Float64Array( [ 0.0, 0.0, 0.0 ] ); + +dgebd2( 'column-major', 3, 2, A, 3, D, E, TAUQ, TAUP, WORK ); +// A => [ ~-3.742, ~0.422, ~0.633, ~-8.552, ~1.964, ~0.86 ] +// D => [ ~-3.742, ~1.964 ] +// E => [ ~-8.552 ] +// TAUQ => [ ~1.267, ~1.15 ] +// TAUP => [ 0.0, 0.0 ] +// WORK => [ ~9.9, 0.0, 0.0 ] +``` + +The function has the following parameters: + +- **order**: storage layout. Must be either `'column-major'` or `'row-major'`. +- **M**: number of rows of `A`. +- **N**: number of columns of `A`. +- **A**: input/output matrix as a [`Float64Array`][@stdlib/array/float64]. On exit, `A` is overwritten. +- **LDA**: stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`). If `order = 'column-major'`, `LDA` must be at least `max(1, M)`. If `order = 'row-major'`, `LDA` must be at least `max(1, N)`. +- **D**: diagonal elements of the bi-diagonal matrix `B` as a [`Float64Array`][@stdlib/array/float64]. Length `min(M,N)`. +- **E**: off-diagonal elements of the bi-diagonal matrix `B` as a [`Float64Array`][@stdlib/array/float64]. Length `min(M,N)-1`. +- **TAUQ**: scalar factors of the elementary reflectors which represent the orthogonal matrix `Q` as a [`Float64Array`][@stdlib/array/float64]. Length `min(M,N)`. +- **TAUP**: scalar factors of the elementary reflectors which represent the orthogonal matrix `P` as a [`Float64Array`][@stdlib/array/float64]. Length `min(M,N)`. +- **WORK**: workspace array as a [`Float64Array`][@stdlib/array/float64]. Length >= `max(M,N)`. + +The function returns an integer status code (`0` indicates success). + +Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views. + + + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); + +// Initial arrays... +var A0 = new Float64Array( [ 0.0, 0.0, 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +var D0 = new Float64Array( [ 0.0, 0.0, 0.0 ] ); +var E0 = new Float64Array( [ 0.0, 0.0 ] ); +var TAUQ0 = new Float64Array( [ 0.0, 0.0, 0.0 ] ); +var TAUP0 = new Float64Array( [ 0.0, 0.0, 0.0 ] ); +var WORK0 = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + +/* + A = [ + [ 1.0, 4.0 ], + [ 2.0, 5.0 ], + [ 3.0, 6.0 ] + ] +*/ + +// Create offset views... +var A1 = new Float64Array( A0.buffer, A0.BYTES_PER_ELEMENT*3 ); // start at 4th element +var D1 = new Float64Array( D0.buffer, D0.BYTES_PER_ELEMENT*1 ); // start at 2nd element +var E1 = new Float64Array( E0.buffer, E0.BYTES_PER_ELEMENT*1 ); // start at 2nd element +var TAUQ1 = new Float64Array( TAUQ0.buffer, TAUQ0.BYTES_PER_ELEMENT*1 ); // start at 2nd element +var TAUP1 = new Float64Array( TAUP0.buffer, TAUP0.BYTES_PER_ELEMENT*1 ); // start at 2nd element +var WORK1 = new Float64Array( WORK0.buffer, WORK0.BYTES_PER_ELEMENT*1 ); // start at 2nd element + +dgebd2( 'column-major', 3, 2, A1, 3, D1, E1, TAUQ1, TAUP1, WORK1 ); +// A0 => [ 0.0, 0.0, 0.0, ~-3.742, ~0.422, ~0.633, ~-8.552, ~1.964, ~0.86 ] +// D0 => [ 0.0, ~-3.742, ~1.964 ] +``` + + + +#### dgebd2.ndarray( M, N, A, sa1, sa2, oa, D, sd, od, E, se, oe, TAUQ, stq, otq, TAUP, stp, otp, WORK, sw, ow ) + +Reduces a real general `M` by `N` matrix `A` to upper or lower bi-diagonal form `B` by an orthogonal transformation: `Q**T * A * P = B` using alternative indexing semantics. + + + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); + +var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +var D = new Float64Array( [ 0.0, 0.0 ] ); +var E = new Float64Array( [ 0.0 ] ); +var TAUQ = new Float64Array( [ 0.0, 0.0 ] ); +var TAUP = new Float64Array( [ 0.0, 0.0 ] ); +var WORK = new Float64Array( [ 0.0, 0.0, 0.0 ] ); + +dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); +// A => [ ~-3.742, ~0.422, ~0.633, ~-8.552, ~1.964, ~0.86 ] +// D => [ ~-3.742, ~1.964 ] +// E => [ ~-8.552 ] +// TAUQ => [ ~1.267, ~1.15 ] +// TAUP => [ 0.0, 0.0 ] +// WORK => [ ~9.9, 0.0, 0.0 ] +``` + +The function has the following additional parameters: + +- **sa1**: stride of the first dimension of `A`. +- **sa2**: stride of the second dimension of `A`. +- **oa**: starting index for `A`. +- **D**: diagonal elements of the bi-diagonal m +- **sd**: stride length for `D`. +- **od**: starting index for `D`. +- **se**: stride length for `E`. +- **oe**: starting index for `E`. +- **stq**: stride length for `TAUQ`. +- **otq**: starting index for `TAUQ`. +- **stp**: stride length for `TAUP`. +- **otp**: starting index for `TAUP`. +- **sw**: stride length for `WORK`. +- **ow**: starting index for `WORK`. + +The function returns an integer status code (`0` indicates success). + +While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameters support indexing semantics based on starting indices. For example, + + + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); + +var A = new Float64Array( [ 0.0, 0.0, 0.0, 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +var D = new Float64Array( [ 0.0, 0.0, 0.0 ] ); +var E = new Float64Array( [ 0.0, 0.0 ] ); +var TAUQ = new Float64Array( [ 0.0, 0.0, 0.0 ] ); +var TAUP = new Float64Array( [ 0.0, 0.0, 0.0 ] ); +var WORK = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + +dgebd2.ndarray( 3, 2, A, 1, 3, 4, D, 1, 1, E, 1, 1, TAUQ, 1, 1, TAUP, 1, 1, WORK, 1, 1 ); +// A => [ 0.0, 0.0, 0.0, 0.0, ~-3.742, ~0.422, ~0.633, ~-8.552, ~1.964, ~0.86 ] +// D => [ 0.0, ~-3.742, ~1.964 ] +``` + +
+ + + +
+ +## Notes + +- Both functions mutate the input arrays `A`, `D`, `E`, `TAUQ`, `TAUP`, and `WORK`. + +- Both functions return a status code indicating success or failure. The status code indicates the following conditions: + + - `0`: reduction was successful. + +- `dgebd2()` corresponds to the [LAPACK][LAPACK] routine [`dgebd2`][lapack-dgebd2]. + +
+ + + +
+ +## Examples + + + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); +var ndarray2array = require( '@stdlib/ndarray/base/to-array' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var dgebd2 = require( '@stdlib/lapack/base/dgebd2' ); + +// Specify matrix meta data: +var shape = [ 4, 3 ]; +var order = 'column-major'; +var strides = shape2strides( shape, order ); + +// Create a matrix stored in linear memory: +var A = new Float64Array( [ 1.0, 5.0, 9.0, 13.0, 6.0, 10.0, 14.0, 2.0, 7.0, 11.0, 15.0, 3.0 ] ); // eslint-disable-line max-len +console.log( ndarray2array( A, shape, strides, 0, order ) ); + +// Allocate workspace: +var D = new Float64Array( 3 ); +var E = new Float64Array( 2 ); +var TAUQ = new Float64Array( 3 ); +var TAUP = new Float64Array( 3 ); +var WORK = new Float64Array( 4 ); + +// Reduce the matrix to bi-diagonal form: +var info = dgebd2( order, shape[ 0 ], shape[ 1 ], A, strides[ 0 ], D, E, TAUQ, TAUP, WORK ); // eslint-disable-line max-len + +console.log( ndarray2array( A, shape, strides, 0, order ) ); +console.log( D ); +console.log( E ); +console.log( TAUQ ); +console.log( TAUP ); +console.log( WORK ); +console.log( info ); +``` + +
+ + + + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +TODO +``` + +#### TODO + +TODO. + +```c +TODO +``` + +TODO + +```c +TODO +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +TODO +``` + +
+ + + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/lapack/base/dgebd2/benchmark/benchmark.js b/lib/node_modules/@stdlib/lapack/base/dgebd2/benchmark/benchmark.js new file mode 100644 index 000000000000..dca28a09a8a2 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgebd2/benchmark/benchmark.js @@ -0,0 +1,127 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var Float64Array = require( '@stdlib/array/float64' ); +var max = require( '@stdlib/math/base/special/max' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; +var dgebd2 = require( './../lib/dgebd2.js' ); + + +// VARIABLES // + +var LAYOUTS = [ + 'row-major', + 'column-major' +]; +var opts = { + 'dtype': 'float64' +}; + + +// 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 TAUQ; + var TAUP; + var WORK; + var A; + var D; + var E; + + A = discreteUniform( N*N, 1.0, 10.0, opts ); + D = new Float64Array( N ); + E = new Float64Array( max( 0, N - 1 ) ); + TAUQ = new Float64Array( N ); + TAUP = new Float64Array( N ); + WORK = new Float64Array( N ); + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + var z; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + z = dgebd2( order, N, N, A, N, D, E, TAUQ, TAUP, WORK ); + if ( z !== 0 ) { + b.fail( 'should return a success status code' ); + } + } + b.toc(); + if ( z !== 0 ) { + b.fail( 'should return a success status code' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var minPow; + var maxPow; + var order; + var N; + var f; + var i; + var j; + + minPow = 1; // 10^minPow + maxPow = 6; // 10^maxPow + + for ( j = 0; j < LAYOUTS.length; j++ ) { + order = LAYOUTS[ j ]; + for ( i = minPow; i <= maxPow; i++ ) { + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( order, N ); + bench( format( '%s::square_matrix:order=%s,size=%d', pkg, order, N*N ), f ); + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/lapack/base/dgebd2/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dgebd2/benchmark/benchmark.ndarray.js new file mode 100644 index 000000000000..cd6cc11f1f07 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgebd2/benchmark/benchmark.ndarray.js @@ -0,0 +1,138 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var Float64Array = require( '@stdlib/array/float64' ); +var max = require( '@stdlib/math/base/special/max' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var isColumnMajor = require( '@stdlib/ndarray/base/assert/is-column-major-string' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; +var dgebd2 = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var LAYOUTS = [ + 'row-major', + 'column-major' +]; +var opts = { + 'dtype': 'float64' +}; + + +// 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 TAUQ; + var TAUP; + var WORK; + var sa1; + var sa2; + var A; + var D; + var E; + + A = discreteUniform( N*N, 1.0, 10.0, opts ); + D = new Float64Array( N ); + E = new Float64Array( max( 0, N - 1 ) ); + TAUQ = new Float64Array( N ); + TAUP = new Float64Array( N ); + WORK = new Float64Array( N ); + + if ( isColumnMajor( order ) ) { + sa1 = 1; + sa2 = N; + } else { + sa1 = N; + sa2 = 1; + } + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + var z; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + z = dgebd2( N, N, A, sa1, sa2, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); + if ( z !== 0 ) { + b.fail( 'should return a success status code' ); + } + } + b.toc(); + if ( z !== 0 ) { + b.fail( 'should return a success status code' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var minPow; + var maxPow; + var order; + var N; + var f; + var i; + var j; + + minPow = 1; // 10^minPow + maxPow = 6; // 10^maxPow + + for ( j = 0; j < LAYOUTS.length; j++ ) { + order = LAYOUTS[ j ]; + for ( i = minPow; i <= maxPow; i++ ) { + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( order, N ); + bench( format( '%s:ndarray::square_matrix:order=%s,size=%d', pkg, order, N*N ), f ); + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/lapack/base/dgebd2/docs/repl.txt b/lib/node_modules/@stdlib/lapack/base/dgebd2/docs/repl.txt new file mode 100644 index 000000000000..d38fd44788bf --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgebd2/docs/repl.txt @@ -0,0 +1,202 @@ + +{{alias}}( order, M, N, A, LDA, D, E, TAUQ, TAUP, WORK ) + Reduces a real general M by N matrix A to upper or lower bi-diagonal form + B by an orthogonal transformation: Q**T * A * P = B. + + If `M >= N`, + + - `B` is upper bi-diagonal. + - The diagonal and the first superdiagonal are overwritten with the upper + bi-diagonal matrix `B`. + - The elements below the diagonal, with the array `TAUQ`, represent the + orthogonal matrix `Q` as a product of elementary reflectors. + - The elements above the first superdiagonal, with the array `TAUP`, + represent the orthogonal matrix `P` as a product of elementary reflectors. + + If `M < N`, + + - `B` is lower bi-diagonal. + - The diagonal and the first subdiagonal are overwritten with the lower + bi-diagonal matrix `B`. + - The elements below the first subdiagonal, with the array `TAUQ`, + represent the orthogonal matrix `Q` as a product of elementary reflectors. + - The elements above the diagonal, with the array `TAUP`, represent the + orthogonal matrix `P` as a product of elementary reflectors. + + Parameters + ---------- + order: string + Storage layout. Must be either 'row-major' or 'column-major'. + + M: integer + Number of rows of `A`. + + N: integer + Number of columns of `A`. + + A: Float64Array + Input/output matrix. On exit, `A` is overwritten. If `M >= N`, the + diagonal and first superdiagonal of `A` are overwritten by the upper + bi-diagonal matrix `B`. If `M < N`, the diagonal and first subdiagonal + are overwritten by the lower bi-diagonal matrix `B`. + + LDA: integer + Stride of the first dimension of `A` (a.k.a., leading dimension of the + matrix `A`). If `order = 'column-major'`, `LDA` must be at least + `max(1, M)`. If `order = 'row-major'`, `LDA` must be at least + `max(1, N)`. + + D: Float64Array + Diagonal elements of the bi-diagonal matrix `B`. Length `min(M,N)`. + + E: Float64Array + Off-diagonal elements of the bi-diagonal matrix `B`. Length + `min(M,N)-1`. + + TAUQ: Float64Array + Scalar factors of the elementary reflectors which represent the + orthogonal matrix `Q`. Length `min(M,N)`. + + TAUP: Float64Array + Scalar factors of the elementary reflectors which represent the + orthogonal matrix `P`. Length `min(M,N)`. + + WORK: Float64Array + Workspace array. Length >= `max(M,N)`. + + Returns + ------- + info: integer + Status code. Always returns `0` (success). + + Examples + -------- + > var A = new {{alias:@stdlib/array/float64}}([ 1.0,2.0,3.0,4.0,5.0,6.0 ]); + > var D = new {{alias:@stdlib/array/float64}}( [ 0.0, 0.0 ] ); + > var E = new {{alias:@stdlib/array/float64}}( [ 0.0 ] ); + > var TAUQ = new {{alias:@stdlib/array/float64}}( [ 0.0, 0.0 ] ); + > var TAUP = new {{alias:@stdlib/array/float64}}( [ 0.0, 0.0 ] ); + > var WORK = new {{alias:@stdlib/array/float64}}( [ 0.0, 0.0, 0.0 ] ); + > {{alias}}( 'column-major', 3, 2, A, 3, D, E, TAUQ, TAUP, WORK ) + 0 + > A + [ ~-3.742, ~0.422, ~0.633, ~-8.552, ~1.964, ~0.86 ] + > D + [ ~-3.742, ~1.964 ] + > E + [ ~-8.552 ] + > TAUQ + [ ~1.267, ~1.15 ] + > TAUP + [ 0.0, 0.0 ] + > WORK + [ ~9.9, 0.0, 0.0 ] + + +{{alias}}.ndarray(M,N,A,sa1,sa2,oa,D,sd,od,E,se,oe,TAUQ,stq,otq,TAUP,stp,otp,WORK,sw,ow) + Reduces a real general M by N matrix A to upper or lower bi-diagonal form + B by an orthogonal transformation: Q**T * A * P = B, using alternative + indexing semantics. + + While typed array views mandate a view offset based on the underlying + buffer, the offset parameters support indexing semantics based on starting + indices. + + Parameters + ---------- + M: integer + Number of rows of `A`. + + N: integer + Number of columns of `A`. + + A: Float64Array + Input/output matrix. + + sa1: integer + Stride of the first dimension of `A`. + + sa2: integer + Stride of the second dimension of `A`. + + oa: integer + Starting index for `A`. + + D: Float64Array + Diagonal elements of the bi-diagonal matrix `B`. Length `min(M,N)`. + + sd: integer + Stride length for `D`. + + od: integer + Starting index for `D`. + + E: Float64Array + Off-diagonal elements of the bi-diagonal matrix `B`. Length + `min(M,N)-1`. + + se: integer + Stride length for `E`. + + oe: integer + Starting index for `E`. + + TAUQ: Float64Array + Scalar factors of the elementary reflectors which represent the + orthogonal matrix `Q`. Length `min(M,N)`. + + stq: integer + Stride length for `TAUQ`. + + otq: integer + Starting index for `TAUQ`. + + TAUP: Float64Array + Scalar factors of the elementary reflectors which represent the + orthogonal matrix `P`. Length `min(M,N)`. + + stp: integer + Stride length for `TAUP`. + + otp: integer + Starting index for `TAUP`. + + WORK: Float64Array + Workspace array. Length >= `max(M,N)`. + + sw: integer + Stride length for `WORK`. + + ow: integer + Starting index for `WORK`. + + Returns + ------- + info: integer + Status code. Always returns `0` (success). + + Examples + -------- + > var A = new {{alias:@stdlib/array/float64}}([ 1.0,2.0,3.0,4.0,5.0,6.0 ]); + > var D = new {{alias:@stdlib/array/float64}}( [ 0.0, 0.0 ] ); + > var E = new {{alias:@stdlib/array/float64}}( [ 0.0 ] ); + > var TAUQ = new {{alias:@stdlib/array/float64}}( [ 0.0, 0.0 ] ); + > var TAUP = new {{alias:@stdlib/array/float64}}( [ 0.0, 0.0 ] ); + > var WORK = new {{alias:@stdlib/array/float64}}( [ 0.0, 0.0, 0.0 ] ); + > {{alias}}.ndarray( 3,2,A,1,3,0,D,1,0,E,1,0,TAUQ,1,0,TAUP,1,0,WORK,1,0 ) + 0 + > A + [ ~-3.742, ~0.422, ~0.633, ~-8.552, ~1.964, ~0.86 ] + > D + [ ~-3.742, ~1.964 ] + > E + [ ~-8.552 ] + > TAUQ + [ ~1.267, ~1.15 ] + > TAUP + [ 0.0, 0.0 ] + > WORK + [ ~9.9, 0.0, 0.0 ] + + See Also + -------- diff --git a/lib/node_modules/@stdlib/lapack/base/dgebd2/docs/types/index.d.ts b/lib/node_modules/@stdlib/lapack/base/dgebd2/docs/types/index.d.ts new file mode 100644 index 000000000000..db38855dd38e --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgebd2/docs/types/index.d.ts @@ -0,0 +1,206 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/// + +import { Layout } from '@stdlib/types/blas'; + +/** +* Status code. +* +* ## Notes +* +* The status code indicates the following conditions: +* +* - if equal to zero, then the reduction was successful. +*/ +type StatusCode = number; + +/** +* Interface describing `dgebd2`. +*/ +interface Routine { + /** + * Reduces a real general `M` by `N` matrix `A` to upper or lower bi-diagonal form `B` by an orthogonal transformation: `Q**T * A * P = B`. + * + * ## Notes + * + * - If `M >= N`, + * + * - `B` is upper bi-diagonal. + * - The diagonal and the first superdiagonal are overwritten with the upper bi-diagonal matrix `B`. + * - The elements below the diagonal, with the array `TAUQ`, represent the orthogonal matrix `Q` as a product of elementary reflectors. + * - The elements above the first superdiagonal, with the array `TAUP`, represent the orthogonal matrix `P` as a product of elementary reflectors. + * + * - If `M < N`, + * + * - `B` is lower bi-diagonal. + * - The diagonal and the first subdiagonal are overwritten with the lower bi-diagonal matrix `B`. + * - The elements below the first subdiagonal, with the array `TAUQ`, represent the orthogonal matrix `Q` as a product of elementary reflectors. + * - The elements above the diagonal, with the array `TAUP`, represent the orthogonal matrix `P` as a product of elementary reflectors. + * + * @param order - storage layout + * @param M - number of rows of `A` + * @param N - number of columns of `A` + * @param A - input/output matrix + * @param LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) + * @param D - diagonal elements of the bi-diagonal matrix `B` (length `min(M,N)`) + * @param E - off-diagonal elements of the bi-diagonal matrix `B`, (length `min(M,N)`-1) + * @param TAUQ - scalar factors of the elementary reflectors which represent the orthogonal matrix `Q` (length `min(M,N)`) + * @param TAUP - scalar factors of the elementary reflectors which represent the orthogonal matrix `P` (length `min(M,N)`) + * @param WORK - workspace array (length >= `max(M,N)`) + * @returns status code + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + * var D = new Float64Array( [ 0.0, 0.0 ] ); + * var E = new Float64Array( [ 0.0 ] ); + * var TAUQ = new Float64Array( [ 0.0, 0.0 ] ); + * var TAUP = new Float64Array( [ 0.0, 0.0 ] ); + * var WORK = new Float64Array( [ 0.0, 0.0, 0.0 ] ); + * + * dgebd2( 'column-major', 3, 2, A, 3, D, E, TAUQ, TAUP, WORK ); + * // A => [ ~-3.742, ~0.422, ~0.633, ~-8.552, ~1.964, ~0.86 ] + */ + ( order: Layout, M: number, N: number, A: Float64Array, LDA: number, D: Float64Array, E: Float64Array, TAUQ: Float64Array, TAUP: Float64Array, WORK: Float64Array ): StatusCode; + + /** + * Reduces a real general `M` by `N` matrix `A` to upper or lower bi-diagonal form `B` by an orthogonal transformation: `Q**T * A * P = B` using alternative indexing semantics. + * + * ## Notes + * + * - If `M >= N`, + * + * - `B` is upper bi-diagonal. + * - The diagonal and the first superdiagonal are overwritten with the upper bi-diagonal matrix `B`. + * - The elements below the diagonal, with the array `TAUQ`, represent the orthogonal matrix `Q` as a product of elementary reflectors. + * - The elements above the first superdiagonal, with the array `TAUP`, represent the orthogonal matrix `P` as a product of elementary reflectors. + * + * - If `M < N`, + * + * - `B` is lower bi-diagonal. + * - The diagonal and the first subdiagonal are overwritten with the lower bi-diagonal matrix `B`. + * - The elements below the first subdiagonal, with the array `TAUQ`, represent the orthogonal matrix `Q` as a product of elementary reflectors. + * - The elements above the diagonal, with the array `TAUP`, represent the orthogonal matrix `P` as a product of elementary reflectors. + * + * @param M - number of rows of `A` + * @param N - number of columns of `A` + * @param A - input/output matrix + * @param strideA1 - stride of the first dimension of `A` + * @param strideA2 - stride of the second dimension of `A` + * @param offsetA - starting index of `A` + * @param D - diagonal elements of the bi-diagonal matrix `B` (length `min(M,N)`) + * @param strideD - stride length for `D` + * @param offsetD - starting index of `D` + * @param E - off-diagonal elements of the bi-diagonal matrix `B`, (length `min(M,N)`-1) + * @param strideE - stride length for `E` + * @param offsetE - starting index of `E` + * @param TAUQ - scalar factors of the elementary reflectors which represent the orthogonal matrix `Q` (length `min(M,N)`) + * @param strideTAUQ - stride length for `TAUQ` + * @param offsetTAUQ - starting index of `TAUQ` + * @param TAUP - scalar factors of the elementary reflectors which represent the orthogonal matrix `P` (length `min(M,N)`) + * @param strideTAUP - stride length for `TAUP` + * @param offsetTAUP - starting index of `TAUP` + * @param WORK - workspace array (length >= `max(M,N)`) + * @param strideWORK - stride length for `WORK` + * @param offsetWORK - starting index of `WORK` + * @returns status code + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + * var D = new Float64Array( [ 0.0, 0.0 ] ); + * var E = new Float64Array( [ 0.0 ] ); + * var TAUQ = new Float64Array( [ 0.0, 0.0 ] ); + * var TAUP = new Float64Array( [ 0.0, 0.0 ] ); + * var WORK = new Float64Array( [ 0.0, 0.0, 0.0 ] ); + * + * dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); + * // A => [ ~-3.742, ~0.422, ~0.633, ~-8.552, ~1.964, ~0.86 ] + */ + ndarray( M: number, N: number, A: Float64Array, strideA1: number, strideA2: number, offsetA: number, D: Float64Array, strideD: number, offsetD: number, E: Float64Array, strideE: number, offsetE: number, TAUQ: Float64Array, strideTAUQ: number, offsetTAUQ: number, TAUP: Float64Array, strideTAUP: number, offsetTAUP: number, WORK: Float64Array, strideWORK: number, offsetWORK: number ): StatusCode; +} + +/** +* LAPACK routine to reduce a real general `M` by `N` matrix `A` to upper or lower bi-diagonal form `B` by an orthogonal transformation: `Q**T * A * P = B`. +* +* ## Notes +* +* - If `M >= N`, +* +* - `B` is upper bi-diagonal. +* - The diagonal and the first superdiagonal are overwritten with the upper bi-diagonal matrix `B`. +* - The elements below the diagonal, with the array `TAUQ`, represent the orthogonal matrix `Q` as a product of elementary reflectors. +* - The elements above the first superdiagonal, with the array `TAUP`, represent the orthogonal matrix `P` as a product of elementary reflectors. +* +* - If `M < N`, +* +* - `B` is lower bi-diagonal. +* - The diagonal and the first subdiagonal are overwritten with the lower bi-diagonal matrix `B`. +* - The elements below the first subdiagonal, with the array `TAUQ`, represent the orthogonal matrix `Q` as a product of elementary reflectors. +* - The elements above the diagonal, with the array `TAUP`, represent the orthogonal matrix `P` as a product of elementary reflectors. +* +* @param order - storage layout +* @param M - number of rows of `A` +* @param N - number of columns of `A` +* @param A - input/output matrix +* @param LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) +* @param D - diagonal elements of the bi-diagonal matrix `B` (length `min(M,N)`) +* @param E - off-diagonal elements of the bi-diagonal matrix `B`, (length `min(M,N)`-1) +* @param TAUQ - scalar factors of the elementary reflectors which represent the orthogonal matrix `Q` (length `min(M,N)`) +* @param TAUP - scalar factors of the elementary reflectors which represent the orthogonal matrix `P` (length `min(M,N)`) +* @param WORK - workspace array (length >= `max(M,N)`) +* @returns status code +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* var D = new Float64Array( [ 0.0, 0.0 ] ); +* var E = new Float64Array( [ 0.0 ] ); +* var TAUQ = new Float64Array( [ 0.0, 0.0 ] ); +* var TAUP = new Float64Array( [ 0.0, 0.0 ] ); +* var WORK = new Float64Array( [ 0.0, 0.0, 0.0 ] ); +* +* dgebd2( 'column-major', 3, 2, A, 3, D, E, TAUQ, TAUP, WORK ); +* // A => [ ~-3.742, ~0.422, ~0.633, ~-8.552, ~1.964, ~0.86 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* var D = new Float64Array( [ 0.0, 0.0 ] ); +* var E = new Float64Array( [ 0.0 ] ); +* var TAUQ = new Float64Array( [ 0.0, 0.0 ] ); +* var TAUP = new Float64Array( [ 0.0, 0.0 ] ); +* var WORK = new Float64Array( [ 0.0, 0.0, 0.0 ] ); +* +* dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); +* // A => [ ~-3.742, ~0.422, ~0.633, ~-8.552, ~1.964, ~0.86 ] +*/ +declare var dgebd2: Routine; + + +// EXPORTS // + +export = dgebd2; diff --git a/lib/node_modules/@stdlib/lapack/base/dgebd2/docs/types/test.ts b/lib/node_modules/@stdlib/lapack/base/dgebd2/docs/types/test.ts new file mode 100644 index 000000000000..b8f13b7ee677 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgebd2/docs/types/test.ts @@ -0,0 +1,692 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +import dgebd2 = require( './index' ); + + +// TESTS // + +// The function returns a number... +{ + const A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const D = new Float64Array( [ 0.0, 0.0 ] ); + const E = new Float64Array( [ 0.0 ] ); + const TAUQ = new Float64Array( [ 0.0, 0.0 ] ); + const TAUP = new Float64Array( [ 0.0, 0.0 ] ); + const WORK = new Float64Array( [ 0.0, 0.0, 0.0 ] ); + + dgebd2( 'column-major', 3, 2, A, 3, D, E, TAUQ, TAUP, WORK ); // $ExpectType number +} + +// The compiler throws an error if the function is provided a first argument which is not a valid order... +{ + const A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const D = new Float64Array( [ 0.0, 0.0 ] ); + const E = new Float64Array( [ 0.0 ] ); + const TAUQ = new Float64Array( [ 0.0, 0.0 ] ); + const TAUP = new Float64Array( [ 0.0, 0.0 ] ); + const WORK = new Float64Array( [ 0.0, 0.0, 0.0 ] ); + + dgebd2( 5, 3, 2, A, 3, D, E, TAUQ, TAUP, WORK ); // $ExpectError + dgebd2( true, 3, 2, A, 3, D, E, TAUQ, TAUP, WORK ); // $ExpectError + dgebd2( false, 3, 2, A, 3, D, E, TAUQ, TAUP, WORK ); // $ExpectError + dgebd2( null, 3, 2, A, 3, D, E, TAUQ, TAUP, WORK ); // $ExpectError + dgebd2( undefined, 3, 2, A, 3, D, E, TAUQ, TAUP, WORK ); // $ExpectError + dgebd2( [], 3, 2, A, 3, D, E, TAUQ, TAUP, WORK ); // $ExpectError + dgebd2( {}, 3, 2, A, 3, D, E, TAUQ, TAUP, WORK ); // $ExpectError + dgebd2( ( x: number ): number => x, 3, 2, A, 3, D, E, TAUQ, TAUP, WORK ); // $ExpectError +} + +// The compiler throws an error if the function is provided a second argument which is not a number... +{ + const A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const D = new Float64Array( [ 0.0, 0.0 ] ); + const E = new Float64Array( [ 0.0 ] ); + const TAUQ = new Float64Array( [ 0.0, 0.0 ] ); + const TAUP = new Float64Array( [ 0.0, 0.0 ] ); + const WORK = new Float64Array( [ 0.0, 0.0, 0.0 ] ); + + dgebd2( 'column-major', '5', 2, A, 3, D, E, TAUQ, TAUP, WORK ); // $ExpectError + dgebd2( 'column-major', true, 2, A, 3, D, E, TAUQ, TAUP, WORK ); // $ExpectError + dgebd2( 'column-major', false, 2, A, 3, D, E, TAUQ, TAUP, WORK ); // $ExpectError + dgebd2( 'column-major', null, 2, A, 3, D, E, TAUQ, TAUP, WORK ); // $ExpectError + dgebd2( 'column-major', undefined, 2, A, 3, D, E, TAUQ, TAUP, WORK ); // $ExpectError + dgebd2( 'column-major', [], 2, A, 3, D, E, TAUQ, TAUP, WORK ); // $ExpectError + dgebd2( 'column-major', {}, 2, A, 3, D, E, TAUQ, TAUP, WORK ); // $ExpectError + dgebd2( 'column-major', ( x: number ): number => x, 2, A, 3, D, E, TAUQ, TAUP, WORK ); // $ExpectError +} + +// The compiler throws an error if the function is provided a third argument which is not a number... +{ + const A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const D = new Float64Array( [ 0.0, 0.0 ] ); + const E = new Float64Array( [ 0.0 ] ); + const TAUQ = new Float64Array( [ 0.0, 0.0 ] ); + const TAUP = new Float64Array( [ 0.0, 0.0 ] ); + const WORK = new Float64Array( [ 0.0, 0.0, 0.0 ] ); + + dgebd2( 'column-major', 3, '5', A, 3, D, E, TAUQ, TAUP, WORK ); // $ExpectError + dgebd2( 'column-major', 3, true, A, 3, D, E, TAUQ, TAUP, WORK ); // $ExpectError + dgebd2( 'column-major', 3, false, A, 3, D, E, TAUQ, TAUP, WORK ); // $ExpectError + dgebd2( 'column-major', 3, null, A, 3, D, E, TAUQ, TAUP, WORK ); // $ExpectError + dgebd2( 'column-major', 3, undefined, A, 3, D, E, TAUQ, TAUP, WORK ); // $ExpectError + dgebd2( 'column-major', 3, [], A, 3, D, E, TAUQ, TAUP, WORK ); // $ExpectError + dgebd2( 'column-major', 3, {}, A, 3, D, E, TAUQ, TAUP, WORK ); // $ExpectError + dgebd2( 'column-major', 3, ( x: number ): number => x, A, 3, D, E, TAUQ, TAUP, WORK ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fourth argument which is not a Float64Array... +{ + const D = new Float64Array( [ 0.0, 0.0 ] ); + const E = new Float64Array( [ 0.0 ] ); + const TAUQ = new Float64Array( [ 0.0, 0.0 ] ); + const TAUP = new Float64Array( [ 0.0, 0.0 ] ); + const WORK = new Float64Array( [ 0.0, 0.0, 0.0 ] ); + + dgebd2( 'column-major', 3, 2, '5', 3, D, E, TAUQ, TAUP, WORK ); // $ExpectError + dgebd2( 'column-major', 3, 2, 5, 3, D, E, TAUQ, TAUP, WORK ); // $ExpectError + dgebd2( 'column-major', 3, 2, true, 3, D, E, TAUQ, TAUP, WORK ); // $ExpectError + dgebd2( 'column-major', 3, 2, false, 3, D, E, TAUQ, TAUP, WORK ); // $ExpectError + dgebd2( 'column-major', 3, 2, null, 3, D, E, TAUQ, TAUP, WORK ); // $ExpectError + dgebd2( 'column-major', 3, 2, undefined, 3, D, E, TAUQ, TAUP, WORK ); // $ExpectError + dgebd2( 'column-major', 3, 2, [], 3, D, E, TAUQ, TAUP, WORK ); // $ExpectError + dgebd2( 'column-major', 3, 2, {}, 3, D, E, TAUQ, TAUP, WORK ); // $ExpectError + dgebd2( 'column-major', 3, 2, ( x: number ): number => x, 3, D, E, TAUQ, TAUP, WORK ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fifth argument which is not a number... +{ + const A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const D = new Float64Array( [ 0.0, 0.0 ] ); + const E = new Float64Array( [ 0.0 ] ); + const TAUQ = new Float64Array( [ 0.0, 0.0 ] ); + const TAUP = new Float64Array( [ 0.0, 0.0 ] ); + const WORK = new Float64Array( [ 0.0, 0.0, 0.0 ] ); + + dgebd2( 'column-major', 3, 2, A, '5', D, E, TAUQ, TAUP, WORK ); // $ExpectError + dgebd2( 'column-major', 3, 2, A, true, D, E, TAUQ, TAUP, WORK ); // $ExpectError + dgebd2( 'column-major', 3, 2, A, false, D, E, TAUQ, TAUP, WORK ); // $ExpectError + dgebd2( 'column-major', 3, 2, A, null, D, E, TAUQ, TAUP, WORK ); // $ExpectError + dgebd2( 'column-major', 3, 2, A, undefined, D, E, TAUQ, TAUP, WORK ); // $ExpectError + dgebd2( 'column-major', 3, 2, A, [], D, E, TAUQ, TAUP, WORK ); // $ExpectError + dgebd2( 'column-major', 3, 2, A, {}, D, E, TAUQ, TAUP, WORK ); // $ExpectError + dgebd2( 'column-major', 3, 2, A, ( x: number ): number => x, D, E, TAUQ, TAUP, WORK ); // $ExpectError +} + +// The compiler throws an error if the function is provided a sixth argument which is not a Float64Array... +{ + const A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const E = new Float64Array( [ 0.0 ] ); + const TAUQ = new Float64Array( [ 0.0, 0.0 ] ); + const TAUP = new Float64Array( [ 0.0, 0.0 ] ); + const WORK = new Float64Array( [ 0.0, 0.0, 0.0 ] ); + + dgebd2( 'column-major', 3, 2, A, 3, '5', E, TAUQ, TAUP, WORK ); // $ExpectError + dgebd2( 'column-major', 3, 2, A, 3, 5, E, TAUQ, TAUP, WORK ); // $ExpectError + dgebd2( 'column-major', 3, 2, A, 3, true, E, TAUQ, TAUP, WORK ); // $ExpectError + dgebd2( 'column-major', 3, 2, A, 3, false, E, TAUQ, TAUP, WORK ); // $ExpectError + dgebd2( 'column-major', 3, 2, A, 3, null, E, TAUQ, TAUP, WORK ); // $ExpectError + dgebd2( 'column-major', 3, 2, A, 3, undefined, E, TAUQ, TAUP, WORK ); // $ExpectError + dgebd2( 'column-major', 3, 2, A, 3, [], E, TAUQ, TAUP, WORK ); // $ExpectError + dgebd2( 'column-major', 3, 2, A, 3, {}, E, TAUQ, TAUP, WORK ); // $ExpectError + dgebd2( 'column-major', 3, 2, A, 3, ( x: number ): number => x, E, TAUQ, TAUP, WORK ); // $ExpectError +} + +// The compiler throws an error if the function is provided a seventh argument which is not a Float64Array... +{ + const A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const D = new Float64Array( [ 0.0, 0.0 ] ); + const TAUQ = new Float64Array( [ 0.0, 0.0 ] ); + const TAUP = new Float64Array( [ 0.0, 0.0 ] ); + const WORK = new Float64Array( [ 0.0, 0.0, 0.0 ] ); + + dgebd2( 'column-major', 3, 2, A, 3, D, '5', TAUQ, TAUP, WORK ); // $ExpectError + dgebd2( 'column-major', 3, 2, A, 3, D, 5, TAUQ, TAUP, WORK ); // $ExpectError + dgebd2( 'column-major', 3, 2, A, 3, D, true, TAUQ, TAUP, WORK ); // $ExpectError + dgebd2( 'column-major', 3, 2, A, 3, D, false, TAUQ, TAUP, WORK ); // $ExpectError + dgebd2( 'column-major', 3, 2, A, 3, D, null, TAUQ, TAUP, WORK ); // $ExpectError + dgebd2( 'column-major', 3, 2, A, 3, D, undefined, TAUQ, TAUP, WORK ); // $ExpectError + dgebd2( 'column-major', 3, 2, A, 3, D, [], TAUQ, TAUP, WORK ); // $ExpectError + dgebd2( 'column-major', 3, 2, A, 3, D, {}, TAUQ, TAUP, WORK ); // $ExpectError + dgebd2( 'column-major', 3, 2, A, 3, D, ( x: number ): number => x, TAUQ, TAUP, WORK ); // $ExpectError +} + +// The compiler throws an error if the function is provided an eighth argument which is not a Float64Array... +{ + const A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const D = new Float64Array( [ 0.0, 0.0 ] ); + const E = new Float64Array( [ 0.0 ] ); + const TAUP = new Float64Array( [ 0.0, 0.0 ] ); + const WORK = new Float64Array( [ 0.0, 0.0, 0.0 ] ); + + dgebd2( 'column-major', 3, 2, A, 3, D, E, '5', TAUP, WORK ); // $ExpectError + dgebd2( 'column-major', 3, 2, A, 3, D, E, 5, TAUP, WORK ); // $ExpectError + dgebd2( 'column-major', 3, 2, A, 3, D, E, true, TAUP, WORK ); // $ExpectError + dgebd2( 'column-major', 3, 2, A, 3, D, E, false, TAUP, WORK ); // $ExpectError + dgebd2( 'column-major', 3, 2, A, 3, D, E, null, TAUP, WORK ); // $ExpectError + dgebd2( 'column-major', 3, 2, A, 3, D, E, undefined, TAUP, WORK ); // $ExpectError + dgebd2( 'column-major', 3, 2, A, 3, D, E, [], TAUP, WORK ); // $ExpectError + dgebd2( 'column-major', 3, 2, A, 3, D, E, {}, TAUP, WORK ); // $ExpectError + dgebd2( 'column-major', 3, 2, A, 3, D, E, ( x: number ): number => x, TAUP, WORK ); // $ExpectError +} + +// The compiler throws an error if the function is provided a ninth argument which is not a Float64Array... +{ + const A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const D = new Float64Array( [ 0.0, 0.0 ] ); + const E = new Float64Array( [ 0.0 ] ); + const TAUQ = new Float64Array( [ 0.0, 0.0 ] ); + const WORK = new Float64Array( [ 0.0, 0.0, 0.0 ] ); + + dgebd2( 'column-major', 3, 2, A, 3, D, E, TAUQ, '5', WORK ); // $ExpectError + dgebd2( 'column-major', 3, 2, A, 3, D, E, TAUQ, 5, WORK ); // $ExpectError + dgebd2( 'column-major', 3, 2, A, 3, D, E, TAUQ, true, WORK ); // $ExpectError + dgebd2( 'column-major', 3, 2, A, 3, D, E, TAUQ, false, WORK ); // $ExpectError + dgebd2( 'column-major', 3, 2, A, 3, D, E, TAUQ, null, WORK ); // $ExpectError + dgebd2( 'column-major', 3, 2, A, 3, D, E, TAUQ, undefined, WORK ); // $ExpectError + dgebd2( 'column-major', 3, 2, A, 3, D, E, TAUQ, [], WORK ); // $ExpectError + dgebd2( 'column-major', 3, 2, A, 3, D, E, TAUQ, {}, WORK ); // $ExpectError + dgebd2( 'column-major', 3, 2, A, 3, D, E, TAUQ, ( x: number ): number => x, WORK ); // $ExpectError +} + +// The compiler throws an error if the function is provided a tenth argument which is not a Float64Array... +{ + const A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const D = new Float64Array( [ 0.0, 0.0 ] ); + const E = new Float64Array( [ 0.0 ] ); + const TAUQ = new Float64Array( [ 0.0, 0.0 ] ); + const TAUP = new Float64Array( [ 0.0, 0.0 ] ); + + dgebd2( 'column-major', 3, 2, A, 3, D, E, TAUQ, TAUP, '5' ); // $ExpectError + dgebd2( 'column-major', 3, 2, A, 3, D, E, TAUQ, TAUP, 5 ); // $ExpectError + dgebd2( 'column-major', 3, 2, A, 3, D, E, TAUQ, TAUP, true ); // $ExpectError + dgebd2( 'column-major', 3, 2, A, 3, D, E, TAUQ, TAUP, false ); // $ExpectError + dgebd2( 'column-major', 3, 2, A, 3, D, E, TAUQ, TAUP, null ); // $ExpectError + dgebd2( 'column-major', 3, 2, A, 3, D, E, TAUQ, TAUP, undefined ); // $ExpectError + dgebd2( 'column-major', 3, 2, A, 3, D, E, TAUQ, TAUP, [] ); // $ExpectError + dgebd2( 'column-major', 3, 2, A, 3, D, E, TAUQ, TAUP, {} ); // $ExpectError + dgebd2( 'column-major', 3, 2, A, 3, D, E, TAUQ, TAUP, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + const A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const D = new Float64Array( [ 0.0, 0.0 ] ); + const E = new Float64Array( [ 0.0 ] ); + const TAUQ = new Float64Array( [ 0.0, 0.0 ] ); + const TAUP = new Float64Array( [ 0.0, 0.0 ] ); + const WORK = new Float64Array( [ 0.0, 0.0, 0.0 ] ); + + dgebd2(); // $ExpectError + dgebd2( 'column-major' ); // $ExpectError + dgebd2( 'column-major', 3 ); // $ExpectError + dgebd2( 'column-major', 3, 2 ); // $ExpectError + dgebd2( 'column-major', 3, 2, A ); // $ExpectError + dgebd2( 'column-major', 3, 2, A, 3 ); // $ExpectError + dgebd2( 'column-major', 3, 2, A, 3, D ); // $ExpectError + dgebd2( 'column-major', 3, 2, A, 3, D, E ); // $ExpectError + dgebd2( 'column-major', 3, 2, A, 3, D, E, TAUQ ); // $ExpectError + dgebd2( 'column-major', 3, 2, A, 3, D, E, TAUQ, TAUP ); // $ExpectError + dgebd2( 'column-major', 3, 2, A, 3, D, E, TAUQ, TAUP, WORK, 10 ); // $ExpectError +} + +// Attached to main export is an `ndarray` method which returns a number... +{ + const A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const D = new Float64Array( [ 0.0, 0.0 ] ); + const E = new Float64Array( [ 0.0 ] ); + const TAUQ = new Float64Array( [ 0.0, 0.0 ] ); + const TAUP = new Float64Array( [ 0.0, 0.0 ] ); + const WORK = new Float64Array( [ 0.0, 0.0, 0.0 ] ); + + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectType number +} + +// The compiler throws an error if the function is provided a first argument which is not a number... +{ + const A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const D = new Float64Array( [ 0.0, 0.0 ] ); + const E = new Float64Array( [ 0.0 ] ); + const TAUQ = new Float64Array( [ 0.0, 0.0 ] ); + const TAUP = new Float64Array( [ 0.0, 0.0 ] ); + const WORK = new Float64Array( [ 0.0, 0.0, 0.0 ] ); + + dgebd2.ndarray( '5', 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( true, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( false, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( null, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( undefined, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( [], 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( {}, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( ( x: number ): number => x, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a second argument which is not a number... +{ + const A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const D = new Float64Array( [ 0.0, 0.0 ] ); + const E = new Float64Array( [ 0.0 ] ); + const TAUQ = new Float64Array( [ 0.0, 0.0 ] ); + const TAUP = new Float64Array( [ 0.0, 0.0 ] ); + const WORK = new Float64Array( [ 0.0, 0.0, 0.0 ] ); + + dgebd2.ndarray( 3, '5', A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, true, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, false, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, null, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, undefined, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, [], A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, {}, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, ( x: number ): number => x, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a third argument which is not a Float64Array... +{ + const D = new Float64Array( [ 0.0, 0.0 ] ); + const E = new Float64Array( [ 0.0 ] ); + const TAUQ = new Float64Array( [ 0.0, 0.0 ] ); + const TAUP = new Float64Array( [ 0.0, 0.0 ] ); + const WORK = new Float64Array( [ 0.0, 0.0, 0.0 ] ); + + dgebd2.ndarray( 3, 2, '5', 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, 5, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, true, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, false, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, null, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, undefined, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, [], 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, {}, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, ( x: number ): number => x, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fourth argument which is not a number... +{ + const A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const D = new Float64Array( [ 0.0, 0.0 ] ); + const E = new Float64Array( [ 0.0 ] ); + const TAUQ = new Float64Array( [ 0.0, 0.0 ] ); + const TAUP = new Float64Array( [ 0.0, 0.0 ] ); + const WORK = new Float64Array( [ 0.0, 0.0, 0.0 ] ); + + dgebd2.ndarray( 3, 2, A, '5', 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, true, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, false, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, null, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, undefined, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, [], 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, {}, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, ( x: number ): number => x, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fifth argument which is not a number... +{ + const A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const D = new Float64Array( [ 0.0, 0.0 ] ); + const E = new Float64Array( [ 0.0 ] ); + const TAUQ = new Float64Array( [ 0.0, 0.0 ] ); + const TAUP = new Float64Array( [ 0.0, 0.0 ] ); + const WORK = new Float64Array( [ 0.0, 0.0, 0.0 ] ); + + dgebd2.ndarray( 3, 2, A, 1, '5', 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, true, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, false, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, null, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, undefined, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, [], 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, {}, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, ( x: number ): number => x, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a sixth argument which is not a number... +{ + const A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const D = new Float64Array( [ 0.0, 0.0 ] ); + const E = new Float64Array( [ 0.0 ] ); + const TAUQ = new Float64Array( [ 0.0, 0.0 ] ); + const TAUP = new Float64Array( [ 0.0, 0.0 ] ); + const WORK = new Float64Array( [ 0.0, 0.0, 0.0 ] ); + + dgebd2.ndarray( 3, 2, A, 1, 3, '5', D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, true, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, false, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, null, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, undefined, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, [], D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, {}, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, ( x: number ): number => x, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a seventh argument which is not a Float64Array... +{ + const A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const E = new Float64Array( [ 0.0 ] ); + const TAUQ = new Float64Array( [ 0.0, 0.0 ] ); + const TAUP = new Float64Array( [ 0.0, 0.0 ] ); + const WORK = new Float64Array( [ 0.0, 0.0, 0.0 ] ); + + dgebd2.ndarray( 3, 2, A, 1, 3, 0, '5', 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, 5, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, true, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, false, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, null, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, undefined, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, [], 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, {}, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, ( x: number ): number => x, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided an eighth argument which is not a number... +{ + const A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const D = new Float64Array( [ 0.0, 0.0 ] ); + const E = new Float64Array( [ 0.0 ] ); + const TAUQ = new Float64Array( [ 0.0, 0.0 ] ); + const TAUP = new Float64Array( [ 0.0, 0.0 ] ); + const WORK = new Float64Array( [ 0.0, 0.0, 0.0 ] ); + + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, '5', 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, true, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, false, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, null, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, undefined, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, [], 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, {}, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, ( x: number ): number => x, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a ninth argument which is not a number... +{ + const A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const D = new Float64Array( [ 0.0, 0.0 ] ); + const E = new Float64Array( [ 0.0 ] ); + const TAUQ = new Float64Array( [ 0.0, 0.0 ] ); + const TAUP = new Float64Array( [ 0.0, 0.0 ] ); + const WORK = new Float64Array( [ 0.0, 0.0, 0.0 ] ); + + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, '5', E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, true, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, false, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, null, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, undefined, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, [], E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, {}, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, ( x: number ): number => x, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a tenth argument which is not a Float64Array... +{ + const A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const D = new Float64Array( [ 0.0, 0.0 ] ); + const TAUQ = new Float64Array( [ 0.0, 0.0 ] ); + const TAUP = new Float64Array( [ 0.0, 0.0 ] ); + const WORK = new Float64Array( [ 0.0, 0.0, 0.0 ] ); + + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, '5', 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, 5, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, true, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, false, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, null, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, undefined, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, [], 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, {}, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, ( x: number ): number => x, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided an eleventh argument which is not a number... +{ + const A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const D = new Float64Array( [ 0.0, 0.0 ] ); + const E = new Float64Array( [ 0.0 ] ); + const TAUQ = new Float64Array( [ 0.0, 0.0 ] ); + const TAUP = new Float64Array( [ 0.0, 0.0 ] ); + const WORK = new Float64Array( [ 0.0, 0.0, 0.0 ] ); + + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, '5', 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, true, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, false, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, null, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, undefined, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, [], 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, {}, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, ( x: number ): number => x, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a twelfth argument which is not a number... +{ + const A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const D = new Float64Array( [ 0.0, 0.0 ] ); + const E = new Float64Array( [ 0.0 ] ); + const TAUQ = new Float64Array( [ 0.0, 0.0 ] ); + const TAUP = new Float64Array( [ 0.0, 0.0 ] ); + const WORK = new Float64Array( [ 0.0, 0.0, 0.0 ] ); + + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, '5', TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, true, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, false, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, null, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, undefined, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, [], TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, {}, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, ( x: number ): number => x, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a thirteenth argument which is not a Float64Array... +{ + const A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const D = new Float64Array( [ 0.0, 0.0 ] ); + const E = new Float64Array( [ 0.0 ] ); + const TAUP = new Float64Array( [ 0.0, 0.0 ] ); + const WORK = new Float64Array( [ 0.0, 0.0, 0.0 ] ); + + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, '5', 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, 5, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, true, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, false, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, null, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, undefined, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, [], 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, {}, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, ( x: number ): number => x, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fourteenth argument which is not a number... +{ + const A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const D = new Float64Array( [ 0.0, 0.0 ] ); + const E = new Float64Array( [ 0.0 ] ); + const TAUQ = new Float64Array( [ 0.0, 0.0 ] ); + const TAUP = new Float64Array( [ 0.0, 0.0 ] ); + const WORK = new Float64Array( [ 0.0, 0.0, 0.0 ] ); + + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, '5', 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, true, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, false, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, null, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, undefined, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, [], 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, {}, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, ( x: number ): number => x, 0, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fifteenth argument which is not a number... +{ + const A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const D = new Float64Array( [ 0.0, 0.0 ] ); + const E = new Float64Array( [ 0.0 ] ); + const TAUQ = new Float64Array( [ 0.0, 0.0 ] ); + const TAUP = new Float64Array( [ 0.0, 0.0 ] ); + const WORK = new Float64Array( [ 0.0, 0.0, 0.0 ] ); + + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, '5', TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, true, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, false, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, null, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, undefined, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, [], TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, {}, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, ( x: number ): number => x, TAUP, 1, 0, WORK, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a sixteenth argument which is not a Float64Array... +{ + const A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const D = new Float64Array( [ 0.0, 0.0 ] ); + const E = new Float64Array( [ 0.0 ] ); + const TAUQ = new Float64Array( [ 0.0, 0.0 ] ); + const WORK = new Float64Array( [ 0.0, 0.0, 0.0 ] ); + + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, '5', 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, 5, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, true, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, false, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, null, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, undefined, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, [], 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, {}, 1, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, ( x: number ): number => x, 1, 0, WORK, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a seventeenth argument which is not a number... +{ + const A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const D = new Float64Array( [ 0.0, 0.0 ] ); + const E = new Float64Array( [ 0.0 ] ); + const TAUQ = new Float64Array( [ 0.0, 0.0 ] ); + const TAUP = new Float64Array( [ 0.0, 0.0 ] ); + const WORK = new Float64Array( [ 0.0, 0.0, 0.0 ] ); + + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, '5', 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, true, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, false, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, null, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, undefined, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, [], 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, {}, 0, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, ( x: number ): number => x, 0, WORK, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided an eighteenth argument which is not a number... +{ + const A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const D = new Float64Array( [ 0.0, 0.0 ] ); + const E = new Float64Array( [ 0.0 ] ); + const TAUQ = new Float64Array( [ 0.0, 0.0 ] ); + const TAUP = new Float64Array( [ 0.0, 0.0 ] ); + const WORK = new Float64Array( [ 0.0, 0.0, 0.0 ] ); + + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, '5', WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, true, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, false, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, null, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, undefined, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, [], WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, {}, WORK, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, ( x: number ): number => x, WORK, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a nineteenth argument which is not a Float64Array... +{ + const A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const D = new Float64Array( [ 0.0, 0.0 ] ); + const E = new Float64Array( [ 0.0 ] ); + const TAUQ = new Float64Array( [ 0.0, 0.0 ] ); + const TAUP = new Float64Array( [ 0.0, 0.0 ] ); + + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, '5', 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, 5, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, true, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, false, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, null, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, undefined, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, [], 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, {}, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, ( x: number ): number => x, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a twentieth argument which is not a number... +{ + const A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const D = new Float64Array( [ 0.0, 0.0 ] ); + const E = new Float64Array( [ 0.0 ] ); + const TAUQ = new Float64Array( [ 0.0, 0.0 ] ); + const TAUP = new Float64Array( [ 0.0, 0.0 ] ); + const WORK = new Float64Array( [ 0.0, 0.0, 0.0 ] ); + + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, '5', 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, true, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, false, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, null, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, undefined, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, [], 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, {}, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, ( x: number ): number => x, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a twenty-first argument which is not a number... +{ + const A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const D = new Float64Array( [ 0.0, 0.0 ] ); + const E = new Float64Array( [ 0.0 ] ); + const TAUQ = new Float64Array( [ 0.0, 0.0 ] ); + const TAUP = new Float64Array( [ 0.0, 0.0 ] ); + const WORK = new Float64Array( [ 0.0, 0.0, 0.0 ] ); + + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, '5' ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, true ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, false ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, null ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, undefined ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, [] ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, {} ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + const A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const D = new Float64Array( [ 0.0, 0.0 ] ); + const E = new Float64Array( [ 0.0 ] ); + const TAUQ = new Float64Array( [ 0.0, 0.0 ] ); + const TAUP = new Float64Array( [ 0.0, 0.0 ] ); + const WORK = new Float64Array( [ 0.0, 0.0, 0.0 ] ); + + dgebd2.ndarray(); // $ExpectError + dgebd2.ndarray( 3 ); // $ExpectError + dgebd2.ndarray( 3, 2 ); // $ExpectError + dgebd2.ndarray( 3, 2, A ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1 ); // $ExpectError + dgebd2.ndarray( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0, 10 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/lapack/base/dgebd2/examples/index.js b/lib/node_modules/@stdlib/lapack/base/dgebd2/examples/index.js new file mode 100644 index 000000000000..561ee402816a --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgebd2/examples/index.js @@ -0,0 +1,53 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var Float64Array = require( '@stdlib/array/float64' ); +var ndarray2array = require( '@stdlib/ndarray/base/to-array' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var dgebd2 = require( './../lib' ); + +// Specify matrix meta data: +var shape = [ 3, 2 ]; +var order = 'column-major'; +var strides = shape2strides( shape, order ); + +// Create a matrix stored in linear memory: +var A = new Float64Array( [ 1.0, 4.0, 5.0, 2.0, 3.0, 6.0 ] ); +console.log( ndarray2array( A, shape, strides, 0, order ) ); + +// Allocate workspace: +var D = new Float64Array( 2 ); +var E = new Float64Array( 1 ); +var TAUQ = new Float64Array( 2 ); +var TAUP = new Float64Array( 2 ); +var WORK = new Float64Array( 3 ); + +// Reduce the matrix to bi-diagonal form: +var info = dgebd2( order, shape[ 0 ], shape[ 1 ], A, strides[ 0 ], D, E, TAUQ, TAUP, WORK ); // eslint-disable-line max-len + +console.log( '' ); +console.log( 'A after reduction:' ); +console.log( ndarray2array( A, shape, strides, 0, order ) ); +console.log( 'D:', D ); +console.log( 'E:', E ); +console.log( 'TAUQ:', TAUQ ); +console.log( 'TAUP:', TAUP ); +console.log( 'WORK:', WORK ); +console.log( 'info:', info ); diff --git a/lib/node_modules/@stdlib/lapack/base/dgebd2/lib/base.js b/lib/node_modules/@stdlib/lapack/base/dgebd2/lib/base.js new file mode 100644 index 000000000000..371215257c82 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgebd2/lib/base.js @@ -0,0 +1,189 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-len, max-params */ + +'use strict'; + +// MODULES // + +var dlarf1f = require( '@stdlib/lapack/base/dlarf1f' ).ndarray; +var min = require( '@stdlib/math/base/special/min' ); +var Float64Array = require( '@stdlib/array/float64' ); +var dlarfg = require( './dlarfg.js' ); + + +// MAIN // + +/** +* Reduces a real general `M` by `N` matrix `A` to upper or lower bi-diagonal form `B` by an orthogonal transformation: `Q**T * A * P = B`. +* +* ## Notes +* +* - If `M >= N`, +* +* - `B` is upper bi-diagonal. +* - The diagonal and the first superdiagonal are overwritten with the upper bi-diagonal matrix `B`. +* - The elements below the diagonal, with the array `TAUQ`, represent the orthogonal matrix `Q` as a product of elementary reflectors. +* - The elements above the first superdiagonal, with the array `TAUP`, represent the orthogonal matrix `P` as a product of elementary reflectors. +* +* - If `M < N`, +* +* - `B` is lower bi-diagonal. +* - The diagonal and the first subdiagonal are overwritten with the lower bi-diagonal matrix `B`. +* - The elements below the first subdiagonal, with the array `TAUQ`, represent the orthogonal matrix `Q` as a product of elementary reflectors. +* - The elements above the diagonal, with the array `TAUP`, represent the orthogonal matrix `P` as a product of elementary reflectors. +* +* @private +* @param {NonNegativeInteger} M - number of rows of `A` +* @param {NonNegativeInteger} N - number of columns of `A` +* @param {Float64Array} A - input/output matrix +* @param {integer} strideA1 - stride of the first dimension of `A` +* @param {integer} strideA2 - stride of the second dimension of `A` +* @param {NonNegativeInteger} offsetA - starting index of `A` +* @param {Float64Array} D - diagonal elements of the bi-diagonal matrix `B` (length `min(M,N)`) +* @param {integer} strideD - stride length for `D` +* @param {NonNegativeInteger} offsetD - starting index of `D` +* @param {Float64Array} E - off-diagonal elements of the bi-diagonal matrix `B`, (length `min(M,N)`-1) +* @param {integer} strideE - stride length for `E` +* @param {NonNegativeInteger} offsetE - starting index of `E` +* @param {Float64Array} TAUQ - scalar factors of the elementary reflectors which represent the orthogonal matrix `Q` (length `min(M,N)`) +* @param {integer} strideTAUQ - stride length for `TAUQ` +* @param {NonNegativeInteger} offsetTAUQ - starting index of `TAUQ` +* @param {Float64Array} TAUP - scalar factors of the elementary reflectors which represent the orthogonal matrix `P` (length `min(M,N)`) +* @param {integer} strideTAUP - stride length for `TAUP` +* @param {NonNegativeInteger} offsetTAUP - starting index of `TAUP` +* @param {Float64Array} WORK - workspace array (length >= `max(M,N)`) +* @param {integer} strideWORK - stride length for `WORK` +* @param {NonNegativeInteger} offsetWORK - starting index of `WORK` +* @returns {integer} status code +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* var D = new Float64Array( [ 0.0, 0.0 ] ); +* var E = new Float64Array( [ 0.0 ] ); +* var TAUQ = new Float64Array( [ 0.0, 0.0 ] ); +* var TAUP = new Float64Array( [ 0.0, 0.0 ] ); +* var WORK = new Float64Array( [ 0.0, 0.0, 0.0 ] ); +* +* dgebd2( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); +* // A => [ ~-3.742, ~0.422, ~0.633, ~-8.552, ~1.964, ~0.86 ] +* // D => [ ~-3.742, ~1.964 ] +* // E => [ ~-8.552 ] +* // TAUQ => [ ~1.267, ~1.15 ] +* // TAUP => [ 0.0, 0.0 ] +* // WORK => [ ~9.9, 0.0, 0.0 ] +*/ +function dgebd2( M, N, A, strideA1, strideA2, offsetA, D, strideD, offsetD, E, strideE, offsetE, TAUQ, strideTAUQ, offsetTAUQ, TAUP, strideTAUP, offsetTAUP, WORK, strideWORK, offsetWORK ) { // eslint-disable-line stdlib/jsdoc-doctest-decimal-point + var aii; + var out; + var i; + + if ( M === 0 || N === 0 ) { + return 0; + } + + out = new Float64Array( 2 ); + + if ( M >= N ) { + // Reduce to upper bi-diagonal form + for ( i = 0; i < N; i++ ) { + aii = offsetA + ( i * strideA1 ) + ( i * strideA2 ); // Index of A(i, i) + + // Generate elementary reflector H(i) to annihilate A(i+1:M-1, i) + out[ 0 ] = A[ aii ]; + + dlarfg( M - i, A, strideA1, offsetA + ( min( i + 1, M - 1 ) * strideA1 ) + ( i * strideA2 ), out, 1, 0 ); + + A[ aii ] = out[ 0 ]; + TAUQ[ offsetTAUQ + ( strideTAUQ * i ) ] = out[ 1 ]; + + // D(i) = A(i,i) (the computed beta) + D[ offsetD + ( i * strideD ) ] = A[ aii ]; + + // Apply H(i) to A(i:M-1, i+1:N-1) from the left + if ( i < N - 1 ) { + dlarf1f( 'left', M - i, N - i - 1, A, strideA1, aii, TAUQ[ offsetTAUQ + ( i * strideTAUQ ) ], A, strideA1, strideA2, aii + strideA2, WORK, strideWORK, offsetWORK ); + } + + if ( i < N - 1 ) { + // Generate elementary reflector G(i) to annihilate A(i, i+2:N-1) + out[ 0 ] = A[ aii + strideA2 ]; + + dlarfg( N - i - 1, A, strideA2, offsetA + ( i * strideA1 ) + ( min( i + 2, N - 1 ) * strideA2 ), out, 1, 0 ); + + A[ aii + strideA2 ] = out[ 0 ]; + TAUP[ offsetTAUP + ( strideTAUP * i ) ] = out[ 1 ]; + + // E(i) = A(i, i+1) (the computed beta) + E[ offsetE + ( i * strideE ) ] = A[ aii + strideA2 ]; + + // Apply G(i) to A(i+1:M-1, i+1:N-1) from the right + dlarf1f( 'right', M - i - 1, N - i - 1, A, strideA2, aii + strideA2, TAUP[ offsetTAUP + ( i * strideTAUP ) ], A, strideA1, strideA2, aii + strideA1 + strideA2, WORK, strideWORK, offsetWORK ); + } else { + TAUP[ offsetTAUP + ( i * strideTAUP ) ] = 0.0; + } + } + } else { + // Reduce to lower bi-diagonal form + for ( i = 0; i < M; i++ ) { + aii = offsetA + ( i * strideA1 ) + ( i * strideA2 ); // Index of A(i, i) + + // Generate elementary reflector G(i) to annihilate A(i, i+1:N-1) + out[ 0 ] = A[ aii ]; + dlarfg( N - i, A, strideA2, offsetA + ( i * strideA1 ) + ( min( i + 1, N - 1 ) * strideA2 ), out, 1, 0 ); + + A[ aii ] = out[ 0 ]; + TAUP[ offsetTAUP + ( strideTAUP * i ) ] = out[ 1 ]; + + // D(i) = A(i,i) (the computed beta) + D[ offsetD + ( i * strideD ) ] = A[ aii ]; + + // Apply G(i) to A(i+1:M-1, i:N-1) from the right + if ( i < M - 1 ) { + dlarf1f( 'right', M - i - 1, N - i, A, strideA2, aii, TAUP[ offsetTAUP + ( i * strideTAUP ) ], A, strideA1, strideA2, aii + strideA1, WORK, strideWORK, offsetWORK ); + } + + if ( i < M - 1 ) { + // Generate elementary reflector H(i) to annihilate A(i+2:M-1, i) + out[ 0 ] = A[ aii + strideA1 ]; + dlarfg( M - i - 1, A, strideA1, offsetA + ( min( i + 2, M - 1 ) * strideA1 ) + ( i * strideA2 ), out, 1, 0 ); + + A[ aii + strideA1 ] = out[ 0 ]; + TAUQ[ offsetTAUQ + ( strideTAUQ * i ) ] = out[ 1 ]; + + // E(i) = A(i+1, i) (the computed beta) + E[ offsetE + ( i * strideE ) ] = A[ aii + strideA1 ]; + + // Apply H(i) to A(i+1:M-1, i+1:N-1) from the left + dlarf1f( 'left', M - i - 1, N - i - 1, A, strideA1, aii + strideA1, TAUQ[ offsetTAUQ + ( i * strideTAUQ ) ], A, strideA1, strideA2, aii + strideA1 + strideA2, WORK, strideWORK, offsetWORK ); + } else { + TAUQ[ offsetTAUQ + ( i * strideTAUQ ) ] = 0.0; + } + } + } + + return 0; +} + + +// EXPORTS // + +module.exports = dgebd2; diff --git a/lib/node_modules/@stdlib/lapack/base/dgebd2/lib/dgebd2.js b/lib/node_modules/@stdlib/lapack/base/dgebd2/lib/dgebd2.js new file mode 100644 index 000000000000..34bf9ec86fcf --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgebd2/lib/dgebd2.js @@ -0,0 +1,117 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var isLayout = require( '@stdlib/blas/base/assert/is-layout' ); +var isColumnMajor = require( '@stdlib/ndarray/base/assert/is-column-major-string' ); +var max = require( '@stdlib/math/base/special/max' ); +var format = require( '@stdlib/string/format' ); +var base = require( './base.js' ); + + +// MAIN // + +/** +* Reduces a real general `M` by `N` matrix `A` to upper or lower bi-diagonal form `B` by an orthogonal transformation: `Q**T * A * P = B`. +* +* ## Notes +* +* - If `M >= N`, +* +* - `B` is upper bi-diagonal. +* - The diagonal and the first superdiagonal are overwritten with the upper bi-diagonal matrix `B`. +* - The elements below the diagonal, with the array `TAUQ`, represent the orthogonal matrix `Q` as a product of elementary reflectors. +* - The elements above the first superdiagonal, with the array `TAUP`, represent the orthogonal matrix `P` as a product of elementary reflectors. +* +* - If `M < N`, +* +* - `B` is lower bi-diagonal. +* - The diagonal and the first subdiagonal are overwritten with the lower bi-diagonal matrix `B`. +* - The elements below the first subdiagonal, with the array `TAUQ`, represent the orthogonal matrix `Q` as a product of elementary reflectors. +* - The elements above the diagonal, with the array `TAUP`, represent the orthogonal matrix `P` as a product of elementary reflectors. +* +* @param {string} order - storage layout +* @param {NonNegativeInteger} M - number of rows of `A` +* @param {NonNegativeInteger} N - number of columns of `A` +* @param {Float64Array} A - input/output matrix +* @param {integer} LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) +* @param {Float64Array} D - diagonal elements of the bi-diagonal matrix `B` (length `min(M,N)`) +* @param {Float64Array} E - off-diagonal elements of the bi-diagonal matrix `B`, (length `min(M,N)`-1) +* @param {Float64Array} TAUQ - scalar factors of the elementary reflectors which represent the orthogonal matrix `Q` (length `min(M,N)`) +* @param {Float64Array} TAUP - scalar factors of the elementary reflectors which represent the orthogonal matrix `P` (length `min(M,N)`) +* @param {Float64Array} WORK - workspace array (length >= `max(M,N)`) +* @throws {TypeError} first argument must be a valid order +* @throws {RangeError} second argument must be a non-negative integer +* @throws {RangeError} third argument must be a non-negative integer +* @throws {RangeError} sixth argument must be a valid LDA value +* @returns {integer} status code +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* var D = new Float64Array( [ 0.0, 0.0 ] ); +* var E = new Float64Array( [ 0.0 ] ); +* var TAUQ = new Float64Array( [ 0.0, 0.0 ] ); +* var TAUP = new Float64Array( [ 0.0, 0.0 ] ); +* var WORK = new Float64Array( [ 0.0, 0.0, 0.0 ] ); +* +* dgebd2( 'column-major', 3, 2, A, 3, D, E, TAUQ, TAUP, WORK ); +* // A => [ ~-3.742, ~0.422, ~0.633, ~-8.552, ~1.964, ~0.86 ] +* // D => [ ~-3.742, ~1.964 ] +* // E => [ ~-8.552 ] +* // TAUQ => [ ~1.267, ~1.15 ] +* // TAUP => [ 0.0, 0.0 ] +* // WORK => [ ~9.9, 0.0, 0.0 ] +*/ +function dgebd2( order, M, N, A, LDA, D, E, TAUQ, TAUP, WORK ) { // eslint-disable-line stdlib/jsdoc-doctest-decimal-point + var sA1; + var sA2; + + if ( !isLayout( order ) ) { + throw new TypeError( format( 'invalid argument. First argument must be a valid order. Value: `%s`.', order ) ); + } + if ( M < 0 ) { + throw new RangeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%d`.', M ) ); + } + if ( N < 0 ) { + throw new RangeError( format( 'invalid argument. Third argument must be a nonnegative integer. Value: `%d`.', N ) ); + } + if ( isColumnMajor( order ) ) { + if ( LDA < max( 1, M ) ) { + throw new RangeError( format( 'invalid argument. Sixth argument must be greater than or equal to max(1,%d). Value: `%d`.', M, LDA ) ); + } + sA1 = 1; + sA2 = LDA; + } else { // order === 'row-major' + if ( LDA < max( 1, N ) ) { + throw new RangeError( format( 'invalid argument. Sixth argument must be greater than or equal to max(1,%d). Value: `%d`.', N, LDA ) ); + } + sA1 = LDA; + sA2 = 1; + } + return base( M, N, A, sA1, sA2, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); // eslint-disable-line max-len +} + + +// EXPORTS // + +module.exports = dgebd2; diff --git a/lib/node_modules/@stdlib/lapack/base/dgebd2/lib/dlarfg.js b/lib/node_modules/@stdlib/lapack/base/dgebd2/lib/dlarfg.js new file mode 100644 index 000000000000..04ab125dc7e7 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgebd2/lib/dlarfg.js @@ -0,0 +1,142 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var dnrm2 = require( '@stdlib/blas/base/dnrm2' ).ndarray; +var sign = require( '@stdlib/math/base/special/copysign' ); +var dlamch = require( '@stdlib/lapack/base/dlamch' ); +var abs = require( '@stdlib/math/base/special/abs' ); +var dscal = require( '@stdlib/blas/base/dscal' ).ndarray; +var dlapy2 = require( '@stdlib/lapack/base/dlapy2' ); + + +// MAIN // + +/** +* Generates a real elementary reflector `H` of order `N` such that applying `H` to a vector `[alpha; X]` zeros out `X`. +* +* `H` is a Householder matrix with the form: +* +* ```tex +* H \cdot \begin{bmatrix} \alpha \\ x \end{bmatrix} = \begin{bmatrix} \beta \\ 0 \end{bmatrix}, \quad \text{and} \quad H^T H = I +* ``` +* +* where: +* +* - `tau` is a scalar +* - `X` is a vector of length `N-1` +* - `beta` is a scalar value +* - `H` is an orthogonal matrix known as a Householder reflector. +* +* The reflector `H` is constructed in the form: +* +* ```tex +* H = I - \tau \begin{bmatrix}1 \\ v \end{bmatrix} \begin{bmatrix}1 & v^T \end{bmatrix} +* ``` +* +* where: +* +* - `tau` is a real scalar +* - `V` is a real vector of length `N-1` that defines the Householder vector +* - The vector `[1; V]` is the Householder direction. +* +* The values of `tau` and `V` are chosen so that applying `H` to the vector `[alpha; X]` results in a new vector `[beta; 0]`, i.e., only the first component remains nonzero. The reflector matrix `H` is symmetric and orthogonal, satisfying `H^T = H` and `H^T H = I` +* +* ## Special cases +* +* - If all elements of `X` are zero, then `tau = 0` and `H = I`, the identity matrix. +* - Otherwise, `tau` satisfies `1 ≤ tau ≤ 2`, ensuring numerical stability in transformations. +* +* ## Notes +* +* - `X` should have `N-1` indexed elements +* - The output array contains the following two elements: `alpha` and `tau` +* +* @private +* @param {NonNegativeInteger} N - number of rows/columns of the elementary reflector `H` +* @param {Float64Array} X - input vector +* @param {integer} strideX - stride length for `X` +* @param {NonNegativeInteger} offsetX - starting index of `X` +* @param {Float64Array} out - output array +* @param {integer} strideOut - stride length for `out` +* @param {NonNegativeInteger} offsetOut - starting index of `out` +* @returns {void} +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var X = new Float64Array( [ 2.0, 3.0, 4.0 ] ); +* var out = new Float64Array( [ 4.0, 0.0 ] ); +* +* dlarfg( 4, X, 1, 0, out, 1, 0 ); +* // X => [ ~0.19, ~0.28, ~0.37 ] +* // out => [ ~-6.7, ~1.6 ] +*/ +function dlarfg( N, X, strideX, offsetX, out, strideOut, offsetOut ) { + var safemin; + var rsafmin; + var xnorm; + var alpha; + var beta; + var tau; + var knt; + var i; + + if ( N <= 1 ) { + out[ offsetOut + strideOut ] = 0.0; + return; + } + + xnorm = dnrm2( N - 1, X, strideX, offsetX ); + alpha = out[ offsetOut ]; + + if ( xnorm === 0.0 ) { + out[ strideOut + offsetOut ] = 0.0; + } else { + beta = -1.0 * sign( dlapy2( alpha, xnorm ), alpha ); + safemin = dlamch( 'safemin' ) / dlamch( 'epsilon' ); + knt = 0; + if ( abs( beta ) < safemin ) { + rsafmin = 1.0 / safemin; + while ( abs( beta ) < safemin && knt < 20 ) { + knt += 1; + dscal( N-1, rsafmin, X, strideX, offsetX ); + beta *= rsafmin; + alpha *= rsafmin; + } + xnorm = dnrm2( N - 1, X, strideX, offsetX ); + beta = -1.0 * sign( dlapy2( alpha, xnorm ), alpha ); + } + tau = ( beta - alpha ) / beta; + dscal( N-1, 1.0 / ( alpha - beta ), X, strideX, offsetX ); + for ( i = 0; i < knt; i++ ) { + beta *= safemin; + } + + out[ offsetOut ] = beta; + out[ strideOut + offsetOut ] = tau; + } +} + + +// EXPORTS // + +module.exports = dlarfg; diff --git a/lib/node_modules/@stdlib/lapack/base/dgebd2/lib/index.js b/lib/node_modules/@stdlib/lapack/base/dgebd2/lib/index.js new file mode 100644 index 000000000000..e10c2426dd17 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgebd2/lib/index.js @@ -0,0 +1,69 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* LAPACK routine to reduce a real general `M` by `N` matrix `A` to upper or lower bi-diagonal form `B` by an orthogonal transformation: `Q**T * A * P = B`. +* +* @module @stdlib/lapack/base/dgebd2 +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var dgebd2 = require( '@stdlib/lapack/base/dgebd2' ); +* +* var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* var D = new Float64Array( [ 0.0, 0.0 ] ); +* var E = new Float64Array( [ 0.0 ] ); +* var TAUQ = new Float64Array( [ 0.0, 0.0 ] ); +* var TAUP = new Float64Array( [ 0.0, 0.0 ] ); +* var WORK = new Float64Array( [ 0.0, 0.0, 0.0 ] ); +* +* dgebd2( 'column-major', 3, 2, A, 3, D, E, TAUQ, TAUP, WORK ); +* // A => [ ~-3.742, ~0.422, ~0.633, ~-8.552, ~1.964, ~0.86 ] +* // D => [ ~-3.742, ~1.964 ] +* // E => [ ~-8.552 ] +* // TAUQ => [ ~1.267, ~1.15 ] +* // TAUP => [ 0.0, 0.0 ] +* // WORK => [ ~9.9, 0.0, 0.0 ] +*/ + +// MODULES // + +var join = require( 'path' ).join; +var tryRequire = require( '@stdlib/utils/try-require' ); +var isError = require( '@stdlib/assert/is-error' ); +var main = require( './main.js' ); + + +// MAIN // + +var dgebd2; +var tmp = tryRequire( join( __dirname, './native.js' ) ); +if ( isError( tmp ) ) { + dgebd2 = main; +} else { + dgebd2 = tmp; +} + + +// EXPORTS // + +module.exports = dgebd2; + +// exports: { "ndarray": "dgebd2.ndarray" } diff --git a/lib/node_modules/@stdlib/lapack/base/dgebd2/lib/main.js b/lib/node_modules/@stdlib/lapack/base/dgebd2/lib/main.js new file mode 100644 index 000000000000..a62d7480f36d --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgebd2/lib/main.js @@ -0,0 +1,35 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var dgebd2 = require( './dgebd2.js' ); +var ndarray = require( './ndarray.js' ); + + +// MAIN // + +setReadOnly( dgebd2, 'ndarray', ndarray ); + + +// EXPORTS // + +module.exports = dgebd2; diff --git a/lib/node_modules/@stdlib/lapack/base/dgebd2/lib/ndarray.js b/lib/node_modules/@stdlib/lapack/base/dgebd2/lib/ndarray.js new file mode 100644 index 000000000000..e2217026c76b --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgebd2/lib/ndarray.js @@ -0,0 +1,106 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-len */ + +'use strict'; + +// MODULES // + +var format = require( '@stdlib/string/format' ); +var base = require( './base.js' ); + + +// MAIN // + +/** +* Reduces a real general `M` by `N` matrix `A` to upper or lower bi-diagonal form `B` by an orthogonal transformation: `Q**T * A * P = B` using alternative indexing semantics. +* +* ## Notes +* +* - If `M >= N`, +* +* - `B` is upper bi-diagonal. +* - The diagonal and the first superdiagonal are overwritten with the upper bi-diagonal matrix `B`. +* - The elements below the diagonal, with the array `TAUQ`, represent the orthogonal matrix `Q` as a product of elementary reflectors. +* - The elements above the first superdiagonal, with the array `TAUP`, represent the orthogonal matrix `P` as a product of elementary reflectors. +* +* - If `M < N`, +* +* - `B` is lower bi-diagonal. +* - The diagonal and the first subdiagonal are overwritten with the lower bi-diagonal matrix `B`. +* - The elements below the first subdiagonal, with the array `TAUQ`, represent the orthogonal matrix `Q` as a product of elementary reflectors. +* - The elements above the diagonal, with the array `TAUP`, represent the orthogonal matrix `P` as a product of elementary reflectors. +* +* @param {NonNegativeInteger} M - number of rows of `A` +* @param {NonNegativeInteger} N - number of columns of `A` +* @param {Float64Array} A - input/output matrix +* @param {integer} strideA1 - stride of the first dimension of `A` +* @param {integer} strideA2 - stride of the second dimension of `A` +* @param {NonNegativeInteger} offsetA - starting index of `A` +* @param {Float64Array} D - diagonal elements of the bi-diagonal matrix `B` (length `min(M,N)`) +* @param {integer} strideD - stride length for `D` +* @param {NonNegativeInteger} offsetD - starting index of `D` +* @param {Float64Array} E - off-diagonal elements of the bi-diagonal matrix `B`, (length `min(M,N)`-1) +* @param {integer} strideE - stride length for `E` +* @param {NonNegativeInteger} offsetE - starting index of `E` +* @param {Float64Array} TAUQ - scalar factors of the elementary reflectors which represent the orthogonal matrix `Q` (length `min(M,N)`) +* @param {integer} strideTAUQ - stride length for `TAUQ` +* @param {NonNegativeInteger} offsetTAUQ - starting index of `TAUQ` +* @param {Float64Array} TAUP - scalar factors of the elementary reflectors which represent the orthogonal matrix `P` (length `min(M,N)`) +* @param {integer} strideTAUP - stride length for `TAUP` +* @param {NonNegativeInteger} offsetTAUP - starting index of `TAUP` +* @param {Float64Array} WORK - workspace array (length >= `max(M,N)`) +* @param {integer} strideWORK - stride length for `WORK` +* @param {NonNegativeInteger} offsetWORK - starting index of `WORK` +* @throws {RangeError} first argument must be a non-negative integer +* @throws {RangeError} second argument must be a non-negative integer +* @returns {integer} status code +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* var D = new Float64Array( [ 0.0, 0.0 ] ); +* var E = new Float64Array( [ 0.0 ] ); +* var TAUQ = new Float64Array( [ 0.0, 0.0 ] ); +* var TAUP = new Float64Array( [ 0.0, 0.0 ] ); +* var WORK = new Float64Array( [ 0.0, 0.0, 0.0 ] ); +* +* dgebd2( 3, 2, A, 1, 3, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 ); +* // A => [ ~-3.742, ~0.422, ~0.633, ~-8.552, ~1.964, ~0.86 ] +* // D => [ ~-3.742, ~1.964 ] +* // E => [ ~-8.552 ] +* // TAUQ => [ ~1.267, ~1.15 ] +* // TAUP => [ 0.0, 0.0 ] +* // WORK => [ ~9.9, 0.0, 0.0 ] +*/ +function dgebd2( M, N, A, strideA1, strideA2, offsetA, D, strideD, offsetD, E, strideE, offsetE, TAUQ, strideTAUQ, offsetTAUQ, TAUP, strideTAUP, offsetTAUP, WORK, strideWORK, offsetWORK ) { // eslint-disable-line max-params, stdlib/jsdoc-doctest-decimal-point + if ( M < 0 ) { + throw new RangeError( format( 'invalid argument. First argument must be a nonnegative integer. Value: `%d`.', M ) ); + } + if ( N < 0 ) { + throw new RangeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%d`.', N ) ); + } + return base( M, N, A, strideA1, strideA2, offsetA, D, strideD, offsetD, E, strideE, offsetE, TAUQ, strideTAUQ, offsetTAUQ, TAUP, strideTAUP, offsetTAUP, WORK, strideWORK, offsetWORK ); +} + + +// EXPORTS // + +module.exports = dgebd2; diff --git a/lib/node_modules/@stdlib/lapack/base/dgebd2/package.json b/lib/node_modules/@stdlib/lapack/base/dgebd2/package.json new file mode 100644 index 000000000000..45c909f22dee --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgebd2/package.json @@ -0,0 +1,69 @@ +{ + "name": "@stdlib/lapack/base/dgebd2", + "version": "0.0.0", + "description": "LAPACK routine to reduce a real general `M-by-N` matrix `A` to upper or lower bi-diagonal form `B` by an orthogonal transformation: `Q**T * A * P = B`.", + "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", + "dgebd2", + "reflector", + "linear", + "algebra", + "subroutines", + "array", + "ndarray", + "matrix", + "float64", + "double", + "float64array" + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dgebd2/test/fixtures/m_gt_n_col_maj.json b/lib/node_modules/@stdlib/lapack/base/dgebd2/test/fixtures/m_gt_n_col_maj.json new file mode 100644 index 000000000000..7e6f44cf4a1f --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgebd2/test/fixtures/m_gt_n_col_maj.json @@ -0,0 +1,70 @@ +{ + "order": "column-major", + + "M": 4, + "N": 3, + + "A": [ 1, 4, 7, 10, 2, 5, 8, 11, 3, 6, 9, 12 ], + "strideA1": 1, + "strideA2": 4, + "offsetA": 0, + "LDA": 4, + "A_mat": [ + [1, 2, 3], + [4, 5, 6], + [7, 8, 9], + [10, 11, 12] + ], + + "D": [ 0.0, 0.0, 0.0 ], + "strideD": 1, + "offsetD": 0, + + "E": [ 0.0, 0.0 ], + "strideE": 1, + "offsetE": 0, + + "TAUQ": [ 0.0, 0.0, 0.0 ], + "strideTAUQ": 1, + "offsetTAUQ": 0, + + "TAUP": [ 0.0, 0.0, 0.0 ], + "strideTAUP": 1, + "offsetTAUP": 0, + + "WORK": [ 0.0, 0.0, 0.0, 0.0 ], + "strideWORK": 1, + "offsetWORK": 0, + + "A_out": [ + -1.28840987267251244E+001, + 2.88099363072124304E-001, + 5.04173885376217545E-001, + 7.20248407680310732E-001, + 2.18764328274289781E+001, + 2.24623524029471699E+000, + -2.89441926772752989E-001, + -7.53280091176845135E-001, + 4.46943430176977907E-001, + -6.13281332054147366E-001, + -2.62506711171686623E-015, + 2.99577117869326559E-001 + ], + "A_out_mat": [ + [ -1.28840987267251244E+001, 2.18764328274289781E+001, 4.46943430176977907E-001 ], + [ 2.88099363072124304E-001, 2.24623524029471699E+000, -6.13281332054147366E-001 ], + [ 5.04173885376217545E-001,-2.89441926772752989E-001, -2.62506711171686623E-015 ], + [ 7.20248407680310732E-001, -7.53280091176845135E-001, 2.99577117869326559E-001 ] + ], + + "D_out": [ -1.28840987267251244E+001, 2.24623524029471699E+000, -2.62506711171686623E-015 ], + + "E_out": [ 2.18764328274289781E+001, -6.13281332054147366E-001 ], + + "TAUQ_out": [ 1.07761505257063339E+000, 1.21123479031999159E+000, 1.83528930130879742E+000 ], + + "TAUP_out": [ 1.66700224841884959E+000, 0.00000000000000000E+000, 0.00000000000000000E+000 ], + + "WORK_out": [ 6.13281332054149253E-001, -6.91394653143437621E-001, -1.79937244464231805E+000, 0.00000000000000000E+000 ] + +} diff --git a/lib/node_modules/@stdlib/lapack/base/dgebd2/test/fixtures/m_gt_n_row_maj.json b/lib/node_modules/@stdlib/lapack/base/dgebd2/test/fixtures/m_gt_n_row_maj.json new file mode 100644 index 000000000000..c64f04b7e8e4 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgebd2/test/fixtures/m_gt_n_row_maj.json @@ -0,0 +1,70 @@ +{ + "order": "row-major", + + "M": 4, + "N": 3, + + "A": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 ], + "strideA1": 3, + "strideA2": 1, + "offsetA": 0, + "LDA": 3, + "A_mat": [ + [1, 2, 3], + [4, 5, 6], + [7, 8, 9], + [10, 11, 12] + ], + + "D": [ 0.0, 0.0, 0.0 ], + "strideD": 1, + "offsetD": 0, + + "E": [ 0.0, 0.0 ], + "strideE": 1, + "offsetE": 0, + + "TAUQ": [ 0.0, 0.0, 0.0 ], + "strideTAUQ": 1, + "offsetTAUQ": 0, + + "TAUP": [ 0.0, 0.0, 0.0 ], + "strideTAUP": 1, + "offsetTAUP": 0, + + "WORK": [ 0.0, 0.0, 0.0, 0.0 ], + "strideWORK": 1, + "offsetWORK": 0, + + "A_out": [ + -1.28840987267251244E+001, + 2.18764328274289781E+001, + 4.46943430176977907E-001, + 2.88099363072124304E-001, + 2.24623524029471699E+000, + -6.13281332054147366E-001, + 5.04173885376217545E-001, + -2.89441926772752989E-001, + -2.62506711171686623E-015, + 7.20248407680310732E-001, + -7.53280091176845135E-001, + 2.99577117869326559E-001 + ], + "A_out_mat": [ + [ -1.28840987267251244E+001, 2.18764328274289781E+001, 4.46943430176977907E-001 ], + [ 2.88099363072124304E-001, 2.24623524029471699E+000, -6.13281332054147366E-001 ], + [ 5.04173885376217545E-001,-2.89441926772752989E-001, -2.62506711171686623E-015 ], + [ 7.20248407680310732E-001, -7.53280091176845135E-001, 2.99577117869326559E-001 ] + ], + + "D_out": [ -1.28840987267251244E+001, 2.24623524029471699E+000, -2.62506711171686623E-015 ], + + "E_out": [ 2.18764328274289781E+001, -6.13281332054147366E-001 ], + + "TAUQ_out": [ 1.07761505257063339E+000, 1.21123479031999159E+000, 1.83528930130879742E+000 ], + + "TAUP_out": [ 1.66700224841884959E+000, 0.00000000000000000E+000, 0.00000000000000000E+000 ], + + "WORK_out": [ 6.13281332054149253E-001, -6.91394653143437621E-001, -1.79937244464231805E+000, 0.00000000000000000E+000 ] + +} diff --git a/lib/node_modules/@stdlib/lapack/base/dgebd2/test/fixtures/m_lt_n_col_maj.json b/lib/node_modules/@stdlib/lapack/base/dgebd2/test/fixtures/m_lt_n_col_maj.json new file mode 100644 index 000000000000..ab5195fe11f3 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgebd2/test/fixtures/m_lt_n_col_maj.json @@ -0,0 +1,68 @@ +{ + "order": "column-major", + + "M": 3, + "N": 4, + + "A": [ 1, 4, 7, 10, 2, 5, 8, 11, 3, 6, 9, 12 ], + "strideA1": 3, + "strideA2": 1, + "offsetA": 0, + "LDA": 3, + "A_mat": [ + [1, 10, 8, 6], + [4, 2, 11, 9], + [7, 5, 3, 12] + ], + + "D": [ 0.0, 0.0, 0.0 ], + "strideD": 1, + "offsetD": 0, + + "E": [ 0.0, 0.0 ], + "strideE": 1, + "offsetE": 0, + + "TAUQ": [ 0.0, 0.0, 0.0 ], + "strideTAUQ": 1, + "offsetTAUQ": 0, + + "TAUP": [ 0.0, 0.0, 0.0 ], + "strideTAUP": 1, + "offsetTAUP": 0, + + "WORK": [ 0.0, 0.0, 0.0, 0.0 ], + "strideWORK": 1, + "offsetWORK": 0, + + "A_out": [ + -1.41774468787578254E+001, + 1.59234799566661405E+001, + 3.90550922945092360E-001, + 6.58872343937891292E-001, + -1.22125262718466061E+001, + 1.39666946650123203E+000, + 5.27097875150313033E-001, + 1.01383428074017831E-001, + 6.65930195519405643E+000, + 3.95323406362734775E-001, + -2.36481521337517125E-001, + -1.21925974091942613E-001 + ], + "A_out_mat": [ + [ -1.41774468787578254E+001, 6.58872343937891292E-001, 5.27097875150313033E-001, 3.95323406362734775E-001 ], + [ 1.59234799566661405E+001, -1.22125262718466061E+001, 1.01383428074017831E-001, -2.36481521337517125E-001 ], + [ 3.90550922945092360E-001, 1.39666946650123203E+000, 6.65930195519405643E+000, -1.21925974091942613E-001 ] + ], + + "D_out": [ -1.41774468787578254E+001, -1.22125262718466061E+001, 6.65930195519405643E+000 ], + + "E_out": [ 1.59234799566661405E+001, 1.39666946650123203E+000 ], + + "TAUQ_out": [ 1.73531271148748090E+000, 0.00000000000000000E+000, 0.00000000000000000E+000 ], + + "TAUP_out": [ 1.07053456158585991E+000, 1.87581696033592382E+000, 1.97070363182745845E+000 ], + + "WORK_out": [ -3.62912512283762811E-001, 2.29018886720240733E-001, 4.72963566375483069E+000, 0.00000000000000000E+000 ] + +} diff --git a/lib/node_modules/@stdlib/lapack/base/dgebd2/test/fixtures/m_lt_n_row_maj.json b/lib/node_modules/@stdlib/lapack/base/dgebd2/test/fixtures/m_lt_n_row_maj.json new file mode 100644 index 000000000000..2b39f1995969 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgebd2/test/fixtures/m_lt_n_row_maj.json @@ -0,0 +1,68 @@ +{ + "order": "row-major", + + "M": 3, + "N": 4, + + "A": [ 1, 10, 8, 6, 4, 2, 11, 9, 7, 5, 3, 12 ], + "strideA1": 4, + "strideA2": 1, + "offsetA": 0, + "LDA": 4, + "A_mat": [ + [1, 10, 8, 6], + [4, 2, 11, 9], + [7, 5, 3, 12] + ], + + "D": [ 0.0, 0.0, 0.0 ], + "strideD": 1, + "offsetD": 0, + + "E": [ 0.0, 0.0 ], + "strideE": 1, + "offsetE": 0, + + "TAUQ": [ 0.0, 0.0, 0.0 ], + "strideTAUQ": 1, + "offsetTAUQ": 0, + + "TAUP": [ 0.0, 0.0, 0.0 ], + "strideTAUP": 1, + "offsetTAUP": 0, + + "WORK": [ 0.0, 0.0, 0.0, 0.0 ], + "strideWORK": 1, + "offsetWORK": 0, + + "A_out": [ + -1.41774468787578254E+001, + 6.58872343937891292E-001, + 5.27097875150313033E-001, + 3.95323406362734775E-001, + 1.59234799566661405E+001, + -1.22125262718466061E+001, + 1.01383428074017831E-001, + -2.36481521337517125E-001, + 3.90550922945092360E-001, + 1.39666946650123203E+000, + 6.65930195519405643E+000, + -1.21925974091942613E-001 + ], + "A_out_mat": [ + [ -1.41774468787578254E+001, 6.58872343937891292E-001, 5.27097875150313033E-001, 3.95323406362734775E-001 ], + [ 1.59234799566661405E+001, -1.22125262718466061E+001, 1.01383428074017831E-001, -2.36481521337517125E-001 ], + [ 3.90550922945092360E-001, 1.39666946650123203E+000, 6.65930195519405643E+000, -1.21925974091942613E-001 ] + ], + + "D_out": [ -1.41774468787578254E+001, -1.22125262718466061E+001, 6.65930195519405643E+000 ], + + "E_out": [ 1.59234799566661405E+001, 1.39666946650123203E+000 ], + + "TAUQ_out": [ 1.73531271148748090E+000, 0.00000000000000000E+000, 0.00000000000000000E+000 ], + + "TAUP_out": [ 1.07053456158585991E+000, 1.87581696033592382E+000, 1.97070363182745845E+000 ], + + "WORK_out": [ -3.62912512283762811E-001, 2.29018886720240733E-001, 4.72963566375483069E+000, 0.00000000000000000E+000 ] + +} diff --git a/lib/node_modules/@stdlib/lapack/base/dgebd2/test/test.dgebd2.js b/lib/node_modules/@stdlib/lapack/base/dgebd2/test/test.dgebd2.js new file mode 100644 index 000000000000..b2de2ad13795 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgebd2/test/test.dgebd2.js @@ -0,0 +1,438 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Float64Array = require( '@stdlib/array/float64' ); +var isAlmostEqual = require( '@stdlib/assert/is-almost-equal-float64array' ); +var dgebd2 = require( './../lib/dgebd2.js' ); + + +// FIXTURES // + +var M_GT_N_ROW_MAJ = require( './fixtures/m_gt_n_row_maj.json' ); +var M_LT_N_ROW_MAJ = require( './fixtures/m_lt_n_row_maj.json' ); +var M_GT_N_COL_MAJ = require( './fixtures/m_gt_n_col_maj.json' ); +var M_LT_N_COL_MAJ = require( './fixtures/m_lt_n_col_maj.json' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof dgebd2, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 10', function test( t ) { + t.strictEqual( dgebd2.length, 10, '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 TAUP; + var TAUQ; + var WORK; + var A; + var D; + var E; + var i; + + A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + D = new Float64Array( [ 0.0, 0.0 ] ); + E = new Float64Array( [ 0.0 ] ); + TAUQ = new Float64Array( [ 0.0, 0.0 ] ); + TAUP = new Float64Array( [ 0.0, 0.0 ] ); + WORK = new Float64Array( [ 0.0, 0.0, 0.0 ] ); + + 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() { + dgebd2( value, 3, 2, A, 3, D, E, TAUQ, TAUP, WORK ); + }; + } +}); + +tape( 'the function throws an error if provided a second argument which is smaller than 0', function test( t ) { + var values; + var TAUP; + var TAUQ; + var WORK; + var A; + var D; + var E; + var i; + + A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + D = new Float64Array( [ 0.0, 0.0 ] ); + E = new Float64Array( [ 0.0 ] ); + TAUQ = new Float64Array( [ 0.0, 0.0 ] ); + TAUP = new Float64Array( [ 0.0, 0.0 ] ); + WORK = new Float64Array( [ 0.0, 0.0, 0.0 ] ); + + values = [ + -1, + -2, + -3 + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + dgebd2( 'column-major', value, 2, A, 3, D, E, TAUQ, TAUP, WORK ); + }; + } +}); + +tape( 'the function throws an error if provided a third argument which is smaller than 0', function test( t ) { + var values; + var TAUP; + var TAUQ; + var WORK; + var A; + var D; + var E; + var i; + + A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + D = new Float64Array( [ 0.0, 0.0 ] ); + E = new Float64Array( [ 0.0 ] ); + TAUQ = new Float64Array( [ 0.0, 0.0 ] ); + TAUP = new Float64Array( [ 0.0, 0.0 ] ); + WORK = new Float64Array( [ 0.0, 0.0, 0.0 ] ); + + values = [ + -1, + -2, + -3 + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + dgebd2( 'column-major', 3, value, A, 3, D, E, TAUQ, TAUP, WORK ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid LDA value (row-major)', function test( t ) { + var values; + var TAUP; + var TAUQ; + var WORK; + var A; + var D; + var E; + var i; + + A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + D = new Float64Array( [ 0.0, 0.0 ] ); + E = new Float64Array( [ 0.0 ] ); + TAUQ = new Float64Array( [ 0.0, 0.0 ] ); + TAUP = new Float64Array( [ 0.0, 0.0 ] ); + WORK = new Float64Array( [ 0.0, 0.0, 0.0 ] ); + + values = [ + -1, + 0, + 1 + ]; + + 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() { + dgebd2( 'row-major', 3, 2, A, value, D, E, TAUQ, TAUP, WORK ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid LDA value (column-major)', function test( t ) { + var values; + var TAUP; + var TAUQ; + var WORK; + var A; + var D; + var E; + var i; + + A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + D = new Float64Array( [ 0.0, 0.0 ] ); + E = new Float64Array( [ 0.0 ] ); + TAUQ = new Float64Array( [ 0.0, 0.0 ] ); + TAUP = new Float64Array( [ 0.0, 0.0 ] ); + WORK = new Float64Array( [ 0.0, 0.0, 0.0 ] ); + + values = [ + 2, + 1, + 0 + ]; + + 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() { + dgebd2( 'column-major', 3, 2, A, value, D, E, TAUQ, TAUP, WORK ); + }; + } +}); + +tape( 'the function quick returns when `M` or `N` is equal to 0', function test( t ) { + var expectedTAUQ; + var expectedTAUP; + var expectedWORK; + var expectedA; + var expectedD; + var expectedE; + var data; + var TAUP; + var TAUQ; + var WORK; + var A; + var D; + var E; + + data = M_GT_N_ROW_MAJ; + + A = new Float64Array( data.A ); + D = new Float64Array( data.D ); + E = new Float64Array( data.E ); + TAUQ = new Float64Array( data.TAUQ ); + TAUP = new Float64Array( data.TAUP ); + WORK = new Float64Array( data.WORK ); + + expectedA = new Float64Array( data.A ); + expectedD = new Float64Array( data.D ); + expectedE = new Float64Array( data.E ); + expectedTAUQ = new Float64Array( data.TAUQ ); + expectedTAUP = new Float64Array( data.TAUP ); + expectedWORK = new Float64Array( data.WORK ); + + dgebd2( data.order, 0, 0, A, data.LDA, D, E, TAUQ, TAUP, WORK ); + t.strictEqual( isAlmostEqual( A, expectedA, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( D, expectedD, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( E, expectedE, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( TAUQ, expectedTAUQ, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( TAUP, expectedTAUP, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( WORK, expectedWORK, 1 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function reduces Reduces a real general matrix to upper or lower bi-diagonal form by an orthogonal transformation (M >= N, row-major)', function test( t ) { + var expectedTAUQ; + var expectedTAUP; + var expectedWORK; + var expectedA; + var expectedD; + var expectedE; + var data; + var TAUP; + var TAUQ; + var WORK; + var A; + var D; + var E; + + data = M_GT_N_ROW_MAJ; + + A = new Float64Array( data.A ); + D = new Float64Array( data.D ); + E = new Float64Array( data.E ); + TAUQ = new Float64Array( data.TAUQ ); + TAUP = new Float64Array( data.TAUP ); + WORK = new Float64Array( data.WORK ); + + expectedA = new Float64Array( data.A_out ); + expectedD = new Float64Array( data.D_out ); + expectedE = new Float64Array( data.E_out ); + expectedTAUQ = new Float64Array( data.TAUQ_out ); + expectedTAUP = new Float64Array( data.TAUP_out ); + expectedWORK = new Float64Array( data.WORK_out ); + + dgebd2( data.order, data.M, data.N, A, data.LDA, D, E, TAUQ, TAUP, WORK ); + t.strictEqual( isAlmostEqual( A, expectedA, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( D, expectedD, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( E, expectedE, 3 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( TAUQ, expectedTAUQ, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( TAUP, expectedTAUP, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( WORK, expectedWORK, 12 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function reduces Reduces a real general matrix to upper or lower bi-diagonal form by an orthogonal transformation (M >= N, column-major)', function test( t ) { + var expectedTAUQ; + var expectedTAUP; + var expectedWORK; + var expectedA; + var expectedD; + var expectedE; + var data; + var TAUP; + var TAUQ; + var WORK; + var A; + var D; + var E; + + data = M_GT_N_COL_MAJ; + + A = new Float64Array( data.A ); + D = new Float64Array( data.D ); + E = new Float64Array( data.E ); + TAUQ = new Float64Array( data.TAUQ ); + TAUP = new Float64Array( data.TAUP ); + WORK = new Float64Array( data.WORK ); + + expectedA = new Float64Array( data.A_out ); + expectedD = new Float64Array( data.D_out ); + expectedE = new Float64Array( data.E_out ); + expectedTAUQ = new Float64Array( data.TAUQ_out ); + expectedTAUP = new Float64Array( data.TAUP_out ); + expectedWORK = new Float64Array( data.WORK_out ); + + dgebd2( data.order, data.M, data.N, A, data.LDA, D, E, TAUQ, TAUP, WORK ); + t.strictEqual( isAlmostEqual( A, expectedA, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( D, expectedD, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( E, expectedE, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( TAUQ, expectedTAUQ, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( TAUP, expectedTAUP, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( WORK, expectedWORK, 1 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function reduces Reduces a real general matrix to upper or lower bi-diagonal form by an orthogonal transformation (M < N, row-major)', function test( t ) { + var expectedTAUQ; + var expectedTAUP; + var expectedWORK; + var expectedA; + var expectedD; + var expectedE; + var data; + var TAUP; + var TAUQ; + var WORK; + var A; + var D; + var E; + + data = M_LT_N_ROW_MAJ; + + A = new Float64Array( data.A ); + D = new Float64Array( data.D ); + E = new Float64Array( data.E ); + TAUQ = new Float64Array( data.TAUQ ); + TAUP = new Float64Array( data.TAUP ); + WORK = new Float64Array( data.WORK ); + + expectedA = new Float64Array( data.A_out ); + expectedD = new Float64Array( data.D_out ); + expectedE = new Float64Array( data.E_out ); + expectedTAUQ = new Float64Array( data.TAUQ_out ); + expectedTAUP = new Float64Array( data.TAUP_out ); + expectedWORK = new Float64Array( data.WORK_out ); + + dgebd2( data.order, data.M, data.N, A, data.LDA, D, E, TAUQ, TAUP, WORK ); + t.strictEqual( isAlmostEqual( A, expectedA, 4 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( D, expectedD, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( E, expectedE, 4 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( TAUQ, expectedTAUQ, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( TAUP, expectedTAUP, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( WORK, expectedWORK, 15 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function reduces Reduces a real general matrix to upper or lower bi-diagonal form by an orthogonal transformation (M < N, column-major)', function test( t ) { + var expectedTAUQ; + var expectedTAUP; + var expectedWORK; + var expectedA; + var expectedD; + var expectedE; + var data; + var TAUP; + var TAUQ; + var WORK; + var A; + var D; + var E; + + data = M_LT_N_COL_MAJ; + + A = new Float64Array( data.A ); + D = new Float64Array( data.D ); + E = new Float64Array( data.E ); + TAUQ = new Float64Array( data.TAUQ ); + TAUP = new Float64Array( data.TAUP ); + WORK = new Float64Array( data.WORK ); + + expectedA = new Float64Array( data.A_out ); + expectedD = new Float64Array( data.D_out ); + expectedE = new Float64Array( data.E_out ); + expectedTAUQ = new Float64Array( data.TAUQ_out ); + expectedTAUP = new Float64Array( data.TAUP_out ); + expectedWORK = new Float64Array( data.WORK_out ); + + dgebd2( data.order, data.M, data.N, A, data.LDA, D, E, TAUQ, TAUP, WORK ); + t.strictEqual( isAlmostEqual( A, expectedA, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( D, expectedD, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( E, expectedE, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( TAUQ, expectedTAUQ, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( TAUP, expectedTAUP, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( WORK, expectedWORK, 1 ), true, 'returns expected value' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/lapack/base/dgebd2/test/test.js b/lib/node_modules/@stdlib/lapack/base/dgebd2/test/test.js new file mode 100644 index 000000000000..d45018d3dc13 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgebd2/test/test.js @@ -0,0 +1,82 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var proxyquire = require( 'proxyquire' ); +var IS_BROWSER = require( '@stdlib/assert/is-browser' ); +var dgebd2 = 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 dgebd2, '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 dgebd2.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 dgebd2 = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( dgebd2, 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 dgebd2; + var main; + + main = require( './../lib/dgebd2.js' ); + + dgebd2 = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( dgebd2, main, 'returns expected value' ); + t.end(); + + function tryRequire() { + return new Error( 'Cannot find module' ); + } +});