diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/benchmark/benchmark.js b/lib/node_modules/@stdlib/lapack/base/dorm2r/benchmark/benchmark.js new file mode 100644 index 000000000000..7d43b0a630d0 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/benchmark/benchmark.js @@ -0,0 +1,151 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var Float64Array = require( '@stdlib/array/float64' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var dorm2r = require( './../lib/dorm2r.js' ); + + +// VARIABLES // + +var LAYOUTS = [ + 'row-major', + 'column-major' +]; +var SIDES = [ + 'left', + 'right' +]; +var TRANS = [ + 'no-transpose', + 'transpose' +]; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {string} order - storage layout +* @param {string} side - specifies the side of multiplication +* @param {string} trans - specifies the operation to be performed +* @param {PositiveInteger} N - number of rows/columns in matrix C +* @returns {Function} benchmark function +*/ +function createBenchmark( order, side, trans, N ) { + var work; + var tau; + var A; + var C; + + A = uniform( N*N, 0.01, 0.1, { + 'dtype': 'float64' + }); + tau = uniform( N, 0.01, 0.1, { + 'dtype': 'float64' + }); + C = uniform( N*N, 0.01, 0.1, { + 'dtype': 'float64' + }); + work = new Float64Array( N ); + + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var z; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + z = dorm2r( order, side, trans, N, N, N, A, N, tau, C, N, work ); + 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 trans; + var side; + var min; + var max; + var ord; + var N; + var f; + var i; + var j; + var k; + var l; + var m; + + min = 1; // 10^min + max = 3; // 10^max + + for ( k = 0; k < LAYOUTS.length; k++ ) { + ord = LAYOUTS[ k ]; + for ( l = 0; l < SIDES.length; l++ ) { + side = SIDES[ l ]; + for ( m = 0; m < TRANS.length; m++ ) { + trans = TRANS[ m ]; + for ( i = min; i <= max; i++ ) { + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + j = 1; + while ( j <= N ) { + f = createBenchmark( ord, side, trans, N ); + bench( pkg+'::square_matrix:order='+ord+',side='+side+',trans='+trans+',M='+N+',N='+N+',K='+N, f ); + j *= 2; + } + } + } + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dorm2r/benchmark/benchmark.ndarray.js new file mode 100644 index 000000000000..7fa825cfec7c --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/benchmark/benchmark.ndarray.js @@ -0,0 +1,141 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var Float64Array = require( '@stdlib/array/float64' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var dorm2r = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var SIDES = [ + 'left', + 'right' +]; +var TRANS = [ + 'no-transpose', + 'transpose' +]; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {string} side - specifies the side of multiplication +* @param {string} trans - specifies the operation to be performed +* @param {PositiveInteger} N - number of rows/columns in matrix C +* @returns {Function} benchmark function +*/ +function createBenchmark( side, trans, N ) { + var work; + var tau; + var A; + var C; + + A = uniform( N*N, 0.01, 0.1, { + 'dtype': 'float64' + }); + tau = uniform( N, 0.01, 0.1, { + 'dtype': 'float64' + }); + C = uniform( N*N, 0.01, 0.1, { + 'dtype': 'float64' + }); + work = new Float64Array( N ); + + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var z; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + z = dorm2r( side, trans, N, N, N, A, N, 1, 0, tau, 1, 0, C, N, 1, 0, work, 1, 0 ); // eslint-disable-line max-len + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var trans; + var side; + var min; + var max; + var N; + var f; + var i; + var j; + var k; + var l; + + min = 1; // 10^min + max = 3; // 10^max + + for ( k = 0; k < SIDES.length; k++ ) { + side = SIDES[ k ]; + for ( l = 0; l < TRANS.length; l++ ) { + trans = TRANS[ l ]; + for ( i = min; i <= max; i++ ) { + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + j = 1; + while ( j <= N ) { + f = createBenchmark( side, trans, N ); + bench( pkg+'::square_matrix:ndarray:side='+side+',trans='+trans+',M='+N+',N='+N+',K='+N, f ); + j *= 2; + } + } + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/docs/types/index.d.ts b/lib/node_modules/@stdlib/lapack/base/dorm2r/docs/types/index.d.ts new file mode 100644 index 000000000000..9bbb56f058d5 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/docs/types/index.d.ts @@ -0,0 +1,174 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/// + +import { Layout, OperationSide, TransposeOperation } from '@stdlib/types/blas'; + +/** +* Interface describing `dorm2r`. +*/ +interface Routine { + /** + * Multiplies a matrix `C` by an orthogonal matrix `Q` from a QR factorization. + * + * ## Notes + * + * `dorm2r` overwrites the general real M by N matrix C with + * + * - `Q * C` if side = 'left' and trans = 'no-transpose' + * - `Q^T * C` if side = 'left' and trans = 'transpose' + * - `C * Q` if side = 'right' and trans = 'no-transpose' + * - `C * Q^T` if side = 'right' and trans = 'transpose' + * + * where Q is a real orthogonal matrix defined as the product of K elementary reflectors `Q = H(1) H(2) ... H(K)` as returned by `dgeqrf`. Q is of order M if side = 'left' and of order N if side = 'right'. + * + * @param order - storage layout + * @param side - specifies the side of multiplication with `C` + * @param trans - specifies the operation to be performed + * @param M - number of rows in matrix `C` + * @param N - number of columns in matrix `C` + * @param K - number of elementary reflectors whose product defines the matrix `Q` + * @param A - input matrix containing the elementary reflectors + * @param LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) + * @param tau - array containing the scalar factors of the elementary reflectors + * @param C - input/output matrix to be multiplied + * @param LDC - stride of the first dimension of `C` (a.k.a., leading dimension of the matrix `C`) + * @param work - workspace array for intermediate calculations + * @returns the modified matrix `C` + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * var A = new Float64Array( [ 1.0, 0.0, 0.0, 2.0, 4.0, 0.0, 3.0, 5.0, 6.0 ] ); + * var tau = new Float64Array( [ 7.0, 8.0, 9.0 ] ); + * var C = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ] ); + * var work = new Float64Array( 3 ); + * + * dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, work ); + * // C => [ -261638.0, -298618.0, -335598.0, -521066.0, -594715.0, -668364.0, -773933.0, -883324.0, -992715.0 ] + */ + ( order: Layout, side: OperationSide, trans: TransposeOperation, M: number, N: number, K: number, A: Float64Array, LDA: number, tau: Float64Array, C: Float64Array, LDC: number, work: Float64Array ): Float64Array; + + /** + * Multiplies a matrix `C` by an orthogonal matrix `Q` from a QR factorization using alternative indexing semantics. + * + * ## Notes + * + * `dorm2r` overwrites the general real M by N matrix C with + * + * - `Q * C` if side = 'left' and trans = 'no-transpose' + * - `Q^T * C` if side = 'left' and trans = 'transpose' + * - `C * Q` if side = 'right' and trans = 'no-transpose' + * - `C * Q^T` if side = 'right' and trans = 'transpose' + * + * where Q is a real orthogonal matrix defined as the product of K elementary reflectors `Q = H(1) H(2) ... H(K)` as returned by `dgeqrf`. Q is of order M if side = 'left' and of order N if side = 'right'. + * + * @param side - specifies the side of multiplication with `C` + * @param trans - specifies the operation to be performed + * @param M - number of rows in matrix `C` + * @param N - number of columns in matrix `C` + * @param K - number of elementary reflectors whose product defines the matrix `Q` + * @param A - input matrix containing the elementary reflectors + * @param strideA1 - stride length for the first dimension of `A` + * @param strideA2 - stride length for the second dimension of `A` + * @param offsetA - starting index for `A` + * @param tau - array containing the scalar factors of the elementary reflectors + * @param strideTau - stride length for `tau` + * @param offsetTau - starting index for `tau` + * @param C - input/output matrix to be multiplied + * @param strideC1 - stride length for the first dimension of `C` + * @param strideC2 - stride length for the second dimension of `C` + * @param offsetC - starting index for `C` + * @param work - workspace array for intermediate calculations + * @param strideWork - stride length for `work` + * @param offsetWork - starting index for `work` + * @returns the modified matrix `C` + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * var A = new Float64Array( [ 1.0, 0.0, 0.0, 2.0, 4.0, 0.0, 3.0, 5.0, 6.0 ] ); + * var tau = new Float64Array( [ 7.0, 8.0, 9.0 ] ); + * var C = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ] ); + * var work = new Float64Array( 3 ); + * + * dorm2r( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); + * // C => [ -261638.0, -298618.0, -335598.0, -521066.0, -594715.0, -668364.0, -773933.0, -883324.0, -992715.0 ] + */ + ndarray( side: OperationSide, trans: TransposeOperation, M: number, N: number, K: number, A: Float64Array, strideA1: number, strideA2: number, offsetA: number, tau: Float64Array, strideTau: number, offsetTau: number, C: Float64Array, strideC1: number, strideC2: number, offsetC: number, work: Float64Array, strideWork: number, offsetWork: number ): Float64Array; +} + +/** +* Multiplies a matrix `C` by an orthogonal matrix `Q` from a QR factorization. +* +* ## Notes +* +* `dorm2r` overwrites the general real M by N matrix C with +* +* - `Q * C` if side = 'left' and trans = 'no-transpose' +* - `Q^T * C` if side = 'left' and trans = 'transpose' +* - `C * Q` if side = 'right' and trans = 'no-transpose' +* - `C * Q^T` if side = 'right' and trans = 'transpose' +* +* where Q is a real orthogonal matrix defined as the product of K elementary reflectors `Q = H(1) H(2) ... H(K)` as returned by `dgeqrf`. Q is of order M if side = 'left' and of order N if side = 'right'. +* +* @param order - storage layout +* @param side - specifies the side of multiplication with `C` +* @param trans - specifies the operation to be performed +* @param M - number of rows in matrix `C` +* @param N - number of columns in matrix `C` +* @param K - number of elementary reflectors whose product defines the matrix `Q` +* @param A - input matrix containing the elementary reflectors +* @param LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) +* @param tau - array containing the scalar factors of the elementary reflectors +* @param C - input/output matrix to be multiplied +* @param LDC - stride of the first dimension of `C` (a.k.a., leading dimension of the matrix `C`) +* @param work - workspace array for intermediate calculations +* @returns the modified matrix `C` +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( [ 1.0, 0.0, 0.0, 2.0, 4.0, 0.0, 3.0, 5.0, 6.0 ] ); +* var tau = new Float64Array( [ 7.0, 8.0, 9.0 ] ); +* var C = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ] ); +* var work = new Float64Array( 3 ); +* +* dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, work ); +* // C => [ -261638.0, -298618.0, -335598.0, -521066.0, -594715.0, -668364.0, -773933.0, -883324.0, -992715.0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( [ 1.0, 0.0, 0.0, 2.0, 4.0, 0.0, 3.0, 5.0, 6.0 ] ); +* var tau = new Float64Array( [ 7.0, 8.0, 9.0 ] ); +* var C = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ] ); +* var work = new Float64Array( 3 ); +* +* dorm2r( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); +* // C => [ -261638.0, -298618.0, -335598.0, -521066.0, -594715.0, -668364.0, -773933.0, -883324.0, -992715.0 ] +*/ +declare var dorm2r: Routine; + + +// EXPORTS // + +export = dorm2r; diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/docs/types/test.ts b/lib/node_modules/@stdlib/lapack/base/dorm2r/docs/types/test.ts new file mode 100644 index 000000000000..2bafd67b038e --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/docs/types/test.ts @@ -0,0 +1,620 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import dorm2r = require( './index' ); + + +// TESTS // + +// The function returns a Float64Array... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, work ); // $ExpectType Float64Array +} + +// The compiler throws an error if the function is provided a first argument which is not a string... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r( 5, 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( true, 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( false, 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( null, 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( void 0, 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( [], 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( {}, 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( ( x: number ): number => x, 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError +} + +// The compiler throws an error if the function is provided a second argument which is not a string... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r( 'row-major', 5, 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', true, 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', false, 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', null, 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', void 0, 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', [], 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', {}, 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', ( x: number ): number => x, 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError +} + +// The compiler throws an error if the function is provided a third argument which is not a string... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r( 'row-major', 'left', 5, 3, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', true, 3, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', false, 3, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', null, 3, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', void 0, 3, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', [], 3, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', {}, 3, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', ( x: number ): number => x, 3, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fourth argument which is not a number... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r( 'row-major', 'left', 'no-transpose', '5', 3, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', true, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', false, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', null, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', void 0, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', [], 3, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', {}, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', ( x: number ): number => x, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fifth argument which is not a number... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r( 'row-major', 'left', 'no-transpose', 3, '5', 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, true, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, false, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, null, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, void 0, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, [], 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, {}, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, ( x: number ): number => x, 3, A, 3, tau, C, 3, work ); // $ExpectError +} + +// The compiler throws an error if the function is provided a sixth argument which is not a number... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, '5', A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, true, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, false, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, null, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, void 0, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, [], A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, {}, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, ( x: number ): number => x, A, 3, tau, C, 3, work ); // $ExpectError +} + +// The compiler throws an error if the function is provided a seventh argument which is not a Float64Array... +{ + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, '5', 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, 5, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, true, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, false, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, null, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, void 0, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, [], 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, {}, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, ( x: number ): number => x, 3, tau, C, 3, work ); // $ExpectError +} + +// The compiler throws an error if the function is provided an eighth argument which is not a number... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, '5', tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, true, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, false, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, null, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, void 0, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, [], tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, {}, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, ( x: number ): number => x, tau, C, 3, work ); // $ExpectError +} + +// The compiler throws an error if the function is provided a ninth argument which is not a Float64Array... +{ + const A = new Float64Array( 9 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, '5', C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, 5, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, true, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, false, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, null, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, void 0, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, [], C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, {}, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, ( x: number ): number => x, C, 3, work ); // $ExpectError +} + +// The compiler throws an error if the function is provided a tenth argument which is not a Float64Array... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const work = new Float64Array( 3 ); + + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, '5', 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, 5, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, true, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, false, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, null, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, void 0, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, [], 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, {}, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, ( x: number ): number => x, 3, work ); // $ExpectError +} + +// The compiler throws an error if the function is provided an eleventh argument which is not a number... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, '5', work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, true, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, false, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, null, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, void 0, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, [], work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, {}, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, ( x: number ): number => x, work ); // $ExpectError +} + +// The compiler throws an error if the function is provided a twelfth argument which is not a Float64Array... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, '5' ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, 5 ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, true ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, false ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, null ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, void 0 ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, [] ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, {} ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r(); // $ExpectError + dorm2r( 'row-major' ); // $ExpectError + dorm2r( 'row-major', 'left' ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose' ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3 ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3 ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3 ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3 ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, 3 ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, work, 10 ); // $ExpectError +} + +// Attached to main export is an `ndarray` method which returns a Float64Array... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectType Float64Array +} + +// The compiler throws an error if the function is provided a first argument which is not a string... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r.ndarray( 5, 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( true, 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( false, 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( null, 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( void 0, 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( [], 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( {}, 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( ( x: number ): number => x, 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a second argument which is not a string... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r.ndarray( 'left', 5, 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', true, 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', false, 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', null, 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', void 0, 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', [], 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', {}, 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', ( x: number ): number => x, 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a third argument which is not a number... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r.ndarray( 'left', 'no-transpose', '5', 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', true, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', false, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', null, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', void 0, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', [], 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', {}, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', ( x: number ): number => x, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fourth argument which is not a number... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r.ndarray( 'left', 'no-transpose', 3, '5', 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, true, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, false, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, null, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, void 0, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, [], 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, {}, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, ( x: number ): number => x, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fifth argument which is not a number... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, '5', A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, true, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, false, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, null, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, void 0, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, [], A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, {}, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, ( x: number ): number => x, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a sixth argument which is not a Float64Array... +{ + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, '5', 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, 5, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, true, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, false, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, null, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, void 0, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, [], 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, {}, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, ( x: number ): number => x, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a seventh argument which is not a number... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, '5', 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, true, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, false, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, null, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, void 0, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, [], 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, {}, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, ( x: number ): number => x, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided an eighth argument which is not a number... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, '5', 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, true, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, false, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, null, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, void 0, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, [], 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, {}, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, ( x: number ): number => x, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a ninth argument which is not a number... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, '5', tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, true, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, false, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, null, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, void 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, [], tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, {}, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, ( x: number ): number => x, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a tenth argument which is not a Float64Array... +{ + const A = new Float64Array( 9 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, '5', 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, 5, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, true, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, false, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, null, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, void 0, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, [], 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, {}, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, ( x: number ): number => x, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided an eleventh argument which is not a number... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, '5', 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, true, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, false, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, null, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, void 0, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, [], 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, {}, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, ( x: number ): number => x, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a twelfth argument which is not a number... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, '5', C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, true, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, false, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, null, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, void 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, [], C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, {}, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, ( x: number ): number => x, C, 3, 1, 0, work, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a thirteenth argument which is not a Float64Array... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const work = new Float64Array( 3 ); + + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, '5', 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, 5, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, true, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, false, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, null, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, void 0, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, [], 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, {}, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, ( x: number ): number => x, 3, 1, 0, work, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fourteenth argument which is not a number... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, '5', 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, true, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, false, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, null, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, void 0, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, [], 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, {}, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, ( x: number ): number => x, 1, 0, work, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fifteenth argument which is not a number... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, '5', 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, true, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, false, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, null, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, void 0, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, [], 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, {}, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, ( x: number ): number => x, 0, work, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a sixteenth argument which is not a number... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, '5', work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, true, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, false, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, null, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, void 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, [], work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, {}, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, ( x: number ): number => x, work, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a seventeenth argument which is not a Float64Array... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, '5', 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, 5, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, true, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, false, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, null, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, void 0, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, [], 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, {}, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, ( x: number ): number => x, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided an eighteenth argument which is not a number... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, '5', 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, true, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, false, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, null, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, void 0, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, [], 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, {}, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, ( x: number ): number => x, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a nineteenth argument which is not a number... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, '5' ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, true ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, false ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, null ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, void 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, [] ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, {} ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided an unsupported number of arguments... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r.ndarray(); // $ExpectError + dorm2r.ndarray( 'left' ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose' ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0, 10 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/examples/index.js b/lib/node_modules/@stdlib/lapack/base/dorm2r/examples/index.js new file mode 100644 index 000000000000..2fab24e1d24b --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/examples/index.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var Float64Array = require( '@stdlib/array/float64' ); +var ndarray2array = require( '@stdlib/ndarray/base/to-array' ); +var dorm2r = require( './../lib' ); + +// Specify matrix meta data: +var shape = [ 3, 3 ]; +var strides = [ 1, 3 ]; +var offset = 0; +var order = 'column-major'; + +// Create matrices stored in linear memory: +var A = new Float64Array( [ 1.0, 0.0, 0.0, 2.0, 4.0, 0.0, 3.0, 5.0, 6.0 ] ); +var tau = new Float64Array( [ 7.0, 8.0, 9.0 ] ); +var C = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ] ); +var work = new Float64Array( 3 ); + +console.log( 'Input matrix C:' ); +console.log( ndarray2array( C, shape, strides, offset, order ) ); + +// Multiply C by Q from the left (no transpose): +dorm2r( order, 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, work ); +console.log( 'Output matrix C (Q * C):' ); +console.log( ndarray2array( C, shape, strides, offset, order ) ); diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/base.js b/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/base.js new file mode 100644 index 000000000000..54398848d33f --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/base.js @@ -0,0 +1,159 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var dlarf1f = require( './dlarf1f.js' ); + + +// MAIN // + +/** +* Multiplies a matrix `C` by an orthogonal matrix `Q` from a QR factorization. +* +* ## Notes +* +* `dorm2r` overwrites the general real M by N matrix C with +* +* - `Q * C` if side = 'left' and trans = 'no-transpose' +* - `Q^T * C` if side = 'left' and trans = 'transpose' +* - `C * Q` if side = 'right' and trans = 'no-transpose' +* - `C * Q^T` if side = 'right' and trans = 'transpose' +* +* where Q is a real orthogonal matrix defined as the product of K elementary reflectors `Q = H(1) H(2) ... H(K)` as returned by `dgeqrf`. Q is of order M if side = 'left' and of order N if side = 'right'. +* +* @private +* @param {string} side - specifies the side of multiplication with `C` +* @param {string} trans - specifies the operation to be performed +* @param {NonNegativeInteger} M - number of rows in matrix `C` +* @param {NonNegativeInteger} N - number of columns in matrix `C` +* @param {NonNegativeInteger} K - number of elementary reflectors whose product defines the matrix `Q` +* @param {Float64Array} A - input matrix containing the elementary reflectors +* @param {integer} strideA1 - stride length for the first dimension of `A` +* @param {integer} strideA2 - stride length for the second dimension of `A` +* @param {NonNegativeInteger} offsetA - starting index for `A` +* @param {Float64Array} tau - array containing the scalar factors of the elementary reflectors +* @param {integer} strideTau - stride length for `tau` +* @param {NonNegativeInteger} offsetTau - starting index for `tau` +* @param {Float64Array} C - input/output matrix to be multiplied +* @param {integer} strideC1 - stride length for the first dimension of `C` +* @param {integer} strideC2 - stride length for the second dimension of `C` +* @param {NonNegativeInteger} offsetC - starting index for `C` +* @param {Float64Array} work - workspace array for intermediate calculations +* @param {integer} strideWork - stride length for `work` +* @param {NonNegativeInteger} offsetWork - starting index for `work` +* @returns {Float64Array} the modified matrix `C` +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( [ 1.0, 0.0, 0.0, 2.0, 4.0, 0.0, 3.0, 5.0, 6.0 ] ); +* var tau = new Float64Array( [ 7.0, 8.0, 9.0 ] ); +* var C = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ] ); +* var work = new Float64Array( 3 ); +* +* dorm2r( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); +* // C => [ -261638.0, -298618.0, -335598.0, -521066.0, -594715.0, -668364.0, -773933.0, -883324.0, -992715.0 ] +*/ +function dorm2r( side, trans, M, N, K, A, strideA1, strideA2, offsetA, tau, strideTau, offsetTau, C, strideC1, strideC2, offsetC, work, strideWork, offsetWork ) { // eslint-disable-line max-params, max-len + var aOffset; + var cOffset; + var tauVal; + var notran; + var passC1; + var passC2; + var passA; + var left; + var i1; + var i2; + var i3; + var mi; + var ni; + var ic; + var jc; + var i; + + // Quick return if possible + if ( M === 0 || N === 0 || K === 0 ) { + return C; + } + + left = ( side === 'left' ); + notran = ( trans === 'no-transpose' ); + + // Determine loop indices based on side and trans + if ( ( left && !notran ) || ( !left && notran ) ) { + i1 = 1; + i2 = K; + i3 = 1; + } else { + i1 = K; + i2 = 1; + i3 = -1; + } + + // Initialize dimensions + if ( left ) { + ni = N; + jc = 1; + } else { + mi = M; + ic = 1; + } + + for ( i = i1; ( i3 > 0 ) ? ( i <= i2 ) : ( i >= i2 ); i += i3 ) { // loop going from 1..K or K..1 + if ( left ) { + mi = M - i + 1; + ic = i; + } else { + ni = N - i + 1; + jc = i; + } + + tauVal = tau[ offsetTau + ( ( i - 1 ) * strideTau ) ]; + aOffset = offsetA + ( ( i - 1 ) * strideA1 ) + ( ( i - 1 ) * strideA2 ); + + // if ( notran ) { + // passA = strideA1; + // passC1 = strideC1; + // passC2 = strideC2; + // cOffset = offsetC + ( (ic-1) * strideC1 ) + ( (jc-1) * strideC2 ); + // } else { + // passA = strideA2; + // passC1 = strideC2; + // passC2 = strideC1; + // cOffset = offsetC + ( (jc-1) * strideC1 ) + ( (ic-1) * strideC2 ); + // } + + passA = strideA1; + passC1 = strideC1; + passC2 = strideC2; + cOffset = offsetC + ( (ic-1) * strideC1 ) + ( (jc-1) * strideC2 ); + + dlarf1f( side, mi, ni, A, passA, aOffset, tauVal, C, passC1, passC2, cOffset, work, strideWork, offsetWork ); // eslint-disable-line max-len + } + + return C; +} + + +// EXPORTS // + +module.exports = dorm2r; diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/dlarf1f.js b/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/dlarf1f.js new file mode 100644 index 000000000000..1da894fe3c3c --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/dlarf1f.js @@ -0,0 +1,128 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/* eslint-disable max-len */ + +// MODULES // + +var iladlc = require( '@stdlib/lapack/base/iladlc' ).ndarray; +var iladlr = require( '@stdlib/lapack/base/iladlr' ).ndarray; +var dgemv = require( '@stdlib/blas/base/dgemv' ).ndarray; +var dger = require( '@stdlib/blas/base/dger' ).ndarray; +var daxpy = require( '@stdlib/blas/base/daxpy' ).ndarray; +var dscal = require( '@stdlib/blas/base/dscal' ).ndarray; + + +// MAIN // + +/** +* Applies a real elementary reflector `H = I - tau * v * v ^ T` to a real M by N matrix `C`. +* +* ## Notes +* +* - `work` should have `N` indexed elements if side = `left` and `M` indexed elements if side = `right`. +* - `V` should have `1 + (M-1) * abs(strideV)` indexed elements if side = `left` and `1 + (N-1) * abs(strideV)` indexed elements if side = `right`. +* - `C` is overwritten by `H * C` if side = `left` and `C * H` if side = `right`. +* +* @private +* @param {string} side - specifies the side of multiplication with `C`. Use `left` to form `H * C` and `right` to from `C * H`. +* @param {NonNegativeInteger} M - number of rows in `C` +* @param {NonNegativeInteger} N - number of columns in `C` +* @param {Float64Array} V - the vector `v` in the representation of `H` +* @param {integer} strideV - stride length for `V` +* @param {NonNegativeInteger} offsetV - starting index for `V` +* @param {number} tau - the value of `tau` in representation of `H` +* @param {Float64Array} C - input matrix +* @param {integer} strideC1 - stride of the first dimension of `C` +* @param {integer} strideC2 - stride of the second dimension of `C` +* @param {NonNegativeInteger} offsetC - starting index for `C` +* @param {Float64Array} work - workspace array +* @param {integer} strideWork - stride length for `work` +* @param {NonNegativeInteger} offsetWork - starting index for `work` +* @returns {Float64Array} `C * H` or `H * C` +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var C = new Float64Array( [ 1.0, 5.0, 9.0, 2.0, 6.0, 10.0, 3.0, 7.0, 11.0, 4.0, 8.0, 12.0 ] ); +* var V = new Float64Array( [ 0.5, 0.5, 0.5, 0.5 ] ); +* var work = new Float64Array( 3 ); +* +* var out = dlarf1f( 'left', 4, 3, V, 1, 0, 1.0, C, 3, 1, 0, work, 1, 0 ); +* // returns [ -4.5, -10.5, -16.5, -0.75, -1.75, -2.75, 0.25, -0.75, -1.75, 1.25, 0.25, -0.75 ] +*/ +function dlarf1f( side, M, N, V, strideV, offsetV, tau, C, strideC1, strideC2, offsetC, work, strideWork, offsetWork ) { // eslint-disable-line max-params + var lastv; + var lastc; + var i; + + lastv = 1; + lastc = 0; + if ( tau !== 0.0 ) { + if ( side === 'left' ) { + lastv = M; + } else { + lastv = N; + } + + // i points to the last element in V + i = offsetV + ( ( lastv - 1 ) * strideV ); + + // Move i to the last non-zero element in V + while ( lastv > 0 && V[ i ] === 0.0 ) { + lastv -= 1; + i -= strideV; + } + if ( side === 'left' ) { + lastc = iladlc( lastv + 1, N, C, strideC1, strideC2, offsetC ) + 1; // to account for the difference between zero-based and one-based indexing + } else { + lastc = iladlr( M, lastv + 1, C, strideC1, strideC2, offsetC ) + 1; // to account for the difference between zero-based and one-based indexing + } + // lastc is zero if a matrix is filled with zeros + } + if ( lastc === 0 ) { + // Returns C unchanged if tau is zero or all elements in C are zero + return C; + } + if ( side === 'left' ) { + if ( lastv === 0 ) { + dscal( lastc, 1.0 - tau, C, strideC2, offsetC ); // scale the first row + } else { + dgemv( 'transpose', lastv-1, lastc, 1.0, C, strideC1, strideC2, offsetC + strideC1, V, strideV, offsetV + strideV, 0.0, work, strideWork, offsetWork ); // C( 1, 0 ) is accessed here + daxpy( lastc, 1.0, C, strideC2, offsetC, work, strideWork, offsetWork ); // operates on the first row of C + daxpy( lastc, -tau, work, strideWork, offsetWork, C, strideC2, offsetC ); // operates on the first row of C + dger( lastv-1, lastc, -tau, V, strideV, offsetV + strideV, work, strideWork, offsetWork, C, strideC1, strideC2, offsetC + strideC1 ); // C( 1, 0 ) is accessed here + } + } else if ( lastv === 0 ) { + dscal( lastc, 1.0 - tau, C, strideC1, offsetC ); // scale the first column + } else { + dgemv( 'no-transpose', lastc, lastv-1, 1.0, C, strideC1, strideC2, offsetC + strideC2, V, strideV, offsetV + strideV, 0.0, work, strideWork, offsetWork ); // C( 0, 1 ) is accessed here + daxpy( lastc, 1.0, C, strideC1, offsetC, work, strideWork, offsetWork ); // operates on the first column of C + daxpy( lastc, -tau, work, strideWork, offsetWork, C, strideC1, offsetC ); // operates on the first column of C + dger( lastc, lastv-1, -tau, work, strideWork, offsetWork, V, strideV, offsetV + strideV, C, strideC1, strideC2, offsetC + strideC2 ); // C( 0, 1 ) is accessed here + } + + return C; +} + + +// EXPORTS // + +module.exports = dlarf1f; diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/dorm2r.js b/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/dorm2r.js new file mode 100644 index 000000000000..a60581d825bf --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/dorm2r.js @@ -0,0 +1,127 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var isLayout = require( '@stdlib/blas/base/assert/is-layout' ); +var isOperationSide = require( '@stdlib/blas/base/assert/is-operation-side' ); +var isTransposeOperation = require( '@stdlib/blas/base/assert/is-transpose-operation' ); +var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major-string' ); +var isColumnMajor = require( '@stdlib/ndarray/base/assert/is-column-major-string' ); +var max = require( '@stdlib/math/base/special/max' ); +var format = require( '@stdlib/string/format' ); +var base = require( './base.js' ); + + +// MAIN // + +/** +* Multiplies a matrix `C` by an orthogonal matrix `Q` from a QR factorization. +* +* ## Notes +* +* `dorm2r` overwrites the general real M by N matrix C with +* +* - `Q * C` if side = 'left' and trans = 'no-transpose' +* - `Q^T * C` if side = 'left' and trans = 'transpose' +* - `C * Q` if side = 'right' and trans = 'no-transpose' +* - `C * Q^T` if side = 'right' and trans = 'transpose' +* +* where Q is a real orthogonal matrix defined as the product of K elementary reflectors `Q = H(1) H(2) ... H(K)` as returned by `dgeqrf`. Q is of order M if side = 'left' and of order N if side = 'right'. +* +* @param {string} order - storage layout +* @param {string} side - specifies the side of multiplication with `C` +* @param {string} trans - specifies the operation to be performed +* @param {NonNegativeInteger} M - number of rows in matrix `C` +* @param {NonNegativeInteger} N - number of columns in matrix `C` +* @param {NonNegativeInteger} K - number of elementary reflectors whose product defines the matrix `Q` +* @param {Float64Array} A - input matrix containing the elementary reflectors +* @param {PositiveInteger} LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) +* @param {Float64Array} tau - array containing the scalar factors of the elementary reflectors +* @param {Float64Array} C - input/output matrix to be multiplied +* @param {PositiveInteger} LDC - stride of the first dimension of `C` (a.k.a., leading dimension of the matrix `C`) +* @param {Float64Array} work - workspace array for intermediate calculations +* @throws {TypeError} first argument must be a valid order +* @throws {TypeError} second argument must be a valid operation side +* @throws {TypeError} third argument must be a valid transpose operation +* @throws {RangeError} eighth argument must be greater than or equal to max(1,M) when side is 'left' or max(1,N) when side is 'right' +* @throws {RangeError} twelfth argument must be greater than or equal to max(1,M) +* @returns {Float64Array} the modified matrix `C` +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( [ 1.0, 0.0, 0.0, 2.0, 4.0, 0.0, 3.0, 5.0, 6.0 ] ); +* var tau = new Float64Array( [ 7.0, 8.0, 9.0 ] ); +* var C = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ] ); +* var work = new Float64Array( 3 ); +* +* dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, work ); +* // C => [ -261638.0, -298618.0, -335598.0, -521066.0, -594715.0, -668364.0, -773933.0, -883324.0, -992715.0 ] +*/ +function dorm2r( order, side, trans, M, N, K, A, LDA, tau, C, LDC, work ) { // eslint-disable-line max-params + var sa1; + var sa2; + var sc1; + var sc2; + + if ( !isLayout( order ) ) { + throw new TypeError( format( 'invalid argument. First argument must be a valid order. Value: `%s`.', order ) ); + } + if ( !isOperationSide( side ) ) { + throw new TypeError( format( 'invalid argument. Second argument must be a valid operation side. Value: `%s`.', side ) ); + } + if ( !isTransposeOperation( trans ) ) { + throw new TypeError( format( 'invalid argument. Third argument must be a valid transpose operation. Value: `%s`.', trans ) ); + } + if ( isColumnMajor( order ) ) { + if ( side === 'left' && LDA < max( 1, M ) ) { + throw new RangeError( format( 'invalid argument. Eighth argument must be greater than or equal to max(1,%d). Value: `%d`.', M, LDA ) ); + } + if ( side === 'right' && LDA < max( 1, N ) ) { + throw new RangeError( format( 'invalid argument. Eighth argument must be greater than or equal to max(1,%d). Value: `%d`.', N, LDA ) ); + } + } else if ( LDA < max( 1, K ) ) { + throw new RangeError( format( 'invalid argument. Eighth argument must be greater than or equal to max(1,%d). Value: `%d`.', K, LDA ) ); + } + if ( isRowMajor( order ) && LDC < max( 1, N ) ) { + throw new RangeError( format( 'invalid argument. Twelfth argument must be greater than or equal to max(1,%d). Value: `%d`.', N, LDC ) ); + } + if ( isColumnMajor( order ) && LDC < max( 1, M ) ) { + throw new RangeError( format( 'invalid argument. Twelfth argument must be greater than or equal to max(1,%d). Value: `%d`.', M, LDC ) ); + } + if ( isColumnMajor( order ) ) { + sa1 = 1; + sa2 = LDA; + sc1 = 1; + sc2 = LDC; + } else { + sa1 = LDA; + sa2 = 1; + sc1 = LDC; + sc2 = 1; + } + return base( side, trans, M, N, K, A, sa1, sa2, 0, tau, 1, 0, C, sc1, sc2, 0, work, 1, 0 ); // eslint-disable-line max-len +} + + +// EXPORTS // + +module.exports = dorm2r; diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/index.js b/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/index.js new file mode 100644 index 000000000000..556056d588ac --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/index.js @@ -0,0 +1,71 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* LAPACK routine to multiply a matrix by an orthogonal matrix from a QR factorization. +* +* ## Notes +* +* `dorm2r` overwrites the general real M by N matrix C with +* +* - `Q * C` if side = 'left' and trans = 'no-transpose' +* - `Q^T * C` if side = 'left' and trans = 'transpose' +* - `C * Q` if side = 'right' and trans = 'no-transpose' +* - `C * Q^T` if side = 'right' and trans = 'transpose' +* +* where Q is a real orthogonal matrix defined as the product of K elementary reflectors `Q = H(1) H(2) ... H(K)` as returned by `dgeqrf`. Q is of order M if side = 'left' and of order N if side = 'right'. +* +* @module @stdlib/lapack/base/dorm2r +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var dorm2r = require( '@stdlib/lapack/base/dorm2r' ); +* +* var A = new Float64Array( [ 1.0, 0.0, 0.0, 2.0, 4.0, 0.0, 3.0, 5.0, 6.0 ] ); +* var tau = new Float64Array( [ 7.0, 8.0, 9.0 ] ); +* var C = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ] ); +* var work = new Float64Array( 3 ); +* +* dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, work ); +* // C => [ -261638.0, -298618.0, -335598.0, -521066.0, -594715.0, -668364.0, -773933.0, -883324.0, -992715.0 ] +*/ + +// MODULES // + +var join = require( 'path' ).join; +var tryRequire = require( '@stdlib/utils/try-require' ); +var isError = require( '@stdlib/assert/is-error' ); +var main = require( './main.js' ); + + +// MAIN // + +var dorm2r; +var tmp = tryRequire( join( __dirname, './native.js' ) ); +if ( isError( tmp ) ) { + dorm2r = main; +} else { + dorm2r = tmp; +} + + +// EXPORTS // + +module.exports = dorm2r; diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/main.js b/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/main.js new file mode 100644 index 000000000000..d7972eb91091 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/main.js @@ -0,0 +1,35 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var dorm2r = require( './dorm2r.js' ); +var ndarray = require( './ndarray.js' ); + + +// MAIN // + +setReadOnly( dorm2r, 'ndarray', ndarray ); + + +// EXPORTS // + +module.exports = dorm2r; diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/ndarray.js b/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/ndarray.js new file mode 100644 index 000000000000..cdeb7adb6c81 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/ndarray.js @@ -0,0 +1,92 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var isOperationSide = require( '@stdlib/blas/base/assert/is-operation-side' ); +var isTransposeOperation = require( '@stdlib/blas/base/assert/is-transpose-operation' ); +var format = require( '@stdlib/string/format' ); +var base = require( './base.js' ); + + +// MAIN // + +/** +* Multiplies a matrix `C` by an orthogonal matrix `Q` from a QR factorization. +* +* ## Notes +* +* `dorm2r` overwrites the general real M by N matrix C with +* +* - `Q * C` if side = 'left' and trans = 'no-transpose' +* - `Q^T * C` if side = 'left' and trans = 'transpose' +* - `C * Q` if side = 'right' and trans = 'no-transpose' +* - `C * Q^T` if side = 'right' and trans = 'transpose' +* +* where Q is a real orthogonal matrix defined as the product of K elementary reflectors `Q = H(1) H(2) ... H(K)` as returned by `dgeqrf`. Q is of order M if side = 'left' and of order N if side = 'right'. +* +* @param {string} side - specifies the side of multiplication with `C` +* @param {string} trans - specifies the operation to be performed +* @param {NonNegativeInteger} M - number of rows in matrix `C` +* @param {NonNegativeInteger} N - number of columns in matrix `C` +* @param {NonNegativeInteger} K - number of elementary reflectors whose product defines the matrix `Q` +* @param {Float64Array} A - input matrix containing the elementary reflectors +* @param {integer} strideA1 - stride length for the first dimension of `A` +* @param {integer} strideA2 - stride length for the second dimension of `A` +* @param {NonNegativeInteger} offsetA - starting index for `A` +* @param {Float64Array} tau - array containing the scalar factors of the elementary reflectors +* @param {integer} strideTau - stride length for `tau` +* @param {NonNegativeInteger} offsetTau - starting index for `tau` +* @param {Float64Array} C - input/output matrix to be multiplied +* @param {integer} strideC1 - stride length for the first dimension of `C` +* @param {integer} strideC2 - stride length for the second dimension of `C` +* @param {NonNegativeInteger} offsetC - starting index for `C` +* @param {Float64Array} work - workspace array for intermediate calculations +* @param {integer} strideWork - stride length for `work` +* @param {NonNegativeInteger} offsetWork - starting index for `work` +* @throws {TypeError} first argument must be a valid operation side +* @throws {TypeError} second argument must be a valid transpose operation +* @returns {Float64Array} the modified matrix `C` +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( [ 1.0, 0.0, 0.0, 2.0, 4.0, 0.0, 3.0, 5.0, 6.0 ] ); +* var tau = new Float64Array( [ 7.0, 8.0, 9.0 ] ); +* var C = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ] ); +* var work = new Float64Array( 3 ); +* +* dorm2r( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); +* // C => [ -261638.0, -298618.0, -335598.0, -521066.0, -594715.0, -668364.0, -773933.0, -883324.0, -992715.0 ] +*/ +function dorm2r( side, trans, M, N, K, A, strideA1, strideA2, offsetA, tau, strideTau, offsetTau, C, strideC1, strideC2, offsetC, work, strideWork, offsetWork ) { // eslint-disable-line max-len, max-params + if ( !isOperationSide( side ) ) { + throw new TypeError( format( 'invalid argument. First argument must be a valid operation side. Value: `%s`.', side ) ); + } + if ( !isTransposeOperation( trans ) ) { + throw new TypeError( format( 'invalid argument. Second argument must be a valid transpose operation. Value: `%s`.', trans ) ); + } + return base( side, trans, M, N, K, A, strideA1, strideA2, offsetA, tau, strideTau, offsetTau, C, strideC1, strideC2, offsetC, work, strideWork, offsetWork ); // eslint-disable-line max-len +} + + +// EXPORTS // + +module.exports = dorm2r; diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/package.json b/lib/node_modules/@stdlib/lapack/base/dorm2r/package.json new file mode 100644 index 000000000000..d064af3582b5 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/package.json @@ -0,0 +1,74 @@ +{ + "name": "@stdlib/lapack/base/dorm2r", + "version": "0.0.0", + "description": "Multiply a matrix by an orthogonal matrix from a QR factorization.", + "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", + "dorm2r", + "orthogonal", + "matrix", + "multiplication", + "qr", + "factorization", + "reflector", + "elementary", + "linear", + "algebra", + "subroutines", + "array", + "ndarray", + "float64", + "double", + "float64array" + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/left_notrans_col_major.json b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/left_notrans_col_major.json new file mode 100644 index 000000000000..f26f8d91df17 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/left_notrans_col_major.json @@ -0,0 +1,45 @@ +{ + "order": "column-major", + "side": "left", + "trans": "no-transpose", + "M": 3, + "N": 3, + "K": 3, + + "A_mat": [ + [ 1.0, 0.0, 0.0 ], + [ 2.0, 4.0, 0.0 ], + [ 3.0, 5.0, 6.0 ] + ], + "LDA": 3, + "strideA1": 1, + "strideA2": 3, + "offsetA": 0, + "A": [ 1.0, 2.0, 3.0, 0.0, 4.0, 5.0, 0.0, 0.0, 6.0 ], + + "tau": [ 7.0, 8.0, 9.0 ], + "strideTau": 1, + "offsetTau": 0, + + "C_mat": [ + [ 1.0, 2.0, 3.0 ], + [ 4.0, 5.0, 6.0 ], + [ 7.0, 8.0, 9.0 ] + ], + "LDC": 3, + "strideC1": 1, + "strideC2": 3, + "offsetC": 0, + "C": [ 1.0, 4.0, 7.0, 2.0, 5.0, 8.0, 3.0, 6.0, 9.0 ], + + "work": [ 0.0, 0.0, 0.0 ], + "strideWork": 1, + "offsetWork": 0, + + "C_out_mat": [ + [ -261638.0, -298618.0, -335598.0 ], + [ -521066.0, -594715.0, -668364.0 ], + [ -773933.0, -883324.0, -992715.0 ] + ], + "C_out": [ -261638.0, -521066.0, -773933.0, -298618.0, -594715.0, -883324.0, -335598.0, -668364.0, -992715.0 ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/left_notrans_row_major.json b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/left_notrans_row_major.json new file mode 100644 index 000000000000..51e06b1a92b9 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/left_notrans_row_major.json @@ -0,0 +1,45 @@ +{ + "order": "row-major", + "side": "left", + "trans": "no-transpose", + "M": 3, + "N": 3, + "K": 3, + + "A_mat": [ + [ 1.0, 0.0, 0.0 ], + [ 2.0, 4.0, 0.0 ], + [ 3.0, 5.0, 6.0 ] + ], + "LDA": 3, + "strideA1": 3, + "strideA2": 1, + "offsetA": 0, + "A": [ 1.0, 0.0, 0.0, 2.0, 4.0, 0.0, 3.0, 5.0, 6.0 ], + + "tau": [ 7.0, 8.0, 9.0 ], + "strideTau": 1, + "offsetTau": 0, + + "C_mat": [ + [ 1.0, 2.0, 3.0 ], + [ 4.0, 5.0, 6.0 ], + [ 7.0, 8.0, 9.0 ] + ], + "LDC": 3, + "strideC1": 3, + "strideC2": 1, + "offsetC": 0, + "C": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ], + + "work": [ 0.0, 0.0, 0.0 ], + "strideWork": 1, + "offsetWork": 0, + + "C_out_mat": [ + [ -261638.0, -298618.0, -335598.0 ], + [ -521066.0, -594715.0, -668364.0 ], + [ -773933.0, -883324.0, -992715.0 ] + ], + "C_out": [ -261638.0, -298618.0, -335598.0, -521066.0, -594715.0, -668364.0, -773933.0, -883324.0, -992715.0 ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/left_trans_col_major.json b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/left_trans_col_major.json new file mode 100644 index 000000000000..9a8ea643f058 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/left_trans_col_major.json @@ -0,0 +1,45 @@ +{ + "order": "column-major", + "side": "left", + "trans": "transpose", + "M": 3, + "N": 3, + "K": 3, + + "A_mat": [ + [ 10.0, 200.0, 123.0 ], + [ 20.0, 30.0, 200.0 ], + [ 40.0, 50.0, 60.0 ] + ], + "LDA": 3, + "strideA1": 1, + "strideA2": 3, + "offsetA": 0, + "A": [ 10.0, 20.0, 40.0, 200.0, 30.0, 50.0, 123.0, 200.0, 60.0 ], + + "tau": [ 2.0, 3.0, 4.0 ], + "strideTau": 1, + "offsetTau": 0, + + "C_mat": [ + [ 7.0, 9.0, 11.0 ], + [ 12.0, 14.0, 16.0 ], + [ 17.0, 19.0, 21.0 ] + ], + "LDC": 3, + "strideC1": 1, + "strideC2": 3, + "offsetC": 0, + "C": [ 7.0, 12.0, 17.0, 9.0, 14.0, 19.0, 11.0, 16.0, 21.0 ], + + "work": [ 0.0, 0.0, 0.0 ], + "strideWork": 1, + "offsetWork": 0, + + "C_out_mat": [ + [ -1847.0, -2089.0, -2331.0 ], + [ 11195586.0, 12669042.0, 14142498.0 ], + [ -1684675671.0, -1906396497.0, -2128117323.0 ] + ], + "C_out": [ -1847.0, 11195586.0, -1684675671.0, -2089.0, 12669042.0, -1906396497.0, -2331.0, 14142498.0, -2128117323.0 ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/left_trans_row_major.json b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/left_trans_row_major.json new file mode 100644 index 000000000000..b7485a4d8feb --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/left_trans_row_major.json @@ -0,0 +1,45 @@ +{ + "order": "row-major", + "side": "left", + "trans": "transpose", + "M": 3, + "N": 3, + "K": 3, + + "A_mat": [ + [ 10.0, 200.0, 123.0 ], + [ 20.0, 30.0, 200.0 ], + [ 40.0, 50.0, 60.0 ] + ], + "LDA": 3, + "strideA1": 3, + "strideA2": 1, + "offsetA": 0, + "A": [ 10.0, 200.0, 123.0, 20.0, 30.0, 200.0, 40.0, 50.0, 60.0 ], + + "tau": [ 2.0, 3.0, 4.0 ], + "strideTau": 1, + "offsetTau": 0, + + "C_mat": [ + [ 7.0, 9.0, 11.0 ], + [ 12.0, 14.0, 16.0 ], + [ 17.0, 19.0, 21.0 ] + ], + "LDC": 3, + "strideC1": 3, + "strideC2": 1, + "offsetC": 0, + "C": [ 7.0, 9.0, 11.0, 12.0, 14.0, 16.0, 17.0, 19.0, 21.0 ], + + "work": [ 0.0, 0.0, 0.0 ], + "strideWork": 1, + "offsetWork": 0, + + "C_out_mat": [ + [ -1847.0, -2089.0, -2331.0 ], + [ 11195586.0, 12669042.0, 14142498.0 ], + [ -1684675671.0, -1906396497.0, -2128117323.0 ] + ], + "C_out": [ -1847.0, -2089.0, -2331.0, 11195586.0, 12669042.0, 14142498.0, -1684675671.0, -1906396497.0, -2128117323.0 ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/test/test.dorm2r.js b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/test.dorm2r.js new file mode 100644 index 000000000000..e1407059003a --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/test.dorm2r.js @@ -0,0 +1,365 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-len */ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Float64Array = require( '@stdlib/array/float64' ); +var dorm2r = require( './../lib/dorm2r.js' ); + + +// FIXTURES // + +var LEFT_NOTRANS_ROW_MAJOR = require( './fixtures/left_notrans_row_major.json' ); +var LEFT_NOTRANS_COL_MAJOR = require( './fixtures/left_notrans_col_major.json' ); +var LEFT_TRANS_ROW_MAJOR = require( './fixtures/left_trans_row_major.json' ); +var LEFT_TRANS_COL_MAJOR = require( './fixtures/left_trans_col_major.json' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof dorm2r, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 12', function test( t ) { + t.strictEqual( dorm2r.length, 12, '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 work; + var tau; + var A; + var C; + var i; + + A = new Float64Array( [ 1.0, 0.0, 0.0, 2.0, 4.0, 0.0, 3.0, 5.0, 6.0 ] ); + tau = new Float64Array( [ 7.0, 8.0, 9.0 ] ); + C = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ] ); + work = new Float64Array( 3 ); + + 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() { + dorm2r( value, 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, work ); + }; + } +}); + +tape( 'the function throws an error if provided a second argument which is not a valid side', function test( t ) { + var values; + var work; + var tau; + var A; + var C; + var i; + + A = new Float64Array( [ 1.0, 0.0, 0.0, 2.0, 4.0, 0.0, 3.0, 5.0, 6.0 ] ); + tau = new Float64Array( [ 7.0, 8.0, 9.0 ] ); + C = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ] ); + work = new Float64Array( 3 ); + + 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() { + dorm2r( 'row-major', value, 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, work ); + }; + } +}); + +tape( 'the function throws an error if provided a third argument which is not a valid trans', function test( t ) { + var values; + var work; + var tau; + var A; + var C; + var i; + + A = new Float64Array( [ 1.0, 0.0, 0.0, 2.0, 4.0, 0.0, 3.0, 5.0, 6.0 ] ); + tau = new Float64Array( [ 7.0, 8.0, 9.0 ] ); + C = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ] ); + work = new Float64Array( 3 ); + + 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() { + dorm2r( 'row-major', 'left', value, 3, 3, 3, A, 3, tau, C, 3, work ); + }; + } +}); + +tape( 'the function throws an error if provided an eighth argument which is not a valid `LDA` value (row-major)', function test( t ) { + var values; + var work; + var tau; + var A; + var C; + var i; + + A = new Float64Array( [ 1.0, 0.0, 0.0, 2.0, 4.0, 0.0, 3.0, 5.0, 6.0 ] ); + tau = new Float64Array( [ 7.0, 8.0, 9.0 ] ); + C = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ] ); + work = new Float64Array( 3 ); + + values = [ + 0, + 1, + 2 + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, value, tau, C, 3, work ); + }; + } +}); + +tape( 'the function throws an error if provided a twelfth argument which is not a valid `LDC` value (row-major)', function test( t ) { + var values; + var work; + var tau; + var A; + var C; + var i; + + A = new Float64Array( [ 1.0, 0.0, 0.0, 2.0, 4.0, 0.0, 3.0, 5.0, 6.0 ] ); + tau = new Float64Array( [ 7.0, 8.0, 9.0 ] ); + C = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ] ); + work = new Float64Array( 3 ); + + values = [ + 0, + 1, + 2 + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, value, work ); + }; + } +}); + +tape( 'the function throws an error if provided a twelfth argument which is not a valid `LDC` value (column-major)', function test( t ) { + var values; + var work; + var tau; + var A; + var C; + var i; + + A = new Float64Array( [ 1.0, 0.0, 0.0, 2.0, 4.0, 0.0, 3.0, 5.0, 6.0 ] ); + tau = new Float64Array( [ 7.0, 8.0, 9.0 ] ); + C = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ] ); + work = new Float64Array( 3 ); + + values = [ + 0, + 1, + 2 + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + dorm2r( 'column-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, value, work ); + }; + } +}); + +tape( 'the function applies Q from the left without transpose (row-major)', function test( t ) { + var expected; + var work; + var data; + var tau; + var out; + var A; + var C; + + data = LEFT_NOTRANS_ROW_MAJOR; + + A = new Float64Array( data.A ); + tau = new Float64Array( data.tau ); + C = new Float64Array( data.C ); + work = new Float64Array( data.work ); + + expected = new Float64Array( data.C_out ); + + out = dorm2r( data.order, data.side, data.trans, data.M, data.N, data.K, A, data.LDA, tau, C, data.LDC, work ); + t.strictEqual( out, C, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies Q from the left without transpose (column-major)', function test( t ) { + var expected; + var work; + var data; + var tau; + var out; + var A; + var C; + + data = LEFT_NOTRANS_COL_MAJOR; + + A = new Float64Array( data.A ); + tau = new Float64Array( data.tau ); + C = new Float64Array( data.C ); + work = new Float64Array( data.work ); + + expected = new Float64Array( data.C_out ); + + out = dorm2r( data.order, data.side, data.trans, data.M, data.N, data.K, A, data.LDA, tau, C, data.LDC, work ); + t.strictEqual( out, C, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies Q from the left with transpose (row-major)', function test( t ) { + var expected; + var work; + var data; + var tau; + var out; + var A; + var C; + + data = LEFT_TRANS_ROW_MAJOR; + + A = new Float64Array( data.A ); + tau = new Float64Array( data.tau ); + C = new Float64Array( data.C ); + work = new Float64Array( data.work ); + + expected = new Float64Array( data.C_out ); + + out = dorm2r( data.order, data.side, data.trans, data.M, data.N, data.K, A, data.LDA, tau, C, data.LDC, work ); + t.strictEqual( out, C, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies Q from the left with transpose (column-major)', function test( t ) { + var expected; + var work; + var data; + var tau; + var out; + var A; + var C; + + data = LEFT_TRANS_COL_MAJOR; + + A = new Float64Array( data.A ); + tau = new Float64Array( data.tau ); + C = new Float64Array( data.C ); + work = new Float64Array( data.work ); + + expected = new Float64Array( data.C_out ); + + out = dorm2r( data.order, data.side, data.trans, data.M, data.N, data.K, A, data.LDA, tau, C, data.LDC, work ); + t.strictEqual( out, C, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/test/test.js b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/test.js new file mode 100644 index 000000000000..63f9d011be26 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/test.js @@ -0,0 +1,82 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var proxyquire = require( 'proxyquire' ); +var IS_BROWSER = require( '@stdlib/assert/is-browser' ); +var dorm2r = 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 dorm2r, '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 dorm2r.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 dorm2r = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( dorm2r, 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 dorm2r; + var main; + + main = require( './../lib/dorm2r.js' ); + + dorm2r = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( dorm2r, main, 'returns expected value' ); + t.end(); + + function tryRequire() { + return new Error( 'Cannot find module' ); + } +}); diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/test/test.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/test.ndarray.js new file mode 100644 index 000000000000..d71ece4eab43 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/test.ndarray.js @@ -0,0 +1,121 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Float64Array = require( '@stdlib/array/float64' ); +var dorm2r = require( './../lib/ndarray.js' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof dorm2r, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 19', function test( t ) { + t.strictEqual( dorm2r.length, 19, 'returns expected value' ); + t.end(); +}); + +tape( 'the function throws an error if provided a first argument which is not a valid side', function test( t ) { + var values; + var work; + var tau; + var A; + var C; + var i; + + A = new Float64Array( [ 1.0, 0.0, 0.0, 2.0, 4.0, 0.0, 3.0, 5.0, 6.0 ] ); + tau = new Float64Array( [ 7.0, 8.0, 9.0 ] ); + C = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ] ); + work = new Float64Array( 3 ); + + 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() { + dorm2r( value, 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); + }; + } +}); + +tape( 'the function throws an error if provided a second argument which is not a valid trans', function test( t ) { + var values; + var work; + var tau; + var A; + var C; + var i; + + A = new Float64Array( [ 1.0, 0.0, 0.0, 2.0, 4.0, 0.0, 3.0, 5.0, 6.0 ] ); + tau = new Float64Array( [ 7.0, 8.0, 9.0 ] ); + C = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ] ); + work = new Float64Array( 3 ); + + 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() { + dorm2r( 'left', value, 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); + }; + } +});