diff --git a/lib/node_modules/@stdlib/lapack/base/dlarft/README.md b/lib/node_modules/@stdlib/lapack/base/dlarft/README.md new file mode 100644 index 000000000000..1ed1068ea732 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlarft/README.md @@ -0,0 +1,356 @@ + + +# dlarft + +> Form the triangular factor `T` of a real block reflector `H` of order `N`, which is defined as a product of `K` elementary reflectors. + +
+ +A **block reflector** `H` is a product of `k` elementary reflectors `H = H(1) H(2) ... H(k)` (forward direction) or `H = H(k) ... H(2) H(1)` (backward direction). It can be represented as `H = I - V * T * V^T` (columnwise storage) or `H = I - V^T * T * V` (rowwise storage), where `T` is a triangular matrix. This routine computes `T`. + +The shape of the matrix `V` and the storage of the vectors which define the `H(i)` is best illustrated by the following example with `n = 5` and `k = 3`. The elements equal to `1` are not stored. + + + +```math +V = \left[ + \begin{array}{ccc} + 1 & 0 & 0 \\ + v_1 & 1 & 0 \\ + v_1 & v_2 & 1 \\ + v_1 & v_2 & v_3 \\ + v_1 & v_2 & v_3 + \end{array} +\right], \quad \text{forward, columnwise} +``` + + + + + +```math +V = \left[ + \begin{array}{ccccc} + 1 & v_1 & v_1 & v_1 & v_1 \\ + 0 & 1 & v_2 & v_2 & v_2 \\ + 0 & 0 & 1 & v_3 & v_3 + \end{array} +\right], \quad \text{forward, rowwise} +``` + + + + + +```math +V = \left[ + \begin{array}{ccc} + v_1 & v_2 & v_3 \\ + v_1 & v_2 & v_3 \\ + 1 & v_2 & v_3 \\ + 0 & 1 & v_3 \\ + 0 & 0 & 1 + \end{array} +\right], \quad \text{backward, columnwise} +``` + + + + + +```math +V = \left[ + \begin{array}{ccccc} + v_1 & v_1 & 1 & 0 & 0 \\ + v_2 & v_2 & v_2 & 1 & 0 \\ + v_3 & v_3 & v_3 & v_3 & 1 + \end{array} +\right], \quad \text{backward, rowwise} +``` + + + +
+ + + +
+ +## Usage + +```javascript +var dlarft = require( '@stdlib/lapack/base/dlarft' ); +``` + +#### dlarft( order, direct, storev, N, K, V, LDV, TAU, T, LDT ) + +Forms the triangular factor `T` of a real block reflector `H` of order `N`, which is defined as a product of `K` elementary reflectors. + + + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); + +var V = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 0.0, 1.0, 2.0, 3.0, 4.0, 0.0, 0.0, 1.0, 2.0, 3.0 ] ); +var TAU = new Float64Array( [ 2.0/55.0, 2.0/30.0, 2.0/14.0 ] ); +var T = new Float64Array( 9 ); + +dlarft( 'column-major', 'forward', 'columnwise', 5, 3, V, 5, TAU, T, 3 ); +// T => [ ~0.036, 0.0, 0.0, ~-0.097, ~0.067, 0.0, ~0.142, ~-0.1905, ~0.143 ] +``` + +The function has the following parameters: + +- **order**: storage layout. +- **direct**: direction in which the elementary reflectors are multiplied. Must be `'forward'` or `'backward'`. +- **storev**: how the vectors defining the elementary reflectors are stored. Must be `'columnwise'` or `'rowwise'`. +- **N**: order of the block reflector `H`. +- **K**: number of elementary reflectors (order of `T`). +- **V**: matrix of reflector vectors as a [`Float64Array`][@stdlib/array/float64]. +- **LDV**: leading dimension of `V`. +- **TAU**: array of scalar factors as a [`Float64Array`][@stdlib/array/float64]. +- **T**: output triangular matrix as a [`Float64Array`][@stdlib/array/float64]. +- **LDT**: leading dimension of `T`. + +If `storev` is `'columnwise'`: + +- `V` should have `K` columns. +- `LDV` must be at least `max(1,N)`. +- `H = I - V * T * V^T`. + +If `storev` is `'rowwise'`: + +- `V` should have `K` rows. +- `LDV` must be at least `K`. +- `H = I - V^T * T * V`. + +If `direct` is `'forward'`, `T` is upper triangular. If `direct` is `'backward'`, `T` is lower triangular. + +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 V0 = new Float64Array( [ 0.0, 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 0.0, 1.0, 2.0, 3.0, 4.0, 0.0, 0.0, 1.0, 2.0, 3.0 ] ); +var TAU0 = new Float64Array( [ 0.0, 2.0/55.0, 2.0/30.0, 2.0/14.0 ] ); +var T0 = new Float64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + +// Create offset views... +var V1 = new Float64Array( V0.buffer, V0.BYTES_PER_ELEMENT*2 ); // start at 3rd element +var TAU1 = new Float64Array( TAU0.buffer, TAU0.BYTES_PER_ELEMENT*1 ); // start at 2nd element +var T1 = new Float64Array( T0.buffer, T0.BYTES_PER_ELEMENT*1 ); // start at 2nd element + +dlarft( 'column-major', 'forward', 'columnwise', 5, 3, V1, 5, TAU1, T1, 3 ); +// T0 => [ 0.0, ~0.036, 0.0, 0.0, ~-0.097, ~0.067, 0.0, ~0.142, ~-0.1905, ~0.143 ] +``` + +#### dlarft.ndarray( direct,storev,N,K,V,sV1,sV2,oV,TAU,sTAU,oTAU,T,sT1,sT2,oT ) + +Forms the triangular factor `T` of a real block reflector `H` of order `N` using alternative indexing semantics. + + + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); + +var V = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 0.0, 1.0, 2.0, 3.0, 4.0, 0.0, 0.0, 1.0, 2.0, 3.0 ] ); +var TAU = new Float64Array( [ 2.0/55.0, 2.0/30.0, 2.0/14.0 ] ); +var T = new Float64Array( 9 ); + +dlarft.ndarray( 'forward', 'columnwise', 5, 3, V, 1, 5, 0, TAU, 1, 0, T, 1, 3, 0 ); +// T => [ ~0.036, 0.0, 0.0, ~-0.097, ~0.067, 0.0, ~0.142, ~-0.1905, ~0.143 ] +``` + +The function has the following additional parameters: + +- **direct**: direction in which the elementary reflectors are multiplied. +- **storev**: how the vectors defining the elementary reflectors are stored. +- **N**: order of the block reflector `H`. +- **K**: number of elementary reflectors. +- **V**: matrix of reflector vectors as a [`Float64Array`][@stdlib/array/float64]. +- **sV1**: stride of the first dimension of `V`. +- **sV2**: stride of the second dimension of `V`. +- **oV**: starting index for `V`. +- **TAU**: array of scalar factors as a [`Float64Array`][@stdlib/array/float64]. +- **sTAU**: stride for `TAU`. +- **oTAU**: starting index for `TAU`. +- **T**: output triangular matrix as a [`Float64Array`][@stdlib/array/float64]. +- **sT1**: stride of the first dimension of `T`. +- **sT2**: stride of the second dimension of `T`. +- **oT**: starting index for `T`. + +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 V = new Float64Array( [ 0.0, 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 0.0, 1.0, 2.0, 3.0, 4.0, 0.0, 0.0, 1.0, 2.0, 3.0 ] ); +var TAU = new Float64Array( [ 2.0/55.0, 2.0/30.0, 2.0/14.0 ] ); +var T = new Float64Array( 9 ); + +dlarft.ndarray( 'forward', 'columnwise', 5, 3, V, 1, 5, 2, TAU, 1, 0, T, 1, 3, 0 ); +// T => [ ~0.036, 0.0, 0.0, ~-0.097, ~0.067, 0.0, ~0.142, ~-0.1905, ~0.143 ] +``` + +
+ + + +
+ +## Notes + +- `dlarft()` corresponds to the [LAPACK][LAPACK] function [`dlarft`][lapack-dlarft]. + +
+ + + +
+ +## Examples + + + + + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); +var dlarft = require( '@stdlib/lapack/base/dlarft' ); + +// Construct V and TAU for a block reflector from a QR-like decomposition: +var N = 5; +var K = 3; +var V = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 0.0, 1.0, 2.0, 3.0, 4.0, 0.0, 0.0, 1.0, 2.0, 3.0 ] ); +var TAU = new Float64Array( [ 2.0/55.0, 2.0/30.0, 2.0/14.0 ] ); + +// Compute T: +var T = new Float64Array( K*K ); +dlarft( 'column-major', 'forward', 'columnwise', N, K, V, N, TAU, T, K ); + +console.log( 'T:' ); +console.log( T[0].toFixed(4), T[3].toFixed(4), T[6].toFixed(4) ); +console.log( T[1].toFixed(4), T[4].toFixed(4), T[7].toFixed(4) ); +console.log( T[2].toFixed(4), T[5].toFixed(4), T[8].toFixed(4) ); +``` + +
+ + + + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +TODO +``` + +#### TODO + +TODO. + +```c +TODO +``` + +TODO + +```c +TODO +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +TODO +``` + +
+ + + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/lapack/base/dlarft/benchmark/benchmark.js b/lib/node_modules/@stdlib/lapack/base/dlarft/benchmark/benchmark.js new file mode 100644 index 000000000000..897b0089e02c --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlarft/benchmark/benchmark.js @@ -0,0 +1,179 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var Float64Array = require( '@stdlib/array/float64' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +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 dlarft = require( './../lib/dlarft.js' ); + + +// VARIABLES // + +var LAYOUTS = [ + 'row-major', + 'column-major' +]; +var DIRECTS = [ + 'forward', + 'backward' +]; +var STOREVS = [ + 'columnwise', + 'rowwise' +]; +var opts = { + 'dtype': 'float64' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {string} order - storage layout +* @param {string} direct - direction +* @param {string} storev - storage +* @param {PositiveInteger} K - order of T +* @returns {Function} benchmark function +*/ +function createBenchmark( order, direct, storev, K ) { + var vlen; + var LDV = K; + var TAU; + var N = K + 2; + var T; + var V; + var i; + + if ( storev === 'columnwise' ) { + LDV = N; + if ( order === 'row-major' ) { + vlen = ( (N-1) * N ) + K; + } else { + vlen = N * K; + } + V = uniform( vlen, -10.0, 10.0, opts ); + for ( i = 0; i < K; i++ ) { + if ( order === 'row-major' ) { + V[ (i*N) + i ] = 1.0; + } else { + V[ i + (i*N) ] = 1.0; + } + } + } else { + LDV = K; + if ( order === 'row-major' ) { + vlen = ( (K-1) * K ) + N; + } else { + vlen = K * N; + } + V = uniform( vlen, -10.0, 10.0, opts ); + for ( i = 0; i < K; i++ ) { + if ( order === 'row-major' ) { + V[ (i*K) + i ] = 1.0; + } else { + V[ i + (i*K) ] = 1.0; + } + } + } + TAU = uniform( K, -10.0, 10.0, opts ); + T = new Float64Array( K*K ); + + 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 = dlarft( order, direct, storev, N, K, V, LDV, TAU, T, K ); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var storev; + var direct; + var order; + var min; + var max; + var K; + var f; + var i; + var j; + var k; + var l; + + min = 1; // 10^min + max = 6; // 10^max + + for ( l = 0; l < LAYOUTS.length; l++ ) { + order = LAYOUTS[ l ]; + for ( k = 0; k < DIRECTS.length; k++ ) { + direct = DIRECTS[ k ]; + for ( j = 0; j < STOREVS.length; j++ ) { + storev = STOREVS[ j ]; + for ( i = min; i <= max; i++ ) { + K = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + if ( K === 0 ) { + K = 1; + } + f = createBenchmark( order, direct, storev, K ); + bench( format( '%s::order=%s:direct=%s,storev=%s,size=%d', pkg, order, direct, storev, K ), f ); + } + } + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/lapack/base/dlarft/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dlarft/benchmark/benchmark.ndarray.js new file mode 100644 index 000000000000..5feee615b596 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlarft/benchmark/benchmark.ndarray.js @@ -0,0 +1,195 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var Float64Array = require( '@stdlib/array/float64' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major-string' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; +var dlarft = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var LAYOUTS = [ + 'row-major', + 'column-major' +]; +var DIRECTS = [ + 'forward', + 'backward' +]; +var STOREVS = [ + 'columnwise', + 'rowwise' +]; +var opts = { + 'dtype': 'float64' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {string} order - storage layout +* @param {string} direct - direction +* @param {string} storev - storage +* @param {PositiveInteger} K - order of T +* @returns {Function} benchmark function +*/ +function createBenchmark( order, direct, storev, K ) { + var strideV1; + var strideV2; + var strideT1; + var strideT2; + var vlen; + var LDV = K; + var TAU; + var N = K + 2; + var T; + var V; + var i; + + if ( storev === 'columnwise' ) { + LDV = N; + if ( isRowMajor( order ) ) { + vlen = ( (N-1) * N ) + K; + } else { + vlen = N * K; + } + V = uniform( vlen, -10.0, 10.0, opts ); + for ( i = 0; i < K; i++ ) { + if ( order === 'row-major' ) { + V[ (i*N) + i ] = 1.0; + } else { + V[ i + (i*N) ] = 1.0; + } + } + } else { + LDV = K; + if ( isRowMajor( order ) ) { + vlen = ( (K-1) * K ) + N; + } else { + vlen = K * N; + } + V = uniform( vlen, -10.0, 10.0, opts ); + for ( i = 0; i < K; i++ ) { + if ( order === 'row-major' ) { + V[ (i*K) + i ] = 1.0; + } else { + V[ i + (i*K) ] = 1.0; + } + } + } + TAU = uniform( K, -10.0, 10.0, opts ); + T = new Float64Array( K*K ); + if ( isRowMajor( order ) ) { + strideV1 = LDV; + strideV2 = 1; + strideT1 = K; + strideT2 = 1; + } else { // order === 'column-major' + strideV1 = 1; + strideV2 = LDV; + strideT1 = 1; + strideT2 = K; + } + + 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 = dlarft( direct, storev, N, K, V, strideV1, strideV2, 0, TAU, 1, 0, T, strideT1, strideT2, 0 ); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var storev; + var direct; + var order; + var min; + var max; + var K; + var f; + var i; + var j; + var k; + var l; + + min = 1; // 10^min + max = 6; // 10^max + + for ( l = 0; l < LAYOUTS.length; l++ ) { + order = LAYOUTS[ l ]; + for ( k = 0; k < DIRECTS.length; k++ ) { + direct = DIRECTS[ k ]; + for ( j = 0; j < STOREVS.length; j++ ) { + storev = STOREVS[ j ]; + for ( i = min; i <= max; i++ ) { + K = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + if ( K === 0 ) { + K = 1; + } + f = createBenchmark( order, direct, storev, K ); + bench( format( '%s::ndarray:order=%s:direct=%s,storev=%s,size=%d', pkg, order, direct, storev, K ), f ); + } + } + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/lapack/base/dlarft/docs/repl.txt b/lib/node_modules/@stdlib/lapack/base/dlarft/docs/repl.txt new file mode 100644 index 000000000000..848232c135ad --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlarft/docs/repl.txt @@ -0,0 +1,142 @@ + +{{alias}}( order, direct, storev, N, K, V, LDV, TAU, T, LDT ) + Forms the triangular factor `T` of a real block reflector `H` of order `N`, + which is defined as a product of `K` elementary reflectors. + + If `direct = 'forward'`, `H = H(1) H(2) ... H(k)` and `T` is upper + triangular. + If `direct = 'backward'`, `H = H(k) ... H(2) H(1)` and `T` is lower + triangular. + + If `storev = 'columnwise'`, + + - `V` should have `K` columns. + - `LDV` must be at least `max(1,N)`. + - `H = I - V * T * V^T`. + + If `storev = 'rowwise'`, + + - `V` should have `K` rows. + - `LDV` must be at least `K`. + - `H = I - V^T * T * V`. + + Parameters + ---------- + order: string + Storage layout. Must be either 'row-major' or 'column-major'. + + direct: string + Direction. Specifies the order in which the elementary reflectors are + multiplied to form the block reflector. Must be 'forward' or 'backward'. + + storev: string + Specifies how the vectors which define the elementary reflectors are + stored. Must be 'columnwise' or 'rowwise'. + + N: integer + Order of the block reflector `H`. + + K: integer + Number of elementary reflectors (order of `T`). `K` must be at least 1. + + V: Float64Array + Matrix of reflector vectors. + + LDV: integer + Leading dimension of `V`. + + TAU: Float64Array + Array of scalar factors of the elementary reflectors. Must have at least + `K` indexed elements. + + T: Float64Array + Output matrix for the triangular factor `T`. + + LDT: integer + Leading dimension of `T`. Must be at least `K`. + + Returns + ------- + T: Float64Array + Output matrix. + + Examples + -------- + > var V = new {{alias:@stdlib/array/float64}}( [1.0,2.0,3.0,0.0,1.0,2.0] ); + > var TAU = new {{alias:@stdlib/array/float64}}( [ 2.0, 3.0 ] ); + > var T = new {{alias:@stdlib/array/float64}}( 4 ); + > {{alias}}('column-major', 'forward', 'columnwise', 3, 2, V, 3, TAU, T, 2) + [ 2.0, 0.0, -48.0, 3.0 ] + + +{{alias}}.ndarray( direct,storev,N,K,V,sV1,sV2,oV,TAU,sTAU,oTAU,T,sT1,sT2,oT ) + Forms the triangular factor `T` of a real block reflector `H` of order `N` + using alternative indexing semantics. + + If `direct = 'forward'`, `H = H(1) H(2) ... H(k)` and `T` is upper + triangular. + If `direct = 'backward'`, `H = H(k) ... H(2) H(1)` and `T` is lower + triangular. + + Parameters + ---------- + direct: string + Direction. Must be 'forward' or 'backward'. + + storev: string + Storage of elementary reflectors. Must be 'columnwise' or 'rowwise'. + + N: integer + Order of the block reflector `H`. + + K: integer + Number of elementary reflectors. + + V: Float64Array + Matrix of reflector vectors. + + sV1: integer + Stride of the first dimension of `V`. + + sV2: integer + Stride of the second dimension of `V`. + + oV: integer + Starting index for `V`. + + TAU: Float64Array + Array of scalar factors. + + sTAU: integer + Stride for `TAU`. + + oTAU: integer + Starting index for `TAU`. + + T: Float64Array + Output matrix for the triangular factor `T`. + + sT1: integer + Stride of the first dimension of `T`. + + sT2: integer + Stride of the second dimension of `T`. + + oT: integer + Starting index for `T`. + + Returns + ------- + T: Float64Array + Output matrix. + + Examples + -------- + > var V = new {{alias:@stdlib/array/float64}}( [1.0,2.0,3.0,0.0,1.0,2.0] ); + > var TAU = new {{alias:@stdlib/array/float64}}( [ 2.0, 3.0 ] ); + > var T = new {{alias:@stdlib/array/float64}}( 4 ); + > {{alias}}.ndarray( 'forward','columnwise',3,2,V,1,3,0,TAU,1,0,T,1,2,0 ) + [ 2.0, 0.0, -48.0, 3.0 ] + + See Also + -------- diff --git a/lib/node_modules/@stdlib/lapack/base/dlarft/docs/types/index.d.ts b/lib/node_modules/@stdlib/lapack/base/dlarft/docs/types/index.d.ts new file mode 100644 index 000000000000..302ea8a4cda9 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlarft/docs/types/index.d.ts @@ -0,0 +1,150 @@ +/* +* @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'; + +/** +* Interface describing `dlarft`. +*/ +interface Routine { + /** + * Forms the triangular factor `T` of a real block reflector `H` of order `N`, which is defined as a product of `K` elementary reflectors. + * + * ## Notes + * + * - If `direct` = 'forward', `H = H(1) H(2) . . . H(k)` and `T` is upper triangular. + * - If `direct` = 'backward', `H = H(k) . . . H(2) H(1)` and `T` is lower triangular. + * - If `storev` = 'columnwise', the vector which defines the elementary reflector `H(i)` is stored in the i-th column of the array `V`, and `H = I - V * T * V**T`. + * - If `storev` = 'rowwise', the vector which defines the elementary reflector `H(i)` is stored in the i-th row of the array `V`, and `H = I - V**T * T * V`. + * + * @param order - storage layout + * @param direct - direction: `'forward'` or `'backward'` + * @param storev - storage of elementary reflectors: `'columnwise'` or `'rowwise'` + * @param N - order of the block reflector `H` + * @param K - number of elementary reflectors (order of `T`) + * @param V - matrix of reflector vectors + * @param LDV - leading dimension of `V` + * @param TAU - array of scalar factors of elementary reflectors + * @param T - output triangular matrix + * @param LDT - leading dimension of `T` + * @returns `T` + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * var V = new Float64Array( [ 1.0, 2.0, 3.0, 0.0, 1.0, 2.0 ] ); + * var TAU = new Float64Array( [ 2.0, 3.0 ] ); + * var T = new Float64Array( 4 ); + * + * var out = dlarft( 'column-major', 'forward', 'columnwise', 3, 2, V, 3, TAU, T, 2 ); + * // returns [ 2.0, 0.0, -48.0, 3.0 ] + */ + ( order: Layout, direct: string, storev: string, N: number, K: number, V: Float64Array, LDV: number, TAU: Float64Array, T: Float64Array, LDT: number ): Float64Array; + + /** + * Forms the triangular factor `T` of a real block reflector `H` of order `N` using alternative indexing semantics. + * + * ## Notes + * + * - If `direct` = 'forward', `H = H(1) H(2) . . . H(k)` and `T` is upper triangular. + * - If `direct` = 'backward', `H = H(k) . . . H(2) H(1)` and `T` is lower triangular. + * - If `storev` = 'columnwise', the vector which defines the elementary reflector `H(i)` is stored in the i-th column of the array `V`, and `H = I - V * T * V**T`. + * - If `storev` = 'rowwise', the vector which defines the elementary reflector `H(i)` is stored in the i-th row of the array `V`, and `H = I - V**T * T * V`. + * + * @param direct - direction: `'forward'` or `'backward'` + * @param storev - storage of elementary reflectors: `'columnwise'` or `'rowwise'` + * @param N - order of the block reflector `H` + * @param K - number of elementary reflectors + * @param V - matrix of reflector vectors + * @param strideV1 - stride of the first dimension of `V` + * @param strideV2 - stride of the second dimension of `V` + * @param offsetV - starting index for `V` + * @param TAU - array of scalar factors + * @param strideTAU - stride for `TAU` + * @param offsetTAU - starting index for `TAU` + * @param T - output triangular matrix + * @param strideT1 - stride of the first dimension of `T` + * @param strideT2 - stride of the second dimension of `T` + * @param offsetT - starting index for `T` + * @returns `T` + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * var V = new Float64Array( [ 1.0, 2.0, 3.0, 0.0, 1.0, 2.0 ] ); + * var TAU = new Float64Array( [ 2.0, 3.0 ] ); + * var T = new Float64Array( 4 ); + * + * var out = dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, TAU, 1, 0, T, 1, 2, 0 ); + * // returns [ 2.0, 0.0, -48.0, 3.0 ] + */ + ndarray( direct: string, storev: string, N: number, K: number, V: Float64Array, strideV1: number, strideV2: number, offsetV: number, TAU: Float64Array, strideTAU: number, offsetTAU: number, T: Float64Array, strideT1: number, strideT2: number, offsetT: number ): Float64Array; +} + +/** +* Forms the triangular factor `T` of a real block reflector `H` of order `N`, which is defined as a product of `K` elementary reflectors. +* +* ## Notes +* +* - If `direct` = 'forward', `H = H(1) H(2) . . . H(k)` and `T` is upper triangular. +* - If `direct` = 'backward', `H = H(k) . . . H(2) H(1)` and `T` is lower triangular. +* - If `storev` = 'columnwise', the vector which defines the elementary reflector `H(i)` is stored in the i-th column of the array `V`, and `H = I - V * T * V**T`. +* - If `storev` = 'rowwise', the vector which defines the elementary reflector `H(i)` is stored in the i-th row of the array `V`, and `H = I - V**T * T * V`. +* +* @param order - storage layout +* @param direct - direction: `'forward'` or `'backward'` +* @param storev - storage of elementary reflectors: `'columnwise'` or `'rowwise'` +* @param N - order of the block reflector `H` +* @param K - number of elementary reflectors (order of `T`) +* @param V - matrix of reflector vectors +* @param LDV - leading dimension of `V` +* @param TAU - array of scalar factors of elementary reflectors +* @param T - output triangular matrix +* @param LDT - leading dimension of `T` +* @returns `T` +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var V = new Float64Array( [ 1.0, 2.0, 3.0, 0.0, 1.0, 2.0 ] ); +* var TAU = new Float64Array( [ 2.0, 3.0 ] ); +* var T = new Float64Array( 4 ); +* +* var out = dlarft( 'column-major', 'forward', 'columnwise', 3, 2, V, 3, TAU, T, 2 ); +* // returns [ 2.0, 0.0, -48.0, 3.0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var V = new Float64Array( [ 1.0, 2.0, 3.0, 0.0, 1.0, 2.0 ] ); +* var TAU = new Float64Array( [ 2.0, 3.0 ] ); +* var T = new Float64Array( 4 ); +* +* var out = dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, TAU, 1, 0, T, 1, 2, 0 ); +* // returns [ 2.0, 0.0, -48.0, 3.0 ] +*/ +declare var dlarft: Routine; + + +// EXPORTS // + +export = dlarft; diff --git a/lib/node_modules/@stdlib/lapack/base/dlarft/docs/types/test.ts b/lib/node_modules/@stdlib/lapack/base/dlarft/docs/types/test.ts new file mode 100644 index 000000000000..0d591b112f1c --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlarft/docs/types/test.ts @@ -0,0 +1,454 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import dlarft = require( './index' ); + + +// TESTS // + +// The function returns a Float64Array... +{ + const V = new Float64Array( 6 ); + const TAU = new Float64Array( 2 ); + const T = new Float64Array( 4 ); + dlarft( 'column-major', 'forward', 'columnwise', 3, 2, V, 3, TAU, T, 2 ); // $ExpectType Float64Array +} + +// The compiler throws an error if the function is provided a first argument which is not a valid layout... +{ + const V = new Float64Array( 6 ); + const TAU = new Float64Array( 2 ); + const T = new Float64Array( 4 ); + dlarft( 5, 'forward', 'columnwise', 3, 2, V, 3, TAU, T, 2 ); // $ExpectError + dlarft( true, 'forward', 'columnwise', 3, 2, V, 3, TAU, T, 2 ); // $ExpectError + dlarft( false, 'forward', 'columnwise', 3, 2, V, 3, TAU, T, 2 ); // $ExpectError + dlarft( null, 'forward', 'columnwise', 3, 2, V, 3, TAU, T, 2 ); // $ExpectError + dlarft( void 0, 'forward', 'columnwise', 3, 2, V, 3, TAU, T, 2 ); // $ExpectError + dlarft( [], 'forward', 'columnwise', 3, 2, V, 3, TAU, T, 2 ); // $ExpectError + dlarft( {}, 'forward', 'columnwise', 3, 2, V, 3, TAU, T, 2 ); // $ExpectError + dlarft( ( x: number ): number => x, 'forward', 'columnwise', 3, 2, V, 3, TAU, T, 2 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a second argument which is not a valid direction... +{ + const V = new Float64Array( 6 ); + const TAU = new Float64Array( 2 ); + const T = new Float64Array( 4 ); + dlarft( 'column-major', 5, 'columnwise', 3, 2, V, 3, TAU, T, 2 ); // $ExpectError + dlarft( 'column-major', true, 'columnwise', 3, 2, V, 3, TAU, T, 2 ); // $ExpectError + dlarft( 'column-major', false, 'columnwise', 3, 2, V, 3, TAU, T, 2 ); // $ExpectError + dlarft( 'column-major', null, 'columnwise', 3, 2, V, 3, TAU, T, 2 ); // $ExpectError + dlarft( 'column-major', void 0, 'columnwise', 3, 2, V, 3, TAU, T, 2 ); // $ExpectError + dlarft( 'column-major', [], 'columnwise', 3, 2, V, 3, TAU, T, 2 ); // $ExpectError + dlarft( 'column-major', {}, 'columnwise', 3, 2, V, 3, TAU, T, 2 ); // $ExpectError + dlarft( 'column-major', ( x: number ): number => x, 'columnwise', 3, 2, V, 3, TAU, T, 2 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a third argument which is not a valid storage mode... +{ + const V = new Float64Array( 6 ); + const TAU = new Float64Array( 2 ); + const T = new Float64Array( 4 ); + dlarft( 'column-major', 'forward', 5, 3, 2, V, 3, TAU, T, 2 ); // $ExpectError + dlarft( 'column-major', 'forward', true, 3, 2, V, 3, TAU, T, 2 ); // $ExpectError + dlarft( 'column-major', 'forward', false, 3, 2, V, 3, TAU, T, 2 ); // $ExpectError + dlarft( 'column-major', 'forward', null, 3, 2, V, 3, TAU, T, 2 ); // $ExpectError + dlarft( 'column-major', 'forward', void 0, 3, 2, V, 3, TAU, T, 2 ); // $ExpectError + dlarft( 'column-major', 'forward', [], 3, 2, V, 3, TAU, T, 2 ); // $ExpectError + dlarft( 'column-major', 'forward', {}, 3, 2, V, 3, TAU, T, 2 ); // $ExpectError + dlarft( 'column-major', 'forward', ( x: number ): number => x, 3, 2, V, 3, TAU, T, 2 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fourth argument which is not a number... +{ + const V = new Float64Array( 6 ); + const TAU = new Float64Array( 2 ); + const T = new Float64Array( 4 ); + dlarft( 'column-major', 'forward', 'columnwise', '5', 2, V, 3, TAU, T, 2 ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise', true, 2, V, 3, TAU, T, 2 ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise', false, 2, V, 3, TAU, T, 2 ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise', null, 2, V, 3, TAU, T, 2 ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise', void 0, 2, V, 3, TAU, T, 2 ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise', [], 2, V, 3, TAU, T, 2 ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise', {}, 2, V, 3, TAU, T, 2 ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise', ( x: number ): number => x, 2, V, 3, TAU, T, 2 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fifth argument which is not a number... +{ + const V = new Float64Array( 6 ); + const TAU = new Float64Array( 2 ); + const T = new Float64Array( 4 ); + dlarft( 'column-major', 'forward', 'columnwise', 3, '2', V, 3, TAU, T, 2 ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise', 3, true, V, 3, TAU, T, 2 ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise', 3, false, V, 3, TAU, T, 2 ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise', 3, null, V, 3, TAU, T, 2 ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise', 3, void 0, V, 3, TAU, T, 2 ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise', 3, [], V, 3, TAU, T, 2 ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise', 3, {}, V, 3, TAU, T, 2 ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise', 3, ( x: number ): number => x, V, 3, TAU, T, 2 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a sixth argument which is not a Float64Array... +{ + const TAU = new Float64Array( 2 ); + const T = new Float64Array( 4 ); + dlarft( 'column-major', 'forward', 'columnwise', 3, 2, '5', 3, TAU, T, 2 ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise', 3, 2, 5, 3, TAU, T, 2 ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise', 3, 2, true, 3, TAU, T, 2 ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise', 3, 2, false, 3, TAU, T, 2 ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise', 3, 2, null, 3, TAU, T, 2 ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise', 3, 2, void 0, 3, TAU, T, 2 ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise', 3, 2, [], 3, TAU, T, 2 ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise', 3, 2, {}, 3, TAU, T, 2 ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise', 3, 2, ( x: number ): number => x, 3, TAU, T, 2 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a seventh argument which is not a number... +{ + const V = new Float64Array( 6 ); + const TAU = new Float64Array( 2 ); + const T = new Float64Array( 4 ); + dlarft( 'column-major', 'forward', 'columnwise', 3, 2, V, '3', TAU, T, 2 ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise', 3, 2, V, true, TAU, T, 2 ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise', 3, 2, V, false, TAU, T, 2 ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise', 3, 2, V, null, TAU, T, 2 ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise', 3, 2, V, void 0, TAU, T, 2 ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise', 3, 2, V, [], TAU, T, 2 ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise', 3, 2, V, {}, TAU, T, 2 ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise', 3, 2, V, ( x: number ): number => x, TAU, T, 2 ); // $ExpectError +} + +// The compiler throws an error if the function is provided an eighth argument which is not a Float64Array... +{ + const V = new Float64Array( 6 ); + const T = new Float64Array( 4 ); + dlarft( 'column-major', 'forward', 'columnwise', 3, 2, V, 3, '5', T, 2 ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise', 3, 2, V, 3, 5, T, 2 ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise', 3, 2, V, 3, true, T, 2 ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise', 3, 2, V, 3, false, T, 2 ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise', 3, 2, V, 3, null, T, 2 ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise', 3, 2, V, 3, void 0, T, 2 ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise', 3, 2, V, 3, [], T, 2 ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise', 3, 2, V, 3, {}, T, 2 ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise', 3, 2, V, 3, ( x: number ): number => x, T, 2 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a ninth argument which is not a Float64Array... +{ + const V = new Float64Array( 6 ); + const TAU = new Float64Array( 2 ); + dlarft( 'column-major', 'forward', 'columnwise', 3, 2, V, 3, TAU, '5', 2 ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise', 3, 2, V, 3, TAU, 5, 2 ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise', 3, 2, V, 3, TAU, true, 2 ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise', 3, 2, V, 3, TAU, false, 2 ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise', 3, 2, V, 3, TAU, null, 2 ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise', 3, 2, V, 3, TAU, void 0, 2 ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise', 3, 2, V, 3, TAU, [], 2 ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise', 3, 2, V, 3, TAU, {}, 2 ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise', 3, 2, V, 3, TAU, ( x: number ): number => x, 2 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a tenth argument which is not a number... +{ + const V = new Float64Array( 6 ); + const TAU = new Float64Array( 2 ); + const T = new Float64Array( 4 ); + dlarft( 'column-major', 'forward', 'columnwise', 3, 2, V, 3, TAU, T, '2' ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise', 3, 2, V, 3, TAU, T, true ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise', 3, 2, V, 3, TAU, T, false ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise', 3, 2, V, 3, TAU, T, null ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise', 3, 2, V, 3, TAU, T, void 0 ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise', 3, 2, V, 3, TAU, T, [] ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise', 3, 2, V, 3, TAU, T, {} ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise', 3, 2, V, 3, TAU, T, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + const V = new Float64Array( 6 ); + const TAU = new Float64Array( 2 ); + const T = new Float64Array( 4 ); + dlarft(); // $ExpectError + dlarft( 'column-major' ); // $ExpectError + dlarft( 'column-major', 'forward' ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise' ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise', 3 ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise', 3, 2 ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise', 3, 2, V ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise', 3, 2, V, 3 ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise', 3, 2, V, 3, TAU ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise', 3, 2, V, 3, TAU, T ); // $ExpectError + dlarft( 'column-major', 'forward', 'columnwise', 3, 2, V, 3, TAU, T, 2, 10 ); // $ExpectError +} + +// Attached to main export is an `ndarray` method which returns a Float64Array... +{ + const V = new Float64Array( 6 ); + const TAU = new Float64Array( 2 ); + const T = new Float64Array( 4 ); + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectType Float64Array +} + +// The compiler throws an error if the `ndarray` method is provided a first argument which is not a valid direction... +{ + const V = new Float64Array( 6 ); + const TAU = new Float64Array( 2 ); + const T = new Float64Array( 4 ); + dlarft.ndarray( 5, 'columnwise', 3, 2, V, 1, 3, 0, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( true, 'columnwise', 3, 2, V, 1, 3, 0, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( false, 'columnwise', 3, 2, V, 1, 3, 0, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( null, 'columnwise', 3, 2, V, 1, 3, 0, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( void 0, 'columnwise', 3, 2, V, 1, 3, 0, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( [], 'columnwise', 3, 2, V, 1, 3, 0, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( {}, 'columnwise', 3, 2, V, 1, 3, 0, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( ( x: number ): number => x, 'columnwise', 3, 2, V, 1, 3, 0, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a second argument which is not a valid storage mode... +{ + const V = new Float64Array( 6 ); + const TAU = new Float64Array( 2 ); + const T = new Float64Array( 4 ); + dlarft.ndarray( 'forward', 5, 3, 2, V, 1, 3, 0, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', true, 3, 2, V, 1, 3, 0, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', false, 3, 2, V, 1, 3, 0, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', null, 3, 2, V, 1, 3, 0, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', void 0, 3, 2, V, 1, 3, 0, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', [], 3, 2, V, 1, 3, 0, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', {}, 3, 2, V, 1, 3, 0, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', ( x: number ): number => x, 3, 2, V, 1, 3, 0, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a third argument which is not a number... +{ + const V = new Float64Array( 6 ); + const TAU = new Float64Array( 2 ); + const T = new Float64Array( 4 ); + dlarft.ndarray( 'forward', 'columnwise', '5', 2, V, 1, 3, 0, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', true, 2, V, 1, 3, 0, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', false, 2, V, 1, 3, 0, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', null, 2, V, 1, 3, 0, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', void 0, 2, V, 1, 3, 0, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', [], 2, V, 1, 3, 0, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', {}, 2, V, 1, 3, 0, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', ( x: number ): number => x, 2, V, 1, 3, 0, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a fourth argument which is not a number... +{ + const V = new Float64Array( 6 ); + const TAU = new Float64Array( 2 ); + const T = new Float64Array( 4 ); + dlarft.ndarray( 'forward', 'columnwise', 3, '2', V, 1, 3, 0, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, true, V, 1, 3, 0, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, false, V, 1, 3, 0, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, null, V, 1, 3, 0, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, void 0, V, 1, 3, 0, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, [], V, 1, 3, 0, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, {}, V, 1, 3, 0, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, ( x: number ): number => x, V, 1, 3, 0, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a fifth argument which is not a Float64Array... +{ + const TAU = new Float64Array( 2 ); + const T = new Float64Array( 4 ); + dlarft.ndarray( 'forward', 'columnwise', 3, 2, '5', 1, 3, 0, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, 5, 1, 3, 0, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, true, 1, 3, 0, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, false, 1, 3, 0, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, null, 1, 3, 0, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, void 0, 1, 3, 0, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, [], 1, 3, 0, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, {}, 1, 3, 0, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, ( x: number ): number => x, 1, 3, 0, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a sixth argument which is not a number... +{ + const V = new Float64Array( 6 ); + const TAU = new Float64Array( 2 ); + const T = new Float64Array( 4 ); + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, '1', 3, 0, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, true, 3, 0, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, false, 3, 0, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, null, 3, 0, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, void 0, 3, 0, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, [], 3, 0, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, {}, 3, 0, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, ( x: number ): number => x, 3, 0, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a seventh argument which is not a number... +{ + const V = new Float64Array( 6 ); + const TAU = new Float64Array( 2 ); + const T = new Float64Array( 4 ); + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, '3', 0, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, true, 0, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, false, 0, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, null, 0, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, void 0, 0, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, [], 0, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, {}, 0, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, ( x: number ): number => x, 0, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided an eighth argument which is not a number... +{ + const V = new Float64Array( 6 ); + const TAU = new Float64Array( 2 ); + const T = new Float64Array( 4 ); + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, '0', TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, true, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, false, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, null, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, void 0, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, [], TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, {}, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, ( x: number ): number => x, TAU, 1, 0, T, 1, 2, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a ninth argument which is not a Float64Array... +{ + const V = new Float64Array( 6 ); + const T = new Float64Array( 4 ); + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, '5', 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, 5, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, true, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, false, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, null, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, void 0, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, [], 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, {}, 1, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, ( x: number ): number => x, 1, 0, T, 1, 2, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a tenth argument which is not a number... +{ + const V = new Float64Array( 6 ); + const TAU = new Float64Array( 2 ); + const T = new Float64Array( 4 ); + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, TAU, '1', 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, TAU, true, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, TAU, false, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, TAU, null, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, TAU, void 0, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, TAU, [], 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, TAU, {}, 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, TAU, ( x: number ): number => x, 0, T, 1, 2, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided an eleventh argument which is not a number... +{ + const V = new Float64Array( 6 ); + const TAU = new Float64Array( 2 ); + const T = new Float64Array( 4 ); + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, TAU, 1, '0', T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, TAU, 1, true, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, TAU, 1, false, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, TAU, 1, null, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, TAU, 1, void 0, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, TAU, 1, [], T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, TAU, 1, {}, T, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, TAU, 1, ( x: number ): number => x, T, 1, 2, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a twelfth argument which is not a Float64Array... +{ + const V = new Float64Array( 6 ); + const TAU = new Float64Array( 2 ); + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, TAU, 1, 0, '5', 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, TAU, 1, 0, 5, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, TAU, 1, 0, true, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, TAU, 1, 0, false, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, TAU, 1, 0, null, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, TAU, 1, 0, void 0, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, TAU, 1, 0, [], 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, TAU, 1, 0, {}, 1, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, TAU, 1, 0, ( x: number ): number => x, 1, 2, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a thirteenth argument which is not a number... +{ + const V = new Float64Array( 6 ); + const TAU = new Float64Array( 2 ); + const T = new Float64Array( 4 ); + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, TAU, 1, 0, T, '1', 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, TAU, 1, 0, T, true, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, TAU, 1, 0, T, false, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, TAU, 1, 0, T, null, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, TAU, 1, 0, T, void 0, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, TAU, 1, 0, T, [], 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, TAU, 1, 0, T, {}, 2, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, TAU, 1, 0, T, ( x: number ): number => x, 2, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a fourteenth argument which is not a number... +{ + const V = new Float64Array( 6 ); + const TAU = new Float64Array( 2 ); + const T = new Float64Array( 4 ); + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, TAU, 1, 0, T, 1, '2', 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, TAU, 1, 0, T, 1, true, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, TAU, 1, 0, T, 1, false, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, TAU, 1, 0, T, 1, null, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, TAU, 1, 0, T, 1, void 0, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, TAU, 1, 0, T, 1, [], 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, TAU, 1, 0, T, 1, {}, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, TAU, 1, 0, T, 1, ( x: number ): number => x, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a fifteenth argument which is not a number... +{ + const V = new Float64Array( 6 ); + const TAU = new Float64Array( 2 ); + const T = new Float64Array( 4 ); + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, TAU, 1, 0, T, 1, 2, '0' ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, TAU, 1, 0, T, 1, 2, true ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, TAU, 1, 0, T, 1, 2, false ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, TAU, 1, 0, T, 1, 2, null ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, TAU, 1, 0, T, 1, 2, void 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, TAU, 1, 0, T, 1, 2, [] ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, TAU, 1, 0, T, 1, 2, {} ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, TAU, 1, 0, T, 1, 2, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided an unsupported number of arguments... +{ + const V = new Float64Array( 6 ); + const TAU = new Float64Array( 2 ); + const T = new Float64Array( 4 ); + dlarft.ndarray(); // $ExpectError + dlarft.ndarray( 'forward' ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise' ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, TAU ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, TAU, 1 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, TAU, 1, 0 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, TAU, 1, 0, T ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, TAU, 1, 0, T, 1 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, TAU, 1, 0, T, 1, 2 ); // $ExpectError + dlarft.ndarray( 'forward', 'columnwise', 3, 2, V, 1, 3, 0, TAU, 1, 0, T, 1, 2, 0, 10 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlarft/examples/index.js b/lib/node_modules/@stdlib/lapack/base/dlarft/examples/index.js new file mode 100644 index 000000000000..e09b4d3afffb --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlarft/examples/index.js @@ -0,0 +1,54 @@ +/** +* @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 dlarft = require( './../lib' ); + +// Construct V and TAU for a block reflector from a QR-like decomposition: +var N = 5; +var K = 3; +var V = new Float64Array([ + 1.0, + 2.0, + 3.0, + 4.0, + 5.0, + 0.0, + 1.0, + 2.0, + 3.0, + 4.0, + 0.0, + 0.0, + 1.0, + 2.0, + 3.0 +]); +var TAU = new Float64Array( [ 2.0/55.0, 2.0/30.0, 2.0/14.0 ] ); + +// Compute T: +var T = new Float64Array( K*K ); +dlarft( 'column-major', 'forward', 'columnwise', N, K, V, N, TAU, T, K ); + +// Print the upper triangular T: +console.log( 'T (3×3, upper triangular, row-major view):' ); +console.log( ' [', T[0].toFixed(6), ',', T[3].toFixed(6), ',', T[6].toFixed(6), ']' ); +console.log( ' [', T[1].toFixed(6), ',', T[4].toFixed(6), ',', T[7].toFixed(6), ']' ); +console.log( ' [', T[2].toFixed(6), ',', T[5].toFixed(6), ',', T[8].toFixed(6), ']' ); diff --git a/lib/node_modules/@stdlib/lapack/base/dlarft/lib/base.js b/lib/node_modules/@stdlib/lapack/base/dlarft/lib/base.js new file mode 100644 index 000000000000..380bc12d96ee --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlarft/lib/base.js @@ -0,0 +1,445 @@ +/** +* @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 dgemm = require( '@stdlib/blas/base/dgemm' ).ndarray; +var dlacpy = require( '@stdlib/lapack/base/dlacpy' ).ndarray; +var floor = require( '@stdlib/math/base/special/floor' ); +var dtrmm = require( './dtrmm.js' ); + + +// MAIN // + +/** +* Forms the triangular factor T of a real block reflector H of order N, which is defined as a product of K elementary reflectors. +* +* ## Notes +* +* - If `direct` = 'forward', `H = H(1) H(2) . . . H(k)` and `T` is upper triangular. +* - If `direct` = 'backward', `H = H(k) . . . H(2) H(1)` and `T` is lower triangular. +* - If `storev` = 'columnwise', the vector which defines the elementary reflector `H(i)` is stored in the i-th column of the array `V`, and `H = I - V * T * V**T`. +* - If `storev` = 'rowwise', the vector which defines the elementary reflector `H(i)` is stored in the i-th row of the array `V`, and `H = I - V**T * T * V`. +* +* @private +* @param {string} direct - specifies the order in which the elementary reflectors are multiplied to form the block reflector `H` +* @param {string} storev - specifies how the vectors which define the elementary reflectors are stored +* @param {NonNegativeInteger} N - order of the block reflector `H` +* @param {NonNegativeInteger} K - order of the triangular factor `T` (the number of elementary reflectors) +* @param {Float64Array} V - matrix of reflector vectors +* @param {integer} strideV1 - stride of first dimension of `V` +* @param {integer} strideV2 - stride of second dimension of `V` +* @param {NonNegativeInteger} offsetV - starting index for `V` +* @param {Float64Array} TAU - array of scalar factors of the elementary reflector `H(i)` +* @param {integer} strideTAU - stride length for `TAU` +* @param {NonNegativeInteger} offsetTAU - starting index for `TAU` +* @param {Float64Array} T - output triangular matrix +* @param {integer} strideT1 - stride of first dimension of `T` +* @param {integer} strideT2 - stride of second dimension of `T` +* @param {NonNegativeInteger} offsetT - starting index for `T` +* @returns {Float64Array} `T` +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var V = new Float64Array( [ 1.0, 0.2, 0.3, -0.4, 0.5, 0.0, 1.0, -0.6, 0.7, -0.8, 0.0, 0.0, 1.0, 0.9, 1.1 ] ); +* var TAU = new Float64Array( [ 1.2, 0.7, 1.5 ] ); +* var T = new Float64Array( 9 ); +* +* dlarft( 'forward', 'rowwise', 5, 3, V, 5, 1, 0, TAU, 1, 0, T, 3, 1, 0 ); +* // T => [ ~1.2, ~0.5544, ~-0.17514, 0.0, 0.7, 0.8925, 0.0, 0.0, 1.5 ] +*/ +function dlarft( direct, storev, N, K, V, strideV1, strideV2, offsetV, TAU, strideTAU, offsetTAU, T, strideT1, strideT2, offsetT ) { + var colv; + var dirf; + var lq; + var ql; + var qr; + var i; + var j; + var l; + + if ( N === 0 || K === 0 ) { + return T; + } + + if ( N === 1 || K === 1 ) { + T[ offsetT ] = TAU[ offsetTAU ]; + return T; + } + + l = floor( K / 2 ); + + if ( direct === 'forward' ) { + dirf = true; + } + else { + dirf = false; + } + + if ( storev === 'columnwise' ) { + colv = true; + } + else { + colv = false; + } + + // QR happens when we have forward direction in column storage + qr = dirf & colv; + + // LQ happens when we have forward direction in row storage + lq = dirf & ( !colv ); + + // QL happens when we have backward direction in column storage + ql = ( !dirf ) & colv; + + // The last case is RQ. Due to how we structured this, if the above 3 are false, then RQ must be true, so we never store this RQ happens when we have backward direction in row storage `RQ = ( !dirf ) & ( !colv )` + if ( qr ) { + /* + Break V apart into 6 components + + V = |---------------| + |V_{1,1} 0 | + |V_{2,1} V_{2,2}| + |V_{3,1} V_{3,2}| + |---------------| + + V_{1,1}\in\R^{l,l} unit lower triangular + V_{2,1}\in\R^{k-l,l} rectangular + V_{3,1}\in\R^{n-k,l} rectangular + + V_{2,2}\in\R^{k-l,k-l} unit lower triangular + V_{3,2}\in\R^{n-k,k-l} rectangular + + We will construct the T matrix + T = |---------------| + |T_{1,1} T_{1,2}| + |0 T_{2,2}| + |---------------| + + T is the triangular factor obtained from block reflectors. + To motivate the structure, assume we have already computed T_{1,1} + and T_{2,2}. Then collect the associated reflectors in V_1 and V_2 + + T_{1,1}\in\R^{l, l} upper triangular + T_{2,2}\in\R^{k-l, k-l} upper triangular + T_{1,2}\in\R^{l, k-l} rectangular + + Where l = floor(k/2) + + Then, consider the product: + + (I - V_1*T_{1,1}*V_1')*(I - V_2*T_{2,2}*V_2') + = I - V_1*T_{1,1}*V_1' - V_2*T_{2,2}*V_2' + V_1*T_{1,1}*V_1'*V_2*T_{2,2}*V_2' + + Define T_{1,2} = -T_{1,1}*V_1'*V_2*T_{2,2} + + Then, we can define the matrix V as + V = |-------| + |V_1 V_2| + |-------| + + So, our product is equivalent to the matrix product + I - V*T*V' + This means, we can compute T_{1,1} and T_{2,2}, then use this information + to compute T_{1,2} + */ + + // Compute T_{1,1} recursively + dlarft( direct, storev, N, l, V, strideV1, strideV2, offsetV, TAU, strideTAU, offsetTAU, T, strideT1, strideT2, offsetT ); + + // Compute T_{2,2} recursively + dlarft( direct, storev, N - l, K - l, V, strideV1, strideV2, offsetV + ( ( strideV1 + strideV2 ) * l ), TAU, strideTAU, offsetTAU + ( strideTAU * l ), T, strideT1, strideT2, offsetT + ( ( strideT1 + strideT2 ) * l ) ); + + // Compute T_{1,2} = V_{2,1} + for ( j = 0; j < l; j++ ) { + for ( i = 0; i < K - l; i++ ) { + T[ offsetT + ( strideT1 * j ) + ( strideT2 * ( l + i ) ) ] = V[ offsetV + ( strideV1 * ( l + i ) ) + ( strideV2 * j ) ]; + } + } + + // T_{1,2} = T_{1,2}*V_{2,2} + dtrmm( 'right', 'lower', 'no-transpose', 'unit', l, K - l, 1, V, strideV1, strideV2, offsetV + ( ( strideV1 + strideV2 ) * l ), T, strideT1, strideT2, offsetT + ( strideT2 * l ) ); + + // T_{1,2} = V_{3,1}'*V_{3,2} + T_{1,2} + + // Note: We assume K <= N, and GEMM will do nothing if N=K + dgemm( 'transpose', 'no-transpose', l, K - l, N - K, 1, V, strideV1, strideV2, offsetV + ( strideV1 * K ), V, strideV1, strideV2, offsetV + ( strideV1 * K ) + ( strideV2 * l ), 1, T, strideT1, strideT2, offsetT + ( strideT2 * l ) ); + + /* + At this point, we have that T_{1,2} = V_1'*V_2 + All that is left is to pre and post multiply by -T_{1,1} and T_{2,2} respectively. + + T_{1,2} = -T_{1,1}*T_{1,2} + */ + dtrmm( 'left', 'upper', 'no-transpose', 'non-unit', l, K - l, -1, T, strideT1, strideT2, offsetT, T, strideT1, strideT2, offsetT + ( strideT2 * l ) ); + + // T_{1,2} = T_{1,2}*T_{2,2} + dtrmm( 'right', 'upper', 'no-transpose', 'non-unit', l, K - l, 1, T, strideT1, strideT2, offsetT + ( ( strideT1 + strideT2 ) * l ), T, strideT1, strideT2, offsetT + ( strideT2 * l ) ); + } else if ( lq ) { + /* + Break V apart into 6 components + + V = |----------------------| + |V_{1,1} V_{1,2} V{1,3}| + |0 V_{2,2} V{2,3}| + |----------------------| + + V_{1,1}\in\R^{l,l} unit upper triangular + V_{1,2}\in\R^{l,k-l} rectangular + V_{1,3}\in\R^{l,n-k} rectangular + + V_{2,2}\in\R^{k-l,k-l} unit upper triangular + V_{2,3}\in\R^{k-l,n-k} rectangular + + Where l = floor(k/2) + + We will construct the T matrix + T = |---------------| + |T_{1,1} T_{1,2}| + |0 T_{2,2}| + |---------------| + + T is the triangular factor obtained from block reflectors. + To motivate the structure, assume we have already computed T_{1,1} + and T_{2,2}. Then collect the associated reflectors in V_1 and V_2 + + T_{1,1}\in\R^{l, l} upper triangular + T_{2,2}\in\R^{k-l, k-l} upper triangular + T_{1,2}\in\R^{l, k-l} rectangular + + Then, consider the product: + + (I - V_1'*T_{1,1}*V_1)*(I - V_2'*T_{2,2}*V_2) + = I - V_1'*T_{1,1}*V_1 - V_2'*T_{2,2}*V_2 + V_1'*T_{1,1}*V_1*V_2'*T_{2,2}*V_2 + + Define T_{1,2} = -T_{1,1}*V_1*V_2'*T_{2,2} + + Then, we can define the matrix V as + V = |---| + |V_1| + |V_2| + |---| + + So, our product is equivalent to the matrix product + I - V'*T*V + This means, we can compute T_{1,1} and T_{2,2}, then use this information + to compute T_{1,2} + */ + + // Compute T_{1,1} recursively + dlarft( direct, storev, N, l, V, strideV1, strideV2, offsetV, TAU, strideTAU, offsetTAU, T, strideT1, strideT2, offsetT ); + + // Compute T_{2,2} recursively + dlarft( direct, storev, N - l, K - l, V, strideV1, strideV2, offsetV + ( ( strideV1 + strideV2 ) * l ), TAU, strideTAU, offsetTAU + ( strideTAU * l ), T, strideT1, strideT2, offsetT + ( ( strideT1 + strideT2 ) * l ) ); + + // Compute T_{1,2} = V_{1,2} + dlacpy( 'all', l, K - l, V, strideV1, strideV2, offsetV + ( strideV2 * l ), T, strideT1, strideT2, offsetT + ( strideT2 * l ) ); + + // T_{1,2} = T_{1,2}*V_{2,2} + dtrmm( 'right', 'upper', 'transpose', 'unit', l, K - l, 1, V, strideV1, strideV2, offsetV + ( ( strideV1 + strideV2 ) * l ), T, strideT1, strideT2, offsetT + ( strideT2 * l ) ); + + // T_{1,2} = V_{1,3}*V_{2,3}' + T_{1,2} + + // Note: We assume K <= N, and GEMM will do nothing if N=K + dgemm( 'no-transpose', 'transpose', l, K - l, N - K, 1, V, strideV1, strideV2, offsetV + ( strideV2 * K ), V, strideV1, strideV2, offsetV + ( strideV1 * l ) + ( strideV2 * K ), 1, T, strideT1, strideT2, offsetT + ( strideT2 * l ) ); + + /* + At this point, we have that T_{1,2} = V_1*V_2' + All that is left is to pre and post multiply by -T_{1,1} and T_{2,2} respectively. + + T_{1,2} = -T_{1,1}*T_{1,2} + */ + dtrmm( 'left', 'upper', 'no-transpose', 'non-unit', l, K - l, -1, T, strideT1, strideT2, offsetT, T, strideT1, strideT2, offsetT + ( strideT2 * l ) ); + + // T_{1,2} = T_{1,2}*T_{2,2} + dtrmm( 'right', 'upper', 'no-transpose', 'non-unit', l, K - l, 1, T, strideT1, strideT2, offsetT + ( ( strideT1 + strideT2 ) * l ), T, strideT1, strideT2, offsetT + ( strideT2 * l ) ); + } else if ( ql ) { + /* + Break V apart into 6 components + + V = |---------------| + |V_{1,1} V_{1,2}| + |V_{2,1} V_{2,2}| + |0 V_{3,2}| + |---------------| + + V_{1,1}\in\R^{n-k,k-l} rectangular + V_{2,1}\in\R^{k-l,k-l} unit upper triangular + + V_{1,2}\in\R^{n-k,l} rectangular + V_{2,2}\in\R^{k-l,l} rectangular + V_{3,2}\in\R^{l,l} unit upper triangular + + We will construct the T matrix + T = |---------------| + |T_{1,1} 0 | + |T_{2,1} T_{2,2}| + |---------------| + + T is the triangular factor obtained from block reflectors. + To motivate the structure, assume we have already computed T_{1,1} + and T_{2,2}. Then collect the associated reflectors in V_1 and V_2 + + T_{1,1}\in\R^{k-l, k-l} non-unit lower triangular + T_{2,2}\in\R^{l, l} non-unit lower triangular + T_{2,1}\in\R^{k-l, l} rectangular + + Where l = floor(k/2) + + Then, consider the product: + + (I - V_2*T_{2,2}*V_2')*(I - V_1*T_{1,1}*V_1') + = I - V_2*T_{2,2}*V_2' - V_1*T_{1,1}*V_1' + V_2*T_{2,2}*V_2'*V_1*T_{1,1}*V_1' + + Define T_{2,1} = -T_{2,2}*V_2'*V_1*T_{1,1} + + Then, we can define the matrix V as + V = |-------| + |V_1 V_2| + |-------| + + So, our product is equivalent to the matrix product + I - V*T*V' + This means, we can compute T_{1,1} and T_{2,2}, then use this information + to compute T_{2,1} + */ + + // Compute T_{1,1} recursively + dlarft( direct, storev, N - l, K - l, V, strideV1, strideV2, offsetV, TAU, strideTAU, offsetTAU, T, strideT1, strideT2, offsetT ); + + // Compute T_{2,2} recursively + dlarft( direct, storev, N - l, K - l, V, strideV1, strideV2, offsetV + ( ( strideV1 + strideV2 ) * l ), TAU, strideTAU, offsetTAU + ( strideTAU * l ), T, strideT1, strideT2, offsetT + ( ( strideT1 + strideT2 ) * l ) ); + + // Compute T_{2,1} = V_{2,2} + for ( j = 0; j < K - l; j++ ) { + for ( i = 0; i < l; i++ ) { + T[ offsetT + ( strideT1 * ( K - l + i ) ) + ( strideT2 * j ) ] = V[ offsetV + ( strideV1 * ( N - K + j ) ) + ( strideV2 * ( K - l + i ) ) ]; + } + } + + // T_{2,1} = T_{2,1}*V_{2,1} + dtrmm( 'right', 'upper', 'no-transpose', 'unit', l, K - l, 1, V, strideV1, strideV2, offsetV + ( strideV1 * ( N - K ) ), T, strideT1, strideT2, offsetT + ( strideT1 * ( K - l ) ) ); + + // T_{2,1} = V_{2,2}'*V_{2,1} + T_{2,1} + + // Note: We assume K <= N, and GEMM will do nothing if N=K + dgemm( 'transpose', 'no-transpose', l, K - l, N - K, 1, V, strideV1, strideV2, offsetV + ( strideV2 * ( K - l ) ), V, strideV1, strideV2, offsetV, 1, T, strideT1, strideT2, offsetT + ( strideT1 * ( K - l ) ) ); + + /* + At this point, we have that T_{2,1} = V_2'*V_1 + All that is left is to pre and post multiply by -T_{2,2} and T_{1,1} respectively. + + T_{2,1} = -T_{2,2}*T_{2,1} + */ + dtrmm( 'left', 'lower', 'no-transpose', 'non-unit', l, K - l, -1, T, strideT1, strideT2, offsetT + ( ( strideT1 + strideT2 ) * ( K - l ) ), T, strideT1, strideT2, offsetT + ( strideT1 * ( K - l ) ) ); + + // T_{2,1} = T_{2,1}*T_{1,1} + dtrmm( 'right', 'lower', 'no-transpose', 'non-unit', l, K - l, 1, T, strideT1, strideT2, offsetT, T, strideT1, strideT2, offsetT + ( strideT1 * ( K - l ) ) ); + } else { + /* + Else means RQ case + + Break V apart into 6 components + + V = |-----------------------| + |V_{1,1} V_{1,2} 0 | + |V_{2,1} V_{2,2} V_{2,3}| + |-----------------------| + + V_{1,1}\in\R^{k-l,n-k} rectangular + V_{1,2}\in\R^{k-l,k-l} unit lower triangular + + V_{2,1}\in\R^{l,n-k} rectangular + V_{2,2}\in\R^{l,k-l} rectangular + V_{2,3}\in\R^{l,l} unit lower triangular + + We will construct the T matrix + T = |---------------| + |T_{1,1} 0 | + |T_{2,1} T_{2,2}| + |---------------| + + T is the triangular factor obtained from block reflectors. + To motivate the structure, assume we have already computed T_{1,1} + and T_{2,2}. Then collect the associated reflectors in V_1 and V_2 + + T_{1,1}\in\R^{k-l, k-l} non-unit lower triangular + T_{2,2}\in\R^{l, l} non-unit lower triangular + T_{2,1}\in\R^{k-l, l} rectangular + + Where l = floor(k/2) + + Then, consider the product: + + (I - V_2'*T_{2,2}*V_2)*(I - V_1'*T_{1,1}*V_1) + = I - V_2'*T_{2,2}*V_2 - V_1'*T_{1,1}*V_1 + V_2'*T_{2,2}*V_2*V_1'*T_{1,1}*V_1 + + Define T_{2,1} = -T_{2,2}*V_2*V_1'*T_{1,1} + + Then, we can define the matrix V as + V = |---| + |V_1| + |V_2| + |---| + + So, our product is equivalent to the matrix product + I - V'*T*V + This means, we can compute T_{1,1} and T_{2,2}, then use this information + to compute T_{2,1} + */ + + // Compute T_{1,1} recursively + dlarft( direct, storev, N - l, K - l, V, strideV1, strideV2, offsetV, TAU, strideTAU, offsetTAU, T, strideT1, strideT2, offsetT ); + + // Compute T_{2,2} recursively + dlarft( direct, storev, N, l, V, strideV1, strideV2, offsetV + ( strideV1 * ( K - l ) ), TAU, strideTAU, offsetTAU + ( strideTAU * ( K - l ) ), T, strideT1, strideT2, offsetT + ( ( strideT1 + strideT2 ) * ( K - l ) ) ); + + // Compute T_{2,1} = V_{2,2} + dlacpy( 'all', l, K - l, V, strideV1, strideV2, offsetV + ( strideV1 * ( K - l ) ) + ( strideV2 * ( N - K ) ), T, strideT1, strideT2, offsetT + ( strideT1 * ( K - l ) ) ); + + // T_{2,1} = T_{2,1}*V_{1,2} + dtrmm( 'right', 'lower', 'transpose', 'unit', l, K - l, 1, V, strideV1, strideV2, offsetV + ( strideV2 * ( N - K ) ), T, strideT1, strideT2, offsetT + ( strideT1 * ( K - l ) ) ); + + // T_{2,1} = V_{2,1}*V_{1,1}' + T_{2,1} + + // Note: We assume K <= N, and GEMM will do nothing if N=K + dgemm('no-transpose', 'transpose', l, K - l, N - K, 1, V, strideV1, strideV2, offsetV + ( strideV1 * ( K - l ) ), V, strideV1, strideV2, offsetV, 1, T, strideT1, strideT2, offsetT + ( strideT1 * ( K - l ) ) ); + + /* + At this point, we have that T_{2,1} = V_2*V_1' + All that is left is to pre and post multiply by -T_{2,2} and T_{1,1} respectively. + + T_{2,1} = -T_{2,2}*T_{2,1} + */ + dtrmm( 'left', 'lower', 'no-transpose', 'non-unit', l, K - l, -1, T, strideT1, strideT2, offsetT + ( ( strideT1 + strideT2 ) * ( K - l ) ), T, strideT1, strideT2, offsetT + ( strideT1 * ( K - l ) ) ); + + // T_{2,1} = T_{2,1}*T_{1,1} + dtrmm( 'right', 'lower', 'no-transpose', 'non-unit', l, K - l, 1, T, strideT1, strideT2, offsetT, T, strideT1, strideT2, offsetT + ( strideT1 * ( K - l ) ) ); + } + return T; +} + + +// EXPORTS // + +module.exports = dlarft; diff --git a/lib/node_modules/@stdlib/lapack/base/dlarft/lib/dlarft.js b/lib/node_modules/@stdlib/lapack/base/dlarft/lib/dlarft.js new file mode 100644 index 000000000000..dec0e02afa15 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlarft/lib/dlarft.js @@ -0,0 +1,113 @@ +/** +* @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 isStorage = require( './is_storage.js' ); +var isDirection = require( './is_direction.js' ); +var base = require( './base.js' ); + + +// MAIN // + +/** +* Forms the triangular factor T of a real block reflector H of order N, which is defined as a product of K elementary reflectors. +* +* ## Notes +* +* - If `direct` = 'forward', `H = H(1) H(2) . . . H(k)` and `T` is upper triangular. +* - If `direct` = 'backward', `H = H(k) . . . H(2) H(1)` and `T` is lower triangular. +* - If `storev` = 'columnwise', the vector which defines the elementary reflector `H(i)` is stored in the i-th column of the array `V`, and `H = I - V * T * V**T`. +* - If `storev` = 'rowwise', the vector which defines the elementary reflector `H(i)` is stored in the i-th row of the array `V`, and `H = I - V**T * T * V`. +* +* @param {string} order - storage layout +* @param {string} direct - specifies the order in which the elementary reflectors are multiplied to form the block reflector `H` +* @param {string} storev - specifies how the vectors which define the elementary reflectors are stored +* @param {NonNegativeInteger} N - order of the block reflector `H` +* @param {NonNegativeInteger} K - order of the triangular factor `T` (the number of elementary reflectors) +* @param {Float64Array} V - matrix of reflector vectors +* @param {PositiveInteger} LDV - leading dimension of `V` +* @param {Float64Array} TAU - array of scalar factors of the elementary reflector `H(i)`y +* @param {Float64Array} T - output triangular matrix +* @param {PositiveInteger} LDT - leading dimension of `T` +* @throws {TypeError} first argument must be a valid order +* @throws {TypeError} second argument must be a valid direction +* @throws {TypeError} third argument must be a valid storage layout +* @throws {RangeError} seventh argument must be a valid `LDV` +* @throws {RangeError} tenth argument must be a valid `LDT` +* @returns {Float64Array} `T` +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var V = new Float64Array( [ 1.0, 0.2, 0.3, -0.4, 0.5, 0.0, 1.0, -0.6, 0.7, -0.8, 0.0, 0.0, 1.0, 0.9, 1.1 ] ); +* var TAU = new Float64Array( [ 1.2, 0.7, 1.5 ] ); +* var T = new Float64Array( 9 ); +* +* dlarft( 'row-major', 'forward', 'rowwise', 5, 3, V, 5, TAU, T, 3 ); +* // T => [ ~1.2, ~0.5544, ~-0.17514, 0.0, 0.7, 0.8925, 0.0, 0.0, 1.5 ] +*/ +function dlarft( order, direct, storev, N, K, V, LDV, TAU, T, LDT ) { + var strideV1; + var strideV2; + var strideT1; + var strideT2; + + if ( !isLayout( order ) ) { + throw new TypeError( format( 'invalid argument. First argument must be a valid order. Value: `%s`.', order ) ); + } + if ( !isDirection( direct ) ) { + throw new TypeError( format( 'invalid argument. Second argument must be a direction. Value: `%s`.', direct ) ); + } + if ( !isStorage( storev ) ) { + throw new TypeError( format( 'invalid argument. Third argument must be a valid storage layout. Value: `%s`.', storev ) ); + } + if ( isColumnMajor( order ) ) { + if ( storev === 'columnwise' && LDV < max( 1, N ) ) { + throw new RangeError( format( 'invalid argument. Seventh argument must be at least max(1,%d). Value: `%d`.', N, LDV ) ); + } + if ( storev === 'rowwise' && LDV < K ) { + throw new RangeError( format( 'invalid argument. Seventh argument must be at least %d. Value: `%d`.', K, LDV ) ); + } + strideV1 = 1; + strideV2 = LDV; + strideT1 = 1; + strideT2 = LDT; + } else { // order === 'row-major' + strideV1 = LDV; + strideV2 = 1; + strideT1 = LDT; + strideT2 = 1; + } + if ( LDT < K ) { + throw new RangeError( format( 'invalid argument. Tenth argument must be at least %d. Value: `%d`.', K, LDT ) ); + } + base( direct, storev, N, K, V, strideV1, strideV2, 0, TAU, 1, 0, T, strideT1, strideT2, 0 ); + return T; +} + + +// EXPORTS // + +module.exports = dlarft; diff --git a/lib/node_modules/@stdlib/lapack/base/dlarft/lib/dtrmm.js b/lib/node_modules/@stdlib/lapack/base/dlarft/lib/dtrmm.js new file mode 100644 index 000000000000..f360237c6ef3 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlarft/lib/dtrmm.js @@ -0,0 +1,362 @@ +/** +* @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-statements, max-lines-per-function */ + +'use strict'; + +// MODULES // + +var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major' ); + + +// FUNCTIONS // + +/** +* Fills a matrix with zeros. +* +* @private +* @param {NonNegativeInteger} M - number of rows +* @param {NonNegativeInteger} N - number of columns +* @param {Float64Array} X - matrix to fill +* @param {integer} strideX1 - stride of the first dimension of `X` +* @param {integer} strideX2 - stride of the second dimension of `X` +* @param {NonNegativeInteger} offsetX - starting index for `X` +* @returns {Float64Array} input matrix +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var X = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* +* zeros( 2, 3, X, 3, 1, 0 ); +* // X => [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var X = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* +* zeros( 2, 3, X, 1, 2, 0 ); +* // X => [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] +*/ +function zeros( M, N, X, strideX1, strideX2, offsetX ) { // TODO: consider moving to a separate package + var dx0; + var dx1; + var S0; + var S1; + var i0; + var i1; + var ix; + + if ( isRowMajor( [ strideX1, strideX2 ] ) ) { + // For row-major matrices, the last dimension has the fastest changing index... + S0 = N; + S1 = M; + dx0 = strideX2; // offset increment for innermost loop + dx1 = strideX1 - ( S0*strideX2 ); // offset increment for outermost loop + } else { // column-major + // For column-major matrices, the first dimension has the fastest changing index... + S0 = M; + S1 = N; + dx0 = strideX1; // offset increment for innermost loop + dx1 = strideX2 - ( S0*strideX1 ); // offset increment for outermost loop + } + ix = offsetX; + for ( i1 = 0; i1 < S1; i1++ ) { + for ( i0 = 0; i0 < S0; i0++ ) { + X[ ix ] = 0.0; + ix += dx0; + } + ix += dx1; + } + return X; +} + + +// MAIN // + +/** +* Performs one of the matrix-matrix operations `B = α * op(A) * B` or `B = α * B * op(A)` where `α` is a scalar, `B` is an `M` by `N` matrix, `A` is a unit, or non-unit, upper or lower triangular matrix and `op( A )` is one of `op( A ) = A` or `op( A ) = A^T`. +* +* @private +* @param {string} side - specifies whether `op( A )` appears on the left or right side of `B` +* @param {string} uplo - specifies whether the upper or lower triangular part of the matrix `A` should be referenced +* @param {string} transa - specifies whether `A` should be transposed, conjugate-transposed, or not transposed +* @param {string} diag - specifies whether or not `A` is unit triangular +* @param {NonNegativeInteger} M - number of rows in `B` +* @param {NonNegativeInteger} N - number of columns in `B` +* @param {number} alpha - scalar constant +* @param {Float64Array} A - first input 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 for `A` +* @param {Float64Array} B - second input matrix +* @param {integer} strideB1 - stride of the first dimension of `B` +* @param {integer} strideB2 - stride of the second dimension of `B` +* @param {NonNegativeInteger} offsetB - starting index for `B` +* @returns {Float64Array} `B` +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( [ 1.0, 0.0, 0.0, 2.0, 3.0, 0.0, 4.0, 5.0, 6.0 ] ); +* var B = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ] ); +* +* dtrmm( 'left', 'lower', 'no-transpose', 'unit', 3, 3, 1.0, A, 3, 1, 0, B, 3, 1, 0 ); +* // B => [ 1.0, 2.0, 3.0, 6.0, 9.0, 12.0, 31.0, 41.0, 51.0 ] +*/ +function dtrmm( side, uplo, transa, diag, M, N, alpha, A, strideA1, strideA2, offsetA, B, strideB1, strideB2, offsetB ) { // eslint-disable-line max-params + var nonunit; + var isrma; + var tmp; + var oa2; + var ob2; + var sa0; + var sa1; + var sb0; + var sb1; + var oa; + var ob; + var ia; + var ib; + var i; + var j; + var k; + var t; + + // Note on variable naming convention: sa#, sb# where # corresponds to the loop number, with `0` being the innermost loop... + + nonunit = ( diag === 'non-unit' ); + + if ( M === 0 || N === 0 ) { + return B; + } + + // Handle alpha = 0 before any layout conversion (zeroing uses original layout)... + if ( alpha === 0.0 ) { + if ( isRowMajor( [ strideB1, strideB2 ] ) ) { + sb0 = strideB2; + sb1 = strideB1; + } else { + sb0 = strideB1; + sb1 = strideB2; + } + zeros( M, N, B, sb0, sb1, offsetB ); + return B; + } + + // Detect layout and convert column-major to an equivalent row-major problem... + isrma = isRowMajor( [ strideA1, strideA2 ] ); + if ( !isrma ) { + // Swap strides: effectively view A and B as transposed (row-major)... + t = strideA1; + strideA1 = strideA2; + strideA2 = t; + + t = strideB1; + strideB1 = strideB2; + strideB2 = t; + + side = ( side === 'left' ) ? 'right' : 'left'; + uplo = ( uplo === 'upper' ) ? 'lower' : 'upper'; + t = M; + M = N; + N = t; + } + + // For row-major matrices, the last dimension has the fastest changing index... + sa0 = strideA2; // stride for innermost loop + sa1 = strideA1; // stride for outermost loop + sb0 = strideB2; // stride for innermost loop + sb1 = strideB1; // stride for outermost loop + + if ( side === 'left' && uplo === 'upper' && transa === 'no-transpose' ) { + for ( j = 0; j < N; j++ ) { + ib = offsetB + ( j*sb0 ); + for ( k = 0; k < M; k++ ) { + ob2 = ib + ( k * sb1 ); + tmp = alpha * B[ ob2 ]; + ia = offsetA + ( k*sa0 ); + for ( i = 0; i < k; i++ ) { + B[ ib + ( i*sb1 ) ] += ( tmp * A[ ia + ( i*sa1 ) ] ); + } + if ( nonunit ) { + tmp *= A[ ia + ( k*sa1 ) ]; + } + B[ ob2 ] = tmp; + } + } + return B; + } + if ( side === 'left' && uplo === 'lower' && transa === 'no-transpose' ) { + for ( j = 0; j < N; j++ ) { + ib = offsetB + ( j*sb0 ); + for ( k = M - 1; k >= 0; k-- ) { + ob2 = ib + ( k*sb1 ); + tmp = alpha * B[ ob2 ]; + ia = offsetA + ( k*sa0 ); + for ( i = k + 1; i < M; i++ ) { + oa2 = ia + ( i*sa1 ); + B[ ib + ( i*sb1 ) ] += ( tmp * A[ oa2 ] ); + } + if ( nonunit ) { + tmp *= A[ ia + ( k*sa1 ) ]; + } + B[ ob2 ] = tmp; + } + } + return B; + } + if ( side === 'left' && uplo === 'upper' && transa !== 'no-transpose' ) { + for ( j = 0; j < N; j++ ) { + ib = offsetB + ( j*sb0 ); + for ( i = M - 1; i >= 0; i-- ) { + ob2 = ib + ( i*sb1 ); + tmp = 0.0; + ia = offsetA + ( i*sa0 ); + if ( nonunit ) { + tmp += ( A[ ia + ( i*sa1 ) ] * B[ ob2 ] ); + } else { + tmp += B[ ob2 ]; + } + for ( k = 0; k < i; k++ ) { + oa2 = ia + ( k*sa1 ); + tmp += A[ oa2 ] * B[ ib + ( k*sb1 ) ]; + } + B[ ob2 ] = alpha * tmp; + } + } + return B; + } + if ( side === 'left' && uplo === 'lower' && transa !== 'no-transpose' ) { + for ( j = 0; j < N; j++ ) { + ib = offsetB + ( j * sb0 ); + for ( i = 0; i < M; i++ ) { + ia = offsetA + ( i * sa0 ); + ob2 = ib + ( i * sb1 ); + tmp = 0.0; + for ( k = i + 1; k < M; k++ ) { + tmp += A[ ia + ( k * sa1 ) ] * B[ ib + ( k * sb1 ) ]; + } + if ( nonunit ) { + tmp += ( A[ ia + ( i * sa1 ) ] * B[ ob2 ] ); + } else { + tmp += B[ ob2 ]; + } + B[ ob2 ] = alpha * tmp; + } + } + return B; + } + if ( side === 'right' && uplo === 'upper' && transa === 'no-transpose' ) { + for ( j = N - 1; j >= 0; j-- ) { + ia = offsetA + ( j*sa0 ); + ib = offsetB + ( j*sb0 ); + for ( i = 0; i < M; i++ ) { + ob = ib + ( i*sb1 ); + B[ ob ] *= alpha; + if ( nonunit ) { + oa2 = ia + ( j*sa1 ); + tmp = A[ oa2 ]; + B[ ob ] *= tmp; + } + for ( k = 0; k < j; k++ ) { + oa2 = ia + ( k*sa1 ); + ob2 = offsetB + ( k*sb0 ); + if ( A[ oa2 ] !== 0.0 ) { + tmp = alpha * A[ oa2 ]; + B[ ob ] += ( tmp * B[ ob2 + ( i*sb1 ) ] ); + } + } + } + } + return B; + } + if ( side === 'right' && uplo === 'lower' && transa === 'no-transpose' ) { + for ( j = 0; j < N; j++ ) { + ia = offsetA + ( j*sa0 ); + for ( i = 0; i < M; i++ ) { + ib = offsetB + ( i*sb1 ); + ob = ib + ( j*sb0 ); + B[ ob ] *= alpha; + if ( nonunit ) { + oa = ia + ( j*sa1 ); + B[ ob ] *= A[ oa ]; + } + for ( k = j + 1; k < N; k++ ) { + oa2 = ia + ( k*sa1 ); + ob2 = ib + ( k*sb0 ); + if ( A[ oa2 ] !== 0.0 ) { + tmp = alpha * A[ oa2 ]; + B[ ob ] += ( tmp * B[ ob2 ] ); + } + } + } + } + return B; + } + if ( side === 'right' && uplo === 'upper' && transa !== 'no-transpose' ) { + for ( j = 0; j < N; j++ ) { + ia = offsetA + ( j*sa1 ); + for ( i = 0; i < M; i++ ) { + ib = offsetB + ( i*sb1 ); + oa = ia + ( j*sa0 ); + ob = ib + ( j*sb0 ); + if ( nonunit ) { + tmp = B[ ob ] * A[ oa ]; + } else { + tmp = B[ ob ]; + } + for ( k = j + 1; k < N; k++ ) { + oa2 = ia + ( k*sa0 ); + ob2 = ib + ( k*sb0 ); + tmp += ( B[ ob2 ] * A[ oa2 ] ); + } + B[ ob ] = alpha * tmp; + } + } + return B; + } + // side === 'right', uplo === 'lower', transa !== 'no-transpose' + for ( i = 0; i < M; i++ ) { + ib = offsetB + ( i*sb1 ); + for ( j = N - 1; j >= 0; j-- ) { + ia = offsetA + ( j*sa1 ); + oa = ia + ( j*sa0 ); + ob = ib + ( j*sb0 ); + if ( nonunit ) { + tmp = B[ ob ] * A[ oa ]; + } else { + tmp = B[ ob ]; + } + for ( k = 0; k < j; k++ ) { + oa2 = ia + ( k*sa0 ); + ob2 = ib + ( k*sb0 ); + tmp += ( B[ ob2 ] * A[ oa2 ] ); + } + B[ ob ] = alpha * tmp; + } + } + return B; +} + + +// EXPORTS // + +module.exports = dtrmm; diff --git a/lib/node_modules/@stdlib/lapack/base/dlarft/lib/index.js b/lib/node_modules/@stdlib/lapack/base/dlarft/lib/index.js new file mode 100644 index 000000000000..dc5d15dcca5a --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlarft/lib/index.js @@ -0,0 +1,61 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* LAPACK routine to form the triangular factor T of a real block reflector H of order N, which is defined as a product of K elementary reflectors. +* +* @module @stdlib/lapack/base/dlarft +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var dlarft = require( '@stdlib/lapack/base/dlarft' ); +* +* var V = new Float64Array( [ 1.0, 0.2, 0.3, -0.4, 0.5, 0.0, 1.0, -0.6, 0.7, -0.8, 0.0, 0.0, 1.0, 0.9, 1.1 ] ); +* var TAU = new Float64Array( [ 1.2, 0.7, 1.5 ] ); +* var T = new Float64Array( 9 ); +* +* dlarft( 'row-major', 'forward', 'rowwise', 5, 3, V, 5, TAU, T, 3 ); +* // T => [ ~1.2, ~0.5544, ~-0.17514, 0.0, 0.7, 0.8925, 0.0, 0.0, 1.5 ] +*/ + +// 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 dlarft; +var tmp = tryRequire( join( __dirname, './native.js' ) ); +if ( isError( tmp ) ) { + dlarft = main; +} else { + dlarft = tmp; +} + + +// EXPORTS // + +module.exports = dlarft; + +// exports: { "ndarray": "dlarft.ndarray" } diff --git a/lib/node_modules/@stdlib/lapack/base/dlarft/lib/is_direction.js b/lib/node_modules/@stdlib/lapack/base/dlarft/lib/is_direction.js new file mode 100644 index 000000000000..8f11ebb24eac --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlarft/lib/is_direction.js @@ -0,0 +1,42 @@ +/** +* @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 contains = require( '@stdlib/array/base/assert/contains' ).factory; + + +// FUNCTIONS // + +/** +* Tests whether a string is a valid direction. +* +* @private +* @param {string} direct - direction +* @returns {boolean} boolean indicating if the string is a valid direction +*/ +function isDirection( direct ) { + return contains( [ 'forward', 'backward' ] )( direct ); +} + + +// EXPORTS // + +module.exports = isDirection; diff --git a/lib/node_modules/@stdlib/lapack/base/dlarft/lib/is_storage.js b/lib/node_modules/@stdlib/lapack/base/dlarft/lib/is_storage.js new file mode 100644 index 000000000000..2c3f1ab4dfd9 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlarft/lib/is_storage.js @@ -0,0 +1,42 @@ +/** +* @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 contains = require( '@stdlib/array/base/assert/contains' ).factory; + + +// FUNCTIONS // + +/** +* Tests whether a string is a valid storage layout. +* +* @private +* @param {string} store - storage layout +* @returns {boolean} boolean indicating if the string is a valid storage layout +*/ +function isStorage( store ) { + return contains( [ 'columnwise', 'rowwise' ] )( store ); +} + + +// EXPORTS // + +module.exports = isStorage; diff --git a/lib/node_modules/@stdlib/lapack/base/dlarft/lib/main.js b/lib/node_modules/@stdlib/lapack/base/dlarft/lib/main.js new file mode 100644 index 000000000000..14448d2dde85 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlarft/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 dlarft = require( './dlarft.js' ); +var ndarray = require( './ndarray.js' ); + + +// MAIN // + +setReadOnly( dlarft, 'ndarray', ndarray ); + + +// EXPORTS // + +module.exports = dlarft; diff --git a/lib/node_modules/@stdlib/lapack/base/dlarft/lib/ndarray.js b/lib/node_modules/@stdlib/lapack/base/dlarft/lib/ndarray.js new file mode 100644 index 000000000000..56e76d2b4d1d --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlarft/lib/ndarray.js @@ -0,0 +1,84 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var format = require( '@stdlib/string/format' ); +var isStorage = require( './is_storage.js' ); +var isDirection = require( './is_direction.js' ); +var base = require( './base.js' ); + + +// MAIN // + +/** +* Forms the triangular factor T of a real block reflector H of order N, which is defined as a product of K elementary reflectors using alternative indexing semantics. +* +* ## Notes +* +* - If `direct` = 'forward', `H = H(1) H(2) . . . H(k)` and `T` is upper triangular. +* - If `direct` = 'backward', `H = H(k) . . . H(2) H(1)` and `T` is lower triangular. +* - If `storev` = 'columnwise', the vector which defines the elementary reflector `H(i)` is stored in the i-th column of the array `V`, and `H = I - V * T * V**T`. +* - If `storev` = 'rowwise', the vector which defines the elementary reflector `H(i)` is stored in the i-th row of the array `V`, and `H = I - V**T * T * V`. +* +* @param {string} direct - specifies the order in which the elementary reflectors are multiplied to form the block reflector `H` +* @param {string} storev - specifies how the vectors which define the elementary reflectors are stored +* @param {NonNegativeInteger} N - order of the block reflector `H` +* @param {NonNegativeInteger} K - order of the triangular factor `T` (the number of elementary reflectors) +* @param {Float64Array} V - matrix of reflector vectors +* @param {integer} strideV1 - stride of first dimension of `V` +* @param {integer} strideV2 - stride of second dimension of `V` +* @param {NonNegativeInteger} offsetV - starting index for `V` +* @param {Float64Array} TAU - array of scalar factors of the elementary reflector `H(i)` +* @param {integer} strideTAU - stride length for `TAU` +* @param {NonNegativeInteger} offsetTAU - starting index for `TAU` +* @param {Float64Array} T - output triangular matrix +* @param {integer} strideT1 - stride of first dimension of `T` +* @param {integer} strideT2 - stride of second dimension of `T` +* @param {NonNegativeInteger} offsetT - starting index for `T` +* @throws {TypeError} first argument must be a valid direction +* @throws {TypeError} second argument must be a valid storage layout +* @returns {Float64Array} `T` +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var V = new Float64Array( [ 1.0, 0.2, 0.3, -0.4, 0.5, 0.0, 1.0, -0.6, 0.7, -0.8, 0.0, 0.0, 1.0, 0.9, 1.1 ] ); +* var TAU = new Float64Array( [ 1.2, 0.7, 1.5 ] ); +* var T = new Float64Array( 9 ); +* +* dlarft( 'forward', 'rowwise', 5, 3, V, 5, 1, 0, TAU, 1, 0, T, 3, 1, 0 ); +* // T => [ ~1.2, ~0.5544, ~-0.17514, 0.0, 0.7, 0.8925, 0.0, 0.0, 1.5 ] +*/ +function dlarft( direct, storev, N, K, V, strideV1, strideV2, offsetV, TAU, strideTAU, offsetTAU, T, strideT1, strideT2, offsetT ) { // eslint-disable-line max-len, max-params + if ( !isDirection( direct ) ) { + throw new TypeError( format( 'invalid argument. Second argument must be a direction. Value: `%s`.', direct ) ); + } + if ( !isStorage( storev ) ) { + throw new TypeError( format( 'invalid argument. Third argument must be a valid storage layout. Value: `%s`.', storev ) ); + } + base( direct, storev, N, K, V, strideV1, strideV2, offsetV, TAU, strideTAU, offsetTAU, T, strideT1, strideT2, offsetT ); // eslint-disable-line max-len + return T; +} + + +// EXPORTS // + +module.exports = dlarft; diff --git a/lib/node_modules/@stdlib/lapack/base/dlarft/package.json b/lib/node_modules/@stdlib/lapack/base/dlarft/package.json new file mode 100644 index 000000000000..0a91ad176bd5 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlarft/package.json @@ -0,0 +1,72 @@ +{ + "name": "@stdlib/lapack/base/dlarft", + "version": "0.0.0", + "description": "LAPACK routine to form the triangular factor `T` of a real block reflector `H` of order `N`, which is defined as a product of `K` elementary reflectors.", + "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", + "dlarft", + "reflector", + "block", + "triangular", + "factor", + "linear", + "algebra", + "subroutines", + "array", + "ndarray", + "matrix", + "float64", + "double", + "float64array" + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/large_strides/lq_col_maj.json b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/large_strides/lq_col_maj.json new file mode 100644 index 000000000000..3121e68adb6a --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/large_strides/lq_col_maj.json @@ -0,0 +1,137 @@ +{ + "order": "column-major", + "direct": "forward", + "storev": "rowwise", + "N": 5, + "K": 3, + "V": [ + 1, + 9999, + 0, + 9999, + 0, + 9999, + 0.2, + 9999, + 1, + 9999, + 0, + 9999, + 0.3, + 9999, + -0.6, + 9999, + 1, + 9999, + -0.4, + 9999, + 0.7, + 9999, + 0.9, + 9999, + 0.5, + 9999, + -0.8, + 9999, + 1.1, + 9999 + ], + "strideV1": 2, + "strideV2": 6, + "offsetV": 0, + "LDV": 3, + "V_mat": [ + [ + 1, + 0.2, + 0.3, + -0.4, + 0.5 + ], + [ + 0, + 1, + -0.6, + 0.7, + -0.8 + ], + [ + 0, + 0, + 1, + 0.9, + 1.1 + ] + ], + "TAU": [ + 1.2, + 9999, + 0.7, + 9999, + 1.5, + 9999 + ], + "strideTAU": 2, + "offsetTAU": 0, + "T": [ + 0, + 9999, + 0, + 9999, + 0, + 9999, + 0, + 9999, + 0, + 9999, + 0, + 9999, + 0, + 9999, + 0, + 9999, + 0, + 9999 + ], + "strideT1": 2, + "strideT2": 6, + "offsetT": 0, + "LDT": 3, + "T_out": [ + 1.2, + 9999, + 0, + 9999, + 0, + 9999, + 0.5543999999999999, + 9999, + 0.7, + 9999, + 0, + 9999, + -0.17513999999999996, + 9999, + 0.8925000000000002, + 9999, + 1.5, + 9999 + ], + "T_out_mat": [ + [ + 1.2, + 0.5543999999999999, + -0.17513999999999996 + ], + [ + 0, + 0.7, + 0.8925000000000002 + ], + [ + 0, + 0, + 1.5 + ] + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/large_strides/lq_row_maj.json b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/large_strides/lq_row_maj.json new file mode 100644 index 000000000000..a9e7f34429f9 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/large_strides/lq_row_maj.json @@ -0,0 +1,137 @@ +{ + "order": "row-major", + "direct": "forward", + "storev": "rowwise", + "N": 5, + "K": 3, + "V": [ + 1, + 9999, + 0.2, + 9999, + 0.3, + 9999, + -0.4, + 9999, + 0.5, + 9999, + 0, + 9999, + 1, + 9999, + -0.6, + 9999, + 0.7, + 9999, + -0.8, + 9999, + 0, + 9999, + 0, + 9999, + 1, + 9999, + 0.9, + 9999, + 1.1, + 9999 + ], + "strideV1": 10, + "strideV2": 2, + "offsetV": 0, + "LDV": 5, + "V_mat": [ + [ + 1, + 0.2, + 0.3, + -0.4, + 0.5 + ], + [ + 0, + 1, + -0.6, + 0.7, + -0.8 + ], + [ + 0, + 0, + 1, + 0.9, + 1.1 + ] + ], + "TAU": [ + 1.2, + 9999, + 0.7, + 9999, + 1.5, + 9999 + ], + "strideTAU": 2, + "offsetTAU": 0, + "T": [ + 0, + 9999, + 0, + 9999, + 0, + 9999, + 0, + 9999, + 0, + 9999, + 0, + 9999, + 0, + 9999, + 0, + 9999, + 0, + 9999 + ], + "strideT1": 6, + "strideT2": 2, + "offsetT": 0, + "LDT": 3, + "T_out": [ + 1.2, + 9999, + 0.5543999999999999, + 9999, + -0.17513999999999996, + 9999, + 0, + 9999, + 0.7, + 9999, + 0.8925000000000002, + 9999, + 0, + 9999, + 0, + 9999, + 1.5, + 9999 + ], + "T_out_mat": [ + [ + 1.2, + 0.5543999999999999, + -0.17513999999999996 + ], + [ + 0, + 0.7, + 0.8925000000000002 + ], + [ + 0, + 0, + 1.5 + ] + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/large_strides/ql_col_maj.json b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/large_strides/ql_col_maj.json new file mode 100644 index 000000000000..5ee79906879f --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/large_strides/ql_col_maj.json @@ -0,0 +1,141 @@ +{ + "order": "column-major", + "direct": "backward", + "storev": "columnwise", + "N": 5, + "K": 3, + "V": [ + 0.4, + 9999, + 0.5, + 9999, + 1, + 9999, + 0, + 9999, + 0, + 9999, + -0.2, + 9999, + 0.7, + 9999, + 0.8, + 9999, + 1, + 9999, + 0, + 9999, + 0.1, + 9999, + -0.3, + 9999, + 0.9, + 9999, + 1.2, + 9999, + 1, + 9999 + ], + "strideV1": 2, + "strideV2": 10, + "offsetV": 0, + "LDV": 5, + "V_mat": [ + [ + 0.4, + -0.2, + 0.1 + ], + [ + 0.5, + 0.7, + -0.3 + ], + [ + 1, + 0.8, + 0.9 + ], + [ + 0, + 1, + 1.2 + ], + [ + 0, + 0, + 1 + ] + ], + "TAU": [ + 0.9, + 9999, + 1.3, + 9999, + 0.6, + 9999 + ], + "strideTAU": 2, + "offsetTAU": 0, + "T": [ + 0, + 9999, + 0, + 9999, + 0, + 9999, + 0, + 9999, + 0, + 9999, + 0, + 9999, + 0, + 9999, + 0, + 9999, + 0, + 9999 + ], + "strideT1": 2, + "strideT2": 6, + "offsetT": 0, + "LDT": 3, + "T_out": [ + 0.9, + 9999, + -1.2519000000000002, + 9999, + 0.8428266, + 9999, + 0, + 9999, + 1.3, + 9999, + -1.3182, + 9999, + 0, + 9999, + 0, + 9999, + 0.6, + 9999 + ], + "T_out_mat": [ + [ + 0.9, + 0, + 0 + ], + [ + -1.2519000000000002, + 1.3, + 0 + ], + [ + 0.8428266, + -1.3182, + 0.6 + ] + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/large_strides/ql_row_maj.json b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/large_strides/ql_row_maj.json new file mode 100644 index 000000000000..acaa86b63a19 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/large_strides/ql_row_maj.json @@ -0,0 +1,141 @@ +{ + "order": "row-major", + "direct": "backward", + "storev": "columnwise", + "N": 5, + "K": 3, + "V": [ + 0.4, + 9999, + -0.2, + 9999, + 0.1, + 9999, + 0.5, + 9999, + 0.7, + 9999, + -0.3, + 9999, + 1, + 9999, + 0.8, + 9999, + 0.9, + 9999, + 0, + 9999, + 1, + 9999, + 1.2, + 9999, + 0, + 9999, + 0, + 9999, + 1, + 9999 + ], + "strideV1": 6, + "strideV2": 2, + "offsetV": 0, + "LDV": 3, + "V_mat": [ + [ + 0.4, + -0.2, + 0.1 + ], + [ + 0.5, + 0.7, + -0.3 + ], + [ + 1, + 0.8, + 0.9 + ], + [ + 0, + 1, + 1.2 + ], + [ + 0, + 0, + 1 + ] + ], + "TAU": [ + 0.9, + 9999, + 1.3, + 9999, + 0.6, + 9999 + ], + "strideTAU": 2, + "offsetTAU": 0, + "T": [ + 0, + 9999, + 0, + 9999, + 0, + 9999, + 0, + 9999, + 0, + 9999, + 0, + 9999, + 0, + 9999, + 0, + 9999, + 0, + 9999 + ], + "strideT1": 6, + "strideT2": 2, + "offsetT": 0, + "LDT": 3, + "T_out": [ + 0.9, + 9999, + 0, + 9999, + 0, + 9999, + -1.2519000000000002, + 9999, + 1.3, + 9999, + 0, + 9999, + 0.8428266, + 9999, + -1.3182, + 9999, + 0.6, + 9999 + ], + "T_out_mat": [ + [ + 0.9, + 0, + 0 + ], + [ + -1.2519000000000002, + 1.3, + 0 + ], + [ + 0.8428266, + -1.3182, + 0.6 + ] + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/large_strides/qr_col_maj.json b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/large_strides/qr_col_maj.json new file mode 100644 index 000000000000..848ad414d832 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/large_strides/qr_col_maj.json @@ -0,0 +1,141 @@ +{ + "order": "column-major", + "direct": "forward", + "storev": "columnwise", + "N": 5, + "K": 3, + "V": [ + 1, + 9999, + 0.1, + 9999, + 0.2, + 9999, + 0.3, + 9999, + 0.4, + 9999, + 0, + 9999, + 1, + 9999, + 0.5, + 9999, + 0.6, + 9999, + 0.7, + 9999, + 0, + 9999, + 0, + 9999, + 1, + 9999, + 0.8, + 9999, + 0.9, + 9999 + ], + "strideV1": 2, + "strideV2": 10, + "offsetV": 0, + "LDV": 5, + "V_mat": [ + [ + 1, + 0, + 0 + ], + [ + 0.1, + 1, + 0 + ], + [ + 0.2, + 0.5, + 1 + ], + [ + 0.3, + 0.6, + 0.8 + ], + [ + 0.4, + 0.7, + 0.9 + ] + ], + "TAU": [ + 1.1, + 9999, + 0.8, + 9999, + 1.4, + 9999 + ], + "strideTAU": 2, + "offsetTAU": 0, + "T": [ + 0, + 9999, + 0, + 9999, + 0, + 9999, + 0, + 9999, + 0, + 9999, + 0, + 9999, + 0, + 9999, + 0, + 9999, + 0, + 9999 + ], + "strideT1": 2, + "strideT2": 6, + "offsetT": 0, + "LDT": 3, + "T_out": [ + 1.1, + 9999, + 0, + 9999, + 0, + 9999, + -0.5808000000000001, + 9999, + 0.8, + 9999, + 0, + 9999, + 0.07712319999999973, + 9999, + -1.8031999999999997, + 9999, + 1.4, + 9999 + ], + "T_out_mat": [ + [ + 1.1, + -0.5808000000000001, + 0.07712319999999973 + ], + [ + 0, + 0.8, + -1.8031999999999997 + ], + [ + 0, + 0, + 1.4 + ] + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/large_strides/qr_row_maj.json b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/large_strides/qr_row_maj.json new file mode 100644 index 000000000000..d14f9c8b6320 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/large_strides/qr_row_maj.json @@ -0,0 +1,141 @@ +{ + "order": "row-major", + "direct": "forward", + "storev": "columnwise", + "N": 5, + "K": 3, + "V": [ + 1, + 9999, + 0, + 9999, + 0, + 9999, + 0.1, + 9999, + 1, + 9999, + 0, + 9999, + 0.2, + 9999, + 0.5, + 9999, + 1, + 9999, + 0.3, + 9999, + 0.6, + 9999, + 0.8, + 9999, + 0.4, + 9999, + 0.7, + 9999, + 0.9, + 9999 + ], + "strideV1": 6, + "strideV2": 2, + "offsetV": 0, + "LDV": 3, + "V_mat": [ + [ + 1, + 0, + 0 + ], + [ + 0.1, + 1, + 0 + ], + [ + 0.2, + 0.5, + 1 + ], + [ + 0.3, + 0.6, + 0.8 + ], + [ + 0.4, + 0.7, + 0.9 + ] + ], + "TAU": [ + 1.1, + 9999, + 0.8, + 9999, + 1.4, + 9999 + ], + "strideTAU": 2, + "offsetTAU": 0, + "T": [ + 0, + 9999, + 0, + 9999, + 0, + 9999, + 0, + 9999, + 0, + 9999, + 0, + 9999, + 0, + 9999, + 0, + 9999, + 0, + 9999 + ], + "strideT1": 6, + "strideT2": 2, + "offsetT": 0, + "LDT": 3, + "T_out": [ + 1.1, + 9999, + -0.5808000000000001, + 9999, + 0.07712319999999973, + 9999, + 0, + 9999, + 0.8, + 9999, + -1.8032, + 9999, + 0, + 9999, + 0, + 9999, + 1.4, + 9999 + ], + "T_out_mat": [ + [ + 1.1, + -0.5808000000000001, + 0.07712319999999973 + ], + [ + 0, + 0.8, + -1.8031999999999997 + ], + [ + 0, + 0, + 1.4 + ] + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/large_strides/rq_col_maj.json b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/large_strides/rq_col_maj.json new file mode 100644 index 000000000000..954cbdc989e7 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/large_strides/rq_col_maj.json @@ -0,0 +1,137 @@ +{ + "order": "column-major", + "direct": "backward", + "storev": "rowwise", + "N": 5, + "K": 3, + "V": [ + 0.25, + 9999, + -0.4, + 9999, + 0.6, + 9999, + 0.25, + 9999, + -0.4, + 9999, + 0.6, + 9999, + 1, + 9999, + -0.4, + 9999, + 0.6, + 9999, + 0, + 9999, + 1, + 9999, + 0.6, + 9999, + 0, + 9999, + 0, + 9999, + 1, + 9999 + ], + "strideV1": 2, + "strideV2": 6, + "offsetV": 0, + "LDV": 3, + "V_mat": [ + [ + 0.25, + 0.25, + 1, + 0, + 0 + ], + [ + -0.4, + -0.4, + -0.4, + 1, + 0 + ], + [ + 0.6, + 0.6, + 0.6, + 0.6, + 1 + ] + ], + "TAU": [ + 1.25, + 9999, + 0.75, + 9999, + 1.1, + 9999 + ], + "strideTAU": 2, + "offsetTAU": 0, + "T": [ + 0, + 9999, + 0, + 9999, + 0, + 9999, + 0, + 9999, + 0, + 9999, + 0, + 9999, + 0, + 9999, + 0, + 9999, + 0, + 9999 + ], + "strideT1": 2, + "strideT2": 6, + "offsetT": 0, + "LDT": 3, + "T_out": [ + 1.25, + 9999, + 0.5625, + 9999, + -1.16325, + 9999, + 0, + 9999, + 0.75, + 9999, + 0.09900000000000016, + 9999, + 0, + 9999, + 0, + 9999, + 1.1, + 9999 + ], + "T_out_mat": [ + [ + 1.25, + 0, + 0 + ], + [ + 0.5625, + 0.75, + 0 + ], + [ + -1.16325, + 0.09900000000000016, + 1.1 + ] + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/large_strides/rq_row_maj.json b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/large_strides/rq_row_maj.json new file mode 100644 index 000000000000..41d6c6af2846 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/large_strides/rq_row_maj.json @@ -0,0 +1,137 @@ +{ + "order": "row-major", + "direct": "backward", + "storev": "rowwise", + "N": 5, + "K": 3, + "V": [ + 0.25, + 9999, + 0.25, + 9999, + 1, + 9999, + 0, + 9999, + 0, + 9999, + -0.4, + 9999, + -0.4, + 9999, + -0.4, + 9999, + 1, + 9999, + 0, + 9999, + 0.6, + 9999, + 0.6, + 9999, + 0.6, + 9999, + 0.6, + 9999, + 1, + 9999 + ], + "strideV1": 10, + "strideV2": 2, + "offsetV": 0, + "LDV": 5, + "V_mat": [ + [ + 0.25, + 0.25, + 1, + 0, + 0 + ], + [ + -0.4, + -0.4, + -0.4, + 1, + 0 + ], + [ + 0.6, + 0.6, + 0.6, + 0.6, + 1 + ] + ], + "TAU": [ + 1.25, + 9999, + 0.75, + 9999, + 1.1, + 9999 + ], + "strideTAU": 2, + "offsetTAU": 0, + "T": [ + 0, + 9999, + 0, + 9999, + 0, + 9999, + 0, + 9999, + 0, + 9999, + 0, + 9999, + 0, + 9999, + 0, + 9999, + 0, + 9999 + ], + "strideT1": 6, + "strideT2": 2, + "offsetT": 0, + "LDT": 3, + "T_out": [ + 1.25, + 9999, + 0, + 9999, + 0, + 9999, + 0.5625, + 9999, + 0.75, + 9999, + 0, + 9999, + -1.16325, + 9999, + 0.09900000000000016, + 9999, + 1.1, + 9999 + ], + "T_out_mat": [ + [ + 1.25, + 0, + 0 + ], + [ + 0.5625, + 0.75, + 0 + ], + [ + -1.16325, + 0.09900000000000016, + 1.1 + ] + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/lq_col_maj.json b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/lq_col_maj.json new file mode 100644 index 000000000000..b95acf205a81 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/lq_col_maj.json @@ -0,0 +1,46 @@ +{ + "order": "column-major", + "direct": "forward", + "storev": "rowwise", + + "N": 5, + "K": 3, + + "V": [ 1.0, 0.0, 0.0, 0.2, 1.0, 0.0, 0.3, -0.6, 1.0, -0.4, 0.7, 0.9, 0.5, -0.8, 1.1 ], + "strideV1": 1, + "strideV2": 3, + "offsetV": 0, + "LDV": 3, + "V_mat": [ + [ 1.0, 0.2, 0.3, -0.4, 0.5 ], + [ 0.0, 1.0, -0.6, 0.7, -0.8 ], + [ 0.0, 0.0, 1.0, 0.9, 1.1 ] + ], + + "TAU": [ 1.2, 0.7, 1.5 ], + "strideTAU": 1, + "offsetTAU": 0, + + "T": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + "strideT1": 1, + "strideT2": 3, + "offsetT": 0, + "LDT": 3, + + "T_out": [ + 1.19999999999999996, + 0.0, + 0.0, + 5.54399999999999893e-001, + 6.99999999999999956e-001, + 0.0, + -1.75139999999999962e-001, + 8.92500000000000182e-001, + 1.5 + ], + "T_out_mat": [ + [ 1.19999999999999996, 5.54399999999999893e-001, -1.75139999999999962e-001 ], + [ 0.00000000000000000E+000, 6.99999999999999956E-001, 8.92500000000000182E-001 ], + [ 0.00000000000000000E+000, 0.00000000000000000E+000, 1.50000000000000000E+000 ] + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/lq_row_maj.json b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/lq_row_maj.json new file mode 100644 index 000000000000..27d9a70b6538 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/lq_row_maj.json @@ -0,0 +1,46 @@ +{ + "order": "row-major", + "direct": "forward", + "storev": "rowwise", + + "N": 5, + "K": 3, + + "V": [ 1.0, 0.2, 0.3, -0.4, 0.5, 0.0, 1.0, -0.6, 0.7, -0.8, 0.0, 0.0, 1.0, 0.9, 1.1 ], + "strideV1": 5, + "strideV2": 1, + "offsetV": 0, + "LDV": 5, + "V_mat": [ + [ 1.0, 0.2, 0.3, -0.4, 0.5 ], + [ 0.0, 1.0, -0.6, 0.7, -0.8 ], + [ 0.0, 0.0, 1.0, 0.9, 1.1 ] + ], + + "TAU": [ 1.2, 0.7, 1.5 ], + "strideTAU": 1, + "offsetTAU": 0, + + "T": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + "strideT1": 3, + "strideT2": 1, + "offsetT": 0, + "LDT": 3, + + "T_out": [ + 1.19999999999999996, + 5.54399999999999893E-001, + -1.75139999999999962E-001, + 0.00000000000000000E+000, + 6.99999999999999956E-001, + 8.92500000000000182E-001, + 0.00000000000000000E+000, + 0.00000000000000000E+000, + 1.50000000000000000E+000 + ], + "T_out_mat": [ + [ 1.19999999999999996, 5.54399999999999893e-001, -1.75139999999999962e-001 ], + [ 0.00000000000000000E+000, 6.99999999999999956E-001, 8.92500000000000182E-001 ], + [ 0.00000000000000000E+000, 0.00000000000000000E+000, 1.50000000000000000E+000 ] + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/mixed_strides/lq_col_maj.json b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/mixed_strides/lq_col_maj.json new file mode 100644 index 000000000000..40f8948bc460 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/mixed_strides/lq_col_maj.json @@ -0,0 +1,101 @@ +{ + "order": "column-major", + "direct": "forward", + "storev": "rowwise", + "N": 5, + "K": 3, + "V": [ + 0.5, + -0.8, + 1.1, + -0.4, + 0.7, + 0.9, + 0.3, + -0.6, + 1, + 0.2, + 1, + 0, + 1, + 0, + 0 + ], + "strideV1": 1, + "strideV2": -3, + "offsetV": 12, + "LDV": 3, + "V_mat": [ + [ + 1, + 0.2, + 0.3, + -0.4, + 0.5 + ], + [ + 0, + 1, + -0.6, + 0.7, + -0.8 + ], + [ + 0, + 0, + 1, + 0.9, + 1.1 + ] + ], + "TAU": [ + 1.2, + 0.7, + 1.5 + ], + "strideTAU": 1, + "offsetTAU": 0, + "T": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "strideT1": 1, + "strideT2": -3, + "offsetT": 6, + "LDT": 3, + "T_out": [ + -0.17513999999999996, + 0.8925000000000002, + 1.5, + 0.5543999999999999, + 0.7, + 0, + 1.2, + 0, + 0 + ], + "T_out_mat": [ + [ + 1.2, + 0.5543999999999999, + -0.17513999999999996 + ], + [ + 0, + 0.7, + 0.8925000000000002 + ], + [ + 0, + 0, + 1.5 + ] + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/mixed_strides/lq_row_maj.json b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/mixed_strides/lq_row_maj.json new file mode 100644 index 000000000000..f48400048f6d --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/mixed_strides/lq_row_maj.json @@ -0,0 +1,101 @@ +{ + "order": "row-major", + "direct": "forward", + "storev": "rowwise", + "N": 5, + "K": 3, + "V": [ + 0, + 0, + 1, + 0.9, + 1.1, + 0, + 1, + -0.6, + 0.7, + -0.8, + 1, + 0.2, + 0.3, + -0.4, + 0.5 + ], + "strideV1": -5, + "strideV2": 1, + "offsetV": 10, + "LDV": 5, + "V_mat": [ + [ + 1, + 0.2, + 0.3, + -0.4, + 0.5 + ], + [ + 0, + 1, + -0.6, + 0.7, + -0.8 + ], + [ + 0, + 0, + 1, + 0.9, + 1.1 + ] + ], + "TAU": [ + 1.2, + 0.7, + 1.5 + ], + "strideTAU": 1, + "offsetTAU": 0, + "T": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "strideT1": -3, + "strideT2": 1, + "offsetT": 6, + "LDT": 3, + "T_out": [ + 0, + 0, + 1.5, + 0, + 0.7, + 0.8925000000000002, + 1.2, + 0.5543999999999999, + -0.17513999999999996 + ], + "T_out_mat": [ + [ + 1.2, + 0.5543999999999999, + -0.17513999999999996 + ], + [ + 0, + 0.7, + 0.8925000000000002 + ], + [ + 0, + 0, + 1.5 + ] + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/mixed_strides/ql_col_maj.json b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/mixed_strides/ql_col_maj.json new file mode 100644 index 000000000000..d25f1ed37f34 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/mixed_strides/ql_col_maj.json @@ -0,0 +1,105 @@ +{ + "order": "column-major", + "direct": "backward", + "storev": "columnwise", + "N": 5, + "K": 3, + "V": [ + 0.1, + -0.3, + 0.9, + 1.2, + 1, + -0.2, + 0.7, + 0.8, + 1, + 0, + 0.4, + 0.5, + 1, + 0, + 0 + ], + "strideV1": 1, + "strideV2": -5, + "offsetV": 10, + "LDV": 5, + "V_mat": [ + [ + 0.4, + -0.2, + 0.1 + ], + [ + 0.5, + 0.7, + -0.3 + ], + [ + 1, + 0.8, + 0.9 + ], + [ + 0, + 1, + 1.2 + ], + [ + 0, + 0, + 1 + ] + ], + "TAU": [ + 0.9, + 1.3, + 0.6 + ], + "strideTAU": 1, + "offsetTAU": 0, + "T": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "strideT1": 1, + "strideT2": -3, + "offsetT": 6, + "LDT": 3, + "T_out": [ + 0, + 0, + 0.6, + 0, + 1.3, + -1.3182, + 0.9, + -1.2519000000000002, + 0.8428266 + ], + "T_out_mat": [ + [ + 0.9, + 0, + 0 + ], + [ + -1.2519000000000002, + 1.3, + 0 + ], + [ + 0.8428266, + -1.3182, + 0.6 + ] + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/mixed_strides/ql_row_maj.json b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/mixed_strides/ql_row_maj.json new file mode 100644 index 000000000000..39154945a15e --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/mixed_strides/ql_row_maj.json @@ -0,0 +1,105 @@ +{ + "order": "row-major", + "direct": "backward", + "storev": "columnwise", + "N": 5, + "K": 3, + "V": [ + 0, + 0, + 1, + 0, + 1, + 1.2, + 1, + 0.8, + 0.9, + 0.5, + 0.7, + -0.3, + 0.4, + -0.2, + 0.1 + ], + "strideV1": -3, + "strideV2": 1, + "offsetV": 12, + "LDV": 3, + "V_mat": [ + [ + 0.4, + -0.2, + 0.1 + ], + [ + 0.5, + 0.7, + -0.3 + ], + [ + 1, + 0.8, + 0.9 + ], + [ + 0, + 1, + 1.2 + ], + [ + 0, + 0, + 1 + ] + ], + "TAU": [ + 0.9, + 1.3, + 0.6 + ], + "strideTAU": 1, + "offsetTAU": 0, + "T": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "strideT1": -3, + "strideT2": 1, + "offsetT": 6, + "LDT": 3, + "T_out": [ + 0.8428266, + -1.3182, + 0.6, + -1.2519000000000002, + 1.3, + 0, + 0.9, + 0, + 0 + ], + "T_out_mat": [ + [ + 0.9, + 0, + 0 + ], + [ + -1.2519000000000002, + 1.3, + 0 + ], + [ + 0.8428266, + -1.3182, + 0.6 + ] + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/mixed_strides/qr_col_maj.json b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/mixed_strides/qr_col_maj.json new file mode 100644 index 000000000000..4ca521fcddfb --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/mixed_strides/qr_col_maj.json @@ -0,0 +1,105 @@ +{ + "order": "column-major", + "direct": "forward", + "storev": "columnwise", + "N": 5, + "K": 3, + "V": [ + 0, + 0, + 1, + 0.8, + 0.9, + 0, + 1, + 0.5, + 0.6, + 0.7, + 1, + 0.1, + 0.2, + 0.3, + 0.4 + ], + "strideV1": 1, + "strideV2": -5, + "offsetV": 10, + "LDV": 5, + "V_mat": [ + [ + 1, + 0, + 0 + ], + [ + 0.1, + 1, + 0 + ], + [ + 0.2, + 0.5, + 1 + ], + [ + 0.3, + 0.6, + 0.8 + ], + [ + 0.4, + 0.7, + 0.9 + ] + ], + "TAU": [ + 1.1, + 0.8, + 1.4 + ], + "strideTAU": 1, + "offsetTAU": 0, + "T": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "strideT1": 1, + "strideT2": -3, + "offsetT": 6, + "LDT": 3, + "T_out": [ + 0.07712319999999973, + -1.8031999999999997, + 1.4, + -0.5808000000000001, + 0.8, + 0, + 1.1, + 0, + 0 + ], + "T_out_mat": [ + [ + 1.1, + -0.5808000000000001, + 0.07712319999999973 + ], + [ + 0, + 0.8, + -1.8031999999999997 + ], + [ + 0, + 0, + 1.4 + ] + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/mixed_strides/qr_row_maj.json b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/mixed_strides/qr_row_maj.json new file mode 100644 index 000000000000..c3b3e8acae8d --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/mixed_strides/qr_row_maj.json @@ -0,0 +1,105 @@ +{ + "order": "row-major", + "direct": "forward", + "storev": "columnwise", + "N": 5, + "K": 3, + "V": [ + 0.4, + 0.7, + 0.9, + 0.3, + 0.6, + 0.8, + 0.2, + 0.5, + 1, + 0.1, + 1, + 0, + 1, + 0, + 0 + ], + "strideV1": -3, + "strideV2": 1, + "offsetV": 12, + "LDV": 3, + "V_mat": [ + [ + 1, + 0, + 0 + ], + [ + 0.1, + 1, + 0 + ], + [ + 0.2, + 0.5, + 1 + ], + [ + 0.3, + 0.6, + 0.8 + ], + [ + 0.4, + 0.7, + 0.9 + ] + ], + "TAU": [ + 1.1, + 0.8, + 1.4 + ], + "strideTAU": 1, + "offsetTAU": 0, + "T": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "strideT1": -3, + "strideT2": 1, + "offsetT": 6, + "LDT": 3, + "T_out": [ + 0, + 0, + 1.4, + 0, + 0.8, + -1.8032, + 1.1, + -0.5808000000000001, + 0.07712319999999973 + ], + "T_out_mat": [ + [ + 1.1, + -0.5808000000000001, + 0.07712319999999973 + ], + [ + 0, + 0.8, + -1.8031999999999997 + ], + [ + 0, + 0, + 1.4 + ] + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/mixed_strides/rq_col_maj.json b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/mixed_strides/rq_col_maj.json new file mode 100644 index 000000000000..48260952c6e0 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/mixed_strides/rq_col_maj.json @@ -0,0 +1,101 @@ +{ + "order": "column-major", + "direct": "backward", + "storev": "rowwise", + "N": 5, + "K": 3, + "V": [ + 0, + 0, + 1, + 0, + 1, + 0.6, + 1, + -0.4, + 0.6, + 0.25, + -0.4, + 0.6, + 0.25, + -0.4, + 0.6 + ], + "strideV1": 1, + "strideV2": -3, + "offsetV": 12, + "LDV": 3, + "V_mat": [ + [ + 0.25, + 0.25, + 1, + 0, + 0 + ], + [ + -0.4, + -0.4, + -0.4, + 1, + 0 + ], + [ + 0.6, + 0.6, + 0.6, + 0.6, + 1 + ] + ], + "TAU": [ + 1.25, + 0.75, + 1.1 + ], + "strideTAU": 1, + "offsetTAU": 0, + "T": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "strideT1": 1, + "strideT2": -3, + "offsetT": 6, + "LDT": 3, + "T_out": [ + 0, + 0, + 1.1, + 0, + 0.75, + 0.09900000000000016, + 1.25, + 0.5625, + -1.16325 + ], + "T_out_mat": [ + [ + 1.25, + 0, + 0 + ], + [ + 0.5625, + 0.75, + 0 + ], + [ + -1.16325, + 0.09900000000000016, + 1.1 + ] + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/mixed_strides/rq_row_maj.json b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/mixed_strides/rq_row_maj.json new file mode 100644 index 000000000000..8d93e03bc891 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/mixed_strides/rq_row_maj.json @@ -0,0 +1,101 @@ +{ + "order": "row-major", + "direct": "backward", + "storev": "rowwise", + "N": 5, + "K": 3, + "V": [ + 0.6, + 0.6, + 0.6, + 0.6, + 1, + -0.4, + -0.4, + -0.4, + 1, + 0, + 0.25, + 0.25, + 1, + 0, + 0 + ], + "strideV1": -5, + "strideV2": 1, + "offsetV": 10, + "LDV": 5, + "V_mat": [ + [ + 0.25, + 0.25, + 1, + 0, + 0 + ], + [ + -0.4, + -0.4, + -0.4, + 1, + 0 + ], + [ + 0.6, + 0.6, + 0.6, + 0.6, + 1 + ] + ], + "TAU": [ + 1.25, + 0.75, + 1.1 + ], + "strideTAU": 1, + "offsetTAU": 0, + "T": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "strideT1": -3, + "strideT2": 1, + "offsetT": 6, + "LDT": 3, + "T_out": [ + -1.16325, + 0.09900000000000016, + 1.1, + 0.5625, + 0.75, + 0, + 1.25, + 0, + 0 + ], + "T_out_mat": [ + [ + 1.25, + 0, + 0 + ], + [ + 0.5625, + 0.75, + 0 + ], + [ + -1.16325, + 0.09900000000000016, + 1.1 + ] + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/negative_strides/lq_col_maj.json b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/negative_strides/lq_col_maj.json new file mode 100644 index 000000000000..c82e06ccefb4 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/negative_strides/lq_col_maj.json @@ -0,0 +1,101 @@ +{ + "order": "column-major", + "direct": "forward", + "storev": "rowwise", + "N": 5, + "K": 3, + "V": [ + 1.1, + -0.8, + 0.5, + 0.9, + 0.7, + -0.4, + 1, + -0.6, + 0.3, + 0, + 1, + 0.2, + 0, + 0, + 1 + ], + "strideV1": -1, + "strideV2": -3, + "offsetV": 14, + "LDV": 3, + "V_mat": [ + [ + 1, + 0.2, + 0.3, + -0.4, + 0.5 + ], + [ + 0, + 1, + -0.6, + 0.7, + -0.8 + ], + [ + 0, + 0, + 1, + 0.9, + 1.1 + ] + ], + "TAU": [ + 1.5, + 0.7, + 1.2 + ], + "strideTAU": -1, + "offsetTAU": 2, + "T": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "strideT1": -1, + "strideT2": -3, + "offsetT": 8, + "LDT": 3, + "T_out": [ + 1.5, + 0.8925000000000002, + -0.17513999999999996, + 0, + 0.7, + 0.5543999999999999, + 0, + 0, + 1.2 + ], + "T_out_mat": [ + [ + 1.2, + 0.5543999999999999, + -0.17513999999999996 + ], + [ + 0, + 0.7, + 0.8925000000000002 + ], + [ + 0, + 0, + 1.5 + ] + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/negative_strides/lq_row_maj.json b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/negative_strides/lq_row_maj.json new file mode 100644 index 000000000000..ef88535f35e4 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/negative_strides/lq_row_maj.json @@ -0,0 +1,101 @@ +{ + "order": "row-major", + "direct": "forward", + "storev": "rowwise", + "N": 5, + "K": 3, + "V": [ + 1.1, + 0.9, + 1, + 0, + 0, + -0.8, + 0.7, + -0.6, + 1, + 0, + 0.5, + -0.4, + 0.3, + 0.2, + 1 + ], + "strideV1": -5, + "strideV2": -1, + "offsetV": 14, + "LDV": 5, + "V_mat": [ + [ + 1, + 0.2, + 0.3, + -0.4, + 0.5 + ], + [ + 0, + 1, + -0.6, + 0.7, + -0.8 + ], + [ + 0, + 0, + 1, + 0.9, + 1.1 + ] + ], + "TAU": [ + 1.5, + 0.7, + 1.2 + ], + "strideTAU": -1, + "offsetTAU": 2, + "T": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "strideT1": -3, + "strideT2": -1, + "offsetT": 8, + "LDT": 3, + "T_out": [ + 1.5, + 0, + 0, + 0.8925000000000002, + 0.7, + 0, + -0.17513999999999996, + 0.5543999999999999, + 1.2 + ], + "T_out_mat": [ + [ + 1.2, + 0.5543999999999999, + -0.17513999999999996 + ], + [ + 0, + 0.7, + 0.8925000000000002 + ], + [ + 0, + 0, + 1.5 + ] + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/negative_strides/ql_col_maj.json b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/negative_strides/ql_col_maj.json new file mode 100644 index 000000000000..0a2577ab2fc3 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/negative_strides/ql_col_maj.json @@ -0,0 +1,105 @@ +{ + "order": "column-major", + "direct": "backward", + "storev": "columnwise", + "N": 5, + "K": 3, + "V": [ + 1, + 1.2, + 0.9, + -0.3, + 0.1, + 0, + 1, + 0.8, + 0.7, + -0.2, + 0, + 0, + 1, + 0.5, + 0.4 + ], + "strideV1": -1, + "strideV2": -5, + "offsetV": 14, + "LDV": 5, + "V_mat": [ + [ + 0.4, + -0.2, + 0.1 + ], + [ + 0.5, + 0.7, + -0.3 + ], + [ + 1, + 0.8, + 0.9 + ], + [ + 0, + 1, + 1.2 + ], + [ + 0, + 0, + 1 + ] + ], + "TAU": [ + 0.6, + 1.3, + 0.9 + ], + "strideTAU": -1, + "offsetTAU": 2, + "T": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "strideT1": -1, + "strideT2": -3, + "offsetT": 8, + "LDT": 3, + "T_out": [ + 0.6, + 0, + 0, + -1.3182, + 1.3, + 0, + 0.8428266, + -1.2519000000000002, + 0.9 + ], + "T_out_mat": [ + [ + 0.9, + 0, + 0 + ], + [ + -1.2519000000000002, + 1.3, + 0 + ], + [ + 0.8428266, + -1.3182, + 0.6 + ] + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/negative_strides/ql_row_maj.json b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/negative_strides/ql_row_maj.json new file mode 100644 index 000000000000..1d26c9bb6a69 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/negative_strides/ql_row_maj.json @@ -0,0 +1,105 @@ +{ + "order": "row-major", + "direct": "backward", + "storev": "columnwise", + "N": 5, + "K": 3, + "V": [ + 1, + 0, + 0, + 1.2, + 1, + 0, + 0.9, + 0.8, + 1, + -0.3, + 0.7, + 0.5, + 0.1, + -0.2, + 0.4 + ], + "strideV1": -3, + "strideV2": -1, + "offsetV": 14, + "LDV": 3, + "V_mat": [ + [ + 0.4, + -0.2, + 0.1 + ], + [ + 0.5, + 0.7, + -0.3 + ], + [ + 1, + 0.8, + 0.9 + ], + [ + 0, + 1, + 1.2 + ], + [ + 0, + 0, + 1 + ] + ], + "TAU": [ + 0.6, + 1.3, + 0.9 + ], + "strideTAU": -1, + "offsetTAU": 2, + "T": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "strideT1": -3, + "strideT2": -1, + "offsetT": 8, + "LDT": 3, + "T_out": [ + 0.6, + -1.3182, + 0.8428266, + 0, + 1.3, + -1.2519000000000002, + 0, + 0, + 0.9 + ], + "T_out_mat": [ + [ + 0.9, + 0, + 0 + ], + [ + -1.2519000000000002, + 1.3, + 0 + ], + [ + 0.8428266, + -1.3182, + 0.6 + ] + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/negative_strides/qr_col_maj.json b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/negative_strides/qr_col_maj.json new file mode 100644 index 000000000000..1259db2ea0a4 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/negative_strides/qr_col_maj.json @@ -0,0 +1,105 @@ +{ + "order": "column-major", + "direct": "forward", + "storev": "columnwise", + "N": 5, + "K": 3, + "V": [ + 0.9, + 0.8, + 1, + 0, + 0, + 0.7, + 0.6, + 0.5, + 1, + 0, + 0.4, + 0.3, + 0.2, + 0.1, + 1 + ], + "strideV1": -1, + "strideV2": -5, + "offsetV": 14, + "LDV": 5, + "V_mat": [ + [ + 1, + 0, + 0 + ], + [ + 0.1, + 1, + 0 + ], + [ + 0.2, + 0.5, + 1 + ], + [ + 0.3, + 0.6, + 0.8 + ], + [ + 0.4, + 0.7, + 0.9 + ] + ], + "TAU": [ + 1.4, + 0.8, + 1.1 + ], + "strideTAU": -1, + "offsetTAU": 2, + "T": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "strideT1": -1, + "strideT2": -3, + "offsetT": 8, + "LDT": 3, + "T_out": [ + 1.4, + -1.8031999999999997, + 0.07712319999999973, + 0, + 0.8, + -0.5808000000000001, + 0, + 0, + 1.1 + ], + "T_out_mat": [ + [ + 1.1, + -0.5808000000000001, + 0.07712319999999973 + ], + [ + 0, + 0.8, + -1.8031999999999997 + ], + [ + 0, + 0, + 1.4 + ] + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/negative_strides/qr_row_maj.json b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/negative_strides/qr_row_maj.json new file mode 100644 index 000000000000..4fd0e0293049 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/negative_strides/qr_row_maj.json @@ -0,0 +1,105 @@ +{ + "order": "row-major", + "direct": "forward", + "storev": "columnwise", + "N": 5, + "K": 3, + "V": [ + 0.9, + 0.7, + 0.4, + 0.8, + 0.6, + 0.3, + 1, + 0.5, + 0.2, + 0, + 1, + 0.1, + 0, + 0, + 1 + ], + "strideV1": -3, + "strideV2": -1, + "offsetV": 14, + "LDV": 3, + "V_mat": [ + [ + 1, + 0, + 0 + ], + [ + 0.1, + 1, + 0 + ], + [ + 0.2, + 0.5, + 1 + ], + [ + 0.3, + 0.6, + 0.8 + ], + [ + 0.4, + 0.7, + 0.9 + ] + ], + "TAU": [ + 1.4, + 0.8, + 1.1 + ], + "strideTAU": -1, + "offsetTAU": 2, + "T": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "strideT1": -3, + "strideT2": -1, + "offsetT": 8, + "LDT": 3, + "T_out": [ + 1.4, + 0, + 0, + -1.8032, + 0.8, + 0, + 0.07712319999999973, + -0.5808000000000001, + 1.1 + ], + "T_out_mat": [ + [ + 1.1, + -0.5808000000000001, + 0.07712319999999973 + ], + [ + 0, + 0.8, + -1.8031999999999997 + ], + [ + 0, + 0, + 1.4 + ] + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/negative_strides/rq_col_maj.json b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/negative_strides/rq_col_maj.json new file mode 100644 index 000000000000..34fbd896fff5 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/negative_strides/rq_col_maj.json @@ -0,0 +1,101 @@ +{ + "order": "column-major", + "direct": "backward", + "storev": "rowwise", + "N": 5, + "K": 3, + "V": [ + 1, + 0, + 0, + 0.6, + 1, + 0, + 0.6, + -0.4, + 1, + 0.6, + -0.4, + 0.25, + 0.6, + -0.4, + 0.25 + ], + "strideV1": -1, + "strideV2": -3, + "offsetV": 14, + "LDV": 3, + "V_mat": [ + [ + 0.25, + 0.25, + 1, + 0, + 0 + ], + [ + -0.4, + -0.4, + -0.4, + 1, + 0 + ], + [ + 0.6, + 0.6, + 0.6, + 0.6, + 1 + ] + ], + "TAU": [ + 1.1, + 0.75, + 1.25 + ], + "strideTAU": -1, + "offsetTAU": 2, + "T": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "strideT1": -1, + "strideT2": -3, + "offsetT": 8, + "LDT": 3, + "T_out": [ + 1.1, + 0, + 0, + 0.09900000000000016, + 0.75, + 0, + -1.16325, + 0.5625, + 1.25 + ], + "T_out_mat": [ + [ + 1.25, + 0, + 0 + ], + [ + 0.5625, + 0.75, + 0 + ], + [ + -1.16325, + 0.09900000000000016, + 1.1 + ] + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/negative_strides/rq_row_maj.json b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/negative_strides/rq_row_maj.json new file mode 100644 index 000000000000..3c820e58ae6b --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/negative_strides/rq_row_maj.json @@ -0,0 +1,101 @@ +{ + "order": "row-major", + "direct": "backward", + "storev": "rowwise", + "N": 5, + "K": 3, + "V": [ + 1, + 0.6, + 0.6, + 0.6, + 0.6, + 0, + 1, + -0.4, + -0.4, + -0.4, + 0, + 0, + 1, + 0.25, + 0.25 + ], + "strideV1": -5, + "strideV2": -1, + "offsetV": 14, + "LDV": 5, + "V_mat": [ + [ + 0.25, + 0.25, + 1, + 0, + 0 + ], + [ + -0.4, + -0.4, + -0.4, + 1, + 0 + ], + [ + 0.6, + 0.6, + 0.6, + 0.6, + 1 + ] + ], + "TAU": [ + 1.1, + 0.75, + 1.25 + ], + "strideTAU": -1, + "offsetTAU": 2, + "T": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "strideT1": -3, + "strideT2": -1, + "offsetT": 8, + "LDT": 3, + "T_out": [ + 1.1, + 0.09900000000000016, + -1.16325, + 0, + 0.75, + 0.5625, + 0, + 0, + 1.25 + ], + "T_out_mat": [ + [ + 1.25, + 0, + 0 + ], + [ + 0.5625, + 0.75, + 0 + ], + [ + -1.16325, + 0.09900000000000016, + 1.1 + ] + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/offsets/lq_col_maj.json b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/offsets/lq_col_maj.json new file mode 100644 index 000000000000..01a0ddb0db88 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/offsets/lq_col_maj.json @@ -0,0 +1,105 @@ +{ + "order": "column-major", + "direct": "forward", + "storev": "rowwise", + "N": 5, + "K": 3, + "V": [ + 9999, + 1, + 0, + 0, + 0.2, + 1, + 0, + 0.3, + -0.6, + 1, + -0.4, + 0.7, + 0.9, + 0.5, + -0.8, + 1.1 + ], + "strideV1": 1, + "strideV2": 3, + "offsetV": 1, + "LDV": 3, + "V_mat": [ + [ + 1, + 0.2, + 0.3, + -0.4, + 0.5 + ], + [ + 0, + 1, + -0.6, + 0.7, + -0.8 + ], + [ + 0, + 0, + 1, + 0.9, + 1.1 + ] + ], + "TAU": [ + 9999, + 1.2, + 0.7, + 1.5 + ], + "strideTAU": 1, + "offsetTAU": 1, + "T": [ + 9999, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "strideT1": 1, + "strideT2": 3, + "offsetT": 1, + "LDT": 3, + "T_out": [ + 9999, + 1.2, + 0, + 0, + 0.5543999999999999, + 0.7, + 0, + -0.17513999999999996, + 0.8925000000000002, + 1.5 + ], + "T_out_mat": [ + [ + 1.2, + 0.5543999999999999, + -0.17513999999999996 + ], + [ + 0, + 0.7, + 0.8925000000000002 + ], + [ + 0, + 0, + 1.5 + ] + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/offsets/lq_row_maj.json b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/offsets/lq_row_maj.json new file mode 100644 index 000000000000..ed0084edca39 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/offsets/lq_row_maj.json @@ -0,0 +1,105 @@ +{ + "order": "row-major", + "direct": "forward", + "storev": "rowwise", + "N": 5, + "K": 3, + "V": [ + 9999, + 1, + 0.2, + 0.3, + -0.4, + 0.5, + 0, + 1, + -0.6, + 0.7, + -0.8, + 0, + 0, + 1, + 0.9, + 1.1 + ], + "strideV1": 5, + "strideV2": 1, + "offsetV": 1, + "LDV": 5, + "V_mat": [ + [ + 1, + 0.2, + 0.3, + -0.4, + 0.5 + ], + [ + 0, + 1, + -0.6, + 0.7, + -0.8 + ], + [ + 0, + 0, + 1, + 0.9, + 1.1 + ] + ], + "TAU": [ + 9999, + 1.2, + 0.7, + 1.5 + ], + "strideTAU": 1, + "offsetTAU": 1, + "T": [ + 9999, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "strideT1": 3, + "strideT2": 1, + "offsetT": 1, + "LDT": 3, + "T_out": [ + 9999, + 1.2, + 0.5543999999999999, + -0.17513999999999996, + 0, + 0.7, + 0.8925000000000002, + 0, + 0, + 1.5 + ], + "T_out_mat": [ + [ + 1.2, + 0.5543999999999999, + -0.17513999999999996 + ], + [ + 0, + 0.7, + 0.8925000000000002 + ], + [ + 0, + 0, + 1.5 + ] + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/offsets/ql_col_maj.json b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/offsets/ql_col_maj.json new file mode 100644 index 000000000000..26a2597091d5 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/offsets/ql_col_maj.json @@ -0,0 +1,109 @@ +{ + "order": "column-major", + "direct": "backward", + "storev": "columnwise", + "N": 5, + "K": 3, + "V": [ + 9999, + 0.4, + 0.5, + 1, + 0, + 0, + -0.2, + 0.7, + 0.8, + 1, + 0, + 0.1, + -0.3, + 0.9, + 1.2, + 1 + ], + "strideV1": 1, + "strideV2": 5, + "offsetV": 1, + "LDV": 5, + "V_mat": [ + [ + 0.4, + -0.2, + 0.1 + ], + [ + 0.5, + 0.7, + -0.3 + ], + [ + 1, + 0.8, + 0.9 + ], + [ + 0, + 1, + 1.2 + ], + [ + 0, + 0, + 1 + ] + ], + "TAU": [ + 9999, + 0.9, + 1.3, + 0.6 + ], + "strideTAU": 1, + "offsetTAU": 1, + "T": [ + 9999, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "strideT1": 1, + "strideT2": 3, + "offsetT": 1, + "LDT": 3, + "T_out": [ + 9999, + 0.9, + -1.2519000000000002, + 0.8428266, + 0, + 1.3, + -1.3182, + 0, + 0, + 0.6 + ], + "T_out_mat": [ + [ + 0.9, + 0, + 0 + ], + [ + -1.2519000000000002, + 1.3, + 0 + ], + [ + 0.8428266, + -1.3182, + 0.6 + ] + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/offsets/ql_row_maj.json b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/offsets/ql_row_maj.json new file mode 100644 index 000000000000..faed07030103 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/offsets/ql_row_maj.json @@ -0,0 +1,109 @@ +{ + "order": "row-major", + "direct": "backward", + "storev": "columnwise", + "N": 5, + "K": 3, + "V": [ + 9999, + 0.4, + -0.2, + 0.1, + 0.5, + 0.7, + -0.3, + 1, + 0.8, + 0.9, + 0, + 1, + 1.2, + 0, + 0, + 1 + ], + "strideV1": 3, + "strideV2": 1, + "offsetV": 1, + "LDV": 3, + "V_mat": [ + [ + 0.4, + -0.2, + 0.1 + ], + [ + 0.5, + 0.7, + -0.3 + ], + [ + 1, + 0.8, + 0.9 + ], + [ + 0, + 1, + 1.2 + ], + [ + 0, + 0, + 1 + ] + ], + "TAU": [ + 9999, + 0.9, + 1.3, + 0.6 + ], + "strideTAU": 1, + "offsetTAU": 1, + "T": [ + 9999, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "strideT1": 3, + "strideT2": 1, + "offsetT": 1, + "LDT": 3, + "T_out": [ + 9999, + 0.9, + 0, + 0, + -1.2519000000000002, + 1.3, + 0, + 0.8428266, + -1.3182, + 0.6 + ], + "T_out_mat": [ + [ + 0.9, + 0, + 0 + ], + [ + -1.2519000000000002, + 1.3, + 0 + ], + [ + 0.8428266, + -1.3182, + 0.6 + ] + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/offsets/qr_col_maj.json b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/offsets/qr_col_maj.json new file mode 100644 index 000000000000..4ba5ec548e5c --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/offsets/qr_col_maj.json @@ -0,0 +1,109 @@ +{ + "order": "column-major", + "direct": "forward", + "storev": "columnwise", + "N": 5, + "K": 3, + "V": [ + 9999, + 1, + 0.1, + 0.2, + 0.3, + 0.4, + 0, + 1, + 0.5, + 0.6, + 0.7, + 0, + 0, + 1, + 0.8, + 0.9 + ], + "strideV1": 1, + "strideV2": 5, + "offsetV": 1, + "LDV": 5, + "V_mat": [ + [ + 1, + 0, + 0 + ], + [ + 0.1, + 1, + 0 + ], + [ + 0.2, + 0.5, + 1 + ], + [ + 0.3, + 0.6, + 0.8 + ], + [ + 0.4, + 0.7, + 0.9 + ] + ], + "TAU": [ + 9999, + 1.1, + 0.8, + 1.4 + ], + "strideTAU": 1, + "offsetTAU": 1, + "T": [ + 9999, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "strideT1": 1, + "strideT2": 3, + "offsetT": 1, + "LDT": 3, + "T_out": [ + 9999, + 1.1, + 0, + 0, + -0.5808000000000001, + 0.8, + 0, + 0.07712319999999973, + -1.8031999999999997, + 1.4 + ], + "T_out_mat": [ + [ + 1.1, + -0.5808000000000001, + 0.07712319999999973 + ], + [ + 0, + 0.8, + -1.8031999999999997 + ], + [ + 0, + 0, + 1.4 + ] + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/offsets/qr_row_maj.json b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/offsets/qr_row_maj.json new file mode 100644 index 000000000000..f9fe1aa781c1 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/offsets/qr_row_maj.json @@ -0,0 +1,109 @@ +{ + "order": "row-major", + "direct": "forward", + "storev": "columnwise", + "N": 5, + "K": 3, + "V": [ + 9999, + 1, + 0, + 0, + 0.1, + 1, + 0, + 0.2, + 0.5, + 1, + 0.3, + 0.6, + 0.8, + 0.4, + 0.7, + 0.9 + ], + "strideV1": 3, + "strideV2": 1, + "offsetV": 1, + "LDV": 3, + "V_mat": [ + [ + 1, + 0, + 0 + ], + [ + 0.1, + 1, + 0 + ], + [ + 0.2, + 0.5, + 1 + ], + [ + 0.3, + 0.6, + 0.8 + ], + [ + 0.4, + 0.7, + 0.9 + ] + ], + "TAU": [ + 9999, + 1.1, + 0.8, + 1.4 + ], + "strideTAU": 1, + "offsetTAU": 1, + "T": [ + 9999, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "strideT1": 3, + "strideT2": 1, + "offsetT": 1, + "LDT": 3, + "T_out": [ + 9999, + 1.1, + -0.5808000000000001, + 0.07712319999999973, + 0, + 0.8, + -1.8032, + 0, + 0, + 1.4 + ], + "T_out_mat": [ + [ + 1.1, + -0.5808000000000001, + 0.07712319999999973 + ], + [ + 0, + 0.8, + -1.8031999999999997 + ], + [ + 0, + 0, + 1.4 + ] + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/offsets/rq_col_maj.json b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/offsets/rq_col_maj.json new file mode 100644 index 000000000000..645c8c3870ad --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/offsets/rq_col_maj.json @@ -0,0 +1,105 @@ +{ + "order": "column-major", + "direct": "backward", + "storev": "rowwise", + "N": 5, + "K": 3, + "V": [ + 9999, + 0.25, + -0.4, + 0.6, + 0.25, + -0.4, + 0.6, + 1, + -0.4, + 0.6, + 0, + 1, + 0.6, + 0, + 0, + 1 + ], + "strideV1": 1, + "strideV2": 3, + "offsetV": 1, + "LDV": 3, + "V_mat": [ + [ + 0.25, + 0.25, + 1, + 0, + 0 + ], + [ + -0.4, + -0.4, + -0.4, + 1, + 0 + ], + [ + 0.6, + 0.6, + 0.6, + 0.6, + 1 + ] + ], + "TAU": [ + 9999, + 1.25, + 0.75, + 1.1 + ], + "strideTAU": 1, + "offsetTAU": 1, + "T": [ + 9999, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "strideT1": 1, + "strideT2": 3, + "offsetT": 1, + "LDT": 3, + "T_out": [ + 9999, + 1.25, + 0.5625, + -1.16325, + 0, + 0.75, + 0.09900000000000016, + 0, + 0, + 1.1 + ], + "T_out_mat": [ + [ + 1.25, + 0, + 0 + ], + [ + 0.5625, + 0.75, + 0 + ], + [ + -1.16325, + 0.09900000000000016, + 1.1 + ] + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/offsets/rq_row_maj.json b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/offsets/rq_row_maj.json new file mode 100644 index 000000000000..907ce31f4a2e --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/offsets/rq_row_maj.json @@ -0,0 +1,105 @@ +{ + "order": "row-major", + "direct": "backward", + "storev": "rowwise", + "N": 5, + "K": 3, + "V": [ + 9999, + 0.25, + 0.25, + 1, + 0, + 0, + -0.4, + -0.4, + -0.4, + 1, + 0, + 0.6, + 0.6, + 0.6, + 0.6, + 1 + ], + "strideV1": 5, + "strideV2": 1, + "offsetV": 1, + "LDV": 5, + "V_mat": [ + [ + 0.25, + 0.25, + 1, + 0, + 0 + ], + [ + -0.4, + -0.4, + -0.4, + 1, + 0 + ], + [ + 0.6, + 0.6, + 0.6, + 0.6, + 1 + ] + ], + "TAU": [ + 9999, + 1.25, + 0.75, + 1.1 + ], + "strideTAU": 1, + "offsetTAU": 1, + "T": [ + 9999, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "strideT1": 3, + "strideT2": 1, + "offsetT": 1, + "LDT": 3, + "T_out": [ + 9999, + 1.25, + 0, + 0, + 0.5625, + 0.75, + 0, + -1.16325, + 0.09900000000000016, + 1.1 + ], + "T_out_mat": [ + [ + 1.25, + 0, + 0 + ], + [ + 0.5625, + 0.75, + 0 + ], + [ + -1.16325, + 0.09900000000000016, + 1.1 + ] + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/ql_col_maj.json b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/ql_col_maj.json new file mode 100644 index 000000000000..23bd6cbe94d2 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/ql_col_maj.json @@ -0,0 +1,38 @@ +{ + "order": "column-major", + "direct": "backward", + "storev": "columnwise", + + "N": 5, + "K": 3, + + "V": [ 0.4, 0.5, 1.0, 0.0, 0.0, -0.2, 0.7, 0.8, 1.0, 0.0, 0.1, -0.3, 0.9, 1.2, 1.0 ], + "strideV1": 1, + "strideV2": 5, + "offsetV": 0, + "LDV": 5, + "V_mat": [ + [ 0.4, -0.2, 0.1 ], + [ 0.5, 0.7, -0.3 ], + [ 1.0, 0.8, 0.9 ], + [ 0.0, 1.0, 1.2 ], + [ 0.0, 0.0, 1.0 ] + ], + + "TAU": [ 0.9, 1.3, 0.6 ], + "strideTAU": 1, + "offsetTAU": 0, + + "T": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + "strideT1": 1, + "strideT2": 3, + "offsetT": 0, + "LDT": 3, + + "T_out": [ 9.00000000000000022e-001, -1.25190000000000023e+000, 8.42826599999999981e-001, 0.0, 1.30000000000000004e+000, -1.31820000000000004e+000, 0.0, 0.0, 5.99999999999999978e-001 ], + "T_out_mat": [ + [ 9.00000000000000022E-001, 0.00000000000000000E+000, 0.00000000000000000E+000 ], + [ -1.25190000000000023E+000, 1.30000000000000004E+000, 0.00000000000000000E+000 ], + [ 8.42826599999999981E-001, -1.31820000000000004E+000, 5.99999999999999978E-001 ] + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/ql_row_maj.json b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/ql_row_maj.json new file mode 100644 index 000000000000..0eb8c048ff8d --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/ql_row_maj.json @@ -0,0 +1,48 @@ +{ + "order": "row-major", + "direct": "backward", + "storev": "columnwise", + + "N": 5, + "K": 3, + + "V": [ 0.4, -0.2, 0.1, 0.5, 0.7, -0.3, 1.0, 0.8, 0.9, 0.0, 1.0, 1.2, 0.0, 0.0, 1.0 ], + "strideV1": 3, + "strideV2": 1, + "offsetV": 0, + "LDV": 3, + "V_mat": [ + [ 0.4, -0.2, 0.1 ], + [ 0.5, 0.7, -0.3 ], + [ 1.0, 0.8, 0.9 ], + [ 0.0, 1.0, 1.2 ], + [ 0.0, 0.0, 1.0 ] + ], + + "TAU": [ 0.9, 1.3, 0.6 ], + "strideTAU": 1, + "offsetTAU": 0, + + "T": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + "strideT1": 3, + "strideT2": 1, + "offsetT": 0, + "LDT": 3, + + "T_out": [ + 9.00000000000000022E-001, + 0.00000000000000000E+000, + 0.00000000000000000E+000, + -1.25190000000000023E+000, + 1.30000000000000004E+000, + 0.00000000000000000E+000, + 8.42826599999999981E-001, + -1.31820000000000004E+000, + 5.99999999999999978E-001 + ], + "T_out_mat": [ + [ 9.00000000000000022E-001, 0.00000000000000000E+000, 0.00000000000000000E+000 ], + [ -1.25190000000000023E+000, 1.30000000000000004E+000, 0.00000000000000000E+000 ], + [ 8.42826599999999981E-001, -1.31820000000000004E+000, 5.99999999999999978E-001 ] + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/qr_col_maj.json b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/qr_col_maj.json new file mode 100644 index 000000000000..0e181fe0527a --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/qr_col_maj.json @@ -0,0 +1,38 @@ +{ + "order": "column-major", + "direct": "forward", + "storev": "columnwise", + + "N": 5, + "K": 3, + + "V": [ 1.0, 0.1, 0.2, 0.3, 0.4, 0.0, 1.0, 0.5, 0.6, 0.7, 0.0, 0.0, 1.0, 0.8, 0.9 ], + "strideV1": 1, + "strideV2": 5, + "offsetV": 0, + "LDV": 5, + "V_mat": [ + [ 1.0, 0.0, 0.0 ], + [ 0.1, 1.0, 0.0 ], + [ 0.2, 0.5, 1.0 ], + [ 0.3, 0.6, 0.8 ], + [ 0.4, 0.7, 0.9 ] + ], + + "TAU": [ 1.1, 0.8, 1.4 ], + "strideTAU": 1, + "offsetTAU": 0, + + "T": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + "strideT1": 1, + "strideT2": 3, + "offsetT": 0, + "LDT": 3, + + "T_out": [ 1.10000000000000009e+000, 0.0, 0.0, -5.80800000000000094e-001, 8.00000000000000044e-001, 0.0, 7.71231999999997253e-002, -1.80319999999999969e+000, 1.39999999999999991e+000 ], + "T_out_mat": [ + [ 1.10000000000000009E+000, -5.80800000000000094E-001, 7.71231999999997253E-002 ], + [ 0.00000000000000000E+000, 8.00000000000000044E-001, -1.80319999999999969E+000 ], + [ 0.00000000000000000E+000, 0.00000000000000000E+000, 1.39999999999999991E+000 ] + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/qr_row_maj.json b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/qr_row_maj.json new file mode 100644 index 000000000000..00410efa5878 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/qr_row_maj.json @@ -0,0 +1,48 @@ +{ + "order": "row-major", + "direct": "forward", + "storev": "columnwise", + + "N": 5, + "K": 3, + + "V": [ 1.0, 0.0, 0.0, 0.1, 1.0, 0.0, 0.2, 0.5, 1.0, 0.3, 0.6, 0.8, 0.4, 0.7, 0.9 ], + "strideV1": 3, + "strideV2": 1, + "offsetV": 0, + "LDV": 3, + "V_mat": [ + [ 1.0, 0.0, 0.0 ], + [ 0.1, 1.0, 0.0 ], + [ 0.2, 0.5, 1.0 ], + [ 0.3, 0.6, 0.8 ], + [ 0.4, 0.7, 0.9 ] + ], + + "TAU": [ 1.1, 0.8, 1.4 ], + "strideTAU": 1, + "offsetTAU": 0, + + "T": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + "strideT1": 3, + "strideT2": 1, + "offsetT": 0, + "LDT": 3, + + "T_out": [ + 1.100000000000000E+000, + -5.808000000000001E-001, + 7.712319999999973E-002, + 0.000000000000000E+000, + 8.000000000000000E-001, + -1.803200000000000E+000, + 0.000000000000000E+000, + 0.000000000000000E+000, + 1.400000000000000E+000 + ], + "T_out_mat": [ + [ 1.10000000000000009E+000, -5.80800000000000094E-001, 7.71231999999997253E-002 ], + [ 0.00000000000000000E+000, 8.00000000000000044E-001, -1.80319999999999969E+000 ], + [ 0.00000000000000000E+000, 0.00000000000000000E+000, 1.39999999999999991E+000 ] + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/rq_col_maj.json b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/rq_col_maj.json new file mode 100644 index 000000000000..5c08a4314dfb --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/rq_col_maj.json @@ -0,0 +1,36 @@ +{ + "order": "column-major", + "direct": "backward", + "storev": "rowwise", + + "N": 5, + "K": 3, + + "V": [ 0.25, -0.4, 0.6, 0.25, -0.4, 0.6, 1.0, -0.4, 0.6, 0.0, 1.0, 0.6, 0.0, 0.0, 1.0 ], + "strideV1": 1, + "strideV2": 3, + "offsetV": 0, + "LDV": 3, + "V_mat": [ + [ 0.25, 0.25, 1.0, 0.0, 0.0 ], + [ -0.4, -0.4, -0.4, 1.0, 0.0 ], + [ 0.6, 0.6, 0.6, 0.6, 1.0 ] + ], + + "TAU": [ 1.25, 0.75, 1.1 ], + "strideTAU": 1, + "offsetTAU": 0, + + "T": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + "strideT1": 1, + "strideT2": 3, + "offsetT": 0, + "LDT": 3, + + "T_out": [ 1.25000000000000000e+000, 5.62500000000000000e-001, -1.16324999999999990e+000, 0.0, 7.50000000000000000e-001, 9.90000000000001573e-002, 0.0, 0.0, 1.10000000000000009e+000 ], + "T_out_mat": [ + [ 1.25000000000000000E+000, 0.00000000000000000E+000, 0.00000000000000000E+000 ], + [ 5.62500000000000000E-001, 7.50000000000000000E-001, 0.00000000000000000E+000 ], + [ -1.16324999999999990E+000, 9.90000000000001573E-002, 1.10000000000000009E+000 ] + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/rq_row_maj.json b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/rq_row_maj.json new file mode 100644 index 000000000000..652dc96cbb32 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlarft/test/fixtures/rq_row_maj.json @@ -0,0 +1,46 @@ +{ + "order": "row-major", + "direct": "backward", + "storev": "rowwise", + + "N": 5, + "K": 3, + + "V": [ 0.25, 0.25, 1.0, 0.0, 0.0, -0.4, -0.4, -0.4, 1.0, 0.0, 0.6, 0.6, 0.6, 0.6, 1.0 ], + "strideV1": 5, + "strideV2": 1, + "offsetV": 0, + "LDV": 5, + "V_mat": [ + [ 0.25, 0.25, 1.0, 0.0, 0.0 ], + [ -0.4, -0.4, -0.4, 1.0, 0.0 ], + [ 0.6, 0.6, 0.6, 0.6, 1.0 ] + ], + + "TAU": [ 1.25, 0.75, 1.1 ], + "strideTAU": 1, + "offsetTAU": 0, + + "T": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + "strideT1": 3, + "strideT2": 1, + "offsetT": 0, + "LDT": 3, + + "T_out": [ + 1.25000000000000000E+000, + 0.00000000000000000E+000, + 0.00000000000000000E+000, + 5.62500000000000000E-001, + 7.50000000000000000E-001, + 0.00000000000000000E+000, + -1.16324999999999990E+000, + 9.90000000000001573E-002, + 1.10000000000000009E+000 + ], + "T_out_mat": [ + [ 1.25000000000000000E+000, 0.00000000000000000E+000, 0.00000000000000000E+000 ], + [ 5.62500000000000000E-001, 7.50000000000000000E-001, 0.00000000000000000E+000 ], + [ -1.16324999999999990E+000, 9.90000000000001573E-002, 1.10000000000000009E+000 ] + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlarft/test/test.dlarft.js b/lib/node_modules/@stdlib/lapack/base/dlarft/test/test.dlarft.js new file mode 100644 index 000000000000..7d1a51d843fc --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlarft/test/test.dlarft.js @@ -0,0 +1,436 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-len */ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Float64Array = require( '@stdlib/array/float64' ); +var isAlmostEqual = require( '@stdlib/assert/is-almost-equal-float64array' ); +var dlarft = require( './../lib/dlarft.js' ); + + +// FIXTURES // + +var LQ_ROW_MAJ = require( './fixtures/lq_row_maj.json' ); +var QR_ROW_MAJ = require( './fixtures/qr_row_maj.json' ); +var QL_ROW_MAJ = require( './fixtures/ql_row_maj.json' ); +var RQ_ROW_MAJ = require( './fixtures/rq_row_maj.json' ); +var LQ_COL_MAJ = require( './fixtures/lq_col_maj.json' ); +var QR_COL_MAJ = require( './fixtures/qr_col_maj.json' ); +var QL_COL_MAJ = require( './fixtures/ql_col_maj.json' ); +var RQ_COL_MAJ = require( './fixtures/rq_col_maj.json' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof dlarft, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 10', function test( t ) { + t.strictEqual( dlarft.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 TAU; + var T; + var V; + var i; + + V = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 0.0, 1.0, 2.0, 3.0 ] ); + TAU = new Float64Array( [ 2.0, 3.0 ] ); + T = new Float64Array( 4 ); + + 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() { + dlarft( value, 'forward', 'columnwise', 4, 2, V, 4, TAU, T, 2 ); + }; + } +}); + +tape( 'the function throws an error if provided a second argument which is not a valid direction', function test( t ) { + var values; + var TAU; + var T; + var V; + var i; + + V = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 0.0, 1.0, 2.0, 3.0 ] ); + TAU = new Float64Array( [ 2.0, 3.0 ] ); + T = new Float64Array( 4 ); + + 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() { + dlarft( 'row-major', value, 'columnwise', 4, 2, V, 4, TAU, T, 2 ); + }; + } +}); + +tape( 'the function throws an error if provided a third argument which is not a valid storage layout for elementary reflectors', function test( t ) { + var values; + var TAU; + var T; + var V; + var i; + + V = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 0.0, 1.0, 2.0, 3.0 ] ); + TAU = new Float64Array( [ 2.0, 3.0 ] ); + T = new Float64Array( 4 ); + + 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() { + dlarft( 'row-major', 'forward', value, 4, 2, V, 4, TAU, T, 2 ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid LDV for columnwise storage', function test( t ) { + var values; + var TAU; + var T; + var V; + var i; + + V = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 0.0, 1.0, 2.0, 3.0 ] ); + TAU = new Float64Array( [ 2.0, 3.0 ] ); + T = new Float64Array( 4 ); + + values = [ + 0, + 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() { + dlarft( 'column-major', 'forward', 'columnwise', 4, 2, V, value, TAU, T, 2 ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid LDV for rowwise storage', function test( t ) { + var values; + var TAU; + var T; + var V; + var i; + + V = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 0.0, 1.0, 2.0, 3.0 ] ); + TAU = new Float64Array( [ 2.0, 3.0 ] ); + T = new Float64Array( 4 ); + + 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() { + dlarft( 'column-major', 'forward', 'rowwise', 4, 2, V, value, TAU, T, 2 ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid LDT', function test( t ) { + var values; + var TAU; + var T; + var V; + var i; + + V = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 0.0, 1.0, 2.0, 3.0 ] ); + TAU = new Float64Array( [ 2.0, 3.0 ] ); + T = new Float64Array( 4 ); + + 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() { + dlarft( 'row-major', 'forward', 'columnwise', 4, 2, V, 4, TAU, T, value ); + }; + } +}); + +tape( 'the function returns `T` unchanged if N=0 or K=0 (quick return)', function test( t ) { + var expectedT; + var TAU; + var out; + var V; + var T; + + V = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 0.0, 1.0, 2.0, 3.0 ] ); + TAU = new Float64Array( [ 2.0, 3.0 ] ); + T = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + expectedT = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + out = dlarft( 'column-major', 'forward', 'columnwise', 0, 0, V, 4, TAU, T, 2 ); + t.deepEqual( out, expectedT, 'N=0: returns expected value' ); + t.end(); +}); + +tape( 'the function forms triangular factor of a block reflector (row-major, forward, rowwise)', function test( t ) { + var expectedT; + var data; + var TAU; + var T; + var V; + + data = LQ_ROW_MAJ; + + V = new Float64Array( data.V ); + TAU = new Float64Array( data.TAU ); + T = new Float64Array( data.T ); + + expectedT = new Float64Array( data.T_out ); + + dlarft( data.order, data.direct, data.storev, data.N, data.K, V, data.LDV, TAU, T, data.LDT ); + t.strictEqual( isAlmostEqual( T, expectedT, 2 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function forms triangular factor of a block reflector (column-major, forward, rowwise)', function test( t ) { + var expectedT; + var data; + var TAU; + var T; + var V; + + data = LQ_COL_MAJ; + + V = new Float64Array( data.V ); + TAU = new Float64Array( data.TAU ); + T = new Float64Array( data.T ); + + expectedT = new Float64Array( data.T_out ); + + dlarft( data.order, data.direct, data.storev, data.N, data.K, V, data.LDV, TAU, T, data.LDT ); + t.strictEqual( isAlmostEqual( T, expectedT, 2 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function forms triangular factor of a block reflector (row-major, forward, columnwise)', function test( t ) { + var expectedT; + var data; + var TAU; + var T; + var V; + + data = QR_ROW_MAJ; + + V = new Float64Array( data.V ); + TAU = new Float64Array( data.TAU ); + T = new Float64Array( data.T ); + + expectedT = new Float64Array( data.T_out ); + + dlarft( data.order, data.direct, data.storev, data.N, data.K, V, data.LDV, TAU, T, data.LDT ); + t.strictEqual( isAlmostEqual( T, expectedT, 16 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function forms triangular factor of a block reflector (column-major, forward, columnwise)', function test( t ) { + var expectedT; + var data; + var TAU; + var T; + var V; + + data = QR_COL_MAJ; + + V = new Float64Array( data.V ); + TAU = new Float64Array( data.TAU ); + T = new Float64Array( data.T ); + + expectedT = new Float64Array( data.T_out ); + + dlarft( data.order, data.direct, data.storev, data.N, data.K, V, data.LDV, TAU, T, data.LDT ); + t.strictEqual( isAlmostEqual( T, expectedT, 16 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function forms triangular factor of a block reflector (row-major, backward, columnwise)', function test( t ) { + var expectedT; + var data; + var TAU; + var T; + var V; + + data = QL_ROW_MAJ; + + V = new Float64Array( data.V ); + TAU = new Float64Array( data.TAU ); + T = new Float64Array( data.T ); + + expectedT = new Float64Array( data.T_out ); + + dlarft( data.order, data.direct, data.storev, data.N, data.K, V, data.LDV, TAU, T, data.LDT ); + t.strictEqual( isAlmostEqual( T, expectedT, 4 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function forms triangular factor of a block reflector (column-major, backward, columnwise)', function test( t ) { + var expectedT; + var data; + var TAU; + var T; + var V; + + data = QL_COL_MAJ; + + V = new Float64Array( data.V ); + TAU = new Float64Array( data.TAU ); + T = new Float64Array( data.T ); + + expectedT = new Float64Array( data.T_out ); + + dlarft( data.order, data.direct, data.storev, data.N, data.K, V, data.LDV, TAU, T, data.LDT ); + t.strictEqual( isAlmostEqual( T, expectedT, 4 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function forms triangular factor of a block reflector (row-major, backward, rowwise)', function test( t ) { + var expectedT; + var data; + var TAU; + var T; + var V; + + data = RQ_ROW_MAJ; + + V = new Float64Array( data.V ); + TAU = new Float64Array( data.TAU ); + T = new Float64Array( data.T ); + + expectedT = new Float64Array( data.T_out ); + + dlarft( data.order, data.direct, data.storev, data.N, data.K, V, data.LDV, TAU, T, data.LDT ); + t.strictEqual( isAlmostEqual( T, expectedT, 11 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function forms triangular factor of a block reflector (column-major, backward, rowwise)', function test( t ) { + var expectedT; + var data; + var TAU; + var T; + var V; + + data = RQ_COL_MAJ; + + V = new Float64Array( data.V ); + TAU = new Float64Array( data.TAU ); + T = new Float64Array( data.T ); + + expectedT = new Float64Array( data.T_out ); + + dlarft( data.order, data.direct, data.storev, data.N, data.K, V, data.LDV, TAU, T, data.LDT ); + t.strictEqual( isAlmostEqual( T, expectedT, 11 ), true, 'returns expected value' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/lapack/base/dlarft/test/test.js b/lib/node_modules/@stdlib/lapack/base/dlarft/test/test.js new file mode 100644 index 000000000000..546a787bc419 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlarft/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 dlarft = 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 dlarft, '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 dlarft.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 dlarft = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( dlarft, 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 dlarft; + var main; + + main = require( './../lib/dlarft.js' ); + + dlarft = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( dlarft, main, 'returns expected value' ); + t.end(); + + function tryRequire() { + return new Error( 'Cannot find module' ); + } +}); diff --git a/lib/node_modules/@stdlib/lapack/base/dlarft/test/test.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dlarft/test/test.ndarray.js new file mode 100644 index 000000000000..41d9dcccb25a --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlarft/test/test.ndarray.js @@ -0,0 +1,981 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-len */ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Float64Array = require( '@stdlib/array/float64' ); +var isAlmostEqual = require( '@stdlib/assert/is-almost-equal-float64array' ); +var dlarft = require( './../lib/ndarray.js' ); + + +// FIXTURES // + +var LQ_ROW_MAJ = require( './fixtures/lq_row_maj.json' ); +var QR_ROW_MAJ = require( './fixtures/qr_row_maj.json' ); +var QL_ROW_MAJ = require( './fixtures/ql_row_maj.json' ); +var RQ_ROW_MAJ = require( './fixtures/rq_row_maj.json' ); +var LQ_COL_MAJ = require( './fixtures/lq_col_maj.json' ); +var QR_COL_MAJ = require( './fixtures/qr_col_maj.json' ); +var QL_COL_MAJ = require( './fixtures/ql_col_maj.json' ); +var RQ_COL_MAJ = require( './fixtures/rq_col_maj.json' ); +var LAR_STR_LQ_ROW_MAJ = require( './fixtures/large_strides/lq_row_maj.json' ); +var LAR_STR_QR_ROW_MAJ = require( './fixtures/large_strides/qr_row_maj.json' ); +var LAR_STR_QL_ROW_MAJ = require( './fixtures/large_strides/ql_row_maj.json' ); +var LAR_STR_RQ_ROW_MAJ = require( './fixtures/large_strides/rq_row_maj.json' ); +var LAR_STR_LQ_COL_MAJ = require( './fixtures/large_strides/lq_col_maj.json' ); +var LAR_STR_QR_COL_MAJ = require( './fixtures/large_strides/qr_col_maj.json' ); +var LAR_STR_QL_COL_MAJ = require( './fixtures/large_strides/ql_col_maj.json' ); +var LAR_STR_RQ_COL_MAJ = require( './fixtures/large_strides/rq_col_maj.json' ); +var MIX_STR_LQ_ROW_MAJ = require( './fixtures/mixed_strides/lq_row_maj.json' ); +var MIX_STR_QR_ROW_MAJ = require( './fixtures/mixed_strides/qr_row_maj.json' ); +var MIX_STR_QL_ROW_MAJ = require( './fixtures/mixed_strides/ql_row_maj.json' ); +var MIX_STR_RQ_ROW_MAJ = require( './fixtures/mixed_strides/rq_row_maj.json' ); +var MIX_STR_LQ_COL_MAJ = require( './fixtures/mixed_strides/lq_col_maj.json' ); +var MIX_STR_QR_COL_MAJ = require( './fixtures/mixed_strides/qr_col_maj.json' ); +var MIX_STR_QL_COL_MAJ = require( './fixtures/mixed_strides/ql_col_maj.json' ); +var MIX_STR_RQ_COL_MAJ = require( './fixtures/mixed_strides/rq_col_maj.json' ); +var NEG_STR_LQ_ROW_MAJ = require( './fixtures/negative_strides/lq_row_maj.json' ); +var NEG_STR_QR_ROW_MAJ = require( './fixtures/negative_strides/qr_row_maj.json' ); +var NEG_STR_QL_ROW_MAJ = require( './fixtures/negative_strides/ql_row_maj.json' ); +var NEG_STR_RQ_ROW_MAJ = require( './fixtures/negative_strides/rq_row_maj.json' ); +var NEG_STR_LQ_COL_MAJ = require( './fixtures/negative_strides/lq_col_maj.json' ); +var NEG_STR_QR_COL_MAJ = require( './fixtures/negative_strides/qr_col_maj.json' ); +var NEG_STR_QL_COL_MAJ = require( './fixtures/negative_strides/ql_col_maj.json' ); +var NEG_STR_RQ_COL_MAJ = require( './fixtures/negative_strides/rq_col_maj.json' ); +var OFF_LQ_ROW_MAJ = require( './fixtures/offsets/lq_row_maj.json' ); +var OFF_QR_ROW_MAJ = require( './fixtures/offsets/qr_row_maj.json' ); +var OFF_QL_ROW_MAJ = require( './fixtures/offsets/ql_row_maj.json' ); +var OFF_RQ_ROW_MAJ = require( './fixtures/offsets/rq_row_maj.json' ); +var OFF_LQ_COL_MAJ = require( './fixtures/offsets/lq_col_maj.json' ); +var OFF_QR_COL_MAJ = require( './fixtures/offsets/qr_col_maj.json' ); +var OFF_QL_COL_MAJ = require( './fixtures/offsets/ql_col_maj.json' ); +var OFF_RQ_COL_MAJ = require( './fixtures/offsets/rq_col_maj.json' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof dlarft, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 15', function test( t ) { + t.strictEqual( dlarft.length, 15, 'returns expected value' ); + t.end(); +}); + +tape( 'the function throws an error if provided a first argument which is not a valid direction', function test( t ) { + var values; + var TAU; + var T; + var V; + var i; + + V = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 0.0, 1.0, 2.0, 3.0 ] ); + TAU = new Float64Array( [ 2.0, 3.0 ] ); + T = new Float64Array( 4 ); + + 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() { + dlarft( value, 'columnwise', 4, 2, V, 4, 1, 0, TAU, 1, 0, T, 2, 1, 0 ); + }; + } +}); + +tape( 'the function throws an error if provided a second argument which is not a valid storage layout for elementary reflectors', function test( t ) { + var values; + var TAU; + var T; + var V; + var i; + + V = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 0.0, 1.0, 2.0, 3.0 ] ); + TAU = new Float64Array( [ 2.0, 3.0 ] ); + T = new Float64Array( 4 ); + + 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() { + dlarft( 'forward', value, 4, 2, V, 4, 1, 0, TAU, 1, 0, T, 2, 1, 0 ); + }; + } +}); + +tape( 'the function returns `T` unchanged if N=0 or K=0 (quick return)', function test( t ) { + var expectedT; + var TAU; + var out; + var V; + var T; + + V = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 0.0, 1.0, 2.0, 3.0 ] ); + TAU = new Float64Array( [ 2.0, 3.0 ] ); + T = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + + expectedT = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + out = dlarft( 'forward', 'columnwise', 0, 0, V, 4, 1, 0, TAU, 1, 0, T, 2, 1, 0 ); + t.deepEqual( out, expectedT, 'N=0: returns expected value' ); + t.end(); +}); + +tape( 'the function forms triangular factor of a block reflector (row-major, forward, rowwise)', function test( t ) { + var expectedT; + var data; + var TAU; + var T; + var V; + + data = LQ_ROW_MAJ; + + V = new Float64Array( data.V ); + TAU = new Float64Array( data.TAU ); + T = new Float64Array( data.T ); + + expectedT = new Float64Array( data.T_out ); + + dlarft( data.direct, data.storev, data.N, data.K, V, data.strideV1, data.strideV2, data.offsetV, TAU, data.strideTAU, data.offsetTAU, T, data.strideT1, data.strideT2, data.offsetT ); + t.strictEqual( isAlmostEqual( T, expectedT, 2 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function forms triangular factor of a block reflector (column-major, forward, rowwise)', function test( t ) { + var expectedT; + var data; + var TAU; + var T; + var V; + + data = LQ_COL_MAJ; + + V = new Float64Array( data.V ); + TAU = new Float64Array( data.TAU ); + T = new Float64Array( data.T ); + + expectedT = new Float64Array( data.T_out ); + + dlarft( data.direct, data.storev, data.N, data.K, V, data.strideV1, data.strideV2, data.offsetV, TAU, data.strideTAU, data.offsetTAU, T, data.strideT1, data.strideT2, data.offsetT ); + t.strictEqual( isAlmostEqual( T, expectedT, 2 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function forms triangular factor of a block reflector (row-major, forward, columnwise)', function test( t ) { + var expectedT; + var data; + var TAU; + var T; + var V; + + data = QR_ROW_MAJ; + + V = new Float64Array( data.V ); + TAU = new Float64Array( data.TAU ); + T = new Float64Array( data.T ); + + expectedT = new Float64Array( data.T_out ); + + dlarft( data.direct, data.storev, data.N, data.K, V, data.strideV1, data.strideV2, data.offsetV, TAU, data.strideTAU, data.offsetTAU, T, data.strideT1, data.strideT2, data.offsetT ); + t.strictEqual( isAlmostEqual( T, expectedT, 16 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function forms triangular factor of a block reflector (column-major, forward, columnwise)', function test( t ) { + var expectedT; + var data; + var TAU; + var T; + var V; + + data = QR_COL_MAJ; + + V = new Float64Array( data.V ); + TAU = new Float64Array( data.TAU ); + T = new Float64Array( data.T ); + + expectedT = new Float64Array( data.T_out ); + + dlarft( data.direct, data.storev, data.N, data.K, V, data.strideV1, data.strideV2, data.offsetV, TAU, data.strideTAU, data.offsetTAU, T, data.strideT1, data.strideT2, data.offsetT ); + t.strictEqual( isAlmostEqual( T, expectedT, 16 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function forms triangular factor of a block reflector (row-major, backward, columnwise)', function test( t ) { + var expectedT; + var data; + var TAU; + var T; + var V; + + data = QL_ROW_MAJ; + + V = new Float64Array( data.V ); + TAU = new Float64Array( data.TAU ); + T = new Float64Array( data.T ); + + expectedT = new Float64Array( data.T_out ); + + dlarft( data.direct, data.storev, data.N, data.K, V, data.strideV1, data.strideV2, data.offsetV, TAU, data.strideTAU, data.offsetTAU, T, data.strideT1, data.strideT2, data.offsetT ); + t.strictEqual( isAlmostEqual( T, expectedT, 4 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function forms triangular factor of a block reflector (column-major, backward, columnwise)', function test( t ) { + var expectedT; + var data; + var TAU; + var T; + var V; + + data = QL_COL_MAJ; + + V = new Float64Array( data.V ); + TAU = new Float64Array( data.TAU ); + T = new Float64Array( data.T ); + + expectedT = new Float64Array( data.T_out ); + + dlarft( data.direct, data.storev, data.N, data.K, V, data.strideV1, data.strideV2, data.offsetV, TAU, data.strideTAU, data.offsetTAU, T, data.strideT1, data.strideT2, data.offsetT ); + t.strictEqual( isAlmostEqual( T, expectedT, 4 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function forms triangular factor of a block reflector (row-major, backward, rowwise)', function test( t ) { + var expectedT; + var data; + var TAU; + var T; + var V; + + data = RQ_ROW_MAJ; + + V = new Float64Array( data.V ); + TAU = new Float64Array( data.TAU ); + T = new Float64Array( data.T ); + + expectedT = new Float64Array( data.T_out ); + + dlarft( data.direct, data.storev, data.N, data.K, V, data.strideV1, data.strideV2, data.offsetV, TAU, data.strideTAU, data.offsetTAU, T, data.strideT1, data.strideT2, data.offsetT ); + t.strictEqual( isAlmostEqual( T, expectedT, 11 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function forms triangular factor of a block reflector (column-major, backward, rowwise)', function test( t ) { + var expectedT; + var data; + var TAU; + var T; + var V; + + data = RQ_COL_MAJ; + + V = new Float64Array( data.V ); + TAU = new Float64Array( data.TAU ); + T = new Float64Array( data.T ); + + expectedT = new Float64Array( data.T_out ); + + dlarft( data.direct, data.storev, data.N, data.K, V, data.strideV1, data.strideV2, data.offsetV, TAU, data.strideTAU, data.offsetTAU, T, data.strideT1, data.strideT2, data.offsetT ); + t.strictEqual( isAlmostEqual( T, expectedT, 11 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function forms triangular factor of a block reflector (row-major, forward, rowwise, large stride)', function test( t ) { + var expectedT; + var data; + var TAU; + var T; + var V; + + data = LAR_STR_LQ_ROW_MAJ; + + V = new Float64Array( data.V ); + TAU = new Float64Array( data.TAU ); + T = new Float64Array( data.T ); + + expectedT = new Float64Array( data.T_out ); + + dlarft( data.direct, data.storev, data.N, data.K, V, data.strideV1, data.strideV2, data.offsetV, TAU, data.strideTAU, data.offsetTAU, T, data.strideT1, data.strideT2, data.offsetT ); + t.strictEqual( isAlmostEqual( T, expectedT, 2 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function forms triangular factor of a block reflector (column-major, forward, rowwise, large stride)', function test( t ) { + var expectedT; + var data; + var TAU; + var T; + var V; + + data = LAR_STR_LQ_COL_MAJ; + + V = new Float64Array( data.V ); + TAU = new Float64Array( data.TAU ); + T = new Float64Array( data.T ); + + expectedT = new Float64Array( data.T_out ); + + dlarft( data.direct, data.storev, data.N, data.K, V, data.strideV1, data.strideV2, data.offsetV, TAU, data.strideTAU, data.offsetTAU, T, data.strideT1, data.strideT2, data.offsetT ); + t.strictEqual( isAlmostEqual( T, expectedT, 2 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function forms triangular factor of a block reflector (row-major, forward, columnwise, large stride)', function test( t ) { + var expectedT; + var data; + var TAU; + var T; + var V; + + data = LAR_STR_QR_ROW_MAJ; + + V = new Float64Array( data.V ); + TAU = new Float64Array( data.TAU ); + T = new Float64Array( data.T ); + + expectedT = new Float64Array( data.T_out ); + + dlarft( data.direct, data.storev, data.N, data.K, V, data.strideV1, data.strideV2, data.offsetV, TAU, data.strideTAU, data.offsetTAU, T, data.strideT1, data.strideT2, data.offsetT ); + t.strictEqual( isAlmostEqual( T, expectedT, 16 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function forms triangular factor of a block reflector (column-major, forward, columnwise, large stride)', function test( t ) { + var expectedT; + var data; + var TAU; + var T; + var V; + + data = LAR_STR_QR_COL_MAJ; + + V = new Float64Array( data.V ); + TAU = new Float64Array( data.TAU ); + T = new Float64Array( data.T ); + + expectedT = new Float64Array( data.T_out ); + + dlarft( data.direct, data.storev, data.N, data.K, V, data.strideV1, data.strideV2, data.offsetV, TAU, data.strideTAU, data.offsetTAU, T, data.strideT1, data.strideT2, data.offsetT ); + t.strictEqual( isAlmostEqual( T, expectedT, 16 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function forms triangular factor of a block reflector (row-major, backward, columnwise, large stride)', function test( t ) { + var expectedT; + var data; + var TAU; + var T; + var V; + + data = LAR_STR_QL_ROW_MAJ; + + V = new Float64Array( data.V ); + TAU = new Float64Array( data.TAU ); + T = new Float64Array( data.T ); + + expectedT = new Float64Array( data.T_out ); + + dlarft( data.direct, data.storev, data.N, data.K, V, data.strideV1, data.strideV2, data.offsetV, TAU, data.strideTAU, data.offsetTAU, T, data.strideT1, data.strideT2, data.offsetT ); + t.strictEqual( isAlmostEqual( T, expectedT, 4 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function forms triangular factor of a block reflector (column-major, backward, columnwise, large stride)', function test( t ) { + var expectedT; + var data; + var TAU; + var T; + var V; + + data = LAR_STR_QL_COL_MAJ; + + V = new Float64Array( data.V ); + TAU = new Float64Array( data.TAU ); + T = new Float64Array( data.T ); + + expectedT = new Float64Array( data.T_out ); + + dlarft( data.direct, data.storev, data.N, data.K, V, data.strideV1, data.strideV2, data.offsetV, TAU, data.strideTAU, data.offsetTAU, T, data.strideT1, data.strideT2, data.offsetT ); + t.strictEqual( isAlmostEqual( T, expectedT, 4 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function forms triangular factor of a block reflector (row-major, backward, rowwise, large stride)', function test( t ) { + var expectedT; + var data; + var TAU; + var T; + var V; + + data = LAR_STR_RQ_ROW_MAJ; + + V = new Float64Array( data.V ); + TAU = new Float64Array( data.TAU ); + T = new Float64Array( data.T ); + + expectedT = new Float64Array( data.T_out ); + + dlarft( data.direct, data.storev, data.N, data.K, V, data.strideV1, data.strideV2, data.offsetV, TAU, data.strideTAU, data.offsetTAU, T, data.strideT1, data.strideT2, data.offsetT ); + t.strictEqual( isAlmostEqual( T, expectedT, 11 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function forms triangular factor of a block reflector (column-major, backward, rowwise, large stride)', function test( t ) { + var expectedT; + var data; + var TAU; + var T; + var V; + + data = LAR_STR_RQ_COL_MAJ; + + V = new Float64Array( data.V ); + TAU = new Float64Array( data.TAU ); + T = new Float64Array( data.T ); + + expectedT = new Float64Array( data.T_out ); + + dlarft( data.direct, data.storev, data.N, data.K, V, data.strideV1, data.strideV2, data.offsetV, TAU, data.strideTAU, data.offsetTAU, T, data.strideT1, data.strideT2, data.offsetT ); + t.strictEqual( isAlmostEqual( T, expectedT, 11 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function forms triangular factor of a block reflector (row-major, forward, rowwise, mixed stride)', function test( t ) { + var expectedT; + var data; + var TAU; + var T; + var V; + + data = MIX_STR_LQ_ROW_MAJ; + + V = new Float64Array( data.V ); + TAU = new Float64Array( data.TAU ); + T = new Float64Array( data.T ); + + expectedT = new Float64Array( data.T_out ); + + dlarft( data.direct, data.storev, data.N, data.K, V, data.strideV1, data.strideV2, data.offsetV, TAU, data.strideTAU, data.offsetTAU, T, data.strideT1, data.strideT2, data.offsetT ); + t.strictEqual( isAlmostEqual( T, expectedT, 2 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function forms triangular factor of a block reflector (column-major, forward, rowwise, mixed stride)', function test( t ) { + var expectedT; + var data; + var TAU; + var T; + var V; + + data = MIX_STR_LQ_COL_MAJ; + + V = new Float64Array( data.V ); + TAU = new Float64Array( data.TAU ); + T = new Float64Array( data.T ); + + expectedT = new Float64Array( data.T_out ); + + dlarft( data.direct, data.storev, data.N, data.K, V, data.strideV1, data.strideV2, data.offsetV, TAU, data.strideTAU, data.offsetTAU, T, data.strideT1, data.strideT2, data.offsetT ); + t.strictEqual( isAlmostEqual( T, expectedT, 2 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function forms triangular factor of a block reflector (row-major, forward, columnwise, mixed stride)', function test( t ) { + var expectedT; + var data; + var TAU; + var T; + var V; + + data = MIX_STR_QR_ROW_MAJ; + + V = new Float64Array( data.V ); + TAU = new Float64Array( data.TAU ); + T = new Float64Array( data.T ); + + expectedT = new Float64Array( data.T_out ); + + dlarft( data.direct, data.storev, data.N, data.K, V, data.strideV1, data.strideV2, data.offsetV, TAU, data.strideTAU, data.offsetTAU, T, data.strideT1, data.strideT2, data.offsetT ); + t.strictEqual( isAlmostEqual( T, expectedT, 16 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function forms triangular factor of a block reflector (column-major, forward, columnwise, mixed stride)', function test( t ) { + var expectedT; + var data; + var TAU; + var T; + var V; + + data = MIX_STR_QR_COL_MAJ; + + V = new Float64Array( data.V ); + TAU = new Float64Array( data.TAU ); + T = new Float64Array( data.T ); + + expectedT = new Float64Array( data.T_out ); + + dlarft( data.direct, data.storev, data.N, data.K, V, data.strideV1, data.strideV2, data.offsetV, TAU, data.strideTAU, data.offsetTAU, T, data.strideT1, data.strideT2, data.offsetT ); + t.strictEqual( isAlmostEqual( T, expectedT, 16 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function forms triangular factor of a block reflector (row-major, backward, columnwise, mixed stride)', function test( t ) { + var expectedT; + var data; + var TAU; + var T; + var V; + + data = MIX_STR_QL_ROW_MAJ; + + V = new Float64Array( data.V ); + TAU = new Float64Array( data.TAU ); + T = new Float64Array( data.T ); + + expectedT = new Float64Array( data.T_out ); + + dlarft( data.direct, data.storev, data.N, data.K, V, data.strideV1, data.strideV2, data.offsetV, TAU, data.strideTAU, data.offsetTAU, T, data.strideT1, data.strideT2, data.offsetT ); + t.strictEqual( isAlmostEqual( T, expectedT, 4 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function forms triangular factor of a block reflector (column-major, backward, columnwise, mixed stride)', function test( t ) { + var expectedT; + var data; + var TAU; + var T; + var V; + + data = MIX_STR_QL_COL_MAJ; + + V = new Float64Array( data.V ); + TAU = new Float64Array( data.TAU ); + T = new Float64Array( data.T ); + + expectedT = new Float64Array( data.T_out ); + + dlarft( data.direct, data.storev, data.N, data.K, V, data.strideV1, data.strideV2, data.offsetV, TAU, data.strideTAU, data.offsetTAU, T, data.strideT1, data.strideT2, data.offsetT ); + t.strictEqual( isAlmostEqual( T, expectedT, 4 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function forms triangular factor of a block reflector (row-major, backward, rowwise, mixed stride)', function test( t ) { + var expectedT; + var data; + var TAU; + var T; + var V; + + data = MIX_STR_RQ_ROW_MAJ; + + V = new Float64Array( data.V ); + TAU = new Float64Array( data.TAU ); + T = new Float64Array( data.T ); + + expectedT = new Float64Array( data.T_out ); + + dlarft( data.direct, data.storev, data.N, data.K, V, data.strideV1, data.strideV2, data.offsetV, TAU, data.strideTAU, data.offsetTAU, T, data.strideT1, data.strideT2, data.offsetT ); + t.strictEqual( isAlmostEqual( T, expectedT, 11 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function forms triangular factor of a block reflector (column-major, backward, rowwise, mixed stride)', function test( t ) { + var expectedT; + var data; + var TAU; + var T; + var V; + + data = MIX_STR_RQ_COL_MAJ; + + V = new Float64Array( data.V ); + TAU = new Float64Array( data.TAU ); + T = new Float64Array( data.T ); + + expectedT = new Float64Array( data.T_out ); + + dlarft( data.direct, data.storev, data.N, data.K, V, data.strideV1, data.strideV2, data.offsetV, TAU, data.strideTAU, data.offsetTAU, T, data.strideT1, data.strideT2, data.offsetT ); + t.strictEqual( isAlmostEqual( T, expectedT, 11 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function forms triangular factor of a block reflector (row-major, forward, rowwise, negative stride)', function test( t ) { + var expectedT; + var data; + var TAU; + var T; + var V; + + data = NEG_STR_LQ_ROW_MAJ; + + V = new Float64Array( data.V ); + TAU = new Float64Array( data.TAU ); + T = new Float64Array( data.T ); + + expectedT = new Float64Array( data.T_out ); + + dlarft( data.direct, data.storev, data.N, data.K, V, data.strideV1, data.strideV2, data.offsetV, TAU, data.strideTAU, data.offsetTAU, T, data.strideT1, data.strideT2, data.offsetT ); + t.strictEqual( isAlmostEqual( T, expectedT, 2 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function forms triangular factor of a block reflector (column-major, forward, rowwise, negative stride)', function test( t ) { + var expectedT; + var data; + var TAU; + var T; + var V; + + data = NEG_STR_LQ_COL_MAJ; + + V = new Float64Array( data.V ); + TAU = new Float64Array( data.TAU ); + T = new Float64Array( data.T ); + + expectedT = new Float64Array( data.T_out ); + + dlarft( data.direct, data.storev, data.N, data.K, V, data.strideV1, data.strideV2, data.offsetV, TAU, data.strideTAU, data.offsetTAU, T, data.strideT1, data.strideT2, data.offsetT ); + t.strictEqual( isAlmostEqual( T, expectedT, 2 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function forms triangular factor of a block reflector (row-major, forward, columnwise, negative stride)', function test( t ) { + var expectedT; + var data; + var TAU; + var T; + var V; + + data = NEG_STR_QR_ROW_MAJ; + + V = new Float64Array( data.V ); + TAU = new Float64Array( data.TAU ); + T = new Float64Array( data.T ); + + expectedT = new Float64Array( data.T_out ); + + dlarft( data.direct, data.storev, data.N, data.K, V, data.strideV1, data.strideV2, data.offsetV, TAU, data.strideTAU, data.offsetTAU, T, data.strideT1, data.strideT2, data.offsetT ); + t.strictEqual( isAlmostEqual( T, expectedT, 16 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function forms triangular factor of a block reflector (column-major, forward, columnwise, negative stride)', function test( t ) { + var expectedT; + var data; + var TAU; + var T; + var V; + + data = NEG_STR_QR_COL_MAJ; + + V = new Float64Array( data.V ); + TAU = new Float64Array( data.TAU ); + T = new Float64Array( data.T ); + + expectedT = new Float64Array( data.T_out ); + + dlarft( data.direct, data.storev, data.N, data.K, V, data.strideV1, data.strideV2, data.offsetV, TAU, data.strideTAU, data.offsetTAU, T, data.strideT1, data.strideT2, data.offsetT ); + t.strictEqual( isAlmostEqual( T, expectedT, 16 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function forms triangular factor of a block reflector (row-major, backward, columnwise, negative stride)', function test( t ) { + var expectedT; + var data; + var TAU; + var T; + var V; + + data = NEG_STR_QL_ROW_MAJ; + + V = new Float64Array( data.V ); + TAU = new Float64Array( data.TAU ); + T = new Float64Array( data.T ); + + expectedT = new Float64Array( data.T_out ); + + dlarft( data.direct, data.storev, data.N, data.K, V, data.strideV1, data.strideV2, data.offsetV, TAU, data.strideTAU, data.offsetTAU, T, data.strideT1, data.strideT2, data.offsetT ); + t.strictEqual( isAlmostEqual( T, expectedT, 4 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function forms triangular factor of a block reflector (column-major, backward, columnwise, negative stride)', function test( t ) { + var expectedT; + var data; + var TAU; + var T; + var V; + + data = NEG_STR_QL_COL_MAJ; + + V = new Float64Array( data.V ); + TAU = new Float64Array( data.TAU ); + T = new Float64Array( data.T ); + + expectedT = new Float64Array( data.T_out ); + + dlarft( data.direct, data.storev, data.N, data.K, V, data.strideV1, data.strideV2, data.offsetV, TAU, data.strideTAU, data.offsetTAU, T, data.strideT1, data.strideT2, data.offsetT ); + t.strictEqual( isAlmostEqual( T, expectedT, 4 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function forms triangular factor of a block reflector (row-major, backward, rowwise, negative stride)', function test( t ) { + var expectedT; + var data; + var TAU; + var T; + var V; + + data = NEG_STR_RQ_ROW_MAJ; + + V = new Float64Array( data.V ); + TAU = new Float64Array( data.TAU ); + T = new Float64Array( data.T ); + + expectedT = new Float64Array( data.T_out ); + + dlarft( data.direct, data.storev, data.N, data.K, V, data.strideV1, data.strideV2, data.offsetV, TAU, data.strideTAU, data.offsetTAU, T, data.strideT1, data.strideT2, data.offsetT ); + t.strictEqual( isAlmostEqual( T, expectedT, 11 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function forms triangular factor of a block reflector (column-major, backward, rowwise, negative stride)', function test( t ) { + var expectedT; + var data; + var TAU; + var T; + var V; + + data = NEG_STR_RQ_COL_MAJ; + + V = new Float64Array( data.V ); + TAU = new Float64Array( data.TAU ); + T = new Float64Array( data.T ); + + expectedT = new Float64Array( data.T_out ); + + dlarft( data.direct, data.storev, data.N, data.K, V, data.strideV1, data.strideV2, data.offsetV, TAU, data.strideTAU, data.offsetTAU, T, data.strideT1, data.strideT2, data.offsetT ); + t.strictEqual( isAlmostEqual( T, expectedT, 11 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function forms triangular factor of a block reflector (row-major, forward, rowwise, offset)', function test( t ) { + var expectedT; + var data; + var TAU; + var T; + var V; + + data = OFF_LQ_ROW_MAJ; + + V = new Float64Array( data.V ); + TAU = new Float64Array( data.TAU ); + T = new Float64Array( data.T ); + + expectedT = new Float64Array( data.T_out ); + + dlarft( data.direct, data.storev, data.N, data.K, V, data.strideV1, data.strideV2, data.offsetV, TAU, data.strideTAU, data.offsetTAU, T, data.strideT1, data.strideT2, data.offsetT ); + t.strictEqual( isAlmostEqual( T, expectedT, 2 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function forms triangular factor of a block reflector (column-major, forward, rowwise, offset)', function test( t ) { + var expectedT; + var data; + var TAU; + var T; + var V; + + data = OFF_LQ_COL_MAJ; + + V = new Float64Array( data.V ); + TAU = new Float64Array( data.TAU ); + T = new Float64Array( data.T ); + + expectedT = new Float64Array( data.T_out ); + + dlarft( data.direct, data.storev, data.N, data.K, V, data.strideV1, data.strideV2, data.offsetV, TAU, data.strideTAU, data.offsetTAU, T, data.strideT1, data.strideT2, data.offsetT ); + t.strictEqual( isAlmostEqual( T, expectedT, 2 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function forms triangular factor of a block reflector (row-major, forward, columnwise, offset)', function test( t ) { + var expectedT; + var data; + var TAU; + var T; + var V; + + data = OFF_QR_ROW_MAJ; + + V = new Float64Array( data.V ); + TAU = new Float64Array( data.TAU ); + T = new Float64Array( data.T ); + + expectedT = new Float64Array( data.T_out ); + + dlarft( data.direct, data.storev, data.N, data.K, V, data.strideV1, data.strideV2, data.offsetV, TAU, data.strideTAU, data.offsetTAU, T, data.strideT1, data.strideT2, data.offsetT ); + t.strictEqual( isAlmostEqual( T, expectedT, 16 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function forms triangular factor of a block reflector (column-major, forward, columnwise, offset)', function test( t ) { + var expectedT; + var data; + var TAU; + var T; + var V; + + data = OFF_QR_COL_MAJ; + + V = new Float64Array( data.V ); + TAU = new Float64Array( data.TAU ); + T = new Float64Array( data.T ); + + expectedT = new Float64Array( data.T_out ); + + dlarft( data.direct, data.storev, data.N, data.K, V, data.strideV1, data.strideV2, data.offsetV, TAU, data.strideTAU, data.offsetTAU, T, data.strideT1, data.strideT2, data.offsetT ); + t.strictEqual( isAlmostEqual( T, expectedT, 16 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function forms triangular factor of a block reflector (row-major, backward, columnwise, offset)', function test( t ) { + var expectedT; + var data; + var TAU; + var T; + var V; + + data = OFF_QL_ROW_MAJ; + + V = new Float64Array( data.V ); + TAU = new Float64Array( data.TAU ); + T = new Float64Array( data.T ); + + expectedT = new Float64Array( data.T_out ); + + dlarft( data.direct, data.storev, data.N, data.K, V, data.strideV1, data.strideV2, data.offsetV, TAU, data.strideTAU, data.offsetTAU, T, data.strideT1, data.strideT2, data.offsetT ); + t.strictEqual( isAlmostEqual( T, expectedT, 4 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function forms triangular factor of a block reflector (column-major, backward, columnwise, offset)', function test( t ) { + var expectedT; + var data; + var TAU; + var T; + var V; + + data = OFF_QL_COL_MAJ; + + V = new Float64Array( data.V ); + TAU = new Float64Array( data.TAU ); + T = new Float64Array( data.T ); + + expectedT = new Float64Array( data.T_out ); + + dlarft( data.direct, data.storev, data.N, data.K, V, data.strideV1, data.strideV2, data.offsetV, TAU, data.strideTAU, data.offsetTAU, T, data.strideT1, data.strideT2, data.offsetT ); + t.strictEqual( isAlmostEqual( T, expectedT, 4 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function forms triangular factor of a block reflector (row-major, backward, rowwise, offset)', function test( t ) { + var expectedT; + var data; + var TAU; + var T; + var V; + + data = OFF_RQ_ROW_MAJ; + + V = new Float64Array( data.V ); + TAU = new Float64Array( data.TAU ); + T = new Float64Array( data.T ); + + expectedT = new Float64Array( data.T_out ); + + dlarft( data.direct, data.storev, data.N, data.K, V, data.strideV1, data.strideV2, data.offsetV, TAU, data.strideTAU, data.offsetTAU, T, data.strideT1, data.strideT2, data.offsetT ); + t.strictEqual( isAlmostEqual( T, expectedT, 11 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function forms triangular factor of a block reflector (column-major, backward, rowwise, offset)', function test( t ) { + var expectedT; + var data; + var TAU; + var T; + var V; + + data = OFF_RQ_COL_MAJ; + + V = new Float64Array( data.V ); + TAU = new Float64Array( data.TAU ); + T = new Float64Array( data.T ); + + expectedT = new Float64Array( data.T_out ); + + dlarft( data.direct, data.storev, data.N, data.K, V, data.strideV1, data.strideV2, data.offsetV, TAU, data.strideTAU, data.offsetTAU, T, data.strideT1, data.strideT2, data.offsetT ); + t.strictEqual( isAlmostEqual( T, expectedT, 11 ), true, 'returns expected value' ); + t.end(); +});