From 516ab115c6d52f727969775cf236a638e018fc04 Mon Sep 17 00:00:00 2001 From: Prajjwal Bajpai Date: Tue, 2 Jun 2026 00:20:16 +0530 Subject: [PATCH 1/3] feat: add `lapack/base/dorml2` --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown_pkg_readmes status: na - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: passed - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/lapack/base/dorml2/lib/base.js | 172 ++++++ .../@stdlib/lapack/base/dorml2/lib/dorml2.js | 146 +++++ .../@stdlib/lapack/base/dorml2/lib/index.js | 64 ++ .../@stdlib/lapack/base/dorml2/lib/main.js | 35 ++ .../@stdlib/lapack/base/dorml2/lib/ndarray.js | 118 ++++ .../@stdlib/lapack/base/dorml2/package.json | 69 +++ .../base/dorml2/test/fixtures/left_col.json | 45 ++ .../base/dorml2/test/fixtures/left_row.json | 45 ++ .../base/dorml2/test/fixtures/right_col.json | 47 ++ .../base/dorml2/test/fixtures/right_row.json | 47 ++ .../base/dorml2/test/fixtures/trans_left.json | 45 ++ .../dorml2/test/fixtures/trans_right.json | 47 ++ .../lapack/base/dorml2/test/test.dorml2.js | 578 ++++++++++++++++++ .../@stdlib/lapack/base/dorml2/test/test.js | 82 +++ 14 files changed, 1540 insertions(+) create mode 100644 lib/node_modules/@stdlib/lapack/base/dorml2/lib/base.js create mode 100644 lib/node_modules/@stdlib/lapack/base/dorml2/lib/dorml2.js create mode 100644 lib/node_modules/@stdlib/lapack/base/dorml2/lib/index.js create mode 100644 lib/node_modules/@stdlib/lapack/base/dorml2/lib/main.js create mode 100644 lib/node_modules/@stdlib/lapack/base/dorml2/lib/ndarray.js create mode 100644 lib/node_modules/@stdlib/lapack/base/dorml2/package.json create mode 100644 lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/left_col.json create mode 100644 lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/left_row.json create mode 100644 lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/right_col.json create mode 100644 lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/right_row.json create mode 100644 lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/trans_left.json create mode 100644 lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/trans_right.json create mode 100644 lib/node_modules/@stdlib/lapack/base/dorml2/test/test.dorml2.js create mode 100644 lib/node_modules/@stdlib/lapack/base/dorml2/test/test.js diff --git a/lib/node_modules/@stdlib/lapack/base/dorml2/lib/base.js b/lib/node_modules/@stdlib/lapack/base/dorml2/lib/base.js new file mode 100644 index 000000000000..c75c49430105 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorml2/lib/base.js @@ -0,0 +1,172 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-len, max-params */ + +'use strict'; + +// MODULES // + +var dlarf1f = require( '@stdlib/lapack/base/dlarf1f' ).ndarray; + + +// FUNCTIONS // + +/** +* Tests whether an operation should be applied to the left side. +* +* @private +* @param {string} side - operation side +* @returns {boolean} boolean indicating if an operation should be applied to the left side +*/ +function isLeftSide( side ) { + return side === 'left'; +} + + +// MAIN // + +/** +* Multiply a general matrix by the orthogonal matrix from a LQ factorization determined by `DGELQF`. +* +* ## Notes +* +* - `Q` is a real orthogonal matrix defined as the product of k elementary reflectors, Q = H(k) . . . H(2) H(1) as returned by `DGELQF`. +* +* - `Q` is of order `M` if SIDE = 'left' and of order `N` if SIDE = 'R'. +* +* - `DORML2` overwrites the general real `M` by `N` matrix `C` with, +* +* - `Q * C` if SIDE = 'left' and TRANS = 'no-transpose', or +* - `Q^T* C` if SIDE = 'left' and TRANS = 'transpose', or +* - `C * Q` if SIDE = 'right' and TRANS = 'no-transpose', or +* - `C * Q**T` if SIDE = 'right' and TRANS = 'transpose'. +* +* @private +* @param {string} side - specifies the side of multiplication with `C` +* @param {string} trans - `'no-transpose'` for `Q`, `'transpose'` for `Q^T` +* @param {NonNegativeInteger} M - number of rows of `C` +* @param {NonNegativeInteger} N - number of columns of `C` +* @param {NonNegativeInteger} K - number of elementary reflectors +* @param {Float64Array} A - reflector vectors from `DGELQ2` +* @param {integer} strideA1 - stride of the first dimension of A +* @param {integer} strideA2 - stride of the second dimension of A +* @param {NonNegativeInteger} offsetA - starting index for A +* @param {Float64Array} TAU - scalar factors of reflectors +* @param {integer} strideTAU - stride for TAU +* @param {NonNegativeInteger} offsetTAU - starting index for TAU +* @param {Float64Array} C - input/output 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 for `WORK` +* @param {NonNegativeInteger} offsetWORK - starting index for `WORK` +* @returns {integer} status code (0 if successful) +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( [ 1, 0 ] ); +* var TAU = new Float64Array( [ 2 ] ); +* var C = new Float64Array( [ 1, 3, 5, 2, 4, 6 ] ); +* var WORK = new Float64Array( 3 ); +* +* var info = dorml2( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, WORK, 1, 0 ); +* // returns 0 +* // C => [ -1, -3, -5, 2, 4, 6 ] +* // WORK => [ 1, 3, 5 ] +*/ +function dorml2( side, trans, M, N, K, A, strideA1, strideA2, offsetA, TAU, strideTAU, offsetTAU, C, strideC1, strideC2, offsetC, WORK, strideWORK, offsetWORK ) { + var isTrans; + var isLeft; + var idx0; + var idx1; + var idx2; + var mi; + var ni; + var ic; + var jc; + var i1; + var i2; + var i3; + var i; + + isLeft = isLeftSide( side ); + isTrans = ( trans === 'transpose' ); + + // Quick return if possible + if ( M === 0 || N === 0 || K === 0 ) { + return 0; + } + + if ( ( isLeft && !isTrans ) || ( !isLeft && isTrans ) ) { + i1 = 0; + i2 = K - 1; + i3 = 1; + } else { + i1 = K - 1; + i2 = 0; + i3 = -1; + } + + if ( isLeft ) { + ni = N; + jc = 0; + + idx0 = offsetA + ( i1*strideA1 ) + ( i1*strideA2 ); + idx1 = offsetTAU + ( i1*strideTAU ); + idx2 = offsetC + ( i1*strideC1 ) + ( jc*strideC2 ); + for ( i = i1; ( i3 > 0 ) ? ( i <= i2 ) : ( i >= i2 ); i += i3 ) { + // Apply H(i) to C(i:M-1, 0:N-1) + mi = M - i; + ic = i; + + // Apply H(i): the reflector vector is row i of A starting at column i, + dlarf1f( side, mi, ni, A, strideA2, idx0, TAU[ idx1 ], C, strideC1, strideC2, idx2, WORK, strideWORK, offsetWORK ); + idx0 += i3*( strideA1 + strideA2 ); + idx1 += i3*strideTAU; + idx2 += i3*strideC1; + } + } else { + mi = M; + ic = 0; + + idx0 = offsetA + ( i1*strideA1 ) + ( i1*strideA2 ); + idx1 = offsetTAU + ( i1*strideTAU ); + idx2 = offsetC + ( ic*strideC1 ) + ( i1*strideC2 ); + for ( i = i1; ( i3 > 0 ) ? ( i <= i2 ) : ( i >= i2 ); i += i3 ) { + // Apply H(i) to C(0:M-1, i:N-1) + ni = N - i; + jc = i; + + // Apply H(i): the reflector vector is row i of A starting at column i, + dlarf1f( side, mi, ni, A, strideA2, idx0, TAU[ idx1 ], C, strideC1, strideC2, idx2, WORK, strideWORK, offsetWORK ); + idx0 += i3*( strideA1 + strideA2 ); + idx1 += i3*strideTAU; + idx2 += i3*strideC2; + } + } + + return 0; +} + + +// EXPORTS // + +module.exports = dorml2; diff --git a/lib/node_modules/@stdlib/lapack/base/dorml2/lib/dorml2.js b/lib/node_modules/@stdlib/lapack/base/dorml2/lib/dorml2.js new file mode 100644 index 000000000000..b27da7497ecd --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorml2/lib/dorml2.js @@ -0,0 +1,146 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-len, max-params */ + +'use strict'; + +// MODULES // + +var isLayout = require( '@stdlib/blas/base/assert/is-layout' ); +var format = require( '@stdlib/string/format' ); +var isOperationSide = require( '@stdlib/blas/base/assert/is-operation-side' ); +var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major-string' ); +var isMatrixTranspose = require( '@stdlib/blas/base/assert/is-transpose-operation' ); +var max = require( '@stdlib/math/base/special/fast/max' ); +var base = require( './base.js' ); + + +// MAIN // + +/** +* Multiply a general matrix by the orthogonal matrix from a LQ factorization determined by `DGELQF`. +* +* ## Notes +* +* - `Q` is a real orthogonal matrix defined as the product of k elementary reflectors, Q = H(k) . . . H(2) H(1) as returned by `DGELQF`. +* +* - `Q` is of order `M` if SIDE = 'left' and of order `N` if SIDE = 'R'. +* +* - `DORML2` overwrites the general real `M` by `N` matrix `C` with, +* +* - `Q * C` if SIDE = 'left' and TRANS = 'no-transpose', or +* - `Q^T* C` if SIDE = 'left' and TRANS = 'transpose', or +* - `C * Q` if SIDE = 'right' and TRANS = 'no-transpose', or +* - `C * Q**T` if SIDE = 'right' and TRANS = 'transpose'. +* +* @param {string} order - storage layout +* @param {string} side - specifies the side of multiplication with `C` +* @param {string} trans - `'no-transpose'` for `Q`, `'transpose'` for `Q^T` +* @param {NonNegativeInteger} M - number of rows of `C` +* @param {NonNegativeInteger} N - number of columns of `C` +* @param {NonNegativeInteger} K - number of elementary reflectors +* @param {Float64Array} A - reflector vectors from `DGELQ2` +* @param {integer} LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) +* @param {Float64Array} TAU - scalar factors of reflectors +* @param {Float64Array} C - input/output matrix +* @param {integer} LDC - stride of the first dimension of `C` (a.k.a., leading dimension of the matrix `C`) +* @param {Float64Array} WORK - workspace array +* @throws {TypeError} first argument must be a valid order +* @throws {TypeError} second argument must be a valid side +* @throws {TypeError} third argument must be a valid transpose operation +* @throws {RangeError} fourth argument must be a non-negative integer +* @throws {RangeError} fifth argument must be a non-negative integer +* @throws {RangeError} sixth argument must be a non-negative integer] +* @throws {RangeError} sixth argument must be smaller than the order of `Q` +* @throws {RangeError} sixth argument must be smaller than the order of `Q` +* @throws {RangeError} eighth argument must be greater than or equal to max(1,K) +* @throws {RangeError} eleventh argument must be greater than or equal to max(1,M) +* @returns {integer} status code (0 if successful) +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( [ 1, 0 ] ); +* var TAU = new Float64Array( [ 2 ] ); +* var C = new Float64Array( [ 1, 3, 5, 2, 4, 6 ] ); +* var WORK = new Float64Array( 3 ); +* +* var info = dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A, 1, TAU, C, 2, WORK ); +* // returns 0 +* // C => [ -1, -3, -5, 2, 4, 6 ] +* // WORK => [ 1, 3, 5 ] +*/ +function dorml2( order, side, trans, M, N, K, A, LDA, TAU, C, LDC, WORK ) { + 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 ( !isMatrixTranspose( trans ) ) { + throw new TypeError( format( 'invalid argument. Third argument must be a valid transpose operation. Value: `%s`.', trans ) ); + } + if ( M < 0 ) { + throw new RangeError( format( 'invalid argument. Fourth argument must be a nonnegative integer. Value: `%d`.', M ) ); + } + if ( N < 0 ) { + throw new RangeError( format( 'invalid argument. Fifth argument must be a nonnegative integer. Value: `%d`.', N ) ); + } + if ( K < 0 ) { + throw new RangeError( format( 'invalid argument. Sixth argument must be a nonnegative integer. Value: `%d`.', K ) ); + } + if ( side === 'left' && K > M ) { + throw new RangeError( format( 'invalid argument. Sixth argument must be smaller than the order of `Q`. Value: `%d`.', K ) ); + } + if ( side === 'right' && K > N ) { + throw new RangeError( format( 'invalid argument. Sixth argument must be smaller than the order of `Q`. Value: `%d`.', K ) ); + } + if ( isRowMajor( order ) && LDA < max( 1, K ) ) { + throw new RangeError( format( 'invalid argument. Eighth argument must be greater than or equal to max(1,K). Value: `%d`.', LDA ) ); + } + if ( isRowMajor( order ) && LDC < max( 1, M ) ) { + throw new RangeError( format( 'invalid argument. Eleventh argument must be greater than or equal to max(1,M). Value: `%d`.', LDC ) ); + } + if ( order === 'column-major' ) { + sa1 = 1; + sa2 = LDA; + sc1 = 1; + sc2 = LDC; + } else { + if ( side === 'left' ) { + sa1 = M; + } else { + sa1 = N; + } + sa2 = 1; + sc1 = N; + sc2 = 1; + } + return base( side, trans, M, N, K, A, sa1, sa2, 0, TAU, 1, 0, C, sc1, sc2, 0, WORK, 1, 0 ); +} + + +// EXPORTS // + +module.exports = dorml2; diff --git a/lib/node_modules/@stdlib/lapack/base/dorml2/lib/index.js b/lib/node_modules/@stdlib/lapack/base/dorml2/lib/index.js new file mode 100644 index 000000000000..0e26acc1300b --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorml2/lib/index.js @@ -0,0 +1,64 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* LAPACK routine to multiply a general matrix by the orthogonal matrix from a LQ factorization determined by `DGELQF`. +* +* @module @stdlib/lapack/base/dorml2 +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var dorml2 = require( '@stdlib/lapack/base/dorml2' ); +* +* var A = new Float64Array( [ 1, 0 ] ); +* var TAU = new Float64Array( [ 2 ] ); +* var C = new Float64Array( [ 1, 3, 5, 2, 4, 6 ] ); +* var WORK = new Float64Array( 3 ); +* +* var info = dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A, 1, TAU, C, 2, WORK ); +* // returns 0 +* // C => [ -1, -3, -5, 2, 4, 6 ] +* // WORK => [ 1, 3, 5 ] +*/ + +// MODULES // + +var join = require( 'path' ).join; +var tryRequire = require( '@stdlib/utils/try-require' ); +var isError = require( '@stdlib/assert/is-error' ); +var main = require( './main.js' ); + + +// MAIN // + +var dorml2; +var tmp = tryRequire( join( __dirname, './native.js' ) ); +if ( isError( tmp ) ) { + dorml2 = main; +} else { + dorml2 = tmp; +} + + +// EXPORTS // + +module.exports = dorml2; + +// exports: { "ndarray": "dorml2.ndarray" } diff --git a/lib/node_modules/@stdlib/lapack/base/dorml2/lib/main.js b/lib/node_modules/@stdlib/lapack/base/dorml2/lib/main.js new file mode 100644 index 000000000000..3c3a731c3712 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorml2/lib/main.js @@ -0,0 +1,35 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var dorml2 = require( './dorml2.js' ); +var ndarray = require( './ndarray.js' ); + + +// MAIN // + +setReadOnly( dorml2, 'ndarray', ndarray ); + + +// EXPORTS // + +module.exports = dorml2; diff --git a/lib/node_modules/@stdlib/lapack/base/dorml2/lib/ndarray.js b/lib/node_modules/@stdlib/lapack/base/dorml2/lib/ndarray.js new file mode 100644 index 000000000000..d73e9d602702 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorml2/lib/ndarray.js @@ -0,0 +1,118 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-len, max-params */ + +'use strict'; + +// MODULES // + +var format = require( '@stdlib/string/format' ); +var isOperationSide = require( '@stdlib/blas/base/assert/is-operation-side' ); +var isMatrixTranspose = require( '@stdlib/blas/base/assert/is-transpose-operation' ); +var base = require( './base.js' ); + + +// MAIN // + +/** +* Multiply a general matrix by the orthogonal matrix from a LQ factorization determined by `DGELQF` using alternative indexing semantics. +* +* ## Notes +* +* - `Q` is a real orthogonal matrix defined as the product of k elementary reflectors, Q = H(k) . . . H(2) H(1) as returned by `DGELQF`. +* +* - `Q` is of order `M` if SIDE = 'left' and of order `N` if SIDE = 'R'. +* +* - `DORML2` overwrites the general real `M` by `N` matrix `C` with, +* +* - `Q * C` if SIDE = 'left' and TRANS = 'no-transpose', or +* - `Q^T* C` if SIDE = 'left' and TRANS = 'transpose', or +* - `C * Q` if SIDE = 'right' and TRANS = 'no-transpose', or +* - `C * Q**T` if SIDE = 'right' and TRANS = 'transpose'. +* +* @param {string} side - specifies the side of multiplication with `C` +* @param {string} trans - `'no-transpose'` for `Q`, `'transpose'` for `Q^T` +* @param {NonNegativeInteger} M - number of rows of `C` +* @param {NonNegativeInteger} N - number of columns of `C` +* @param {NonNegativeInteger} K - number of elementary reflectors +* @param {Float64Array} A - reflector vectors from `DGELQ2` +* @param {integer} strideA1 - stride of the first dimension of A +* @param {integer} strideA2 - stride of the second dimension of A +* @param {NonNegativeInteger} offsetA - starting index for A +* @param {Float64Array} TAU - scalar factors of reflectors +* @param {integer} strideTAU - stride for TAU +* @param {NonNegativeInteger} offsetTAU - starting index for TAU +* @param {Float64Array} C - input/output 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 for `WORK` +* @param {NonNegativeInteger} offsetWORK - starting index for `WORK` +* @throws {TypeError} first argument must be a valid side +* @throws {TypeError} second argument must be a valid transpose operation +* @throws {RangeError} third argument must be a non-negative integer +* @throws {RangeError} fourth argument must be a non-negative integer +* @throws {RangeError} fifth argument must be a non-negative integer +* @throws {RangeError} fifth argument must be smaller than the order of `Q` +* @throws {RangeError} fifth argument must be smaller than the order of `Q` +* @returns {integer} status code (0 if successful) +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( [ 1, 0 ] ); +* var TAU = new Float64Array( [ 2 ] ); +* var C = new Float64Array( [ 1, 3, 5, 2, 4, 6 ] ); +* var WORK = new Float64Array( 3 ); +* +* var info = dorml2( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, WORK, 1, 0 ); +* // returns 0 +* // C => [ -1, -3, -5, 2, 4, 6 ] +* // WORK => [ 1, 3, 5 ] +*/ +function dorml2( side, trans, M, N, K, A, strideA1, strideA2, offsetA, TAU, strideTAU, offsetTAU, C, strideC1, strideC2, offsetC, WORK, strideWORK, offsetWORK ) { + if ( !isOperationSide( side ) ) { + throw new TypeError( format( 'invalid argument. First argument must be a valid operation side. Value: `%s`.', side ) ); + } + if ( !isMatrixTranspose( trans ) ) { + throw new TypeError( format( 'invalid argument. Second argument must be a valid transpose operation. Value: `%s`.', trans ) ); + } + if ( M < 0 ) { + throw new RangeError( format( 'invalid argument. Third argument must be a nonnegative integer. Value: `%d`.', M ) ); + } + if ( N < 0 ) { + throw new RangeError( format( 'invalid argument. Fourth argument must be a nonnegative integer. Value: `%d`.', N ) ); + } + if ( K < 0 ) { + throw new RangeError( format( 'invalid argument. Fifth argument must be a nonnegative integer. Value: `%d`.', K ) ); + } + if ( side === 'left' && K > M ) { + throw new RangeError( format( 'invalid argument. Fifth argument must be smaller than the order of `Q`. Value: `%d`.', K ) ); + } + if ( side === 'right' && K > N ) { + throw new RangeError( format( 'invalid argument. Fifth argument must be smaller than the order of `Q`. Value: `%d`.', K ) ); + } + return base( side, trans, M, N, K, A, strideA1, strideA2, offsetA, TAU, strideTAU, offsetTAU, C, strideC1, strideC2, offsetC, WORK, strideWORK, offsetWORK ); +} + + +// EXPORTS // + +module.exports = dorml2; diff --git a/lib/node_modules/@stdlib/lapack/base/dorml2/package.json b/lib/node_modules/@stdlib/lapack/base/dorml2/package.json new file mode 100644 index 000000000000..1f02a411e5f0 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorml2/package.json @@ -0,0 +1,69 @@ +{ + "name": "@stdlib/lapack/base/dorml2", + "version": "0.0.0", + "description": "LAPACK routine to Multiply a general matrix by the orthogonal matrix from a LQ factorization determined by `DGELQF`.", + "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", + "dorml2", + "reflector", + "linear", + "algebra", + "subroutines", + "array", + "ndarray", + "matrix", + "float64", + "double", + "float64array" + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/left_col.json b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/left_col.json new file mode 100644 index 000000000000..6bc3cba9f0ff --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/left_col.json @@ -0,0 +1,45 @@ +{ + "order": "column-major", + "side": "left", + "trans": "no-transpose", + + "M": 2, + "N": 3, + "K": 1, + + "A": [ 1, 0 ], + "strideA1": 1, + "strideA2": 1, + "offsetA": 0, + "LDA": 1, + "A_mat": [ + [ 1, 0 ] + ], + + "TAU": [ 2 ], + "strideTAU": 1, + "offsetTAU": 0, + + "C": [ 1, 2, 3, 4, 5, 6 ], + "strideC1": 1, + "strideC2": 2, + "offsetC": 0, + "LDC": 2, + "C_mat": [ + [ 1, 3, 5 ], + [ 2, 4, 6 ] + ], + + "WORK": [ 0, 0, 0 ], + "strideWORK": 1, + "offsetWORK": 0, + + "C_out": [ -1, 2, -3, 4, -5, 6 ], + "C_out_mat": [ + [ -1, -3, -5 ], + [ 2, 4, 6 ] + ], + + "WORK_out": [ 1, 3, 5 ], + "info": 0 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/left_row.json b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/left_row.json new file mode 100644 index 000000000000..651a81a5503d --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/left_row.json @@ -0,0 +1,45 @@ +{ + "order": "row-major", + "side": "left", + "trans": "no-transpose", + + "M": 2, + "N": 3, + "K": 1, + + "A": [ 1, 0 ], + "strideA1": 2, + "strideA2": 1, + "offsetA": 0, + "LDA": 1, + "A_mat": [ + [ 1, 0 ] + ], + + "TAU": [ 2 ], + "strideTAU": 1, + "offsetTAU": 0, + + "C": [ 1, 3, 5, 2, 4, 6 ], + "strideC1": 3, + "strideC2": 1, + "offsetC": 0, + "LDC": 2, + "C_mat": [ + [ 1, 3, 5 ], + [ 2, 4, 6 ] + ], + + "WORK": [ 0, 0, 0 ], + "strideWORK": 1, + "offsetWORK": 0, + + "C_out": [ -1, -3, -5, 2, 4, 6 ], + "C_out_mat": [ + [ -1, -3, -5 ], + [ 2, 4, 6 ] + ], + + "WORK_out": [ 1, 3, 5 ], + "info": 0 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/right_col.json b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/right_col.json new file mode 100644 index 000000000000..4fe0bdb04f4d --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/right_col.json @@ -0,0 +1,47 @@ +{ + "order": "column-major", + "side": "right", + "trans": "no-transpose", + + "M": 3, + "N": 2, + "K": 1, + + "A": [ 1, 0 ], + "strideA1": 1, + "strideA2": 1, + "offsetA": 0, + "LDA": 1, + "A_mat": [ + [ 1, 0 ] + ], + + "TAU": [ 2 ], + "strideTAU": 1, + "offsetTAU": 0, + + "C": [ 1, 2, 3, 4, 5, 6 ], + "strideC1": 1, + "strideC2": 3, + "offsetC": 0, + "LDC": 3, + "C_mat": [ + [ 1, 4 ], + [ 2, 5 ], + [ 3, 6 ] + ], + + "WORK": [ 0, 0, 0 ], + "strideWORK": 1, + "offsetWORK": 0, + + "C_out": [ -1, -2, -3, 4, 5, 6 ], + "C_out_mat": [ + [ -1, 4 ], + [ -2, 5 ], + [ -3, 6 ] + ], + + "WORK_out": [ 1, 2, 3 ], + "info": 0 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/right_row.json b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/right_row.json new file mode 100644 index 000000000000..c57f8d35df3d --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/right_row.json @@ -0,0 +1,47 @@ +{ + "order": "row-major", + "side": "right", + "trans": "no-transpose", + + "M": 3, + "N": 2, + "K": 1, + + "A": [ 1, 0 ], + "strideA1": 2, + "strideA2": 1, + "offsetA": 0, + "LDA": 1, + "A_mat": [ + [ 1, 0 ] + ], + + "TAU": [ 2 ], + "strideTAU": 1, + "offsetTAU": 0, + + "C": [ 1, 4, 2, 5, 3, 6 ], + "strideC1": 2, + "strideC2": 1, + "offsetC": 0, + "LDC": 3, + "C_mat": [ + [ 1, 4 ], + [ 2, 5 ], + [ 3, 6 ] + ], + + "WORK": [ 0, 0, 0 ], + "strideWORK": 1, + "offsetWORK": 0, + + "C_out": [ -1, 4, -2, 5, -3, 6 ], + "C_out_mat": [ + [ -1, 4 ], + [ -2, 5 ], + [ -3, 6 ] + ], + + "WORK_out": [ 1, 2, 3 ], + "info": 0 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/trans_left.json b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/trans_left.json new file mode 100644 index 000000000000..2b2209186719 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/trans_left.json @@ -0,0 +1,45 @@ +{ + "order": "row-major", + "side": "left", + "trans": "transpose", + + "M": 2, + "N": 3, + "K": 1, + + "A": [ 1, 0 ], + "strideA1": 2, + "strideA2": 1, + "offsetA": 0, + "LDA": 1, + "A_mat": [ + [ 1, 0 ] + ], + + "TAU": [ 2 ], + "strideTAU": 1, + "offsetTAU": 0, + + "C": [ 1, 3, 5, 2, 4, 6 ], + "strideC1": 3, + "strideC2": 1, + "offsetC": 0, + "LDC": 2, + "C_mat": [ + [ 1, 3, 5 ], + [ 2, 4, 6 ] + ], + + "WORK": [ 0, 0, 0 ], + "strideWORK": 1, + "offsetWORK": 0, + + "C_out": [ -1, -3, -5, 2, 4, 6 ], + "C_out_mat": [ + [ -1, -3, -5 ], + [ 2, 4, 6 ] + ], + + "WORK_out": [ 1, 3, 5 ], + "info": 0 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/trans_right.json b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/trans_right.json new file mode 100644 index 000000000000..e58743e8313a --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/trans_right.json @@ -0,0 +1,47 @@ +{ + "order": "row-major", + "side": "right", + "trans": "transpose", + + "M": 3, + "N": 2, + "K": 1, + + "A": [ 1, 0 ], + "strideA1": 2, + "strideA2": 1, + "offsetA": 0, + "LDA": 1, + "A_mat": [ + [ 1, 0 ] + ], + + "TAU": [ 2 ], + "strideTAU": 1, + "offsetTAU": 0, + + "C": [ 1, 4, 2, 5, 3, 6 ], + "strideC1": 2, + "strideC2": 1, + "offsetC": 0, + "LDC": 3, + "C_mat": [ + [ 1, 4 ], + [ 2, 5 ], + [ 3, 6 ] + ], + + "WORK": [ 0, 0, 0 ], + "strideWORK": 1, + "offsetWORK": 0, + + "C_out": [ -1, 4, -2, 5, -3, 6 ], + "C_out_mat": [ + [ -1, 4 ], + [ -2, 5 ], + [ -3, 6 ] + ], + + "WORK_out": [ 1, 2, 3 ], + "info": 0 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorml2/test/test.dorml2.js b/lib/node_modules/@stdlib/lapack/base/dorml2/test/test.dorml2.js new file mode 100644 index 000000000000..01e63dbba790 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorml2/test/test.dorml2.js @@ -0,0 +1,578 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Float64Array = require( '@stdlib/array/float64' ); +var isAlmostEqual = require( '@stdlib/assert/is-almost-equal-float64array' ); +var dorml2 = require( './../lib/dorml2.js' ); + + +// FIXTURES // + +var LEFT_ROW = require( './fixtures/left_row.json' ); +var LEFT_COL = require( './fixtures/left_col.json' ); +var RIGHT_ROW = require( './fixtures/right_row.json' ); +var RIGHT_COL = require( './fixtures/right_col.json' ); +var TRANS_LEFT = require( './fixtures/trans_left.json' ); +var TRANS_RIGHT = require( './fixtures/trans_right.json' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof dorml2, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 12', function test( t ) { + t.strictEqual( dorml2.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 ] ); + TAU = new Float64Array( [ 2 ] ); + C = new Float64Array( [ 1, 3, 5, 2, 4, 6 ] ); + 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() { + dorml2( value, 'left', 'no-transpose', 2, 3, 1, A, 1, TAU, C, 2, WORK ); + }; + } +}); +tape( 'the function throws an error if provided a second argument which is not a valid operation side', function test( t ) { + var values; + var WORK; + var TAU; + var A; + var C; + var i; + + A = new Float64Array( [ 1, 0 ] ); + TAU = new Float64Array( [ 2 ] ); + C = new Float64Array( [ 1, 3, 5, 2, 4, 6 ] ); + 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() { + dorml2( 'row-major', value, 'no-transpose', 2, 3, 1, A, 1, TAU, C, 2, WORK ); + }; + } +}); + +tape( 'the function throws an error if provided a third argument which is not a valid transpose operation', function test( t ) { + var values; + var WORK; + var TAU; + var A; + var C; + var i; + + A = new Float64Array( [ 1, 0 ] ); + TAU = new Float64Array( [ 2 ] ); + C = new Float64Array( [ 1, 3, 5, 2, 4, 6 ] ); + 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() { + dorml2( 'row-major', 'left', value, 2, 3, 1, A, 1, TAU, C, 2, WORK ); + }; + } +}); + +tape( 'the function throws an error if provided a fourth argument which is smaller than 0', function test( t ) { + var values; + var WORK; + var TAU; + var A; + var C; + var i; + + A = new Float64Array( [ 1, 0 ] ); + TAU = new Float64Array( [ 2 ] ); + C = new Float64Array( [ 1, 3, 5, 2, 4, 6 ] ); + WORK = new Float64Array( 3 ); + + values = [ + -1, + -2, + -3 + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + dorml2( 'row-major', 'left', 'no-transpose', value, 3, 1, A, 1, TAU, C, 2, WORK ); + }; + } +}); + +tape( 'the function throws an error if provided a fifth argument which is smaller than 0', function test( t ) { + var values; + var WORK; + var TAU; + var A; + var C; + var i; + + A = new Float64Array( [ 1, 0 ] ); + TAU = new Float64Array( [ 2 ] ); + C = new Float64Array( [ 1, 3, 5, 2, 4, 6 ] ); + WORK = new Float64Array( 3 ); + + values = [ + -1, + -2, + -3 + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + dorml2( 'row-major', 'left', 'no-transpose', 2, value, 1, A, 1, TAU, C, 2, WORK ); + }; + } +}); + +tape( 'the function throws an error if provided a sixth argument which is smaller than 0', function test( t ) { + var values; + var WORK; + var TAU; + var A; + var C; + var i; + + A = new Float64Array( [ 1, 0 ] ); + TAU = new Float64Array( [ 2 ] ); + C = new Float64Array( [ 1, 3, 5, 2, 4, 6 ] ); + WORK = new Float64Array( 3 ); + + values = [ + -1, + -2, + -3 + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, value, A, 1, TAU, C, 2, WORK ); + }; + } +}); + +tape( 'the function throws an error if provided a sixth argument which is larger than the order of `Q` (left)', function test( t ) { + var values; + var WORK; + var TAU; + var A; + var C; + var i; + + A = new Float64Array( [ 1, 0 ] ); + TAU = new Float64Array( [ 2 ] ); + C = new Float64Array( [ 1, 3, 5, 2, 4, 6 ] ); + WORK = new Float64Array( 3 ); + + values = [ + 3, + 4, + 5 + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, value, A, 1, TAU, C, 2, WORK ); + }; + } +}); + +tape( 'the function throws an error if provided a sixth argument which is larger than the order of `Q` (right)', function test( t ) { + var values; + var WORK; + var TAU; + var A; + var C; + var i; + + A = new Float64Array( [ 1, 0 ] ); + TAU = new Float64Array( [ 2 ] ); + C = new Float64Array( [ 1, 3, 5, 2, 4, 6 ] ); + WORK = new Float64Array( 3 ); + + values = [ + 4, + 5, + 6 + ]; + + 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() { + dorml2( 'row-major', 'right', 'no-transpose', 2, 3, value, A, 1, TAU, C, 2, WORK ); + }; + } +}); + +tape( 'the function throws an error if provided an eighth argument which is not a valid LDA value', function test( t ) { + var values; + var WORK; + var TAU; + var A; + var C; + var i; + + A = new Float64Array( [ 1, 0 ] ); + TAU = new Float64Array( [ 2 ] ); + C = new Float64Array( [ 1, 3, 5, 2, 4, 6 ] ); + 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() { + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A, value, TAU, C, 2, WORK ); + }; + } +}); + +tape( 'the function throws an error if provided an eleventh argument which is not a valid LDC value', function test( t ) { + var values; + var WORK; + var TAU; + var A; + var C; + var i; + + A = new Float64Array( [ 1, 0 ] ); + TAU = new Float64Array( [ 2 ] ); + C = new Float64Array( [ 1, 3, 5, 2, 4, 6 ] ); + WORK = new Float64Array( 3 ); + + values = [ + 1, + 0, + -1 + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A, 1, TAU, C, value, WORK ); + }; + } +}); + +tape( 'the function quick returns when `M`, `N` or `K` is equal to 0', function test( t ) { + var expectedWORK; + var expectedC; + var info; + var data; + var WORK; + var TAU; + var A; + var C; + + data = LEFT_ROW; + + A = new Float64Array( data.A ); + TAU = new Float64Array( data.TAU ); + C = new Float64Array( data.C ); + WORK = new Float64Array( data.WORK ); + + expectedC = new Float64Array( data.C ); + expectedWORK = new Float64Array( data.WORK ); + + info = dorml2( data.order, data.side, data.trans, 0, 0, 0, A, data.LDA, TAU, C, data.LDC, WORK ); + t.strictEqual( info, 0, 'returns expected value' ); + t.strictEqual( isAlmostEqual( C, expectedC, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( WORK, expectedWORK, 1 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function multiplies a general matrix by the orthogonal matrix from a LQ factorization (left, row-major)', function test( t ) { + var expectedWORK; + var expectedC; + var info; + var data; + var WORK; + var TAU; + var A; + var C; + + data = LEFT_ROW; + + A = new Float64Array( data.A ); + TAU = new Float64Array( data.TAU ); + C = new Float64Array( data.C ); + WORK = new Float64Array( data.WORK ); + + expectedC = new Float64Array( data.C_out ); + expectedWORK = new Float64Array( data.WORK_out ); + + info = dorml2( data.order, data.side, data.trans, data.M, data.N, data.K, A, data.LDA, TAU, C, data.LDC, WORK ); + t.strictEqual( info, 0, 'returns expected value' ); + t.strictEqual( isAlmostEqual( C, expectedC, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( WORK, expectedWORK, 1 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function multiplies a general matrix by the orthogonal matrix from a LQ factorization (left, column-major)', function test( t ) { + var expectedWORK; + var expectedC; + var info; + var data; + var WORK; + var TAU; + var A; + var C; + + data = LEFT_COL; + + A = new Float64Array( data.A ); + TAU = new Float64Array( data.TAU ); + C = new Float64Array( data.C ); + WORK = new Float64Array( data.WORK ); + + expectedC = new Float64Array( data.C_out ); + expectedWORK = new Float64Array( data.WORK_out ); + + info = dorml2( data.order, data.side, data.trans, data.M, data.N, data.K, A, data.LDA, TAU, C, data.LDC, WORK ); + t.strictEqual( info, 0, 'returns expected value' ); + t.strictEqual( isAlmostEqual( C, expectedC, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( WORK, expectedWORK, 1 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function multiplies a general matrix by the orthogonal matrix from a LQ factorization (right, row-major)', function test( t ) { + var expectedWORK; + var expectedC; + var info; + var data; + var WORK; + var TAU; + var A; + var C; + + data = RIGHT_ROW; + + A = new Float64Array( data.A ); + TAU = new Float64Array( data.TAU ); + C = new Float64Array( data.C ); + WORK = new Float64Array( data.WORK ); + + expectedC = new Float64Array( data.C_out ); + expectedWORK = new Float64Array( data.WORK_out ); + + info = dorml2( data.order, data.side, data.trans, data.M, data.N, data.K, A, data.LDA, TAU, C, data.LDC, WORK ); + t.strictEqual( info, 0, 'returns expected value' ); + t.strictEqual( isAlmostEqual( C, expectedC, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( WORK, expectedWORK, 1 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function multiplies a general matrix by the orthogonal matrix from a LQ factorization (right, column-major)', function test( t ) { + var expectedWORK; + var expectedC; + var info; + var data; + var WORK; + var TAU; + var A; + var C; + + data = RIGHT_COL; + + A = new Float64Array( data.A ); + TAU = new Float64Array( data.TAU ); + C = new Float64Array( data.C ); + WORK = new Float64Array( data.WORK ); + + expectedC = new Float64Array( data.C_out ); + expectedWORK = new Float64Array( data.WORK_out ); + + info = dorml2( data.order, data.side, data.trans, data.M, data.N, data.K, A, data.LDA, TAU, C, data.LDC, WORK ); + t.strictEqual( info, 0, 'returns expected value' ); + t.strictEqual( isAlmostEqual( C, expectedC, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( WORK, expectedWORK, 1 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function multiplies a general matrix by the orthogonal matrix from a LQ factorization (left, row-major, trans)', function test( t ) { + var expectedWORK; + var expectedC; + var info; + var data; + var WORK; + var TAU; + var A; + var C; + + data = TRANS_LEFT; + + A = new Float64Array( data.A ); + TAU = new Float64Array( data.TAU ); + C = new Float64Array( data.C ); + WORK = new Float64Array( data.WORK ); + + expectedC = new Float64Array( data.C_out ); + expectedWORK = new Float64Array( data.WORK_out ); + + info = dorml2( data.order, data.side, data.trans, data.M, data.N, data.K, A, data.LDA, TAU, C, data.LDC, WORK ); + t.strictEqual( info, 0, 'returns expected value' ); + t.strictEqual( isAlmostEqual( C, expectedC, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( WORK, expectedWORK, 1 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function multiplies a general matrix by the orthogonal matrix from a LQ factorization (right, row-major, trans)', function test( t ) { + var expectedWORK; + var expectedC; + var info; + var data; + var WORK; + var TAU; + var A; + var C; + + data = TRANS_RIGHT; + + A = new Float64Array( data.A ); + TAU = new Float64Array( data.TAU ); + C = new Float64Array( data.C ); + WORK = new Float64Array( data.WORK ); + + expectedC = new Float64Array( data.C_out ); + expectedWORK = new Float64Array( data.WORK_out ); + + info = dorml2( data.order, data.side, data.trans, data.M, data.N, data.K, A, data.LDA, TAU, C, data.LDC, WORK ); + t.strictEqual( info, 0, 'returns expected value' ); + t.strictEqual( isAlmostEqual( C, expectedC, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( WORK, expectedWORK, 1 ), true, 'returns expected value' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/lapack/base/dorml2/test/test.js b/lib/node_modules/@stdlib/lapack/base/dorml2/test/test.js new file mode 100644 index 000000000000..712d3e1efffc --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorml2/test/test.js @@ -0,0 +1,82 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var proxyquire = require( 'proxyquire' ); +var IS_BROWSER = require( '@stdlib/assert/is-browser' ); +var dorml2 = 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 dorml2, '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 dorml2.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 dorml2 = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( dorml2, 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 dorml2; + var main; + + main = require( './../lib/dorml2.js' ); + + dorml2 = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( dorml2, main, 'returns expected value' ); + t.end(); + + function tryRequire() { + return new Error( 'Cannot find module' ); + } +}); From 0bb4e0e7c1c5c7624c11bfd5d9a404725c570e8d Mon Sep 17 00:00:00 2001 From: Prajjwal Bajpai Date: Tue, 2 Jun 2026 19:30:41 +0530 Subject: [PATCH 2/3] test: add tests for `ndarray` API --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown_pkg_readmes status: na - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../test/fixtures/large_strides/left_col.json | 105 ++ .../test/fixtures/large_strides/left_row.json | 105 ++ .../fixtures/large_strides/right_col.json | 109 ++ .../fixtures/large_strides/right_row.json | 109 ++ .../fixtures/large_strides/trans_left.json | 105 ++ .../fixtures/large_strides/trans_right.json | 109 ++ .../test/fixtures/mixed_strides/left_col.json | 84 ++ .../test/fixtures/mixed_strides/left_row.json | 84 ++ .../fixtures/mixed_strides/right_col.json | 88 ++ .../fixtures/mixed_strides/right_row.json | 88 ++ .../fixtures/mixed_strides/trans_left.json | 84 ++ .../fixtures/mixed_strides/trans_right.json | 88 ++ .../fixtures/negative_strides/left_col.json | 84 ++ .../fixtures/negative_strides/left_row.json | 84 ++ .../fixtures/negative_strides/right_col.json | 88 ++ .../fixtures/negative_strides/right_row.json | 88 ++ .../fixtures/negative_strides/trans_left.json | 84 ++ .../negative_strides/trans_right.json | 88 ++ .../test/fixtures/offsets/left_col.json | 90 ++ .../test/fixtures/offsets/left_row.json | 90 ++ .../test/fixtures/offsets/right_col.json | 94 ++ .../test/fixtures/offsets/right_row.json | 94 ++ .../test/fixtures/offsets/trans_left.json | 90 ++ .../test/fixtures/offsets/trans_right.json | 94 ++ .../lapack/base/dorml2/test/test.dorml2.js | 1 + .../lapack/base/dorml2/test/test.ndarray.js | 1148 +++++++++++++++++ 26 files changed, 3375 insertions(+) create mode 100644 lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/large_strides/left_col.json create mode 100644 lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/large_strides/left_row.json create mode 100644 lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/large_strides/right_col.json create mode 100644 lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/large_strides/right_row.json create mode 100644 lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/large_strides/trans_left.json create mode 100644 lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/large_strides/trans_right.json create mode 100644 lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/mixed_strides/left_col.json create mode 100644 lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/mixed_strides/left_row.json create mode 100644 lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/mixed_strides/right_col.json create mode 100644 lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/mixed_strides/right_row.json create mode 100644 lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/mixed_strides/trans_left.json create mode 100644 lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/mixed_strides/trans_right.json create mode 100644 lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/negative_strides/left_col.json create mode 100644 lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/negative_strides/left_row.json create mode 100644 lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/negative_strides/right_col.json create mode 100644 lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/negative_strides/right_row.json create mode 100644 lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/negative_strides/trans_left.json create mode 100644 lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/negative_strides/trans_right.json create mode 100644 lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/offsets/left_col.json create mode 100644 lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/offsets/left_row.json create mode 100644 lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/offsets/right_col.json create mode 100644 lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/offsets/right_row.json create mode 100644 lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/offsets/trans_left.json create mode 100644 lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/offsets/trans_right.json create mode 100644 lib/node_modules/@stdlib/lapack/base/dorml2/test/test.ndarray.js diff --git a/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/large_strides/left_col.json b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/large_strides/left_col.json new file mode 100644 index 000000000000..6a9d6c570a79 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/large_strides/left_col.json @@ -0,0 +1,105 @@ +{ + "order": "column-major", + "side": "left", + "trans": "no-transpose", + "M": 2, + "N": 3, + "K": 1, + "A": [ + 1, + 9999, + 0, + 9999 + ], + "strideA1": 2, + "strideA2": 2, + "offsetA": 0, + "LDA": 1, + "A_mat": [ + [ + 1, + 0 + ] + ], + "TAU": [ + 2, + 9999 + ], + "strideTAU": 2, + "offsetTAU": 0, + "C": [ + 1, + 9999, + 2, + 9999, + 3, + 9999, + 4, + 9999, + 5, + 9999, + 6, + 9999 + ], + "strideC1": 2, + "strideC2": 4, + "offsetC": 0, + "LDC": 2, + "C_mat": [ + [ + 1, + 3, + 5 + ], + [ + 2, + 4, + 6 + ] + ], + "WORK": [ + 0, + 9999, + 0, + 9999, + 0, + 9999 + ], + "strideWORK": 2, + "offsetWORK": 0, + "C_out": [ + -1, + 9999, + 2, + 9999, + -3, + 9999, + 4, + 9999, + -5, + 9999, + 6, + 9999 + ], + "C_out_mat": [ + [ + -1, + -3, + -5 + ], + [ + 2, + 4, + 6 + ] + ], + "WORK_out": [ + 1, + 9999, + 3, + 9999, + 5, + 9999 + ], + "info": 0 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/large_strides/left_row.json b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/large_strides/left_row.json new file mode 100644 index 000000000000..7d2d3841a741 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/large_strides/left_row.json @@ -0,0 +1,105 @@ +{ + "order": "row-major", + "side": "left", + "trans": "no-transpose", + "M": 2, + "N": 3, + "K": 1, + "A": [ + 1, + 9999, + 0, + 9999 + ], + "strideA1": 4, + "strideA2": 2, + "offsetA": 0, + "LDA": 1, + "A_mat": [ + [ + 1, + 0 + ] + ], + "TAU": [ + 2, + 9999 + ], + "strideTAU": 2, + "offsetTAU": 0, + "C": [ + 1, + 9999, + 3, + 9999, + 5, + 9999, + 2, + 9999, + 4, + 9999, + 6, + 9999 + ], + "strideC1": 6, + "strideC2": 2, + "offsetC": 0, + "LDC": 2, + "C_mat": [ + [ + 1, + 3, + 5 + ], + [ + 2, + 4, + 6 + ] + ], + "WORK": [ + 0, + 9999, + 0, + 9999, + 0, + 9999 + ], + "strideWORK": 2, + "offsetWORK": 0, + "C_out": [ + -1, + 9999, + -3, + 9999, + -5, + 9999, + 2, + 9999, + 4, + 9999, + 6, + 9999 + ], + "C_out_mat": [ + [ + -1, + -3, + -5 + ], + [ + 2, + 4, + 6 + ] + ], + "WORK_out": [ + 1, + 9999, + 3, + 9999, + 5, + 9999 + ], + "info": 0 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/large_strides/right_col.json b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/large_strides/right_col.json new file mode 100644 index 000000000000..8f74648d55ca --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/large_strides/right_col.json @@ -0,0 +1,109 @@ +{ + "order": "column-major", + "side": "right", + "trans": "no-transpose", + "M": 3, + "N": 2, + "K": 1, + "A": [ + 1, + 9999, + 0, + 9999 + ], + "strideA1": 2, + "strideA2": 2, + "offsetA": 0, + "LDA": 1, + "A_mat": [ + [ + 1, + 0 + ] + ], + "TAU": [ + 2, + 9999 + ], + "strideTAU": 2, + "offsetTAU": 0, + "C": [ + 1, + 9999, + 2, + 9999, + 3, + 9999, + 4, + 9999, + 5, + 9999, + 6, + 9999 + ], + "strideC1": 2, + "strideC2": 6, + "offsetC": 0, + "LDC": 3, + "C_mat": [ + [ + 1, + 4 + ], + [ + 2, + 5 + ], + [ + 3, + 6 + ] + ], + "WORK": [ + 0, + 9999, + 0, + 9999, + 0, + 9999 + ], + "strideWORK": 2, + "offsetWORK": 0, + "C_out": [ + -1, + 9999, + -2, + 9999, + -3, + 9999, + 4, + 9999, + 5, + 9999, + 6, + 9999 + ], + "C_out_mat": [ + [ + -1, + 4 + ], + [ + -2, + 5 + ], + [ + -3, + 6 + ] + ], + "WORK_out": [ + 1, + 9999, + 2, + 9999, + 3, + 9999 + ], + "info": 0 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/large_strides/right_row.json b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/large_strides/right_row.json new file mode 100644 index 000000000000..a627bb0bf872 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/large_strides/right_row.json @@ -0,0 +1,109 @@ +{ + "order": "row-major", + "side": "right", + "trans": "no-transpose", + "M": 3, + "N": 2, + "K": 1, + "A": [ + 1, + 9999, + 0, + 9999 + ], + "strideA1": 4, + "strideA2": 2, + "offsetA": 0, + "LDA": 1, + "A_mat": [ + [ + 1, + 0 + ] + ], + "TAU": [ + 2, + 9999 + ], + "strideTAU": 2, + "offsetTAU": 0, + "C": [ + 1, + 9999, + 4, + 9999, + 2, + 9999, + 5, + 9999, + 3, + 9999, + 6, + 9999 + ], + "strideC1": 4, + "strideC2": 2, + "offsetC": 0, + "LDC": 3, + "C_mat": [ + [ + 1, + 4 + ], + [ + 2, + 5 + ], + [ + 3, + 6 + ] + ], + "WORK": [ + 0, + 9999, + 0, + 9999, + 0, + 9999 + ], + "strideWORK": 2, + "offsetWORK": 0, + "C_out": [ + -1, + 9999, + 4, + 9999, + -2, + 9999, + 5, + 9999, + -3, + 9999, + 6, + 9999 + ], + "C_out_mat": [ + [ + -1, + 4 + ], + [ + -2, + 5 + ], + [ + -3, + 6 + ] + ], + "WORK_out": [ + 1, + 9999, + 2, + 9999, + 3, + 9999 + ], + "info": 0 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/large_strides/trans_left.json b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/large_strides/trans_left.json new file mode 100644 index 000000000000..fc289c49ac8a --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/large_strides/trans_left.json @@ -0,0 +1,105 @@ +{ + "order": "row-major", + "side": "left", + "trans": "transpose", + "M": 2, + "N": 3, + "K": 1, + "A": [ + 1, + 9999, + 0, + 9999 + ], + "strideA1": 4, + "strideA2": 2, + "offsetA": 0, + "LDA": 1, + "A_mat": [ + [ + 1, + 0 + ] + ], + "TAU": [ + 2, + 9999 + ], + "strideTAU": 2, + "offsetTAU": 0, + "C": [ + 1, + 9999, + 3, + 9999, + 5, + 9999, + 2, + 9999, + 4, + 9999, + 6, + 9999 + ], + "strideC1": 6, + "strideC2": 2, + "offsetC": 0, + "LDC": 2, + "C_mat": [ + [ + 1, + 3, + 5 + ], + [ + 2, + 4, + 6 + ] + ], + "WORK": [ + 0, + 9999, + 0, + 9999, + 0, + 9999 + ], + "strideWORK": 2, + "offsetWORK": 0, + "C_out": [ + -1, + 9999, + -3, + 9999, + -5, + 9999, + 2, + 9999, + 4, + 9999, + 6, + 9999 + ], + "C_out_mat": [ + [ + -1, + -3, + -5 + ], + [ + 2, + 4, + 6 + ] + ], + "WORK_out": [ + 1, + 9999, + 3, + 9999, + 5, + 9999 + ], + "info": 0 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/large_strides/trans_right.json b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/large_strides/trans_right.json new file mode 100644 index 000000000000..f0df7a38870a --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/large_strides/trans_right.json @@ -0,0 +1,109 @@ +{ + "order": "row-major", + "side": "right", + "trans": "transpose", + "M": 3, + "N": 2, + "K": 1, + "A": [ + 1, + 9999, + 0, + 9999 + ], + "strideA1": 4, + "strideA2": 2, + "offsetA": 0, + "LDA": 1, + "A_mat": [ + [ + 1, + 0 + ] + ], + "TAU": [ + 2, + 9999 + ], + "strideTAU": 2, + "offsetTAU": 0, + "C": [ + 1, + 9999, + 4, + 9999, + 2, + 9999, + 5, + 9999, + 3, + 9999, + 6, + 9999 + ], + "strideC1": 4, + "strideC2": 2, + "offsetC": 0, + "LDC": 3, + "C_mat": [ + [ + 1, + 4 + ], + [ + 2, + 5 + ], + [ + 3, + 6 + ] + ], + "WORK": [ + 0, + 9999, + 0, + 9999, + 0, + 9999 + ], + "strideWORK": 2, + "offsetWORK": 0, + "C_out": [ + -1, + 9999, + 4, + 9999, + -2, + 9999, + 5, + 9999, + -3, + 9999, + 6, + 9999 + ], + "C_out_mat": [ + [ + -1, + 4 + ], + [ + -2, + 5 + ], + [ + -3, + 6 + ] + ], + "WORK_out": [ + 1, + 9999, + 2, + 9999, + 3, + 9999 + ], + "info": 0 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/mixed_strides/left_col.json b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/mixed_strides/left_col.json new file mode 100644 index 000000000000..7462ce9a9200 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/mixed_strides/left_col.json @@ -0,0 +1,84 @@ +{ + "order": "column-major", + "side": "left", + "trans": "no-transpose", + "M": 2, + "N": 3, + "K": 1, + "A": [ + 1, + 0 + ], + "strideA1": 1, + "strideA2": 1, + "offsetA": 0, + "LDA": 1, + "A_mat": [ + [ + 1, + 0 + ] + ], + "TAU": [ + 2 + ], + "strideTAU": 1, + "offsetTAU": 0, + "C": [ + 5, + 6, + 3, + 4, + 1, + 2 + ], + "strideC1": 1, + "strideC2": -2, + "offsetC": 4, + "LDC": 2, + "C_mat": [ + [ + 1, + 3, + 5 + ], + [ + 2, + 4, + 6 + ] + ], + "WORK": [ + 0, + 0, + 0 + ], + "strideWORK": 1, + "offsetWORK": 0, + "C_out": [ + -5, + 6, + -3, + 4, + -1, + 2 + ], + "C_out_mat": [ + [ + -1, + -3, + -5 + ], + [ + 2, + 4, + 6 + ] + ], + "WORK_out": [ + 1, + 3, + 5 + ], + "info": 0 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/mixed_strides/left_row.json b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/mixed_strides/left_row.json new file mode 100644 index 000000000000..70bffe49566a --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/mixed_strides/left_row.json @@ -0,0 +1,84 @@ +{ + "order": "row-major", + "side": "left", + "trans": "no-transpose", + "M": 2, + "N": 3, + "K": 1, + "A": [ + 1, + 0 + ], + "strideA1": -2, + "strideA2": 1, + "offsetA": 0, + "LDA": 1, + "A_mat": [ + [ + 1, + 0 + ] + ], + "TAU": [ + 2 + ], + "strideTAU": 1, + "offsetTAU": 0, + "C": [ + 2, + 4, + 6, + 1, + 3, + 5 + ], + "strideC1": -3, + "strideC2": 1, + "offsetC": 3, + "LDC": 2, + "C_mat": [ + [ + 1, + 3, + 5 + ], + [ + 2, + 4, + 6 + ] + ], + "WORK": [ + 0, + 0, + 0 + ], + "strideWORK": 1, + "offsetWORK": 0, + "C_out": [ + 2, + 4, + 6, + -1, + -3, + -5 + ], + "C_out_mat": [ + [ + -1, + -3, + -5 + ], + [ + 2, + 4, + 6 + ] + ], + "WORK_out": [ + 1, + 3, + 5 + ], + "info": 0 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/mixed_strides/right_col.json b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/mixed_strides/right_col.json new file mode 100644 index 000000000000..3f31de110ea3 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/mixed_strides/right_col.json @@ -0,0 +1,88 @@ +{ + "order": "column-major", + "side": "right", + "trans": "no-transpose", + "M": 3, + "N": 2, + "K": 1, + "A": [ + 1, + 0 + ], + "strideA1": 1, + "strideA2": 1, + "offsetA": 0, + "LDA": 1, + "A_mat": [ + [ + 1, + 0 + ] + ], + "TAU": [ + 2 + ], + "strideTAU": 1, + "offsetTAU": 0, + "C": [ + 4, + 5, + 6, + 1, + 2, + 3 + ], + "strideC1": 1, + "strideC2": -3, + "offsetC": 3, + "LDC": 3, + "C_mat": [ + [ + 1, + 4 + ], + [ + 2, + 5 + ], + [ + 3, + 6 + ] + ], + "WORK": [ + 0, + 0, + 0 + ], + "strideWORK": 1, + "offsetWORK": 0, + "C_out": [ + 4, + 5, + 6, + -1, + -2, + -3 + ], + "C_out_mat": [ + [ + -1, + 4 + ], + [ + -2, + 5 + ], + [ + -3, + 6 + ] + ], + "WORK_out": [ + 1, + 2, + 3 + ], + "info": 0 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/mixed_strides/right_row.json b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/mixed_strides/right_row.json new file mode 100644 index 000000000000..c1ed19903c5c --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/mixed_strides/right_row.json @@ -0,0 +1,88 @@ +{ + "order": "row-major", + "side": "right", + "trans": "no-transpose", + "M": 3, + "N": 2, + "K": 1, + "A": [ + 1, + 0 + ], + "strideA1": -2, + "strideA2": 1, + "offsetA": 0, + "LDA": 1, + "A_mat": [ + [ + 1, + 0 + ] + ], + "TAU": [ + 2 + ], + "strideTAU": 1, + "offsetTAU": 0, + "C": [ + 3, + 6, + 2, + 5, + 1, + 4 + ], + "strideC1": -2, + "strideC2": 1, + "offsetC": 4, + "LDC": 3, + "C_mat": [ + [ + 1, + 4 + ], + [ + 2, + 5 + ], + [ + 3, + 6 + ] + ], + "WORK": [ + 0, + 0, + 0 + ], + "strideWORK": 1, + "offsetWORK": 0, + "C_out": [ + -3, + 6, + -2, + 5, + -1, + 4 + ], + "C_out_mat": [ + [ + -1, + 4 + ], + [ + -2, + 5 + ], + [ + -3, + 6 + ] + ], + "WORK_out": [ + 1, + 2, + 3 + ], + "info": 0 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/mixed_strides/trans_left.json b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/mixed_strides/trans_left.json new file mode 100644 index 000000000000..54a819df8f2b --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/mixed_strides/trans_left.json @@ -0,0 +1,84 @@ +{ + "order": "row-major", + "side": "left", + "trans": "transpose", + "M": 2, + "N": 3, + "K": 1, + "A": [ + 1, + 0 + ], + "strideA1": -2, + "strideA2": 1, + "offsetA": 0, + "LDA": 1, + "A_mat": [ + [ + 1, + 0 + ] + ], + "TAU": [ + 2 + ], + "strideTAU": 1, + "offsetTAU": 0, + "C": [ + 2, + 4, + 6, + 1, + 3, + 5 + ], + "strideC1": -3, + "strideC2": 1, + "offsetC": 3, + "LDC": 2, + "C_mat": [ + [ + 1, + 3, + 5 + ], + [ + 2, + 4, + 6 + ] + ], + "WORK": [ + 0, + 0, + 0 + ], + "strideWORK": 1, + "offsetWORK": 0, + "C_out": [ + 2, + 4, + 6, + -1, + -3, + -5 + ], + "C_out_mat": [ + [ + -1, + -3, + -5 + ], + [ + 2, + 4, + 6 + ] + ], + "WORK_out": [ + 1, + 3, + 5 + ], + "info": 0 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/mixed_strides/trans_right.json b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/mixed_strides/trans_right.json new file mode 100644 index 000000000000..8d1542f7a55f --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/mixed_strides/trans_right.json @@ -0,0 +1,88 @@ +{ + "order": "row-major", + "side": "right", + "trans": "transpose", + "M": 3, + "N": 2, + "K": 1, + "A": [ + 1, + 0 + ], + "strideA1": -2, + "strideA2": 1, + "offsetA": 0, + "LDA": 1, + "A_mat": [ + [ + 1, + 0 + ] + ], + "TAU": [ + 2 + ], + "strideTAU": 1, + "offsetTAU": 0, + "C": [ + 3, + 6, + 2, + 5, + 1, + 4 + ], + "strideC1": -2, + "strideC2": 1, + "offsetC": 4, + "LDC": 3, + "C_mat": [ + [ + 1, + 4 + ], + [ + 2, + 5 + ], + [ + 3, + 6 + ] + ], + "WORK": [ + 0, + 0, + 0 + ], + "strideWORK": 1, + "offsetWORK": 0, + "C_out": [ + -3, + 6, + -2, + 5, + -1, + 4 + ], + "C_out_mat": [ + [ + -1, + 4 + ], + [ + -2, + 5 + ], + [ + -3, + 6 + ] + ], + "WORK_out": [ + 1, + 2, + 3 + ], + "info": 0 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/negative_strides/left_col.json b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/negative_strides/left_col.json new file mode 100644 index 000000000000..ee6a38e72e06 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/negative_strides/left_col.json @@ -0,0 +1,84 @@ +{ + "order": "column-major", + "side": "left", + "trans": "no-transpose", + "M": 2, + "N": 3, + "K": 1, + "A": [ + 0, + 1 + ], + "strideA1": -1, + "strideA2": -1, + "offsetA": 1, + "LDA": 1, + "A_mat": [ + [ + 1, + 0 + ] + ], + "TAU": [ + 2 + ], + "strideTAU": -1, + "offsetTAU": 0, + "C": [ + 6, + 5, + 4, + 3, + 2, + 1 + ], + "strideC1": -1, + "strideC2": -2, + "offsetC": 5, + "LDC": 2, + "C_mat": [ + [ + 1, + 3, + 5 + ], + [ + 2, + 4, + 6 + ] + ], + "WORK": [ + 0, + 0, + 0 + ], + "strideWORK": -1, + "offsetWORK": 2, + "C_out": [ + 6, + -5, + 4, + -3, + 2, + -1 + ], + "C_out_mat": [ + [ + -1, + -3, + -5 + ], + [ + 2, + 4, + 6 + ] + ], + "WORK_out": [ + 5, + 3, + 1 + ], + "info": 0 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/negative_strides/left_row.json b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/negative_strides/left_row.json new file mode 100644 index 000000000000..dfb9b01a0917 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/negative_strides/left_row.json @@ -0,0 +1,84 @@ +{ + "order": "row-major", + "side": "left", + "trans": "no-transpose", + "M": 2, + "N": 3, + "K": 1, + "A": [ + 0, + 1 + ], + "strideA1": -2, + "strideA2": -1, + "offsetA": 1, + "LDA": 1, + "A_mat": [ + [ + 1, + 0 + ] + ], + "TAU": [ + 2 + ], + "strideTAU": -1, + "offsetTAU": 0, + "C": [ + 6, + 4, + 2, + 5, + 3, + 1 + ], + "strideC1": -3, + "strideC2": -1, + "offsetC": 5, + "LDC": 2, + "C_mat": [ + [ + 1, + 3, + 5 + ], + [ + 2, + 4, + 6 + ] + ], + "WORK": [ + 0, + 0, + 0 + ], + "strideWORK": -1, + "offsetWORK": 2, + "C_out": [ + 6, + 4, + 2, + -5, + -3, + -1 + ], + "C_out_mat": [ + [ + -1, + -3, + -5 + ], + [ + 2, + 4, + 6 + ] + ], + "WORK_out": [ + 5, + 3, + 1 + ], + "info": 0 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/negative_strides/right_col.json b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/negative_strides/right_col.json new file mode 100644 index 000000000000..8a0a76b10361 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/negative_strides/right_col.json @@ -0,0 +1,88 @@ +{ + "order": "column-major", + "side": "right", + "trans": "no-transpose", + "M": 3, + "N": 2, + "K": 1, + "A": [ + 0, + 1 + ], + "strideA1": -1, + "strideA2": -1, + "offsetA": 1, + "LDA": 1, + "A_mat": [ + [ + 1, + 0 + ] + ], + "TAU": [ + 2 + ], + "strideTAU": -1, + "offsetTAU": 0, + "C": [ + 6, + 5, + 4, + 3, + 2, + 1 + ], + "strideC1": -1, + "strideC2": -3, + "offsetC": 5, + "LDC": 3, + "C_mat": [ + [ + 1, + 4 + ], + [ + 2, + 5 + ], + [ + 3, + 6 + ] + ], + "WORK": [ + 0, + 0, + 0 + ], + "strideWORK": -1, + "offsetWORK": 2, + "C_out": [ + 6, + 5, + 4, + -3, + -2, + -1 + ], + "C_out_mat": [ + [ + -1, + 4 + ], + [ + -2, + 5 + ], + [ + -3, + 6 + ] + ], + "WORK_out": [ + 3, + 2, + 1 + ], + "info": 0 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/negative_strides/right_row.json b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/negative_strides/right_row.json new file mode 100644 index 000000000000..e4f5f796c9f9 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/negative_strides/right_row.json @@ -0,0 +1,88 @@ +{ + "order": "row-major", + "side": "right", + "trans": "no-transpose", + "M": 3, + "N": 2, + "K": 1, + "A": [ + 0, + 1 + ], + "strideA1": -2, + "strideA2": -1, + "offsetA": 1, + "LDA": 1, + "A_mat": [ + [ + 1, + 0 + ] + ], + "TAU": [ + 2 + ], + "strideTAU": -1, + "offsetTAU": 0, + "C": [ + 6, + 3, + 5, + 2, + 4, + 1 + ], + "strideC1": -2, + "strideC2": -1, + "offsetC": 5, + "LDC": 3, + "C_mat": [ + [ + 1, + 4 + ], + [ + 2, + 5 + ], + [ + 3, + 6 + ] + ], + "WORK": [ + 0, + 0, + 0 + ], + "strideWORK": -1, + "offsetWORK": 2, + "C_out": [ + 6, + -3, + 5, + -2, + 4, + -1 + ], + "C_out_mat": [ + [ + -1, + 4 + ], + [ + -2, + 5 + ], + [ + -3, + 6 + ] + ], + "WORK_out": [ + 3, + 2, + 1 + ], + "info": 0 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/negative_strides/trans_left.json b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/negative_strides/trans_left.json new file mode 100644 index 000000000000..0919fa0485a9 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/negative_strides/trans_left.json @@ -0,0 +1,84 @@ +{ + "order": "row-major", + "side": "left", + "trans": "transpose", + "M": 2, + "N": 3, + "K": 1, + "A": [ + 0, + 1 + ], + "strideA1": -2, + "strideA2": -1, + "offsetA": 1, + "LDA": 1, + "A_mat": [ + [ + 1, + 0 + ] + ], + "TAU": [ + 2 + ], + "strideTAU": -1, + "offsetTAU": 0, + "C": [ + 6, + 4, + 2, + 5, + 3, + 1 + ], + "strideC1": -3, + "strideC2": -1, + "offsetC": 5, + "LDC": 2, + "C_mat": [ + [ + 1, + 3, + 5 + ], + [ + 2, + 4, + 6 + ] + ], + "WORK": [ + 0, + 0, + 0 + ], + "strideWORK": -1, + "offsetWORK": 2, + "C_out": [ + 6, + 4, + 2, + -5, + -3, + -1 + ], + "C_out_mat": [ + [ + -1, + -3, + -5 + ], + [ + 2, + 4, + 6 + ] + ], + "WORK_out": [ + 5, + 3, + 1 + ], + "info": 0 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/negative_strides/trans_right.json b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/negative_strides/trans_right.json new file mode 100644 index 000000000000..c498499aaca9 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/negative_strides/trans_right.json @@ -0,0 +1,88 @@ +{ + "order": "row-major", + "side": "right", + "trans": "transpose", + "M": 3, + "N": 2, + "K": 1, + "A": [ + 0, + 1 + ], + "strideA1": -2, + "strideA2": -1, + "offsetA": 1, + "LDA": 1, + "A_mat": [ + [ + 1, + 0 + ] + ], + "TAU": [ + 2 + ], + "strideTAU": -1, + "offsetTAU": 0, + "C": [ + 6, + 3, + 5, + 2, + 4, + 1 + ], + "strideC1": -2, + "strideC2": -1, + "offsetC": 5, + "LDC": 3, + "C_mat": [ + [ + 1, + 4 + ], + [ + 2, + 5 + ], + [ + 3, + 6 + ] + ], + "WORK": [ + 0, + 0, + 0 + ], + "strideWORK": -1, + "offsetWORK": 2, + "C_out": [ + 6, + -3, + 5, + -2, + 4, + -1 + ], + "C_out_mat": [ + [ + -1, + 4 + ], + [ + -2, + 5 + ], + [ + -3, + 6 + ] + ], + "WORK_out": [ + 3, + 2, + 1 + ], + "info": 0 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/offsets/left_col.json b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/offsets/left_col.json new file mode 100644 index 000000000000..fb3f82843929 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/offsets/left_col.json @@ -0,0 +1,90 @@ +{ + "order": "column-major", + "side": "left", + "trans": "no-transpose", + "M": 2, + "N": 3, + "K": 1, + "A": [ + 9999, + 1, + 0 + ], + "strideA1": 1, + "strideA2": 1, + "offsetA": 1, + "LDA": 1, + "A_mat": [ + [ + 1, + 0 + ] + ], + "TAU": [ + 9999, + 2 + ], + "strideTAU": 1, + "offsetTAU": 1, + "C": [ + 9999, + 1, + 2, + 3, + 4, + 5, + 6 + ], + "strideC1": 1, + "strideC2": 2, + "offsetC": 1, + "LDC": 2, + "C_mat": [ + [ + 1, + 3, + 5 + ], + [ + 2, + 4, + 6 + ] + ], + "WORK": [ + 9999, + 0, + 0, + 0 + ], + "strideWORK": 1, + "offsetWORK": 1, + "C_out": [ + 9999, + -1, + 2, + -3, + 4, + -5, + 6 + ], + "C_out_mat": [ + [ + -1, + -3, + -5 + ], + [ + 2, + 4, + 6 + ] + ], + "WORK_out": [ + 9999, + 1, + 3, + 5 + ], + "info": 0 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/offsets/left_row.json b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/offsets/left_row.json new file mode 100644 index 000000000000..ebf0a045975c --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/offsets/left_row.json @@ -0,0 +1,90 @@ +{ + "order": "row-major", + "side": "left", + "trans": "no-transpose", + "M": 2, + "N": 3, + "K": 1, + "A": [ + 9999, + 1, + 0 + ], + "strideA1": 2, + "strideA2": 1, + "offsetA": 1, + "LDA": 1, + "A_mat": [ + [ + 1, + 0 + ] + ], + "TAU": [ + 9999, + 2 + ], + "strideTAU": 1, + "offsetTAU": 1, + "C": [ + 9999, + 1, + 3, + 5, + 2, + 4, + 6 + ], + "strideC1": 3, + "strideC2": 1, + "offsetC": 1, + "LDC": 2, + "C_mat": [ + [ + 1, + 3, + 5 + ], + [ + 2, + 4, + 6 + ] + ], + "WORK": [ + 9999, + 0, + 0, + 0 + ], + "strideWORK": 1, + "offsetWORK": 1, + "C_out": [ + 9999, + -1, + -3, + -5, + 2, + 4, + 6 + ], + "C_out_mat": [ + [ + -1, + -3, + -5 + ], + [ + 2, + 4, + 6 + ] + ], + "WORK_out": [ + 9999, + 1, + 3, + 5 + ], + "info": 0 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/offsets/right_col.json b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/offsets/right_col.json new file mode 100644 index 000000000000..6009edc10ca0 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/offsets/right_col.json @@ -0,0 +1,94 @@ +{ + "order": "column-major", + "side": "right", + "trans": "no-transpose", + "M": 3, + "N": 2, + "K": 1, + "A": [ + 9999, + 1, + 0 + ], + "strideA1": 1, + "strideA2": 1, + "offsetA": 1, + "LDA": 1, + "A_mat": [ + [ + 1, + 0 + ] + ], + "TAU": [ + 9999, + 2 + ], + "strideTAU": 1, + "offsetTAU": 1, + "C": [ + 9999, + 1, + 2, + 3, + 4, + 5, + 6 + ], + "strideC1": 1, + "strideC2": 3, + "offsetC": 1, + "LDC": 3, + "C_mat": [ + [ + 1, + 4 + ], + [ + 2, + 5 + ], + [ + 3, + 6 + ] + ], + "WORK": [ + 9999, + 0, + 0, + 0 + ], + "strideWORK": 1, + "offsetWORK": 1, + "C_out": [ + 9999, + -1, + -2, + -3, + 4, + 5, + 6 + ], + "C_out_mat": [ + [ + -1, + 4 + ], + [ + -2, + 5 + ], + [ + -3, + 6 + ] + ], + "WORK_out": [ + 9999, + 1, + 2, + 3 + ], + "info": 0 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/offsets/right_row.json b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/offsets/right_row.json new file mode 100644 index 000000000000..f7370211e158 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/offsets/right_row.json @@ -0,0 +1,94 @@ +{ + "order": "row-major", + "side": "right", + "trans": "no-transpose", + "M": 3, + "N": 2, + "K": 1, + "A": [ + 9999, + 1, + 0 + ], + "strideA1": 2, + "strideA2": 1, + "offsetA": 1, + "LDA": 1, + "A_mat": [ + [ + 1, + 0 + ] + ], + "TAU": [ + 9999, + 2 + ], + "strideTAU": 1, + "offsetTAU": 1, + "C": [ + 9999, + 1, + 4, + 2, + 5, + 3, + 6 + ], + "strideC1": 2, + "strideC2": 1, + "offsetC": 1, + "LDC": 3, + "C_mat": [ + [ + 1, + 4 + ], + [ + 2, + 5 + ], + [ + 3, + 6 + ] + ], + "WORK": [ + 9999, + 0, + 0, + 0 + ], + "strideWORK": 1, + "offsetWORK": 1, + "C_out": [ + 9999, + -1, + 4, + -2, + 5, + -3, + 6 + ], + "C_out_mat": [ + [ + -1, + 4 + ], + [ + -2, + 5 + ], + [ + -3, + 6 + ] + ], + "WORK_out": [ + 9999, + 1, + 2, + 3 + ], + "info": 0 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/offsets/trans_left.json b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/offsets/trans_left.json new file mode 100644 index 000000000000..e607ee116708 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/offsets/trans_left.json @@ -0,0 +1,90 @@ +{ + "order": "row-major", + "side": "left", + "trans": "transpose", + "M": 2, + "N": 3, + "K": 1, + "A": [ + 9999, + 1, + 0 + ], + "strideA1": 2, + "strideA2": 1, + "offsetA": 1, + "LDA": 1, + "A_mat": [ + [ + 1, + 0 + ] + ], + "TAU": [ + 9999, + 2 + ], + "strideTAU": 1, + "offsetTAU": 1, + "C": [ + 9999, + 1, + 3, + 5, + 2, + 4, + 6 + ], + "strideC1": 3, + "strideC2": 1, + "offsetC": 1, + "LDC": 2, + "C_mat": [ + [ + 1, + 3, + 5 + ], + [ + 2, + 4, + 6 + ] + ], + "WORK": [ + 9999, + 0, + 0, + 0 + ], + "strideWORK": 1, + "offsetWORK": 1, + "C_out": [ + 9999, + -1, + -3, + -5, + 2, + 4, + 6 + ], + "C_out_mat": [ + [ + -1, + -3, + -5 + ], + [ + 2, + 4, + 6 + ] + ], + "WORK_out": [ + 9999, + 1, + 3, + 5 + ], + "info": 0 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/offsets/trans_right.json b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/offsets/trans_right.json new file mode 100644 index 000000000000..42c7b2b095f9 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/offsets/trans_right.json @@ -0,0 +1,94 @@ +{ + "order": "row-major", + "side": "right", + "trans": "transpose", + "M": 3, + "N": 2, + "K": 1, + "A": [ + 9999, + 1, + 0 + ], + "strideA1": 2, + "strideA2": 1, + "offsetA": 1, + "LDA": 1, + "A_mat": [ + [ + 1, + 0 + ] + ], + "TAU": [ + 9999, + 2 + ], + "strideTAU": 1, + "offsetTAU": 1, + "C": [ + 9999, + 1, + 4, + 2, + 5, + 3, + 6 + ], + "strideC1": 2, + "strideC2": 1, + "offsetC": 1, + "LDC": 3, + "C_mat": [ + [ + 1, + 4 + ], + [ + 2, + 5 + ], + [ + 3, + 6 + ] + ], + "WORK": [ + 9999, + 0, + 0, + 0 + ], + "strideWORK": 1, + "offsetWORK": 1, + "C_out": [ + 9999, + -1, + 4, + -2, + 5, + -3, + 6 + ], + "C_out_mat": [ + [ + -1, + 4 + ], + [ + -2, + 5 + ], + [ + -3, + 6 + ] + ], + "WORK_out": [ + 9999, + 1, + 2, + 3 + ], + "info": 0 +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorml2/test/test.dorml2.js b/lib/node_modules/@stdlib/lapack/base/dorml2/test/test.dorml2.js index 01e63dbba790..1f6359ab2d45 100644 --- a/lib/node_modules/@stdlib/lapack/base/dorml2/test/test.dorml2.js +++ b/lib/node_modules/@stdlib/lapack/base/dorml2/test/test.dorml2.js @@ -89,6 +89,7 @@ tape( 'the function throws an error if provided a first argument which is not a }; } }); + tape( 'the function throws an error if provided a second argument which is not a valid operation side', function test( t ) { var values; var WORK; diff --git a/lib/node_modules/@stdlib/lapack/base/dorml2/test/test.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dorml2/test/test.ndarray.js new file mode 100644 index 000000000000..a37990b2e100 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorml2/test/test.ndarray.js @@ -0,0 +1,1148 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Float64Array = require( '@stdlib/array/float64' ); +var isAlmostEqual = require( '@stdlib/assert/is-almost-equal-float64array' ); +var dorml2 = require( './../lib/ndarray.js' ); + + +// FIXTURES // + +var LEFT_ROW = require( './fixtures/left_row.json' ); +var LEFT_COL = require( './fixtures/left_col.json' ); +var RIGHT_ROW = require( './fixtures/right_row.json' ); +var RIGHT_COL = require( './fixtures/right_col.json' ); +var TRANS_LEFT = require( './fixtures/trans_left.json' ); +var TRANS_RIGHT = require( './fixtures/trans_right.json' ); +var LAR_STR_LEFT_ROW = require( './fixtures/large_strides/left_row.json' ); +var LAR_STR_LEFT_COL = require( './fixtures/large_strides/left_col.json' ); +var LAR_STR_RIGHT_ROW = require( './fixtures/large_strides/right_row.json' ); +var LAR_STR_RIGHT_COL = require( './fixtures/large_strides/right_col.json' ); +var LAR_STR_TRANS_LEFT = require( './fixtures/large_strides/trans_left.json' ); +var LAR_STR_TRANS_RIGHT = require( './fixtures/large_strides/trans_right.json' ); +var MIX_STR_LEFT_ROW = require( './fixtures/mixed_strides/left_row.json' ); +var MIX_STR_LEFT_COL = require( './fixtures/mixed_strides/left_col.json' ); +var MIX_STR_RIGHT_ROW = require( './fixtures/mixed_strides/right_row.json' ); +var MIX_STR_RIGHT_COL = require( './fixtures/mixed_strides/right_col.json' ); +var MIX_STR_TRANS_LEFT = require( './fixtures/mixed_strides/trans_left.json' ); +var MIX_STR_TRANS_RIGHT = require( './fixtures/mixed_strides/trans_right.json' ); +var NEG_STR_LEFT_ROW = require( './fixtures/negative_strides/left_row.json' ); +var NEG_STR_LEFT_COL = require( './fixtures/negative_strides/left_col.json' ); +var NEG_STR_RIGHT_ROW = require( './fixtures/negative_strides/right_row.json' ); +var NEG_STR_RIGHT_COL = require( './fixtures/negative_strides/right_col.json' ); +var NEG_STR_TRANS_LEFT = require( './fixtures/negative_strides/trans_left.json' ); +var NEG_STR_TRANS_RIGHT = require( './fixtures/negative_strides/trans_right.json' ); +var OFF_LEFT_ROW = require( './fixtures/offsets/left_row.json' ); +var OFF_LEFT_COL = require( './fixtures/offsets/left_col.json' ); +var OFF_RIGHT_ROW = require( './fixtures/offsets/right_row.json' ); +var OFF_RIGHT_COL = require( './fixtures/offsets/right_col.json' ); +var OFF_TRANS_LEFT = require( './fixtures/offsets/trans_left.json' ); +var OFF_TRANS_RIGHT = require( './fixtures/offsets/trans_right.json' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof dorml2, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 19', function test( t ) { + t.strictEqual( dorml2.length, 19, 'returns expected value' ); + t.end(); +}); + +tape( 'the function throws an error if provided a first argument which is not a valid operation side', function test( t ) { + var values; + var WORK; + var TAU; + var A; + var C; + var i; + + A = new Float64Array( [ 1, 0 ] ); + TAU = new Float64Array( [ 2 ] ); + C = new Float64Array( [ 1, 3, 5, 2, 4, 6 ] ); + 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() { + dorml2( value, 'no-transpose', 2, 3, 1, A, 2, 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 transpose operation', function test( t ) { + var values; + var WORK; + var TAU; + var A; + var C; + var i; + + A = new Float64Array( [ 1, 0 ] ); + TAU = new Float64Array( [ 2 ] ); + C = new Float64Array( [ 1, 3, 5, 2, 4, 6 ] ); + 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() { + dorml2( 'left', value, 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, WORK, 1, 0 ); + }; + } +}); + +tape( 'the function throws an error if provided a third argument which is smaller than 0', function test( t ) { + var values; + var WORK; + var TAU; + var A; + var C; + var i; + + A = new Float64Array( [ 1, 0 ] ); + TAU = new Float64Array( [ 2 ] ); + C = new Float64Array( [ 1, 3, 5, 2, 4, 6 ] ); + WORK = new Float64Array( 3 ); + + values = [ + -1, + -2, + -3 + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + dorml2( 'left', 'no-transpose', value, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, WORK, 1, 0 ); + }; + } +}); + +tape( 'the function throws an error if provided a fourth argument which is smaller than 0', function test( t ) { + var values; + var WORK; + var TAU; + var A; + var C; + var i; + + A = new Float64Array( [ 1, 0 ] ); + TAU = new Float64Array( [ 2 ] ); + C = new Float64Array( [ 1, 3, 5, 2, 4, 6 ] ); + WORK = new Float64Array( 3 ); + + values = [ + -1, + -2, + -3 + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + dorml2( 'left', 'no-transpose', 2, value, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, WORK, 1, 0 ); + }; + } +}); + +tape( 'the function throws an error if provided a fifth argument which is smaller than 0', function test( t ) { + var values; + var WORK; + var TAU; + var A; + var C; + var i; + + A = new Float64Array( [ 1, 0 ] ); + TAU = new Float64Array( [ 2 ] ); + C = new Float64Array( [ 1, 3, 5, 2, 4, 6 ] ); + WORK = new Float64Array( 3 ); + + values = [ + -1, + -2, + -3 + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + dorml2( 'left', 'no-transpose', 2, 3, value, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, WORK, 1, 0 ); + }; + } +}); + +tape( 'the function throws an error if provided a sixth argument which is larger than the order of `Q` (left)', function test( t ) { + var values; + var WORK; + var TAU; + var A; + var C; + var i; + + A = new Float64Array( [ 1, 0 ] ); + TAU = new Float64Array( [ 2 ] ); + C = new Float64Array( [ 1, 3, 5, 2, 4, 6 ] ); + WORK = new Float64Array( 3 ); + + values = [ + 3, + 4, + 5 + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + dorml2( 'left', 'no-transpose', 2, 3, value, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, WORK, 1, 0 ); + }; + } +}); + +tape( 'the function throws an error if provided a sixth argument which is larger than the order of `Q` (right)', function test( t ) { + var values; + var WORK; + var TAU; + var A; + var C; + var i; + + A = new Float64Array( [ 1, 0 ] ); + TAU = new Float64Array( [ 2 ] ); + C = new Float64Array( [ 1, 3, 5, 2, 4, 6 ] ); + WORK = new Float64Array( 3 ); + + values = [ + 4, + 5, + 6 + ]; + + 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() { + dorml2( 'right', 'no-transpose', 2, 3, value, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, WORK, 1, 0 ); + }; + } +}); + +tape( 'the function quick returns when `M`, `N` or `K` is equal to 0', function test( t ) { + var expectedWORK; + var expectedC; + var info; + var data; + var WORK; + var TAU; + var A; + var C; + + data = LEFT_ROW; + + A = new Float64Array( data.A ); + TAU = new Float64Array( data.TAU ); + C = new Float64Array( data.C ); + WORK = new Float64Array( data.WORK ); + + expectedC = new Float64Array( data.C ); + expectedWORK = new Float64Array( data.WORK ); + + info = dorml2( data.side, data.trans, 0, 0, 0, A, data.strideA1, data.strideA2, data.offsetA, TAU, data.strideTAU, data.offsetTAU, C, data.strideC1, data.strideC2, data.offsetC, WORK, data.strideWORK, data.offsetWORK ); + t.strictEqual( info, 0, 'returns expected value' ); + t.strictEqual( isAlmostEqual( C, expectedC, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( WORK, expectedWORK, 1 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function multiplies a general matrix by the orthogonal matrix from a LQ factorization (left, row-major)', function test( t ) { + var expectedWORK; + var expectedC; + var info; + var data; + var WORK; + var TAU; + var A; + var C; + + data = LEFT_ROW; + + A = new Float64Array( data.A ); + TAU = new Float64Array( data.TAU ); + C = new Float64Array( data.C ); + WORK = new Float64Array( data.WORK ); + + expectedC = new Float64Array( data.C_out ); + expectedWORK = new Float64Array( data.WORK_out ); + + info = dorml2( data.side, data.trans, data.M, data.N, data.K, A, data.strideA1, data.strideA2, data.offsetA, TAU, data.strideTAU, data.offsetTAU, C, data.strideC1, data.strideC2, data.offsetC, WORK, data.strideWORK, data.offsetWORK ); + t.strictEqual( info, 0, 'returns expected value' ); + t.strictEqual( isAlmostEqual( C, expectedC, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( WORK, expectedWORK, 1 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function multiplies a general matrix by the orthogonal matrix from a LQ factorization (left, column-major)', function test( t ) { + var expectedWORK; + var expectedC; + var info; + var data; + var WORK; + var TAU; + var A; + var C; + + data = LEFT_COL; + + A = new Float64Array( data.A ); + TAU = new Float64Array( data.TAU ); + C = new Float64Array( data.C ); + WORK = new Float64Array( data.WORK ); + + expectedC = new Float64Array( data.C_out ); + expectedWORK = new Float64Array( data.WORK_out ); + + info = dorml2( data.side, data.trans, data.M, data.N, data.K, A, data.strideA1, data.strideA2, data.offsetA, TAU, data.strideTAU, data.offsetTAU, C, data.strideC1, data.strideC2, data.offsetC, WORK, data.strideWORK, data.offsetWORK ); + t.strictEqual( info, 0, 'returns expected value' ); + t.strictEqual( isAlmostEqual( C, expectedC, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( WORK, expectedWORK, 1 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function multiplies a general matrix by the orthogonal matrix from a LQ factorization (right, row-major)', function test( t ) { + var expectedWORK; + var expectedC; + var info; + var data; + var WORK; + var TAU; + var A; + var C; + + data = RIGHT_ROW; + + A = new Float64Array( data.A ); + TAU = new Float64Array( data.TAU ); + C = new Float64Array( data.C ); + WORK = new Float64Array( data.WORK ); + + expectedC = new Float64Array( data.C_out ); + expectedWORK = new Float64Array( data.WORK_out ); + + info = dorml2( data.side, data.trans, data.M, data.N, data.K, A, data.strideA1, data.strideA2, data.offsetA, TAU, data.strideTAU, data.offsetTAU, C, data.strideC1, data.strideC2, data.offsetC, WORK, data.strideWORK, data.offsetWORK ); + t.strictEqual( info, 0, 'returns expected value' ); + t.strictEqual( isAlmostEqual( C, expectedC, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( WORK, expectedWORK, 1 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function multiplies a general matrix by the orthogonal matrix from a LQ factorization (right, column-major)', function test( t ) { + var expectedWORK; + var expectedC; + var info; + var data; + var WORK; + var TAU; + var A; + var C; + + data = RIGHT_COL; + + A = new Float64Array( data.A ); + TAU = new Float64Array( data.TAU ); + C = new Float64Array( data.C ); + WORK = new Float64Array( data.WORK ); + + expectedC = new Float64Array( data.C_out ); + expectedWORK = new Float64Array( data.WORK_out ); + + info = dorml2( data.side, data.trans, data.M, data.N, data.K, A, data.strideA1, data.strideA2, data.offsetA, TAU, data.strideTAU, data.offsetTAU, C, data.strideC1, data.strideC2, data.offsetC, WORK, data.strideWORK, data.offsetWORK ); + t.strictEqual( info, 0, 'returns expected value' ); + t.strictEqual( isAlmostEqual( C, expectedC, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( WORK, expectedWORK, 1 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function multiplies a general matrix by the orthogonal matrix from a LQ factorization (left, row-major, trans)', function test( t ) { + var expectedWORK; + var expectedC; + var info; + var data; + var WORK; + var TAU; + var A; + var C; + + data = TRANS_LEFT; + + A = new Float64Array( data.A ); + TAU = new Float64Array( data.TAU ); + C = new Float64Array( data.C ); + WORK = new Float64Array( data.WORK ); + + expectedC = new Float64Array( data.C_out ); + expectedWORK = new Float64Array( data.WORK_out ); + + info = dorml2( data.side, data.trans, data.M, data.N, data.K, A, data.strideA1, data.strideA2, data.offsetA, TAU, data.strideTAU, data.offsetTAU, C, data.strideC1, data.strideC2, data.offsetC, WORK, data.strideWORK, data.offsetWORK ); + t.strictEqual( info, 0, 'returns expected value' ); + t.strictEqual( isAlmostEqual( C, expectedC, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( WORK, expectedWORK, 1 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function multiplies a general matrix by the orthogonal matrix from a LQ factorization (right, row-major, trans)', function test( t ) { + var expectedWORK; + var expectedC; + var info; + var data; + var WORK; + var TAU; + var A; + var C; + + data = TRANS_RIGHT; + + A = new Float64Array( data.A ); + TAU = new Float64Array( data.TAU ); + C = new Float64Array( data.C ); + WORK = new Float64Array( data.WORK ); + + expectedC = new Float64Array( data.C_out ); + expectedWORK = new Float64Array( data.WORK_out ); + + info = dorml2( data.side, data.trans, data.M, data.N, data.K, A, data.strideA1, data.strideA2, data.offsetA, TAU, data.strideTAU, data.offsetTAU, C, data.strideC1, data.strideC2, data.offsetC, WORK, data.strideWORK, data.offsetWORK ); + t.strictEqual( info, 0, 'returns expected value' ); + t.strictEqual( isAlmostEqual( C, expectedC, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( WORK, expectedWORK, 1 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function multiplies a general matrix by the orthogonal matrix from a LQ factorization (large stride, left, row-major)', function test( t ) { + var expectedWORK; + var expectedC; + var info; + var data; + var WORK; + var TAU; + var A; + var C; + + data = LAR_STR_LEFT_ROW; + + A = new Float64Array( data.A ); + TAU = new Float64Array( data.TAU ); + C = new Float64Array( data.C ); + WORK = new Float64Array( data.WORK ); + + expectedC = new Float64Array( data.C_out ); + expectedWORK = new Float64Array( data.WORK_out ); + + info = dorml2( data.side, data.trans, data.M, data.N, data.K, A, data.strideA1, data.strideA2, data.offsetA, TAU, data.strideTAU, data.offsetTAU, C, data.strideC1, data.strideC2, data.offsetC, WORK, data.strideWORK, data.offsetWORK ); + t.strictEqual( info, 0, 'returns expected value' ); + t.strictEqual( isAlmostEqual( C, expectedC, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( WORK, expectedWORK, 1 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function multiplies a general matrix by the orthogonal matrix from a LQ factorization (large stride, left, column-major)', function test( t ) { + var expectedWORK; + var expectedC; + var info; + var data; + var WORK; + var TAU; + var A; + var C; + + data = LAR_STR_LEFT_COL; + + A = new Float64Array( data.A ); + TAU = new Float64Array( data.TAU ); + C = new Float64Array( data.C ); + WORK = new Float64Array( data.WORK ); + + expectedC = new Float64Array( data.C_out ); + expectedWORK = new Float64Array( data.WORK_out ); + + info = dorml2( data.side, data.trans, data.M, data.N, data.K, A, data.strideA1, data.strideA2, data.offsetA, TAU, data.strideTAU, data.offsetTAU, C, data.strideC1, data.strideC2, data.offsetC, WORK, data.strideWORK, data.offsetWORK ); + t.strictEqual( info, 0, 'returns expected value' ); + t.strictEqual( isAlmostEqual( C, expectedC, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( WORK, expectedWORK, 1 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function multiplies a general matrix by the orthogonal matrix from a LQ factorization (large stride, right, row-major)', function test( t ) { + var expectedWORK; + var expectedC; + var info; + var data; + var WORK; + var TAU; + var A; + var C; + + data = LAR_STR_RIGHT_ROW; + + A = new Float64Array( data.A ); + TAU = new Float64Array( data.TAU ); + C = new Float64Array( data.C ); + WORK = new Float64Array( data.WORK ); + + expectedC = new Float64Array( data.C_out ); + expectedWORK = new Float64Array( data.WORK_out ); + + info = dorml2( data.side, data.trans, data.M, data.N, data.K, A, data.strideA1, data.strideA2, data.offsetA, TAU, data.strideTAU, data.offsetTAU, C, data.strideC1, data.strideC2, data.offsetC, WORK, data.strideWORK, data.offsetWORK ); + t.strictEqual( info, 0, 'returns expected value' ); + t.strictEqual( isAlmostEqual( C, expectedC, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( WORK, expectedWORK, 1 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function multiplies a general matrix by the orthogonal matrix from a LQ factorization (large stride, right, column-major)', function test( t ) { + var expectedWORK; + var expectedC; + var info; + var data; + var WORK; + var TAU; + var A; + var C; + + data = LAR_STR_RIGHT_COL; + + A = new Float64Array( data.A ); + TAU = new Float64Array( data.TAU ); + C = new Float64Array( data.C ); + WORK = new Float64Array( data.WORK ); + + expectedC = new Float64Array( data.C_out ); + expectedWORK = new Float64Array( data.WORK_out ); + + info = dorml2( data.side, data.trans, data.M, data.N, data.K, A, data.strideA1, data.strideA2, data.offsetA, TAU, data.strideTAU, data.offsetTAU, C, data.strideC1, data.strideC2, data.offsetC, WORK, data.strideWORK, data.offsetWORK ); + t.strictEqual( info, 0, 'returns expected value' ); + t.strictEqual( isAlmostEqual( C, expectedC, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( WORK, expectedWORK, 1 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function multiplies a general matrix by the orthogonal matrix from a LQ factorization (large stride, left, row-major, trans)', function test( t ) { + var expectedWORK; + var expectedC; + var info; + var data; + var WORK; + var TAU; + var A; + var C; + + data = LAR_STR_TRANS_LEFT; + + A = new Float64Array( data.A ); + TAU = new Float64Array( data.TAU ); + C = new Float64Array( data.C ); + WORK = new Float64Array( data.WORK ); + + expectedC = new Float64Array( data.C_out ); + expectedWORK = new Float64Array( data.WORK_out ); + + info = dorml2( data.side, data.trans, data.M, data.N, data.K, A, data.strideA1, data.strideA2, data.offsetA, TAU, data.strideTAU, data.offsetTAU, C, data.strideC1, data.strideC2, data.offsetC, WORK, data.strideWORK, data.offsetWORK ); + t.strictEqual( info, 0, 'returns expected value' ); + t.strictEqual( isAlmostEqual( C, expectedC, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( WORK, expectedWORK, 1 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function multiplies a general matrix by the orthogonal matrix from a LQ factorization (large stride, right, row-major, trans)', function test( t ) { + var expectedWORK; + var expectedC; + var info; + var data; + var WORK; + var TAU; + var A; + var C; + + data = LAR_STR_TRANS_RIGHT; + + A = new Float64Array( data.A ); + TAU = new Float64Array( data.TAU ); + C = new Float64Array( data.C ); + WORK = new Float64Array( data.WORK ); + + expectedC = new Float64Array( data.C_out ); + expectedWORK = new Float64Array( data.WORK_out ); + + info = dorml2( data.side, data.trans, data.M, data.N, data.K, A, data.strideA1, data.strideA2, data.offsetA, TAU, data.strideTAU, data.offsetTAU, C, data.strideC1, data.strideC2, data.offsetC, WORK, data.strideWORK, data.offsetWORK ); + t.strictEqual( info, 0, 'returns expected value' ); + t.strictEqual( isAlmostEqual( C, expectedC, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( WORK, expectedWORK, 1 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function multiplies a general matrix by the orthogonal matrix from a LQ factorization (mixed stride, left, row-major)', function test( t ) { + var expectedWORK; + var expectedC; + var info; + var data; + var WORK; + var TAU; + var A; + var C; + + data = MIX_STR_LEFT_ROW; + + A = new Float64Array( data.A ); + TAU = new Float64Array( data.TAU ); + C = new Float64Array( data.C ); + WORK = new Float64Array( data.WORK ); + + expectedC = new Float64Array( data.C_out ); + expectedWORK = new Float64Array( data.WORK_out ); + + info = dorml2( data.side, data.trans, data.M, data.N, data.K, A, data.strideA1, data.strideA2, data.offsetA, TAU, data.strideTAU, data.offsetTAU, C, data.strideC1, data.strideC2, data.offsetC, WORK, data.strideWORK, data.offsetWORK ); + t.strictEqual( info, 0, 'returns expected value' ); + t.strictEqual( isAlmostEqual( C, expectedC, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( WORK, expectedWORK, 1 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function multiplies a general matrix by the orthogonal matrix from a LQ factorization (mixed stride, left, column-major)', function test( t ) { + var expectedWORK; + var expectedC; + var info; + var data; + var WORK; + var TAU; + var A; + var C; + + data = MIX_STR_LEFT_COL; + + A = new Float64Array( data.A ); + TAU = new Float64Array( data.TAU ); + C = new Float64Array( data.C ); + WORK = new Float64Array( data.WORK ); + + expectedC = new Float64Array( data.C_out ); + expectedWORK = new Float64Array( data.WORK_out ); + + info = dorml2( data.side, data.trans, data.M, data.N, data.K, A, data.strideA1, data.strideA2, data.offsetA, TAU, data.strideTAU, data.offsetTAU, C, data.strideC1, data.strideC2, data.offsetC, WORK, data.strideWORK, data.offsetWORK ); + t.strictEqual( info, 0, 'returns expected value' ); + t.strictEqual( isAlmostEqual( C, expectedC, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( WORK, expectedWORK, 1 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function multiplies a general matrix by the orthogonal matrix from a LQ factorization (mixed stride, right, row-major)', function test( t ) { + var expectedWORK; + var expectedC; + var info; + var data; + var WORK; + var TAU; + var A; + var C; + + data = MIX_STR_RIGHT_ROW; + + A = new Float64Array( data.A ); + TAU = new Float64Array( data.TAU ); + C = new Float64Array( data.C ); + WORK = new Float64Array( data.WORK ); + + expectedC = new Float64Array( data.C_out ); + expectedWORK = new Float64Array( data.WORK_out ); + + info = dorml2( data.side, data.trans, data.M, data.N, data.K, A, data.strideA1, data.strideA2, data.offsetA, TAU, data.strideTAU, data.offsetTAU, C, data.strideC1, data.strideC2, data.offsetC, WORK, data.strideWORK, data.offsetWORK ); + t.strictEqual( info, 0, 'returns expected value' ); + t.strictEqual( isAlmostEqual( C, expectedC, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( WORK, expectedWORK, 1 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function multiplies a general matrix by the orthogonal matrix from a LQ factorization (mixed stride, right, column-major)', function test( t ) { + var expectedWORK; + var expectedC; + var info; + var data; + var WORK; + var TAU; + var A; + var C; + + data = MIX_STR_RIGHT_COL; + + A = new Float64Array( data.A ); + TAU = new Float64Array( data.TAU ); + C = new Float64Array( data.C ); + WORK = new Float64Array( data.WORK ); + + expectedC = new Float64Array( data.C_out ); + expectedWORK = new Float64Array( data.WORK_out ); + + info = dorml2( data.side, data.trans, data.M, data.N, data.K, A, data.strideA1, data.strideA2, data.offsetA, TAU, data.strideTAU, data.offsetTAU, C, data.strideC1, data.strideC2, data.offsetC, WORK, data.strideWORK, data.offsetWORK ); + t.strictEqual( info, 0, 'returns expected value' ); + t.strictEqual( isAlmostEqual( C, expectedC, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( WORK, expectedWORK, 1 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function multiplies a general matrix by the orthogonal matrix from a LQ factorization (mixed stride, left, row-major, trans)', function test( t ) { + var expectedWORK; + var expectedC; + var info; + var data; + var WORK; + var TAU; + var A; + var C; + + data = MIX_STR_TRANS_LEFT; + + A = new Float64Array( data.A ); + TAU = new Float64Array( data.TAU ); + C = new Float64Array( data.C ); + WORK = new Float64Array( data.WORK ); + + expectedC = new Float64Array( data.C_out ); + expectedWORK = new Float64Array( data.WORK_out ); + + info = dorml2( data.side, data.trans, data.M, data.N, data.K, A, data.strideA1, data.strideA2, data.offsetA, TAU, data.strideTAU, data.offsetTAU, C, data.strideC1, data.strideC2, data.offsetC, WORK, data.strideWORK, data.offsetWORK ); + t.strictEqual( info, 0, 'returns expected value' ); + t.strictEqual( isAlmostEqual( C, expectedC, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( WORK, expectedWORK, 1 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function multiplies a general matrix by the orthogonal matrix from a LQ factorization (mixed stride, right, row-major, trans)', function test( t ) { + var expectedWORK; + var expectedC; + var info; + var data; + var WORK; + var TAU; + var A; + var C; + + data = MIX_STR_TRANS_RIGHT; + + A = new Float64Array( data.A ); + TAU = new Float64Array( data.TAU ); + C = new Float64Array( data.C ); + WORK = new Float64Array( data.WORK ); + + expectedC = new Float64Array( data.C_out ); + expectedWORK = new Float64Array( data.WORK_out ); + + info = dorml2( data.side, data.trans, data.M, data.N, data.K, A, data.strideA1, data.strideA2, data.offsetA, TAU, data.strideTAU, data.offsetTAU, C, data.strideC1, data.strideC2, data.offsetC, WORK, data.strideWORK, data.offsetWORK ); + t.strictEqual( info, 0, 'returns expected value' ); + t.strictEqual( isAlmostEqual( C, expectedC, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( WORK, expectedWORK, 1 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function multiplies a general matrix by the orthogonal matrix from a LQ factorization (negative stride, left, row-major)', function test( t ) { + var expectedWORK; + var expectedC; + var info; + var data; + var WORK; + var TAU; + var A; + var C; + + data = NEG_STR_LEFT_ROW; + + A = new Float64Array( data.A ); + TAU = new Float64Array( data.TAU ); + C = new Float64Array( data.C ); + WORK = new Float64Array( data.WORK ); + + expectedC = new Float64Array( data.C_out ); + expectedWORK = new Float64Array( data.WORK_out ); + + info = dorml2( data.side, data.trans, data.M, data.N, data.K, A, data.strideA1, data.strideA2, data.offsetA, TAU, data.strideTAU, data.offsetTAU, C, data.strideC1, data.strideC2, data.offsetC, WORK, data.strideWORK, data.offsetWORK ); + t.strictEqual( info, 0, 'returns expected value' ); + t.strictEqual( isAlmostEqual( C, expectedC, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( WORK, expectedWORK, 1 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function multiplies a general matrix by the orthogonal matrix from a LQ factorization (negative stride, left, column-major)', function test( t ) { + var expectedWORK; + var expectedC; + var info; + var data; + var WORK; + var TAU; + var A; + var C; + + data = NEG_STR_LEFT_COL; + + A = new Float64Array( data.A ); + TAU = new Float64Array( data.TAU ); + C = new Float64Array( data.C ); + WORK = new Float64Array( data.WORK ); + + expectedC = new Float64Array( data.C_out ); + expectedWORK = new Float64Array( data.WORK_out ); + + info = dorml2( data.side, data.trans, data.M, data.N, data.K, A, data.strideA1, data.strideA2, data.offsetA, TAU, data.strideTAU, data.offsetTAU, C, data.strideC1, data.strideC2, data.offsetC, WORK, data.strideWORK, data.offsetWORK ); + t.strictEqual( info, 0, 'returns expected value' ); + t.strictEqual( isAlmostEqual( C, expectedC, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( WORK, expectedWORK, 1 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function multiplies a general matrix by the orthogonal matrix from a LQ factorization (negative stride, right, row-major)', function test( t ) { + var expectedWORK; + var expectedC; + var info; + var data; + var WORK; + var TAU; + var A; + var C; + + data = NEG_STR_RIGHT_ROW; + + A = new Float64Array( data.A ); + TAU = new Float64Array( data.TAU ); + C = new Float64Array( data.C ); + WORK = new Float64Array( data.WORK ); + + expectedC = new Float64Array( data.C_out ); + expectedWORK = new Float64Array( data.WORK_out ); + + info = dorml2( data.side, data.trans, data.M, data.N, data.K, A, data.strideA1, data.strideA2, data.offsetA, TAU, data.strideTAU, data.offsetTAU, C, data.strideC1, data.strideC2, data.offsetC, WORK, data.strideWORK, data.offsetWORK ); + t.strictEqual( info, 0, 'returns expected value' ); + t.strictEqual( isAlmostEqual( C, expectedC, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( WORK, expectedWORK, 1 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function multiplies a general matrix by the orthogonal matrix from a LQ factorization (negative stride, right, column-major)', function test( t ) { + var expectedWORK; + var expectedC; + var info; + var data; + var WORK; + var TAU; + var A; + var C; + + data = NEG_STR_RIGHT_COL; + + A = new Float64Array( data.A ); + TAU = new Float64Array( data.TAU ); + C = new Float64Array( data.C ); + WORK = new Float64Array( data.WORK ); + + expectedC = new Float64Array( data.C_out ); + expectedWORK = new Float64Array( data.WORK_out ); + + info = dorml2( data.side, data.trans, data.M, data.N, data.K, A, data.strideA1, data.strideA2, data.offsetA, TAU, data.strideTAU, data.offsetTAU, C, data.strideC1, data.strideC2, data.offsetC, WORK, data.strideWORK, data.offsetWORK ); + t.strictEqual( info, 0, 'returns expected value' ); + t.strictEqual( isAlmostEqual( C, expectedC, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( WORK, expectedWORK, 1 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function multiplies a general matrix by the orthogonal matrix from a LQ factorization (negative stride, left, row-major, trans)', function test( t ) { + var expectedWORK; + var expectedC; + var info; + var data; + var WORK; + var TAU; + var A; + var C; + + data = NEG_STR_TRANS_LEFT; + + A = new Float64Array( data.A ); + TAU = new Float64Array( data.TAU ); + C = new Float64Array( data.C ); + WORK = new Float64Array( data.WORK ); + + expectedC = new Float64Array( data.C_out ); + expectedWORK = new Float64Array( data.WORK_out ); + + info = dorml2( data.side, data.trans, data.M, data.N, data.K, A, data.strideA1, data.strideA2, data.offsetA, TAU, data.strideTAU, data.offsetTAU, C, data.strideC1, data.strideC2, data.offsetC, WORK, data.strideWORK, data.offsetWORK ); + t.strictEqual( info, 0, 'returns expected value' ); + t.strictEqual( isAlmostEqual( C, expectedC, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( WORK, expectedWORK, 1 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function multiplies a general matrix by the orthogonal matrix from a LQ factorization (negative stride, right, row-major, trans)', function test( t ) { + var expectedWORK; + var expectedC; + var info; + var data; + var WORK; + var TAU; + var A; + var C; + + data = NEG_STR_TRANS_RIGHT; + + A = new Float64Array( data.A ); + TAU = new Float64Array( data.TAU ); + C = new Float64Array( data.C ); + WORK = new Float64Array( data.WORK ); + + expectedC = new Float64Array( data.C_out ); + expectedWORK = new Float64Array( data.WORK_out ); + + info = dorml2( data.side, data.trans, data.M, data.N, data.K, A, data.strideA1, data.strideA2, data.offsetA, TAU, data.strideTAU, data.offsetTAU, C, data.strideC1, data.strideC2, data.offsetC, WORK, data.strideWORK, data.offsetWORK ); + t.strictEqual( info, 0, 'returns expected value' ); + t.strictEqual( isAlmostEqual( C, expectedC, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( WORK, expectedWORK, 1 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function multiplies a general matrix by the orthogonal matrix from a LQ factorization (offset, left, row-major)', function test( t ) { + var expectedWORK; + var expectedC; + var info; + var data; + var WORK; + var TAU; + var A; + var C; + + data = OFF_LEFT_ROW; + + A = new Float64Array( data.A ); + TAU = new Float64Array( data.TAU ); + C = new Float64Array( data.C ); + WORK = new Float64Array( data.WORK ); + + expectedC = new Float64Array( data.C_out ); + expectedWORK = new Float64Array( data.WORK_out ); + + info = dorml2( data.side, data.trans, data.M, data.N, data.K, A, data.strideA1, data.strideA2, data.offsetA, TAU, data.strideTAU, data.offsetTAU, C, data.strideC1, data.strideC2, data.offsetC, WORK, data.strideWORK, data.offsetWORK ); + t.strictEqual( info, 0, 'returns expected value' ); + t.strictEqual( isAlmostEqual( C, expectedC, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( WORK, expectedWORK, 1 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function multiplies a general matrix by the orthogonal matrix from a LQ factorization (offset, left, column-major)', function test( t ) { + var expectedWORK; + var expectedC; + var info; + var data; + var WORK; + var TAU; + var A; + var C; + + data = OFF_LEFT_COL; + + A = new Float64Array( data.A ); + TAU = new Float64Array( data.TAU ); + C = new Float64Array( data.C ); + WORK = new Float64Array( data.WORK ); + + expectedC = new Float64Array( data.C_out ); + expectedWORK = new Float64Array( data.WORK_out ); + + info = dorml2( data.side, data.trans, data.M, data.N, data.K, A, data.strideA1, data.strideA2, data.offsetA, TAU, data.strideTAU, data.offsetTAU, C, data.strideC1, data.strideC2, data.offsetC, WORK, data.strideWORK, data.offsetWORK ); + t.strictEqual( info, 0, 'returns expected value' ); + t.strictEqual( isAlmostEqual( C, expectedC, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( WORK, expectedWORK, 1 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function multiplies a general matrix by the orthogonal matrix from a LQ factorization (offset, right, row-major)', function test( t ) { + var expectedWORK; + var expectedC; + var info; + var data; + var WORK; + var TAU; + var A; + var C; + + data = OFF_RIGHT_ROW; + + A = new Float64Array( data.A ); + TAU = new Float64Array( data.TAU ); + C = new Float64Array( data.C ); + WORK = new Float64Array( data.WORK ); + + expectedC = new Float64Array( data.C_out ); + expectedWORK = new Float64Array( data.WORK_out ); + + info = dorml2( data.side, data.trans, data.M, data.N, data.K, A, data.strideA1, data.strideA2, data.offsetA, TAU, data.strideTAU, data.offsetTAU, C, data.strideC1, data.strideC2, data.offsetC, WORK, data.strideWORK, data.offsetWORK ); + t.strictEqual( info, 0, 'returns expected value' ); + t.strictEqual( isAlmostEqual( C, expectedC, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( WORK, expectedWORK, 1 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function multiplies a general matrix by the orthogonal matrix from a LQ factorization (offset, right, column-major)', function test( t ) { + var expectedWORK; + var expectedC; + var info; + var data; + var WORK; + var TAU; + var A; + var C; + + data = OFF_RIGHT_COL; + + A = new Float64Array( data.A ); + TAU = new Float64Array( data.TAU ); + C = new Float64Array( data.C ); + WORK = new Float64Array( data.WORK ); + + expectedC = new Float64Array( data.C_out ); + expectedWORK = new Float64Array( data.WORK_out ); + + info = dorml2( data.side, data.trans, data.M, data.N, data.K, A, data.strideA1, data.strideA2, data.offsetA, TAU, data.strideTAU, data.offsetTAU, C, data.strideC1, data.strideC2, data.offsetC, WORK, data.strideWORK, data.offsetWORK ); + t.strictEqual( info, 0, 'returns expected value' ); + t.strictEqual( isAlmostEqual( C, expectedC, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( WORK, expectedWORK, 1 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function multiplies a general matrix by the orthogonal matrix from a LQ factorization (offset, left, row-major, trans)', function test( t ) { + var expectedWORK; + var expectedC; + var info; + var data; + var WORK; + var TAU; + var A; + var C; + + data = OFF_TRANS_LEFT; + + A = new Float64Array( data.A ); + TAU = new Float64Array( data.TAU ); + C = new Float64Array( data.C ); + WORK = new Float64Array( data.WORK ); + + expectedC = new Float64Array( data.C_out ); + expectedWORK = new Float64Array( data.WORK_out ); + + info = dorml2( data.side, data.trans, data.M, data.N, data.K, A, data.strideA1, data.strideA2, data.offsetA, TAU, data.strideTAU, data.offsetTAU, C, data.strideC1, data.strideC2, data.offsetC, WORK, data.strideWORK, data.offsetWORK ); + t.strictEqual( info, 0, 'returns expected value' ); + t.strictEqual( isAlmostEqual( C, expectedC, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( WORK, expectedWORK, 1 ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function multiplies a general matrix by the orthogonal matrix from a LQ factorization (offset, right, row-major, trans)', function test( t ) { + var expectedWORK; + var expectedC; + var info; + var data; + var WORK; + var TAU; + var A; + var C; + + data = OFF_TRANS_RIGHT; + + A = new Float64Array( data.A ); + TAU = new Float64Array( data.TAU ); + C = new Float64Array( data.C ); + WORK = new Float64Array( data.WORK ); + + expectedC = new Float64Array( data.C_out ); + expectedWORK = new Float64Array( data.WORK_out ); + + info = dorml2( data.side, data.trans, data.M, data.N, data.K, A, data.strideA1, data.strideA2, data.offsetA, TAU, data.strideTAU, data.offsetTAU, C, data.strideC1, data.strideC2, data.offsetC, WORK, data.strideWORK, data.offsetWORK ); + t.strictEqual( info, 0, 'returns expected value' ); + t.strictEqual( isAlmostEqual( C, expectedC, 1 ), true, 'returns expected value' ); + t.strictEqual( isAlmostEqual( WORK, expectedWORK, 1 ), true, 'returns expected value' ); + t.end(); +}); From ac0a9a83330099cb046f58672fb2efe514085099 Mon Sep 17 00:00:00 2001 From: Prajjwal Bajpai Date: Wed, 3 Jun 2026 23:45:37 +0530 Subject: [PATCH 3/3] chore: add docs and update implementation --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown_pkg_readmes status: passed - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: passed - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: passed - task: lint_license_headers status: passed --- --- .../@stdlib/lapack/base/dorml2/README.md | 319 ++++++++++ .../@stdlib/lapack/base/dorml2/docs/repl.txt | 174 ++++++ .../lapack/base/dorml2/docs/types/index.d.ts | 200 ++++++ .../lapack/base/dorml2/docs/types/test.ts | 582 ++++++++++++++++++ .../lapack/base/dorml2/examples/index.js | 67 ++ .../@stdlib/lapack/base/dorml2/lib/dorml2.js | 12 +- .../base/dorml2/test/fixtures/left_row.json | 4 +- .../base/dorml2/test/fixtures/right_row.json | 4 +- .../base/dorml2/test/fixtures/trans_left.json | 4 +- .../dorml2/test/fixtures/trans_right.json | 4 +- .../lapack/base/dorml2/test/test.dorml2.js | 4 +- 11 files changed, 1356 insertions(+), 18 deletions(-) create mode 100644 lib/node_modules/@stdlib/lapack/base/dorml2/README.md create mode 100644 lib/node_modules/@stdlib/lapack/base/dorml2/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/lapack/base/dorml2/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/lapack/base/dorml2/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/lapack/base/dorml2/examples/index.js diff --git a/lib/node_modules/@stdlib/lapack/base/dorml2/README.md b/lib/node_modules/@stdlib/lapack/base/dorml2/README.md new file mode 100644 index 000000000000..933dc1659871 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorml2/README.md @@ -0,0 +1,319 @@ + + +# dorml2 + +> Multiply a general matrix by the orthogonal matrix from a LQ factorization determined by `DGELQF`. + +
+ +A **Householder transformation** (or an **elementary reflector**) is a linear transformation which describes a reflection about a plane or a hyperplane containing the origin. + +`DORML2` multiplies a general real matrix `C` by the orthogonal matrix `Q` generated by `DGELQF`/`DGELQ2`. The matrix `Q` is defined as the product of `K` elementary reflectors, `Q = H(K) . . . H(2) H(1)`. + +
+ + + +
+ +## Usage + +```javascript +var dorml2 = require( '@stdlib/lapack/base/dorml2' ); +``` + +#### dorml2( order, side, trans, M, N, K, A, LDA, TAU, C, LDC, WORK ) + +Multiplies a general matrix by the orthogonal matrix from an LQ factorization determined by `DGELQF`(unblocked algorithm). + + + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); + +var A = new Float64Array( [ 1, 0 ] ); +var TAU = new Float64Array( [ 2 ] ); +var C = new Float64Array( [ 1, 3, 5, 2, 4, 6 ] ); +var WORK = new Float64Array( 3 ); + +var info = dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A, 1, TAU, C, 2, WORK ); +// returns 0 +// C => [ -1, -3, -5, 2, 4, 6 ] +// WORK => [ 1, 3, 5 ] +``` + +The function has the following parameters: + +- **order**: storage layout. +- **side**: specifies the side of multiplication with `C`. +- **trans**: `'no-transpose'` for `Q`, `'transpose'` for `Q^T`. +- **M**: number of rows of `C`. +- **N**: number of columns of `C`. +- **K**: number of elementary reflectors. +- **A**: reflector vectors from `DGELQ2`, stored in linear memory as a [`Float64Array`][mdn-float64array]. +- **LDA**: stride of the first dimension of `A` (a.k.a., leading dimension of `A`). +- **TAU**: scalar factors of reflectors as a [`Float64Array`][mdn-float64array]. +- **C**: input/output matrix as a [`Float64Array`][mdn-float64array]. +- **LDC**: stride of the first dimension of `C` (a.k.a., leading dimension of `C`). +- **WORK**: workspace as a [`Float64Array`][mdn-float64array]. + +On entry, the first `K` rows of `A` must contain the vectors which define the elementary reflectors `H(i)` returned by `DGELQF`. + +On exit, `C` contains the matrix after multiplication by `Q` or `Q^T`, where: + +- `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'` + +The size of `WORK` should be at least `M` if `SIDE = 'right'` and at least `N` if `SIDE = 'left'`. + + + +#### dorml2.ndarray( side, trans, M, N, K, A, sa1, sa2, oa, TAU, st, ot, C, sc1, sc2, oc, WORK, sw, ow ) + + + +Multiplies a general matrix by the orthogonal matrix from an LQ factorization determined by `DGELQF`/`DGELQ2` using alternative indexing semantics. + + +Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views. + + + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); + +// Initial arrays... +var A0 = new Float64Array( 13 ); +var TAU0 = new Float64Array( 3 ); +var C0 = new Float64Array( 7 ); +var WORK0 = new Float64Array( 4 ); + +// Create offset views... +var A1 = new Float64Array( A0.buffer, A0.BYTES_PER_ELEMENT*1 ); // start at 2nd element +var TAU1 = new Float64Array( TAU0.buffer, TAU0.BYTES_PER_ELEMENT*1 ); // start at 2nd element +var C1 = new Float64Array( C0.buffer, C0.BYTES_PER_ELEMENT*1 ); // start at 2nd element +var WORK1 = new Float64Array( WORK0.buffer, WORK0.BYTES_PER_ELEMENT*1 ); // start at 2nd element + +var info = dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A1, 2, TAU1, C1, 2, WORK1 ); +// returns 0 +// C => [ 0, -1, -3, -5, 2, 4, 6 ] +// WORK => [ 0, 1, 3, 5 ] +``` + + + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); + +var A = new Float64Array( [ 1, 0 ] ); +var TAU = new Float64Array( [ 2 ] ); +var C = new Float64Array( [ 1, 3, 5, 2, 4, 6 ] ); +var WORK = new Float64Array( 3 ); + +var info = dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 1, 1, 0, TAU, 1, 0, C, 1, 2, 0, WORK, 1, 0 ); +// returns 0 +// C => [ -1, -3, -5, 2, 4, 6 ] +// WORK => [ 1, 3, 5 ] +``` + +The function has the following additional parameters: + +- **sa1**: stride of the first dimension of `A`. +- **sa2**: stride of the second dimension of `A`. +- **oa**: starting index for `A`. +- **st**: stride for `TAU`. +- **ot**: starting index for `TAU`. +- **sc1**: stride of the first dimension of `C`. +- **sc2**: stride of the second dimension of `C`. +- **oc**: starting index for `C`. +- **sw**: stride for `WORK`. +- **ow**: starting index for `WORK`. + +
+ + + +
+ +## Notes + +- `dorml2()` corresponds to the [LAPACK][lapack] routine [`dorml2`][lapack-dorml2]. +- The matrix `A` is overwritten in-place. +- `Q` is of order `M` if `SIDE = 'left'` and of order `N` if `SIDE = 'right'`. + +
+ + + +
+ +## Examples + + + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); +var ndarray2array = require( '@stdlib/ndarray/base/to-array' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var dorml2 = require( '@stdlib/lapack/base/dorml2' ); + +// Specify matrix meta data for C (M x N): +var shapeC = [ 3, 2 ]; +var order = 'row-major'; +var stridesC = shape2strides( shapeC, order ); + +// Specify matrix meta data for A (K x M for 'left' multiplication): +var shapeA = [ 2, 3 ]; +var stridesA = shape2strides( shapeA, order ); + +// The matrix A contains reflector data from DGELQ2: +var A = new Float64Array( [ 1.0, 0.2, -0.4, 0.0, 1.0, 0.3 ] ); + +// Scalar factors of the reflectors: +var TAU = new Float64Array( [ 0.75, 0.50 ] ); + +// The matrix C to be multiplied: +var C = new Float64Array( [ 1.0, -1.0, 2.0, -2.0, 3.0, -3.0 ] ); + +console.log( 'C (unmodified):', ndarray2array( C, shapeC, stridesC, 0, order ) ); + +// When side='left', WORK length should be at least N (columns of C). +var work = new Float64Array( shapeC[ 1 ] ); + +// Multiply C by Q from the left (Q * C) in-place: +dorml2( order, 'left', 'no-transpose', shapeC[ 0 ], shapeC[ 1 ], shapeA[ 0 ], A, stridesA[ 0 ], TAU, C, stridesC[ 0 ], work ); + +console.log( 'C (Q * C):', ndarray2array( C, shapeC, stridesC, 0, order ) ); +console.log( 'WORK:', work ); + +// Re-initialize arrays for the alternative interface +A = new Float64Array( [ 1.0, 0.2, -0.4, 0.0, 1.0, 0.3 ] ); +TAU = new Float64Array( [ 0.75, 0.50 ] ); +C = new Float64Array( [ 1.0, -1.0, 2.0, -2.0, 3.0, -3.0 ] ); + +// Re-initialize workspace: +work = new Float64Array( shapeC[ 1 ] ); + +// Multiply C by Q^T from the left (Q^T * C) in-place using ndarray interface: +dorml2.ndarray( 'left', 'transpose', shapeC[ 0 ], shapeC[ 1 ], shapeA[ 0 ], A, stridesA[ 0 ], stridesA[ 1 ], 0, TAU, 1, 0, C, stridesC[ 0 ], stridesC[ 1 ], 0, work, 1, 0 ); + +console.log( 'C (Q^T * C):', ndarray2array( C, shapeC, stridesC, 0, order ) ); +console.log( 'WORK:', work ); +``` + +
+ + + + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +TODO +``` + +#### TODO + +TODO. + +```c +TODO +``` + +TODO + +```c +TODO +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +TODO +``` + +
+ + + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/lapack/base/dorml2/docs/repl.txt b/lib/node_modules/@stdlib/lapack/base/dorml2/docs/repl.txt new file mode 100644 index 000000000000..bd5b457d6ac9 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorml2/docs/repl.txt @@ -0,0 +1,174 @@ + +{{alias}}( order, side, trans, M, N, K, A, LDA, TAU, C, LDC, WORK ) + Multiplies a general matrix by the orthogonal matrix from an LQ + factorization determined by `DGELQF`. + + - `Q` is a real orthogonal matrix defined as the product of `K` elementary + reflectors, `Q = H(K) ... H(2) H(1)`, as returned by `DGELQF`. + + - `Q` is of order `M` if `SIDE = 'left'` and of order `N` if + `SIDE = 'right'`. + + - `DORML2` 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'` + + Parameters + ---------- + order: string + Storage layout. + + side: string + Specifies the side of multiplication with `C`. + + trans: string + Specifies whether to apply `Q` or `Q^T`. + + M: integer + Number of rows in `C`. + + N: integer + Number of columns in `C`. + + K: integer + Number of elementary reflectors. + + A: Float64Array + Input matrix. + + LDA: integer + Stride of the first dimension of `A` (a.k.a., leading dimension + of the matrix `A`). + + TAU: Float64Array + Scalar factors of reflectors. + + C: Float64Array + Input/output matrix. + + LDC: integer + Stride of the first dimension of `C` (a.k.a., leading dimension + of the matrix `C`). + + WORK: Float64Array + Workspace array. + + Returns + ------- + info: integer + Status code. + + Examples + -------- + > var A = new {{alias:@stdlib/array/float64}}( [ 1, 0 ] ); + > var T = new {{alias:@stdlib/array/float64}}( [ 2 ] ); + > var C = new {{alias:@stdlib/array/float64}}( [ 1, 3, 5, 2, 4, 6 ] ); + > var W = new {{alias:@stdlib/array/float64}}( 3 ); + > {{alias}}('row-major','left','no-transpose',2,3,1,A,1,T,C,2,W ) + 0 + > C + [ -1, -3, -5, 2, 4, 6 ] + > W + [ 1, 3, 5 ] + + +{{alias}}.ndarray(side,trans,M,N,K,A,sa1,sa2,oa,TAU,st,ot,C,sc1,sc2,oc,W,sw,ow) + Multiplies a general matrix by the orthogonal matrix from an LQ + factorization determined by `DGELQF` using alternative indexing semantics. + + - `Q` is a real orthogonal matrix defined as the product of `K` elementary + reflectors, `Q = H(K) ... H(2) H(1)`, as returned by `DGELQF`. + + - `Q` is of order `M` if `SIDE = 'left'` and of order `N` if + `SIDE = 'right'`. + + - `DORML2` 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'` + + Parameters + ---------- + side: string + Specifies the side of multiplication with `C`. + + trans: string + Specifies whether to apply `Q` or `Q^T`. + + M: integer + Number of rows in `C`. + + N: integer + Number of columns in `C`. + + K: integer + Number of elementary reflectors. + + A: Float64Array + Input matrix. + + sa1: integer + Stride of the first dimension of `A`. + + sa2: integer + Stride of the second dimension of `A`. + + oa: integer + Starting index for `A`. + + TAU: Float64Array + Scalar factors of reflectors. + + st: integer + Stride for `TAU`. + + ot: integer + Starting index for `TAU`. + + C: Float64Array + Input/output matrix. + + sc1: integer + Stride of the first dimension of `C`. + + sc2: integer + Stride of the second dimension of `C`. + + oc: integer + Starting index for `C`. + + W: Float64Array + Workspace array. + + sw: integer + Stride for `WORK`. + + ow: integer + Starting index for `WORK`. + + Returns + ------- + info: integer + Status code. + + Examples + -------- + > var A = new {{alias:@stdlib/array/float64}}( [ 1, 0 ] ); + > var T = new {{alias:@stdlib/array/float64}}( [ 2 ] ); + > var C = new {{alias:@stdlib/array/float64}}( [ 1, 3, 5, 2, 4, 6 ] ); + > var W = new {{alias:@stdlib/array/float64}}( 3 ); + > {{alias}}.ndarray('left','no-transpose',2,3,1,A,2,1,0,T,1,0,C,3,1,0,W,1,0) + 0 + > C + [ -1, -3, -5, 2, 4, 6 ] + > W + [ 1, 3, 5 ] + + + See Also + -------- diff --git a/lib/node_modules/@stdlib/lapack/base/dorml2/docs/types/index.d.ts b/lib/node_modules/@stdlib/lapack/base/dorml2/docs/types/index.d.ts new file mode 100644 index 000000000000..93008533d1ca --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorml2/docs/types/index.d.ts @@ -0,0 +1,200 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/// + +import { Layout } from '@stdlib/types/blas'; + +/** +* Interface describing `dorml2`. +*/ +interface Routine { + /** + * Multiplies a general matrix by the orthogonal matrix from an LQ factorization determined by DGELQF/DGELQ2. + * + * ## Notes + * + * - Q is a real orthogonal matrix defined as the product of K elementary reflectors, Q = H(K) ... H(2) H(1), as returned by `DGELQF`. + * + * - Q is of order M if SIDE = 'left' and of order N if SIDE = 'right'. + * + * - DORML2 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' + * + * - On entry, the i-th row of A must contain the vector which defines the elementary reflector H(i), for i = 1, 2, ..., K, as returned by `DGELQF` in the first K rows of its array argument A. + * + * - On exit, C contains the M-by-N matrix after multiplication by Q or Q^T. + * + * @param order - storage layout + * @param side - specifies the side of multiplication with C + * @param trans - specifies whether to apply Q or Q^T + * @param M - number of rows of C + * @param N - number of columns of C + * @param K - number of elementary reflectors + * @param A - input matrix + * @param LDA - stride of the first dimension of `A` (a.k.a. leading dimension of the matrix `A`) + * @param TAU - scalar factors of reflectors + * @param C - input/output matrix + * @param LDC - stride of the first dimension of `C` (a.k.a. leading dimension of the matrix `C`) + * @param WORK - workspace + * @returns status code (0 = success) + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * var A = new Float64Array( [ 1, 0 ] ); + * var TAU = new Float64Array( [ 2 ] ); + * var C = new Float64Array( [ 1, 3, 5, 2, 4, 6 ] ); + * var WORK = new Float64Array( 3 ); + * + * var info = dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A, 1, TAU, C, 2, WORK ); + * // returns 0 + * // C => [ -1, -3, -5, 2, 4, 6 ] + * // WORK => [ 1, 3, 5 ] + */ + ( order: Layout, side: string, trans: string, M: number, N: number, K: number, A: Float64Array, LDA: number, TAU: Float64Array, C: Float64Array, LDC: number, WORK: Float64Array ): number; + + /** + * Multiplies a general matrix by the orthogonal matrix from an LQ factorization determined by DGELQF/DGELQ2 using alternative indexing semantics. + * + * ## Notes + * + * - Q is a real orthogonal matrix defined as the product of K elementary reflectors, Q = H(K) ... H(2) H(1), as returned by `DGELQF`. + * + * - Q is of order M if SIDE = 'left' and of order N if SIDE = 'right'. + * + * - DORML2 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' + * + * - On entry, the i-th row of A must contain the vector which defines the elementary reflector H(i), for i = 1, 2, ..., K, as returned by `DGELQF` in the first K rows of its array argument A. + * + * - On exit, C contains the M-by-N matrix after multiplication by Q or Q^T. + * + * @param side - specifies the side of multiplication with C + * @param trans - specifies whether to apply Q or Q^T + * @param M - number of rows of C + * @param N - number of columns of C + * @param K - number of elementary reflectors + * @param A - input matrix + * @param strideA1 - stride of the first dimension of A + * @param strideA2 - stride of the second dimension of A + * @param offsetA - starting index for A + * @param TAU - scalar factors of reflectors + * @param strideTAU - stride for TAU + * @param offsetTAU - starting index for TAU + * @param C - input/output matrix + * @param strideC1 - stride of the first dimension of C + * @param strideC2 - stride of the second dimension of C + * @param offsetC - starting index for C + * @param WORK - workspace + * @param strideWORK - stride for WORK + * @param offsetWORK - starting index for WORK + * @returns status code (0 = success) + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * var A = new Float64Array( [ 1, 0 ] ); + * var TAU = new Float64Array( [ 2 ] ); + * var C = new Float64Array( [ 1, 3, 5, 2, 4, 6 ] ); + * var WORK = new Float64Array( 3 ); + * + * var info = dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 1, 1, 0, TAU, 1, 0, C, 1, 2, 0, WORK, 1, 0 ); + * // returns 0 + * // C => [ -1, -3, -5, 2, 4, 6 ] + * // WORK => [ 1, 3, 5 ] + */ + ndarray( side: string, trans: string, 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 ): number; +} + +/** +* Multiplies a general matrix by the orthogonal matrix from an LQ factorization determined by DGELQF/DGELQ2. +* +* ## Notes +* +* - Q is a real orthogonal matrix defined as the product of K elementary reflectors, Q = H(K) ... H(2) H(1), as returned by `DGELQF`. +* +* - Q is of order M if SIDE = 'left' and of order N if SIDE = 'right'. +* +* - DORML2 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' +* +* - On entry, the i-th row of A must contain the vector which defines the elementary reflector H(i), for i = 1, 2, ..., K, as returned by `DGELQF` in the first K rows of its array argument A. +* +* - On exit, C contains the M-by-N matrix after multiplication by Q or Q^T. +* +* @param order - storage layout +* @param side - specifies the side of multiplication with C +* @param trans - specifies whether to apply Q or Q^T +* @param M - number of rows of C +* @param N - number of columns of C +* @param K - number of elementary reflectors +* @param A - input matrix +* @param LDA - stride of the first dimension of `A` (a.k.a. leading dimension of the matrix `A`) +* @param TAU - scalar factors of reflectors +* @param C - input/output matrix +* @param LDC - stride of the first dimension of `C` (a.k.a. leading dimension of the matrix `C`) +* @param WORK - workspace +* @returns status code (0 = success) +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( [ 1, 0 ] ); +* var TAU = new Float64Array( [ 2 ] ); +* var C = new Float64Array( [ 1, 3, 5, 2, 4, 6 ] ); +* var WORK = new Float64Array( 3 ); +* +* var info = dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A, 1, TAU, C, 2, WORK ); +* // returns 0 +* // C => [ -1, -3, -5, 2, 4, 6 ] +* // WORK => [ 1, 3, 5 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( [ 1, 0 ] ); +* var TAU = new Float64Array( [ 2 ] ); +* var C = new Float64Array( [ 1, 3, 5, 2, 4, 6 ] ); +* var WORK = new Float64Array( 3 ); +* +* var info = dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 1, 1, 0, TAU, 1, 0, C, 1, 2, 0, WORK, 1, 0 ); +* // returns 0 +* // C => [ -1, -3, -5, 2, 4, 6 ] +* // WORK => [ 1, 3, 5 ] +*/ +declare var dorml2: Routine; + + +// EXPORTS // + +export = dorml2; diff --git a/lib/node_modules/@stdlib/lapack/base/dorml2/docs/types/test.ts b/lib/node_modules/@stdlib/lapack/base/dorml2/docs/types/test.ts new file mode 100644 index 000000000000..5299ee93b56e --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorml2/docs/types/test.ts @@ -0,0 +1,582 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import dorml2 = require( './index' ); + + +// TESTS // + +// The function returns a number... +{ + const A = new Float64Array( 12 ); + const TAU = new Float64Array( 2 ); + const C = new Float64Array( 6 ); + const work = new Float64Array( 3 ); + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A, 1, TAU, C, 2, work ); // $ExpectType number +} + +// The compiler throws an error if the function is provided a first argument which is not a valid layout... +{ + const A = new Float64Array( 12 ); + const TAU = new Float64Array( 2 ); + const C = new Float64Array( 6 ); + const work = new Float64Array( 3 ); + dorml2( 5, 'left', 'no-transpose', 2, 3, 1, A, 1, TAU, C, 2, work ); // $ExpectError + dorml2( true, 'left', 'no-transpose', 2, 3, 1, A, 1, TAU, C, 2, work ); // $ExpectError + dorml2( false, 'left', 'no-transpose', 2, 3, 1, A, 1, TAU, C, 2, work ); // $ExpectError + dorml2( null, 'left', 'no-transpose', 2, 3, 1, A, 1, TAU, C, 2, work ); // $ExpectError + dorml2( void 0, 'left', 'no-transpose', 2, 3, 1, A, 1, TAU, C, 2, work ); // $ExpectError + dorml2( [], 'left', 'no-transpose', 2, 3, 1, A, 1, TAU, C, 2, work ); // $ExpectError + dorml2( {}, 'left', 'no-transpose', 2, 3, 1, A, 1, TAU, C, 2, work ); // $ExpectError + dorml2( ( x: number ): number => x, 'left', 'no-transpose', 2, 3, 1, A, 1, TAU, C, 2, work ); // $ExpectError +} + +// The compiler throws an error if the function is provided a second argument which is not a valid side... +{ + const A = new Float64Array( 12 ); + const TAU = new Float64Array( 2 ); + const C = new Float64Array( 6 ); + const work = new Float64Array( 3 ); + dorml2( 'row-major', 5, 'no-transpose', 2, 3, 1, A, 1, TAU, C, 2, work ); // $ExpectError + dorml2( 'row-major', true, 'no-transpose', 2, 3, 1, A, 1, TAU, C, 2, work ); // $ExpectError + dorml2( 'row-major', false, 'no-transpose', 2, 3, 1, A, 1, TAU, C, 2, work ); // $ExpectError + dorml2( 'row-major', null, 'no-transpose', 2, 3, 1, A, 1, TAU, C, 2, work ); // $ExpectError + dorml2( 'row-major', void 0, 'no-transpose', 2, 3, 1, A, 1, TAU, C, 2, work ); // $ExpectError + dorml2( 'row-major', [], 'no-transpose', 2, 3, 1, A, 1, TAU, C, 2, work ); // $ExpectError + dorml2( 'row-major', {}, 'no-transpose', 2, 3, 1, A, 1, TAU, C, 2, work ); // $ExpectError + dorml2( 'row-major', ( x: number ): number => x, 'no-transpose', 2, 3, 1, A, 1, TAU, C, 2, work ); // $ExpectError +} + +// The compiler throws an error if the function is provided a third argument which is not a valid transpose operation... +{ + const A = new Float64Array( 12 ); + const TAU = new Float64Array( 2 ); + const C = new Float64Array( 6 ); + const work = new Float64Array( 3 ); + dorml2( 'row-major', 'left', true, 2, 3, 1, A, 1, TAU, C, 2, work ); // $ExpectError + dorml2( 'row-major', 'left', false, 2, 3, 1, A, 1, TAU, C, 2, work ); // $ExpectError + dorml2( 'row-major', 'left', null, 2, 3, 1, A, 1, TAU, C, 2, work ); // $ExpectError + dorml2( 'row-major', 'left', void 0, 2, 3, 1, A, 1, TAU, C, 2, work ); // $ExpectError + dorml2( 'row-major', 'left', [], 2, 3, 1, A, 1, TAU, C, 2, work ); // $ExpectError + dorml2( 'row-major', 'left', {}, 2, 3, 1, A, 1, TAU, C, 2, work ); // $ExpectError + dorml2( 'row-major', 'left', ( x: number ): number => x, 2, 3, 1, A, 1, TAU, C, 2, work ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fourth argument which is not a number... +{ + const A = new Float64Array( 12 ); + const TAU = new Float64Array( 2 ); + const C = new Float64Array( 6 ); + const work = new Float64Array( 3 ); + dorml2( 'row-major', 'left', 'no-transpose', '2', 3, 1, A, 1, TAU, C, 2, work ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', true, 3, 1, A, 1, TAU, C, 2, work ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', false, 3, 1, A, 1, TAU, C, 2, work ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', null, 3, 1, A, 1, TAU, C, 2, work ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', void 0, 3, 1, A, 1, TAU, C, 2, work ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', [], 3, 1, A, 1, TAU, C, 2, work ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', {}, 3, 1, A, 1, TAU, C, 2, work ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', ( x: number ): number => x, 3, 1, A, 1, TAU, C, 2, work ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fifth argument which is not a number... +{ + const A = new Float64Array( 12 ); + const TAU = new Float64Array( 2 ); + const C = new Float64Array( 6 ); + const work = new Float64Array( 3 ); + dorml2( 'row-major', 'left', 'no-transpose', 2, '3', 1, A, 1, TAU, C, 2, work ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, true, 1, A, 1, TAU, C, 2, work ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, false, 1, A, 1, TAU, C, 2, work ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, null, 1, A, 1, TAU, C, 2, work ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, void 0, 1, A, 1, TAU, C, 2, work ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, [], 1, A, 1, TAU, C, 2, work ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, {}, 1, A, 1, TAU, C, 2, work ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, ( x: number ): number => x, 1, A, 1, TAU, C, 2, work ); // $ExpectError +} + +// The compiler throws an error if the function is provided a sixth argument which is not a number... +{ + const A = new Float64Array( 12 ); + const TAU = new Float64Array( 2 ); + const C = new Float64Array( 6 ); + const work = new Float64Array( 3 ); + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, '1', A, 1, TAU, C, 2, work ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, true, A, 1, TAU, C, 2, work ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, false, A, 1, TAU, C, 2, work ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, null, A, 1, TAU, C, 2, work ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, void 0, A, 1, TAU, C, 2, work ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, [], A, 1, TAU, C, 2, work ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, {}, A, 1, TAU, C, 2, work ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, ( x: number ): number => x, A, 1, TAU, C, 2, work ); // $ExpectError +} + +// The compiler throws an error if the function is provided a seventh argument which is not a Float64Array... +{ + const TAU = new Float64Array( 2 ); + const C = new Float64Array( 6 ); + const work = new Float64Array( 3 ); + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, '5', 1, TAU, C, 2, work ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, 5, 1, TAU, C, 2, work ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, true, 1, TAU, C, 2, work ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, false, 1, TAU, C, 2, work ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, null, 1, TAU, C, 2, work ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, void 0, 1, TAU, C, 2, work ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, [], 1, TAU, C, 2, work ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, {}, 1, TAU, C, 2, work ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, ( x: number ): number => x, 1, TAU, C, 2, work ); // $ExpectError +} + +// The compiler throws an error if the function is provided an eighth argument which is not a number... +{ + const A = new Float64Array( 12 ); + const TAU = new Float64Array( 2 ); + const C = new Float64Array( 6 ); + const work = new Float64Array( 3 ); + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A, '1', TAU, C, 2, work ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A, true, TAU, C, 2, work ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A, false, TAU, C, 2, work ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A, null, TAU, C, 2, work ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A, void 0, TAU, C, 2, work ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A, [], TAU, C, 2, work ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A, {}, TAU, C, 2, work ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A, ( x: number ): number => x, TAU, C, 2, work ); // $ExpectError +} + +// The compiler throws an error if the function is provided a ninth argument which is not a Float64Array... +{ + const A = new Float64Array( 12 ); + const C = new Float64Array( 6 ); + const work = new Float64Array( 3 ); + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A, 1, '5', C, 2, work ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A, 1, 5, C, 2, work ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A, 1, true, C, 2, work ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A, 1, false, C, 2, work ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A, 1, null, C, 2, work ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A, 1, void 0, C, 2, work ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A, 1, [], C, 2, work ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A, 1, {}, C, 2, work ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A, 1, ( x: number ): number => x, C, 2, work ); // $ExpectError +} + +// The compiler throws an error if the function is provided a tenth argument which is not a Float64Array... +{ + const A = new Float64Array( 12 ); + const TAU = new Float64Array( 2 ); + const work = new Float64Array( 3 ); + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A, 1, TAU, '5', 2, work ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A, 1, TAU, 5, 2, work ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A, 1, TAU, true, 2, work ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A, 1, TAU, false, 2, work ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A, 1, TAU, null, 2, work ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A, 1, TAU, void 0, 2, work ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A, 1, TAU, [], 2, work ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A, 1, TAU, {}, 2, work ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A, 1, TAU, ( x: number ): number => x, 2, work ); // $ExpectError +} + +// The compiler throws an error if the function is provided an eleventh argument which is not a number... +{ + const A = new Float64Array( 12 ); + const TAU = new Float64Array( 2 ); + const C = new Float64Array( 6 ); + const work = new Float64Array( 3 ); + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A, 1, TAU, C, '2', work ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A, 1, TAU, C, true, work ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A, 1, TAU, C, false, work ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A, 1, TAU, C, null, work ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A, 1, TAU, C, void 0, work ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A, 1, TAU, C, [], work ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A, 1, TAU, C, {}, work ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A, 1, 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( 12 ); + const TAU = new Float64Array( 2 ); + const C = new Float64Array( 6 ); + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A, 1, TAU, C, 2, 'work' ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A, 1, TAU, C, 2, 5 ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A, 1, TAU, C, 2, true ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A, 1, TAU, C, 2, false ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A, 1, TAU, C, 2, null ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A, 1, TAU, C, 2, void 0 ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A, 1, TAU, C, 2, [] ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A, 1, TAU, C, 2, {} ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A, 1, TAU, C, 2, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + const A = new Float64Array( 12 ); + const TAU = new Float64Array( 2 ); + const C = new Float64Array( 6 ); + const work = new Float64Array( 3 ); + dorml2(); // $ExpectError + dorml2( 'row-major' ); // $ExpectError + dorml2( 'row-major', 'left' ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose' ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2 ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3 ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1 ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A, 1 ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A, 1, TAU ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A, 1, TAU, C ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A, 1, TAU, C, 2 ); // $ExpectError + dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A, 1, TAU, C, 2, work, 10 ); // $ExpectError +} + +// Attached to main export is an `ndarray` method which returns a number... +{ + const A = new Float64Array( 12 ); + const TAU = new Float64Array( 2 ); + const C = new Float64Array( 6 ); + const work = new Float64Array( 3 ); + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectType number +} + +// The compiler throws an error if the `ndarray` method is provided a first argument which is not a valid side... +{ + const A = new Float64Array( 12 ); + const TAU = new Float64Array( 2 ); + const C = new Float64Array( 6 ); + const work = new Float64Array( 3 ); + dorml2.ndarray( 5, 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( true, 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( false, 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( null, 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( void 0, 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( [], 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( {}, 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( ( x: number ): number => x, 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a second argument which is not a valid transpose operation... +{ + const A = new Float64Array( 12 ); + const TAU = new Float64Array( 2 ); + const C = new Float64Array( 6 ); + const work = new Float64Array( 3 ); + dorml2.ndarray( 'left', 5, 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', true, 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', false, 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', null, 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', void 0, 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', [], 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', {}, 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', ( x: number ): number => x, 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a third argument which is not a number... +{ + const A = new Float64Array( 12 ); + const TAU = new Float64Array( 2 ); + const C = new Float64Array( 6 ); + const work = new Float64Array( 3 ); + dorml2.ndarray( 'left', 'no-transpose', '2', 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', true, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', false, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', null, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', void 0, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', [], 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', {}, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', ( x: number ): number => x, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a fourth argument which is not a number... +{ + const TAU = new Float64Array( 2 ); + const C = new Float64Array( 6 ); + const work = new Float64Array( 3 ); + dorml2.ndarray( 'left', 'no-transpose', 2, '3', 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, true, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, false, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, null, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, void 0, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, [], 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, {}, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, ( x: number ): number => x, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a fifth argument which is not a number... +{ + const A = new Float64Array( 12 ); + const TAU = new Float64Array( 2 ); + const C = new Float64Array( 6 ); + const work = new Float64Array( 3 ); + dorml2.ndarray( 'left', 'no-transpose', 2, 3, '1', A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, true, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, false, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, null, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, void 0, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, [], A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, {}, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, ( x: number ): number => x, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a sixth argument which is not a Float64Array... +{ + const TAU = new Float64Array( 2 ); + const C = new Float64Array( 6 ); + const work = new Float64Array( 3 ); + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, '5', 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, 5, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, true, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, false, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, null, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, void 0, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, [], 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, {}, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, ( x: number ): number => x, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a seventh argument which is not a number... +{ + const A = new Float64Array( 12 ); + const TAU = new Float64Array( 2 ); + const C = new Float64Array( 6 ); + const work = new Float64Array( 3 ); + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, '2', 1, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, true, 1, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, false, 1, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, null, 1, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, void 0, 1, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, [], 1, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, {}, 1, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, 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 `ndarray` method is provided an eighth argument which is not a number... +{ + const A = new Float64Array( 12 ); + const TAU = new Float64Array( 2 ); + const C = new Float64Array( 6 ); + const work = new Float64Array( 3 ); + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, '1', 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, true, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, false, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, null, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, void 0, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, [], 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, {}, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, ( x: number ): number => x, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a ninth argument which is not a number... +{ + const A = new Float64Array( 12 ); + const TAU = new Float64Array( 2 ); + const C = new Float64Array( 6 ); + const work = new Float64Array( 3 ); + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, '0', TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, true, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, false, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, null, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, void 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, [], TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, {}, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, ( x: number ): number => x, TAU, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a tenth argument which is not a Float64Array... +{ + const A = new Float64Array( 12 ); + const work = new Float64Array( 3 ); + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, '5', 1, 0, work, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, 5, 1, 0, work, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, true, 1, 0, work, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, false, 1, 0, work, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, null, 1, 0, work, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, void 0, 1, 0, work, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, [], 1, 0, work, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, {}, 1, 0, work, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, ( x: number ): number => x, 1, 0, work, 3, 1, 0, work, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided an eleventh argument which is not a number... +{ + const A = new Float64Array( 12 ); + const TAU = new Float64Array( 2 ); + const C = new Float64Array( 6 ); + const work = new Float64Array( 3 ); + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, '1', 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, true, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, false, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, null, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, void 0, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, [], 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, {}, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, ( x: number ): number => x, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a twelfth argument which is not a number... +{ + const A = new Float64Array( 12 ); + const TAU = new Float64Array( 2 ); + const C = new Float64Array( 6 ); + const work = new Float64Array( 3 ); + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, '0', C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, true, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, false, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, null, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, void 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, [], C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, {}, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, ( x: number ): number => x, C, 3, 1, 0, work, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a thirteenth argument which is not a Float64Array... +{ + const A = new Float64Array( 12 ); + const TAU = new Float64Array( 2 ); + const work = new Float64Array( 3 ); + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, '5', 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, 5, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, true, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, false, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, null, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, void 0, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, [], 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, {}, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, ( x: number ): number => x, 3, 1, 0, work, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a fourteenth argument which is not a number... +{ + const A = new Float64Array( 12 ); + const TAU = new Float64Array( 2 ); + const C = new Float64Array( 6 ); + const work = new Float64Array( 3 ); + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, '3', 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, true, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, false, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, null, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, void 0, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, [], 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, {}, 1, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, ( x: number ): number => x, 1, 0, work, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a fifteenth argument which is not a number... +{ + const A = new Float64Array( 12 ); + const TAU = new Float64Array( 2 ); + const C = new Float64Array( 6 ); + const work = new Float64Array( 3 ); + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, '1', 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, true, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, false, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, null, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, void 0, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, [], 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, {}, 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, ( x: number ): number => x, 0, work, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a sixteenth argument which is not a number... +{ + const A = new Float64Array( 12 ); + const TAU = new Float64Array( 2 ); + const C = new Float64Array( 6 ); + const work = new Float64Array( 3 ); + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, '0', work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, true, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, false, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, null, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, void 0, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, [], work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, {}, work, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, ( x: number ): number => x, work, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a seventeenth argument which is not a Float64Array... +{ + const A = new Float64Array( 12 ); + const TAU = new Float64Array( 2 ); + const C = new Float64Array( 6 ); + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, 'work', 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, 5, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, true, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, false, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, null, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, void 0, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, [], 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, {}, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, ( x: number ): number => x, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a eighteenth argument which is not a number... +{ + const A = new Float64Array( 12 ); + const TAU = new Float64Array( 2 ); + const C = new Float64Array( 6 ); + const work = new Float64Array( 3 ); + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, work, '0', 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, work, true, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, work, false, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, work, null, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, work, void 0, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, work, [], 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, work, {}, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, work, ( x: number ): number => x, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a ninteenth argument which is not a number... +{ + const A = new Float64Array( 12 ); + const TAU = new Float64Array( 2 ); + const C = new Float64Array( 6 ); + const work = new Float64Array( 3 ); + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, work, 1, '0' ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, work, 1, true ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, work, 1, false ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, work, 1, null ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, work, 1, void 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, work, 1, [] ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, work, 1, {} ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 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( 12 ); + const TAU = new Float64Array( 2 ); + const C = new Float64Array( 6 ); + const work = new Float64Array( 3 ); + dorml2.ndarray(); // $ExpectError + dorml2.ndarray( 'left' ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose' ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, work ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, work, 1 ); // $ExpectError + dorml2.ndarray( 'left', 'no-transpose', 2, 3, 1, A, 2, 1, 0, TAU, 1, 0, C, 3, 1, 0, work, 1, 0, 10 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorml2/examples/index.js b/lib/node_modules/@stdlib/lapack/base/dorml2/examples/index.js new file mode 100644 index 000000000000..4cf367130ec0 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorml2/examples/index.js @@ -0,0 +1,67 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var Float64Array = require( '@stdlib/array/float64' ); +var ndarray2array = require( '@stdlib/ndarray/base/to-array' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var dorml2 = require( './../lib' ); + +// Specify matrix meta data for C (M x N): +var shapeC = [ 3, 2 ]; +var order = 'row-major'; +var stridesC = shape2strides( shapeC, order ); + +// Specify matrix meta data for A (K x M for 'left' multiplication): +var shapeA = [ 2, 3 ]; +var stridesA = shape2strides( shapeA, order ); + +// The matrix A contains reflector data from DGELQ2: +var A = new Float64Array( [ 1.0, 0.2, -0.4, 0.0, 1.0, 0.3 ] ); + +// Scalar factors of the reflectors: +var TAU = new Float64Array( [ 0.75, 0.50 ] ); + +// The matrix C to be multiplied: +var C = new Float64Array( [ 1.0, -1.0, 2.0, -2.0, 3.0, -3.0 ] ); + +console.log( 'C (unmodified):', ndarray2array( C, shapeC, stridesC, 0, order ) ); + +// When side='left', WORK length should be at least N (columns of C). +var work = new Float64Array( shapeC[ 1 ] ); + +// Multiply C by Q from the left (Q * C) in-place: +dorml2( order, 'left', 'no-transpose', shapeC[ 0 ], shapeC[ 1 ], shapeA[ 0 ], A, stridesA[ 0 ], TAU, C, stridesC[ 0 ], work ); + +console.log( 'C (Q * C):', ndarray2array( C, shapeC, stridesC, 0, order ) ); +console.log( 'WORK:', work ); + +// Re-initialize arrays for the alternative interface +A = new Float64Array( [ 1.0, 0.2, -0.4, 0.0, 1.0, 0.3 ] ); +TAU = new Float64Array( [ 0.75, 0.50 ] ); +C = new Float64Array( [ 1.0, -1.0, 2.0, -2.0, 3.0, -3.0 ] ); + +// Re-initialize workspace: +work = new Float64Array( shapeC[ 1 ] ); + +// Multiply C by Q^T from the left (Q^T * C) in-place using ndarray interface: +dorml2.ndarray( 'left', 'transpose', shapeC[ 0 ], shapeC[ 1 ], shapeA[ 0 ], A, stridesA[ 0 ], stridesA[ 1 ], 0, TAU, 1, 0, C, stridesC[ 0 ], stridesC[ 1 ], 0, work, 1, 0 ); + +console.log( 'C (Q^T * C):', ndarray2array( C, shapeC, stridesC, 0, order ) ); +console.log( 'WORK:', work ); diff --git a/lib/node_modules/@stdlib/lapack/base/dorml2/lib/dorml2.js b/lib/node_modules/@stdlib/lapack/base/dorml2/lib/dorml2.js index b27da7497ecd..a85bd7841e29 100644 --- a/lib/node_modules/@stdlib/lapack/base/dorml2/lib/dorml2.js +++ b/lib/node_modules/@stdlib/lapack/base/dorml2/lib/dorml2.js @@ -116,10 +116,10 @@ function dorml2( order, side, trans, M, N, K, A, LDA, TAU, C, LDC, WORK ) { if ( side === 'right' && K > N ) { throw new RangeError( format( 'invalid argument. Sixth argument must be smaller than the order of `Q`. Value: `%d`.', K ) ); } - if ( isRowMajor( order ) && LDA < max( 1, K ) ) { + if ( ( !isRowMajor( order ) ) && LDA < max( 1, K ) ) { throw new RangeError( format( 'invalid argument. Eighth argument must be greater than or equal to max(1,K). Value: `%d`.', LDA ) ); } - if ( isRowMajor( order ) && LDC < max( 1, M ) ) { + if ( ( !isRowMajor( order ) ) && LDC < max( 1, M ) ) { throw new RangeError( format( 'invalid argument. Eleventh argument must be greater than or equal to max(1,M). Value: `%d`.', LDC ) ); } if ( order === 'column-major' ) { @@ -128,13 +128,9 @@ function dorml2( order, side, trans, M, N, K, A, LDA, TAU, C, LDC, WORK ) { sc1 = 1; sc2 = LDC; } else { - if ( side === 'left' ) { - sa1 = M; - } else { - sa1 = N; - } + sa1 = LDA; sa2 = 1; - sc1 = N; + 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 ); diff --git a/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/left_row.json b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/left_row.json index 651a81a5503d..8fe7715db931 100644 --- a/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/left_row.json +++ b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/left_row.json @@ -11,7 +11,7 @@ "strideA1": 2, "strideA2": 1, "offsetA": 0, - "LDA": 1, + "LDA": 2, "A_mat": [ [ 1, 0 ] ], @@ -24,7 +24,7 @@ "strideC1": 3, "strideC2": 1, "offsetC": 0, - "LDC": 2, + "LDC": 3, "C_mat": [ [ 1, 3, 5 ], [ 2, 4, 6 ] diff --git a/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/right_row.json b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/right_row.json index c57f8d35df3d..501fa12c6afe 100644 --- a/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/right_row.json +++ b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/right_row.json @@ -11,7 +11,7 @@ "strideA1": 2, "strideA2": 1, "offsetA": 0, - "LDA": 1, + "LDA": 2, "A_mat": [ [ 1, 0 ] ], @@ -24,7 +24,7 @@ "strideC1": 2, "strideC2": 1, "offsetC": 0, - "LDC": 3, + "LDC": 2, "C_mat": [ [ 1, 4 ], [ 2, 5 ], diff --git a/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/trans_left.json b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/trans_left.json index 2b2209186719..e7ca87fbf409 100644 --- a/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/trans_left.json +++ b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/trans_left.json @@ -11,7 +11,7 @@ "strideA1": 2, "strideA2": 1, "offsetA": 0, - "LDA": 1, + "LDA": 2, "A_mat": [ [ 1, 0 ] ], @@ -24,7 +24,7 @@ "strideC1": 3, "strideC2": 1, "offsetC": 0, - "LDC": 2, + "LDC": 3, "C_mat": [ [ 1, 3, 5 ], [ 2, 4, 6 ] diff --git a/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/trans_right.json b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/trans_right.json index e58743e8313a..e4c872551578 100644 --- a/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/trans_right.json +++ b/lib/node_modules/@stdlib/lapack/base/dorml2/test/fixtures/trans_right.json @@ -11,7 +11,7 @@ "strideA1": 2, "strideA2": 1, "offsetA": 0, - "LDA": 1, + "LDA": 2, "A_mat": [ [ 1, 0 ] ], @@ -24,7 +24,7 @@ "strideC1": 2, "strideC2": 1, "offsetC": 0, - "LDC": 3, + "LDC": 2, "C_mat": [ [ 1, 4 ], [ 2, 5 ], diff --git a/lib/node_modules/@stdlib/lapack/base/dorml2/test/test.dorml2.js b/lib/node_modules/@stdlib/lapack/base/dorml2/test/test.dorml2.js index 1f6359ab2d45..628fbde0a44d 100644 --- a/lib/node_modules/@stdlib/lapack/base/dorml2/test/test.dorml2.js +++ b/lib/node_modules/@stdlib/lapack/base/dorml2/test/test.dorml2.js @@ -353,7 +353,7 @@ tape( 'the function throws an error if provided an eighth argument which is not function badValue( value ) { return function badValue() { - dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A, value, TAU, C, 2, WORK ); + dorml2( 'column-major', 'left', 'no-transpose', 2, 3, 1, A, value, TAU, C, 2, WORK ); }; } }); @@ -384,7 +384,7 @@ tape( 'the function throws an error if provided an eleventh argument which is no function badValue( value ) { return function badValue() { - dorml2( 'row-major', 'left', 'no-transpose', 2, 3, 1, A, 1, TAU, C, value, WORK ); + dorml2( 'column-major', 'left', 'no-transpose', 2, 3, 1, A, 1, TAU, C, value, WORK ); }; } });