From caff6972d25a0040a8ca1bf13155a40986b6a8a1 Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Sun, 3 Aug 2025 12:25:40 +0530 Subject: [PATCH 01/11] feat: lapack/base/dorm2r --- 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 status: na - task: lint_package_json status: na - 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: na - 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/lapack/base/dorm2r/lib/base.js | 143 ++++++++++++++++++ .../@stdlib/lapack/base/dorm2r/lib/dlarf1f.js | 128 ++++++++++++++++ .../@stdlib/lapack/base/dorm2r/lib/dorm2r.js | 116 ++++++++++++++ .../@stdlib/lapack/base/dorm2r/lib/index.js | 71 +++++++++ .../@stdlib/lapack/base/dorm2r/lib/main.js | 35 +++++ .../@stdlib/lapack/base/dorm2r/lib/ndarray.js | 92 +++++++++++ 6 files changed, 585 insertions(+) create mode 100644 lib/node_modules/@stdlib/lapack/base/dorm2r/lib/base.js create mode 100644 lib/node_modules/@stdlib/lapack/base/dorm2r/lib/dlarf1f.js create mode 100644 lib/node_modules/@stdlib/lapack/base/dorm2r/lib/dorm2r.js create mode 100644 lib/node_modules/@stdlib/lapack/base/dorm2r/lib/index.js create mode 100644 lib/node_modules/@stdlib/lapack/base/dorm2r/lib/main.js create mode 100644 lib/node_modules/@stdlib/lapack/base/dorm2r/lib/ndarray.js diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/base.js b/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/base.js new file mode 100644 index 000000000000..f9b53fbd2f58 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/base.js @@ -0,0 +1,143 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var dlarf1f = require( './dlarf1f.js' ); + + +// MAIN // + +/** +* Multiplies a matrix `C` by an orthogonal matrix `Q` from a QR factorization. +* +* ## Notes +* +* `dorm2r` overwrites the general real M by N matrix C with +* +* - `Q * C` if side = 'left' and trans = 'no-transpose' +* - `Q^T * C` if side = 'left' and trans = 'transpose' +* - `C * Q` if side = 'right' and trans = 'no-transpose' +* - `C * Q^T` if side = 'right' and trans = 'transpose' +* +* where Q is a real orthogonal matrix defined as the product of K elementary reflectors `Q = H(1) H(2) ... H(K)` as returned by `dgeqrf`. Q is of order M if side = 'left' and of order N if side = 'right'. +* +* @private +* @param {string} side - specifies the side of multiplication with `C` +* @param {string} trans - specifies the operation to be performed +* @param {NonNegativeInteger} M - number of rows in matrix `C` +* @param {NonNegativeInteger} N - number of columns in matrix `C` +* @param {NonNegativeInteger} K - number of elementary reflectors whose product defines the matrix `Q` +* @param {Float64Array} A - input matrix containing the elementary reflectors +* @param {integer} strideA1 - stride length for the first dimension of `A` +* @param {integer} strideA2 - stride length for the second dimension of `A` +* @param {NonNegativeInteger} offsetA - starting index for `A` +* @param {Float64Array} tau - array containing the scalar factors of the elementary reflectors +* @param {integer} strideTau - stride length for `tau` +* @param {NonNegativeInteger} offsetTau - starting index for `tau` +* @param {Float64Array} C - input/output matrix to be multiplied +* @param {integer} strideC1 - stride length for the first dimension of `C` +* @param {integer} strideC2 - stride length for the second dimension of `C` +* @param {NonNegativeInteger} offsetC - starting index for `C` +* @param {Float64Array} work - workspace array for intermediate calculations +* @param {integer} strideWork - stride length for `work` +* @param {NonNegativeInteger} offsetWork - starting index for `work` +* @returns {Float64Array} the modified matrix `C` +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( [ 1.0, 0.0, 0.0, 2.0, 4.0, 0.0, 3.0, 5.0, 6.0 ] ); +* var tau = new Float64Array( [ 7.0, 8.0, 9.0 ] ); +* var C = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ] ); +* var work = new Float64Array( 3 ); +* +* dorm2r( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); +* // C => [ -261638.0, -298618.0, -335598.0, -521066.0, -594715.0, -668364.0, -773933.0, -883324.0, -992715.0 ] +*/ +function dorm2r( side, trans, M, N, K, A, strideA1, strideA2, offsetA, tau, strideTau, offsetTau, C, strideC1, strideC2, offsetC, work, strideWork, offsetWork ) { // eslint-disable-line max-params, max-len + var aOffset; + var cOffset; + var tauVal; + var notran; + var left; + var i1; + var i2; + var i3; + var mi; + var ni; + var ic; + var jc; + var i; + + // Quick return if possible + if ( M === 0 || N === 0 || K === 0 ) { + return C; + } + + left = ( side === 'left' ); + notran = ( trans === 'no-transpose' ); + + // Determine loop indices based on side and trans + if ( ( left && !notran ) || ( !left && notran ) ) { + i1 = 1; + i2 = K; + i3 = 1; + } else { + i1 = K; + i2 = 1; + i3 = -1; + } + + // Initialize dimensions + if ( left ) { + ni = N; + jc = 0; // 0-based indexing + } else { + mi = M; + ic = 0; // 0-based indexing + } + + // Main loop + for ( i = i1; ( i3 > 0 ) ? ( i <= i2 ) : ( i >= i2 ); i += i3 ) { + if ( left ) { + // H(i) is applied to C(i:m,1:n) + mi = M - i + 1; + ic = i - 1; // Convert to 0-based indexing + } else { + // H(i) is applied to C(1:m,i:n) + ni = N - i + 1; + jc = i - 1; // Convert to 0-based indexing + } + + // Apply H(i) using `dlarf1f` + tauVal = tau[ offsetTau + ( ( i - 1 ) * strideTau ) ]; + aOffset = offsetA + ( ( i - 1 ) * strideA1 ) + ( ( i - 1 ) * strideA2 ); + cOffset = offsetC + ( ic * strideC1 ) + ( jc * strideC2 ); + dlarf1f( side, mi, ni, A, strideA1, aOffset, tauVal, C, strideC1, strideC2, cOffset, work, strideWork, offsetWork ); // eslint-disable-line max-len + } + + return C; +} + + +// EXPORTS // + +module.exports = dorm2r; diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/dlarf1f.js b/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/dlarf1f.js new file mode 100644 index 000000000000..1da894fe3c3c --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/dlarf1f.js @@ -0,0 +1,128 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/* eslint-disable max-len */ + +// MODULES // + +var iladlc = require( '@stdlib/lapack/base/iladlc' ).ndarray; +var iladlr = require( '@stdlib/lapack/base/iladlr' ).ndarray; +var dgemv = require( '@stdlib/blas/base/dgemv' ).ndarray; +var dger = require( '@stdlib/blas/base/dger' ).ndarray; +var daxpy = require( '@stdlib/blas/base/daxpy' ).ndarray; +var dscal = require( '@stdlib/blas/base/dscal' ).ndarray; + + +// MAIN // + +/** +* Applies a real elementary reflector `H = I - tau * v * v ^ T` to a real M by N matrix `C`. +* +* ## Notes +* +* - `work` should have `N` indexed elements if side = `left` and `M` indexed elements if side = `right`. +* - `V` should have `1 + (M-1) * abs(strideV)` indexed elements if side = `left` and `1 + (N-1) * abs(strideV)` indexed elements if side = `right`. +* - `C` is overwritten by `H * C` if side = `left` and `C * H` if side = `right`. +* +* @private +* @param {string} side - specifies the side of multiplication with `C`. Use `left` to form `H * C` and `right` to from `C * H`. +* @param {NonNegativeInteger} M - number of rows in `C` +* @param {NonNegativeInteger} N - number of columns in `C` +* @param {Float64Array} V - the vector `v` in the representation of `H` +* @param {integer} strideV - stride length for `V` +* @param {NonNegativeInteger} offsetV - starting index for `V` +* @param {number} tau - the value of `tau` in representation of `H` +* @param {Float64Array} C - input matrix +* @param {integer} strideC1 - stride of the first dimension of `C` +* @param {integer} strideC2 - stride of the second dimension of `C` +* @param {NonNegativeInteger} offsetC - starting index for `C` +* @param {Float64Array} work - workspace array +* @param {integer} strideWork - stride length for `work` +* @param {NonNegativeInteger} offsetWork - starting index for `work` +* @returns {Float64Array} `C * H` or `H * C` +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var C = new Float64Array( [ 1.0, 5.0, 9.0, 2.0, 6.0, 10.0, 3.0, 7.0, 11.0, 4.0, 8.0, 12.0 ] ); +* var V = new Float64Array( [ 0.5, 0.5, 0.5, 0.5 ] ); +* var work = new Float64Array( 3 ); +* +* var out = dlarf1f( 'left', 4, 3, V, 1, 0, 1.0, C, 3, 1, 0, work, 1, 0 ); +* // returns [ -4.5, -10.5, -16.5, -0.75, -1.75, -2.75, 0.25, -0.75, -1.75, 1.25, 0.25, -0.75 ] +*/ +function dlarf1f( side, M, N, V, strideV, offsetV, tau, C, strideC1, strideC2, offsetC, work, strideWork, offsetWork ) { // eslint-disable-line max-params + var lastv; + var lastc; + var i; + + lastv = 1; + lastc = 0; + if ( tau !== 0.0 ) { + if ( side === 'left' ) { + lastv = M; + } else { + lastv = N; + } + + // i points to the last element in V + i = offsetV + ( ( lastv - 1 ) * strideV ); + + // Move i to the last non-zero element in V + while ( lastv > 0 && V[ i ] === 0.0 ) { + lastv -= 1; + i -= strideV; + } + if ( side === 'left' ) { + lastc = iladlc( lastv + 1, N, C, strideC1, strideC2, offsetC ) + 1; // to account for the difference between zero-based and one-based indexing + } else { + lastc = iladlr( M, lastv + 1, C, strideC1, strideC2, offsetC ) + 1; // to account for the difference between zero-based and one-based indexing + } + // lastc is zero if a matrix is filled with zeros + } + if ( lastc === 0 ) { + // Returns C unchanged if tau is zero or all elements in C are zero + return C; + } + if ( side === 'left' ) { + if ( lastv === 0 ) { + dscal( lastc, 1.0 - tau, C, strideC2, offsetC ); // scale the first row + } else { + dgemv( 'transpose', lastv-1, lastc, 1.0, C, strideC1, strideC2, offsetC + strideC1, V, strideV, offsetV + strideV, 0.0, work, strideWork, offsetWork ); // C( 1, 0 ) is accessed here + daxpy( lastc, 1.0, C, strideC2, offsetC, work, strideWork, offsetWork ); // operates on the first row of C + daxpy( lastc, -tau, work, strideWork, offsetWork, C, strideC2, offsetC ); // operates on the first row of C + dger( lastv-1, lastc, -tau, V, strideV, offsetV + strideV, work, strideWork, offsetWork, C, strideC1, strideC2, offsetC + strideC1 ); // C( 1, 0 ) is accessed here + } + } else if ( lastv === 0 ) { + dscal( lastc, 1.0 - tau, C, strideC1, offsetC ); // scale the first column + } else { + dgemv( 'no-transpose', lastc, lastv-1, 1.0, C, strideC1, strideC2, offsetC + strideC2, V, strideV, offsetV + strideV, 0.0, work, strideWork, offsetWork ); // C( 0, 1 ) is accessed here + daxpy( lastc, 1.0, C, strideC1, offsetC, work, strideWork, offsetWork ); // operates on the first column of C + daxpy( lastc, -tau, work, strideWork, offsetWork, C, strideC1, offsetC ); // operates on the first column of C + dger( lastc, lastv-1, -tau, work, strideWork, offsetWork, V, strideV, offsetV + strideV, C, strideC1, strideC2, offsetC + strideC2 ); // C( 0, 1 ) is accessed here + } + + return C; +} + + +// EXPORTS // + +module.exports = dlarf1f; diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/dorm2r.js b/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/dorm2r.js new file mode 100644 index 000000000000..feb29fd1911b --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/dorm2r.js @@ -0,0 +1,116 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var isLayout = require( '@stdlib/blas/base/assert/is-layout' ); +var isOperationSide = require( '@stdlib/blas/base/assert/is-operation-side' ); +var isTransposeOperation = require( '@stdlib/blas/base/assert/is-transpose-operation' ); +var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major-string' ); +var isColumnMajor = require( '@stdlib/ndarray/base/assert/is-column-major-string' ); +var max = require( '@stdlib/math/base/special/max' ); +var format = require( '@stdlib/string/format' ); +var base = require( './base.js' ); + + +// MAIN // + +/** +* Multiplies a matrix `C` by an orthogonal matrix `Q` from a QR factorization. +* +* ## Notes +* +* `dorm2r` overwrites the general real M by N matrix C with +* +* - `Q * C` if side = 'left' and trans = 'no-transpose' +* - `Q^T * C` if side = 'left' and trans = 'transpose' +* - `C * Q` if side = 'right' and trans = 'no-transpose' +* - `C * Q^T` if side = 'right' and trans = 'transpose' +* +* where Q is a real orthogonal matrix defined as the product of K elementary reflectors `Q = H(1) H(2) ... H(K)` as returned by `dgeqrf`. Q is of order M if side = 'left' and of order N if side = 'right'. +* +* @param {string} order - storage layout +* @param {string} side - specifies the side of multiplication with `C` +* @param {string} trans - specifies the operation to be performed +* @param {NonNegativeInteger} M - number of rows in matrix `C` +* @param {NonNegativeInteger} N - number of columns in matrix `C` +* @param {NonNegativeInteger} K - number of elementary reflectors whose product defines the matrix `Q` +* @param {Float64Array} A - input matrix containing the elementary reflectors +* @param {PositiveInteger} LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) +* @param {Float64Array} tau - array containing the scalar factors of the elementary reflectors +* @param {Float64Array} C - input/output matrix to be multiplied +* @param {PositiveInteger} LDC - stride of the first dimension of `C` (a.k.a., leading dimension of the matrix `C`) +* @param {Float64Array} work - workspace array for intermediate calculations +* @throws {TypeError} first argument must be a valid order +* @throws {TypeError} second argument must be a valid operation side +* @throws {TypeError} third argument must be a valid transpose operation +* @throws {RangeError} eighth argument must be greater than or equal to max(1,K) when side is 'left' or max(1,M) when side is 'right' +* @throws {RangeError} twelfth argument must be greater than or equal to max(1,M) +* @returns {Float64Array} the modified matrix `C` +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( [ 1.0, 0.0, 0.0, 2.0, 4.0, 0.0, 3.0, 5.0, 6.0 ] ); +* var tau = new Float64Array( [ 7.0, 8.0, 9.0 ] ); +* var C = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ] ); +* var work = new Float64Array( 3 ); +* +* dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, work ); +* // C => [ -261638.0, -298618.0, -335598.0, -521066.0, -594715.0, -668364.0, -773933.0, -883324.0, -992715.0 ] +*/ +function dorm2r( order, side, trans, M, N, K, A, LDA, tau, C, LDC, work ) { // eslint-disable-line max-params + var sa1; + var sa2; + var sc1; + var sc2; + if ( !isLayout( order ) ) { + throw new TypeError( format( 'invalid argument. First argument must be a valid order. Value: `%s`.', order ) ); + } + if ( !isOperationSide( side ) ) { + throw new TypeError( format( 'invalid argument. Second argument must be a valid operation side. Value: `%s`.', side ) ); + } + if ( !isTransposeOperation( trans ) ) { + throw new TypeError( format( 'invalid argument. Third argument must be a valid transpose operation. Value: `%s`.', trans ) ); + } + if ( isRowMajor( order ) && LDC < max( 1, N ) ) { + throw new RangeError( format( 'invalid argument. Twelfth argument must be greater than or equal to max(1,%d). Value: `%d`.', N, LDC ) ); + } + if ( isColumnMajor( order ) && LDC < max( 1, M ) ) { + throw new RangeError( format( 'invalid argument. Twelfth argument must be greater than or equal to max(1,%d). Value: `%d`.', M, LDC ) ); + } + if ( isColumnMajor( order ) ) { + sa1 = 1; + sa2 = LDA; + sc1 = 1; + sc2 = LDC; + } else { + sa1 = LDA; + sa2 = 1; + sc1 = LDC; + sc2 = 1; + } + return base( side, trans, M, N, K, A, sa1, sa2, 0, tau, 1, 0, C, sc1, sc2, 0, work, 1, 0 ); // eslint-disable-line max-len +} + + +// EXPORTS // + +module.exports = dorm2r; diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/index.js b/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/index.js new file mode 100644 index 000000000000..556056d588ac --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/index.js @@ -0,0 +1,71 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* LAPACK routine to multiply a matrix by an orthogonal matrix from a QR factorization. +* +* ## Notes +* +* `dorm2r` overwrites the general real M by N matrix C with +* +* - `Q * C` if side = 'left' and trans = 'no-transpose' +* - `Q^T * C` if side = 'left' and trans = 'transpose' +* - `C * Q` if side = 'right' and trans = 'no-transpose' +* - `C * Q^T` if side = 'right' and trans = 'transpose' +* +* where Q is a real orthogonal matrix defined as the product of K elementary reflectors `Q = H(1) H(2) ... H(K)` as returned by `dgeqrf`. Q is of order M if side = 'left' and of order N if side = 'right'. +* +* @module @stdlib/lapack/base/dorm2r +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var dorm2r = require( '@stdlib/lapack/base/dorm2r' ); +* +* var A = new Float64Array( [ 1.0, 0.0, 0.0, 2.0, 4.0, 0.0, 3.0, 5.0, 6.0 ] ); +* var tau = new Float64Array( [ 7.0, 8.0, 9.0 ] ); +* var C = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ] ); +* var work = new Float64Array( 3 ); +* +* dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, work ); +* // C => [ -261638.0, -298618.0, -335598.0, -521066.0, -594715.0, -668364.0, -773933.0, -883324.0, -992715.0 ] +*/ + +// MODULES // + +var join = require( 'path' ).join; +var tryRequire = require( '@stdlib/utils/try-require' ); +var isError = require( '@stdlib/assert/is-error' ); +var main = require( './main.js' ); + + +// MAIN // + +var dorm2r; +var tmp = tryRequire( join( __dirname, './native.js' ) ); +if ( isError( tmp ) ) { + dorm2r = main; +} else { + dorm2r = tmp; +} + + +// EXPORTS // + +module.exports = dorm2r; diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/main.js b/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/main.js new file mode 100644 index 000000000000..d7972eb91091 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/main.js @@ -0,0 +1,35 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var dorm2r = require( './dorm2r.js' ); +var ndarray = require( './ndarray.js' ); + + +// MAIN // + +setReadOnly( dorm2r, 'ndarray', ndarray ); + + +// EXPORTS // + +module.exports = dorm2r; diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/ndarray.js b/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/ndarray.js new file mode 100644 index 000000000000..cdeb7adb6c81 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/ndarray.js @@ -0,0 +1,92 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var isOperationSide = require( '@stdlib/blas/base/assert/is-operation-side' ); +var isTransposeOperation = require( '@stdlib/blas/base/assert/is-transpose-operation' ); +var format = require( '@stdlib/string/format' ); +var base = require( './base.js' ); + + +// MAIN // + +/** +* Multiplies a matrix `C` by an orthogonal matrix `Q` from a QR factorization. +* +* ## Notes +* +* `dorm2r` overwrites the general real M by N matrix C with +* +* - `Q * C` if side = 'left' and trans = 'no-transpose' +* - `Q^T * C` if side = 'left' and trans = 'transpose' +* - `C * Q` if side = 'right' and trans = 'no-transpose' +* - `C * Q^T` if side = 'right' and trans = 'transpose' +* +* where Q is a real orthogonal matrix defined as the product of K elementary reflectors `Q = H(1) H(2) ... H(K)` as returned by `dgeqrf`. Q is of order M if side = 'left' and of order N if side = 'right'. +* +* @param {string} side - specifies the side of multiplication with `C` +* @param {string} trans - specifies the operation to be performed +* @param {NonNegativeInteger} M - number of rows in matrix `C` +* @param {NonNegativeInteger} N - number of columns in matrix `C` +* @param {NonNegativeInteger} K - number of elementary reflectors whose product defines the matrix `Q` +* @param {Float64Array} A - input matrix containing the elementary reflectors +* @param {integer} strideA1 - stride length for the first dimension of `A` +* @param {integer} strideA2 - stride length for the second dimension of `A` +* @param {NonNegativeInteger} offsetA - starting index for `A` +* @param {Float64Array} tau - array containing the scalar factors of the elementary reflectors +* @param {integer} strideTau - stride length for `tau` +* @param {NonNegativeInteger} offsetTau - starting index for `tau` +* @param {Float64Array} C - input/output matrix to be multiplied +* @param {integer} strideC1 - stride length for the first dimension of `C` +* @param {integer} strideC2 - stride length for the second dimension of `C` +* @param {NonNegativeInteger} offsetC - starting index for `C` +* @param {Float64Array} work - workspace array for intermediate calculations +* @param {integer} strideWork - stride length for `work` +* @param {NonNegativeInteger} offsetWork - starting index for `work` +* @throws {TypeError} first argument must be a valid operation side +* @throws {TypeError} second argument must be a valid transpose operation +* @returns {Float64Array} the modified matrix `C` +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( [ 1.0, 0.0, 0.0, 2.0, 4.0, 0.0, 3.0, 5.0, 6.0 ] ); +* var tau = new Float64Array( [ 7.0, 8.0, 9.0 ] ); +* var C = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ] ); +* var work = new Float64Array( 3 ); +* +* dorm2r( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); +* // C => [ -261638.0, -298618.0, -335598.0, -521066.0, -594715.0, -668364.0, -773933.0, -883324.0, -992715.0 ] +*/ +function dorm2r( side, trans, M, N, K, A, strideA1, strideA2, offsetA, tau, strideTau, offsetTau, C, strideC1, strideC2, offsetC, work, strideWork, offsetWork ) { // eslint-disable-line max-len, max-params + if ( !isOperationSide( side ) ) { + throw new TypeError( format( 'invalid argument. First argument must be a valid operation side. Value: `%s`.', side ) ); + } + if ( !isTransposeOperation( trans ) ) { + throw new TypeError( format( 'invalid argument. Second argument must be a valid transpose operation. Value: `%s`.', trans ) ); + } + return base( side, trans, M, N, K, A, strideA1, strideA2, offsetA, tau, strideTau, offsetTau, C, strideC1, strideC2, offsetC, work, strideWork, offsetWork ); // eslint-disable-line max-len +} + + +// EXPORTS // + +module.exports = dorm2r; From 871e7fca7f75cd77ffefeb4e9b4f3b64a2cd508d Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Thu, 7 Aug 2025 11:11:21 +0530 Subject: [PATCH 02/11] test: add initial tests --- 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 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../test/fixtures/left_notrans_col_major.json | 45 +++ .../test/fixtures/left_notrans_row_major.json | 45 +++ .../lapack/base/dorm2r/test/test.dorm2r.js | 279 ++++++++++++++++++ .../@stdlib/lapack/base/dorm2r/test/test.js | 82 +++++ .../lapack/base/dorm2r/test/test.ndarray.js | 121 ++++++++ 5 files changed, 572 insertions(+) create mode 100644 lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/left_notrans_col_major.json create mode 100644 lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/left_notrans_row_major.json create mode 100644 lib/node_modules/@stdlib/lapack/base/dorm2r/test/test.dorm2r.js create mode 100644 lib/node_modules/@stdlib/lapack/base/dorm2r/test/test.js create mode 100644 lib/node_modules/@stdlib/lapack/base/dorm2r/test/test.ndarray.js diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/left_notrans_col_major.json b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/left_notrans_col_major.json new file mode 100644 index 000000000000..82fb3c108f5d --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/left_notrans_col_major.json @@ -0,0 +1,45 @@ +{ + "order": "column-major", + "side": "left", + "trans": "no-transpose", + "M": 3, + "N": 3, + "K": 3, + + "A_mat": [ + [ 1.0, 2.0, 3.0 ], + [ 0.0, 4.0, 5.0 ], + [ 0.0, 0.0, 6.0 ] + ], + "LDA": 3, + "strideA1": 1, + "strideA2": 3, + "offsetA": 0, + "A": [ 1.0, 2.0, 3.0, 0.0, 4.0, 5.0, 0.0, 0.0, 6.0 ], + + "tau": [ 7.0, 8.0, 9.0 ], + "strideTau": 1, + "offsetTau": 0, + + "C_mat": [ + [ 1.0, 4.0, 7.0 ], + [ 2.0, 5.0, 8.0 ], + [ 3.0, 6.0, 9.0 ] + ], + "LDC": 3, + "strideC1": 1, + "strideC2": 3, + "offsetC": 0, + "C": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ], + + "work": [ 0.0, 0.0, 0.0 ], + "strideWork": 1, + "offsetWork": 0, + + "C_out_mat": [ + [ -261638.0, -521066.0, -773933.0 ], + [ -298618.0, -594715.0, -883324.0 ], + [ -335598.0, -668364.0, -992715.0 ] + ], + "C_out": [ -261638.0, -298618.0, -335598.0, -521066.0, -594715.0, -668364.0, -773933.0, -883324.0, -992715.0 ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/left_notrans_row_major.json b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/left_notrans_row_major.json new file mode 100644 index 000000000000..51e06b1a92b9 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/left_notrans_row_major.json @@ -0,0 +1,45 @@ +{ + "order": "row-major", + "side": "left", + "trans": "no-transpose", + "M": 3, + "N": 3, + "K": 3, + + "A_mat": [ + [ 1.0, 0.0, 0.0 ], + [ 2.0, 4.0, 0.0 ], + [ 3.0, 5.0, 6.0 ] + ], + "LDA": 3, + "strideA1": 3, + "strideA2": 1, + "offsetA": 0, + "A": [ 1.0, 0.0, 0.0, 2.0, 4.0, 0.0, 3.0, 5.0, 6.0 ], + + "tau": [ 7.0, 8.0, 9.0 ], + "strideTau": 1, + "offsetTau": 0, + + "C_mat": [ + [ 1.0, 2.0, 3.0 ], + [ 4.0, 5.0, 6.0 ], + [ 7.0, 8.0, 9.0 ] + ], + "LDC": 3, + "strideC1": 3, + "strideC2": 1, + "offsetC": 0, + "C": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ], + + "work": [ 0.0, 0.0, 0.0 ], + "strideWork": 1, + "offsetWork": 0, + + "C_out_mat": [ + [ -261638.0, -298618.0, -335598.0 ], + [ -521066.0, -594715.0, -668364.0 ], + [ -773933.0, -883324.0, -992715.0 ] + ], + "C_out": [ -261638.0, -298618.0, -335598.0, -521066.0, -594715.0, -668364.0, -773933.0, -883324.0, -992715.0 ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/test/test.dorm2r.js b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/test.dorm2r.js new file mode 100644 index 000000000000..45ca3c6ebd2d --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/test.dorm2r.js @@ -0,0 +1,279 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Float64Array = require( '@stdlib/array/float64' ); +var dorm2r = require( './../lib/dorm2r.js' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof dorm2r, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 12', function test( t ) { + t.strictEqual( dorm2r.length, 12, 'returns expected value' ); + t.end(); +}); + +tape( 'the function throws an error if provided a first argument which is not a valid order', function test( t ) { + var values; + var work; + var tau; + var A; + var C; + var i; + + A = new Float64Array( [ 1.0, 0.0, 0.0, 2.0, 4.0, 0.0, 3.0, 5.0, 6.0 ] ); + tau = new Float64Array( [ 7.0, 8.0, 9.0 ] ); + C = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ] ); + work = new Float64Array( 3 ); + + values = [ + 'foo', + 'bar', + 'beep', + 'boop', + -5, + NaN, + true, + false, + null, + void 0, + [], + {}, + function noop() {} + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + dorm2r( value, 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, work ); + }; + } +}); + +tape( 'the function throws an error if provided a second argument which is not a valid side', function test( t ) { + var values; + var work; + var tau; + var A; + var C; + var i; + + A = new Float64Array( [ 1.0, 0.0, 0.0, 2.0, 4.0, 0.0, 3.0, 5.0, 6.0 ] ); + tau = new Float64Array( [ 7.0, 8.0, 9.0 ] ); + C = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ] ); + work = new Float64Array( 3 ); + + values = [ + 'foo', + 'bar', + 'beep', + 'boop', + -5, + NaN, + true, + false, + null, + void 0, + [], + {}, + function noop() {} + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + dorm2r( 'row-major', value, 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, work ); + }; + } +}); + +tape( 'the function throws an error if provided a third argument which is not a valid trans', function test( t ) { + var values; + var work; + var tau; + var A; + var C; + var i; + + A = new Float64Array( [ 1.0, 0.0, 0.0, 2.0, 4.0, 0.0, 3.0, 5.0, 6.0 ] ); + tau = new Float64Array( [ 7.0, 8.0, 9.0 ] ); + C = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ] ); + work = new Float64Array( 3 ); + + values = [ + 'foo', + 'bar', + 'beep', + 'boop', + -5, + NaN, + true, + false, + null, + void 0, + [], + {}, + function noop() {} + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + dorm2r( 'row-major', 'left', value, 3, 3, 3, A, 3, tau, C, 3, work ); + }; + } +}); + +tape( 'the function throws an error if provided an eighth argument which is not a valid `LDA` value (row-major)', function test( t ) { + var values; + var work; + var tau; + var A; + var C; + var i; + + A = new Float64Array( [ 1.0, 0.0, 0.0, 2.0, 4.0, 0.0, 3.0, 5.0, 6.0 ] ); + tau = new Float64Array( [ 7.0, 8.0, 9.0 ] ); + C = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ] ); + work = new Float64Array( 3 ); + + values = [ + -1, + 0, + NaN, + '5', + null, + void 0, + true, + false, + [], + {}, + function noop() {} + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, value, tau, C, 3, work ); + }; + } +}); + +tape( 'the function throws an error if provided a twelfth argument which is not a valid `LDC` value (row-major)', function test( t ) { + var values; + var work; + var tau; + var A; + var C; + var i; + + A = new Float64Array( [ 1.0, 0.0, 0.0, 2.0, 4.0, 0.0, 3.0, 5.0, 6.0 ] ); + tau = new Float64Array( [ 7.0, 8.0, 9.0 ] ); + C = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ] ); + work = new Float64Array( 3 ); + + values = [ + -1, + 0, + NaN, + '5', + null, + void 0, + true, + false, + [], + {}, + function noop() {} + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, value, work ); + }; + } +}); + +tape( 'the function throws an error if provided a twelfth argument which is not a valid `LDC` value (column-major)', function test( t ) { + var values; + var work; + var tau; + var A; + var C; + var i; + + A = new Float64Array( [ 1.0, 0.0, 0.0, 2.0, 4.0, 0.0, 3.0, 5.0, 6.0 ] ); + tau = new Float64Array( [ 7.0, 8.0, 9.0 ] ); + C = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ] ); + work = new Float64Array( 3 ); + + values = [ + -1, + 0, + NaN, + '5', + null, + void 0, + true, + false, + [], + {}, + function noop() {} + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + dorm2r( 'column-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, value, work ); + }; + } +}); diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/test/test.js b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/test.js new file mode 100644 index 000000000000..63f9d011be26 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/test.js @@ -0,0 +1,82 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var proxyquire = require( 'proxyquire' ); +var IS_BROWSER = require( '@stdlib/assert/is-browser' ); +var dorm2r = require( './../lib' ); + + +// VARIABLES // + +var opts = { + 'skip': IS_BROWSER +}; + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof dorm2r, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'attached to the main export is a method providing an ndarray interface', function test( t ) { + t.strictEqual( typeof dorm2r.ndarray, 'function', 'method is a function' ); + t.end(); +}); + +tape( 'if a native implementation is available, the main export is the native implementation', opts, function test( t ) { + var dorm2r = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( dorm2r, mock, 'returns expected value' ); + t.end(); + + function tryRequire() { + return mock; + } + + function mock() { + // Mock... + } +}); + +tape( 'if a native implementation is not available, the main export is a JavaScript implementation', opts, function test( t ) { + var dorm2r; + var main; + + main = require( './../lib/dorm2r.js' ); + + dorm2r = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( dorm2r, main, 'returns expected value' ); + t.end(); + + function tryRequire() { + return new Error( 'Cannot find module' ); + } +}); diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/test/test.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/test.ndarray.js new file mode 100644 index 000000000000..6e8bea26d943 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/test.ndarray.js @@ -0,0 +1,121 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Float64Array = require( '@stdlib/array/float64' ); +var dorm2r = require( './../lib/ndarray.js' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof dorm2r, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 18', function test( t ) { + t.strictEqual( dorm2r.length, 18, 'returns expected value' ); + t.end(); +}); + +tape( 'the function throws an error if provided a first argument which is not a valid side', function test( t ) { + var values; + var work; + var tau; + var A; + var C; + var i; + + A = new Float64Array( [ 1.0, 0.0, 0.0, 2.0, 4.0, 0.0, 3.0, 5.0, 6.0 ] ); + tau = new Float64Array( [ 7.0, 8.0, 9.0 ] ); + C = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ] ); + work = new Float64Array( 3 ); + + values = [ + 'foo', + 'bar', + 'beep', + 'boop', + -5, + NaN, + true, + false, + null, + void 0, + [], + {}, + function noop() {} + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + dorm2r( value, 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); + }; + } +}); + +tape( 'the function throws an error if provided a second argument which is not a valid trans', function test( t ) { + var values; + var work; + var tau; + var A; + var C; + var i; + + A = new Float64Array( [ 1.0, 0.0, 0.0, 2.0, 4.0, 0.0, 3.0, 5.0, 6.0 ] ); + tau = new Float64Array( [ 7.0, 8.0, 9.0 ] ); + C = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ] ); + work = new Float64Array( 3 ); + + values = [ + 'foo', + 'bar', + 'beep', + 'boop', + -5, + NaN, + true, + false, + null, + void 0, + [], + {}, + function noop() {} + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + dorm2r( 'left', value, 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); + }; + } +}); From 2a5a5014973810ff709021fc96ba2ee904356ad7 Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Thu, 7 Aug 2025 11:29:56 +0530 Subject: [PATCH 03/11] fix: fix tests --- 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 status: na - task: lint_package_json status: na - 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/lapack/base/dorm2r/lib/dorm2r.js | 12 ++++++- .../lapack/base/dorm2r/test/test.dorm2r.js | 36 ++++--------------- .../lapack/base/dorm2r/test/test.ndarray.js | 4 +-- 3 files changed, 19 insertions(+), 33 deletions(-) diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/dorm2r.js b/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/dorm2r.js index feb29fd1911b..f97367e6d0aa 100644 --- a/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/dorm2r.js +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/dorm2r.js @@ -61,7 +61,7 @@ var base = require( './base.js' ); * @throws {TypeError} first argument must be a valid order * @throws {TypeError} second argument must be a valid operation side * @throws {TypeError} third argument must be a valid transpose operation -* @throws {RangeError} eighth argument must be greater than or equal to max(1,K) when side is 'left' or max(1,M) when side is 'right' +* @throws {RangeError} eighth argument must be greater than or equal to max(1,M) when side is 'left' or max(1,N) when side is 'right' * @throws {RangeError} twelfth argument must be greater than or equal to max(1,M) * @returns {Float64Array} the modified matrix `C` * @@ -90,6 +90,16 @@ function dorm2r( order, side, trans, M, N, K, A, LDA, tau, C, LDC, work ) { // e if ( !isTransposeOperation( trans ) ) { throw new TypeError( format( 'invalid argument. Third argument must be a valid transpose operation. Value: `%s`.', trans ) ); } + if ( isColumnMajor( order ) ) { + if ( side === 'left' && LDA < max( 1, M ) ) { + throw new RangeError( format( 'invalid argument. Eighth argument must be greater than or equal to max(1,%d) when side is left. Value: `%d`.', M, LDA ) ); + } + if ( side === 'right' && LDA < max( 1, N ) ) { + throw new RangeError( format( 'invalid argument. Eighth argument must be greater than or equal to max(1,%d) when side is right. Value: `%d`.', N, LDA ) ); + } + } else if ( LDA < max( 1, K ) ) { + throw new RangeError( format( 'invalid argument. Eighth argument must be greater than or equal to max(1,%d) for row-major layout. Value: `%d`.', K, LDA ) ); + } if ( isRowMajor( order ) && LDC < max( 1, N ) ) { throw new RangeError( format( 'invalid argument. Twelfth argument must be greater than or equal to max(1,%d). Value: `%d`.', N, LDC ) ); } diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/test/test.dorm2r.js b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/test.dorm2r.js index 45ca3c6ebd2d..99a1c9707a2d 100644 --- a/lib/node_modules/@stdlib/lapack/base/dorm2r/test/test.dorm2r.js +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/test.dorm2r.js @@ -175,17 +175,9 @@ tape( 'the function throws an error if provided an eighth argument which is not work = new Float64Array( 3 ); values = [ - -1, 0, - NaN, - '5', - null, - void 0, - true, - false, - [], - {}, - function noop() {} + 1, + 2 ]; for ( i = 0; i < values.length; i++ ) { @@ -214,17 +206,9 @@ tape( 'the function throws an error if provided a twelfth argument which is not work = new Float64Array( 3 ); values = [ - -1, 0, - NaN, - '5', - null, - void 0, - true, - false, - [], - {}, - function noop() {} + 1, + 2 ]; for ( i = 0; i < values.length; i++ ) { @@ -253,17 +237,9 @@ tape( 'the function throws an error if provided a twelfth argument which is not work = new Float64Array( 3 ); values = [ - -1, 0, - NaN, - '5', - null, - void 0, - true, - false, - [], - {}, - function noop() {} + 1, + 2 ]; for ( i = 0; i < values.length; i++ ) { diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/test/test.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/test.ndarray.js index 6e8bea26d943..d71ece4eab43 100644 --- a/lib/node_modules/@stdlib/lapack/base/dorm2r/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/test.ndarray.js @@ -33,8 +33,8 @@ tape( 'main export is a function', function test( t ) { t.end(); }); -tape( 'the function has an arity of 18', function test( t ) { - t.strictEqual( dorm2r.length, 18, 'returns expected value' ); +tape( 'the function has an arity of 19', function test( t ) { + t.strictEqual( dorm2r.length, 19, 'returns expected value' ); t.end(); }); From 6956d09629d4cf8cf66aae741097dc54839e396e Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Thu, 7 Aug 2025 15:57:45 +0530 Subject: [PATCH 04/11] test: add tests --- 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 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../test/fixtures/left_notrans_col_major.json | 22 ++-- .../test/fixtures/left_trans_col_major.json | 45 +++++++ .../test/fixtures/left_trans_row_major.json | 45 +++++++ .../lapack/base/dorm2r/test/test.dorm2r.js | 110 ++++++++++++++++++ 4 files changed, 211 insertions(+), 11 deletions(-) create mode 100644 lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/left_trans_col_major.json create mode 100644 lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/left_trans_row_major.json diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/left_notrans_col_major.json b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/left_notrans_col_major.json index 82fb3c108f5d..f26f8d91df17 100644 --- a/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/left_notrans_col_major.json +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/left_notrans_col_major.json @@ -7,9 +7,9 @@ "K": 3, "A_mat": [ - [ 1.0, 2.0, 3.0 ], - [ 0.0, 4.0, 5.0 ], - [ 0.0, 0.0, 6.0 ] + [ 1.0, 0.0, 0.0 ], + [ 2.0, 4.0, 0.0 ], + [ 3.0, 5.0, 6.0 ] ], "LDA": 3, "strideA1": 1, @@ -22,24 +22,24 @@ "offsetTau": 0, "C_mat": [ - [ 1.0, 4.0, 7.0 ], - [ 2.0, 5.0, 8.0 ], - [ 3.0, 6.0, 9.0 ] + [ 1.0, 2.0, 3.0 ], + [ 4.0, 5.0, 6.0 ], + [ 7.0, 8.0, 9.0 ] ], "LDC": 3, "strideC1": 1, "strideC2": 3, "offsetC": 0, - "C": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ], + "C": [ 1.0, 4.0, 7.0, 2.0, 5.0, 8.0, 3.0, 6.0, 9.0 ], "work": [ 0.0, 0.0, 0.0 ], "strideWork": 1, "offsetWork": 0, "C_out_mat": [ - [ -261638.0, -521066.0, -773933.0 ], - [ -298618.0, -594715.0, -883324.0 ], - [ -335598.0, -668364.0, -992715.0 ] + [ -261638.0, -298618.0, -335598.0 ], + [ -521066.0, -594715.0, -668364.0 ], + [ -773933.0, -883324.0, -992715.0 ] ], - "C_out": [ -261638.0, -298618.0, -335598.0, -521066.0, -594715.0, -668364.0, -773933.0, -883324.0, -992715.0 ] + "C_out": [ -261638.0, -521066.0, -773933.0, -298618.0, -594715.0, -883324.0, -335598.0, -668364.0, -992715.0 ] } diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/left_trans_col_major.json b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/left_trans_col_major.json new file mode 100644 index 000000000000..4dd2c6aec7bc --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/left_trans_col_major.json @@ -0,0 +1,45 @@ +{ + "order": "column-major", + "side": "left", + "trans": "transpose", + "M": 3, + "N": 3, + "K": 3, + + "A_mat": [ + [ 1.0, 0.0, 0.0 ], + [ 2.0, 4.0, 0.0 ], + [ 3.0, 5.0, 6.0 ] + ], + "LDA": 3, + "strideA1": 1, + "strideA2": 3, + "offsetA": 0, + "A": [ 1.0, 2.0, 3.0, 0.0, 4.0, 5.0, 0.0, 0.0, 6.0 ], + + "tau": [ 7.0, 8.0, 9.0 ], + "strideTau": 1, + "offsetTau": 0, + + "C_mat": [ + [ 1.0, 2.0, 3.0 ], + [ 4.0, 5.0, 6.0 ], + [ 7.0, 8.0, 9.0 ] + ], + "LDC": 3, + "strideC1": 1, + "strideC2": 3, + "offsetC": 0, + "C": [ 1.0, 4.0, 7.0, 2.0, 5.0, 8.0, 3.0, 6.0, 9.0 ], + + "work": [ 0.0, 0.0, 0.0 ], + "strideWork": 1, + "offsetWork": 0, + + "C_out_mat": [ + [ -209.0, -250.0, -291.0 ], + [ 27832.0, 33413.0, 38994.0 ], + [ -1124936.0, -1350496.0, -1576056.0 ] + ], + "C_out": [ -209.0, 27832.0, -1124936.0, -250.0, 33413.0, -1350496.0, -291.0, 38994.0, -1576056.0 ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/left_trans_row_major.json b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/left_trans_row_major.json new file mode 100644 index 000000000000..78d69e0d693e --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/left_trans_row_major.json @@ -0,0 +1,45 @@ +{ + "order": "row-major", + "side": "left", + "trans": "transpose", + "M": 3, + "N": 3, + "K": 3, + + "A_mat": [ + [ 10.0, 0.0, 0.0 ], + [ 20.0, 30.0, 0.0 ], + [ 40.0, 50.0, 60.0 ] + ], + "LDA": 3, + "strideA1": 3, + "strideA2": 1, + "offsetA": 0, + "A": [ 10.0, 0.0, 0.0, 20.0, 30.0, 0.0, 40.0, 50.0, 60.0 ], + + "tau": [ 2.0, 3.0, 4.0 ], + "strideTau": 1, + "offsetTau": 0, + + "C_mat": [ + [ 7.0, 9.0, 11.0 ], + [ 12.0, 14.0, 16.0 ], + [ 17.0, 19.0, 21.0 ] + ], + "LDC": 3, + "strideC1": 3, + "strideC2": 1, + "offsetC": 0, + "C": [ 7.0, 9.0, 11.0, 12.0, 14.0, 16.0, 17.0, 19.0, 21.0 ], + + "work": [ 0.0, 0.0, 0.0 ], + "strideWork": 1, + "offsetWork": 0, + + "C_out_mat": [ + [ -1847.0, -2089.0, -2331.0 ], + [ 11195586.0, 12669042.0, 14142498.0 ], + [ -1684675671.0, -1906396497.0, -2128117323.0 ] + ], + "C_out": [ -1847.0, -2089.0, -2331.0, 11195586.0, 12669042.0, 14142498.0, -1684675671.0, -1906396497.0, -2128117323.0 ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/test/test.dorm2r.js b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/test.dorm2r.js index 99a1c9707a2d..e1407059003a 100644 --- a/lib/node_modules/@stdlib/lapack/base/dorm2r/test/test.dorm2r.js +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/test.dorm2r.js @@ -16,6 +16,8 @@ * limitations under the License. */ +/* eslint-disable max-len */ + 'use strict'; // MODULES // @@ -25,6 +27,14 @@ var Float64Array = require( '@stdlib/array/float64' ); var dorm2r = require( './../lib/dorm2r.js' ); +// FIXTURES // + +var LEFT_NOTRANS_ROW_MAJOR = require( './fixtures/left_notrans_row_major.json' ); +var LEFT_NOTRANS_COL_MAJOR = require( './fixtures/left_notrans_col_major.json' ); +var LEFT_TRANS_ROW_MAJOR = require( './fixtures/left_trans_row_major.json' ); +var LEFT_TRANS_COL_MAJOR = require( './fixtures/left_trans_col_major.json' ); + + // TESTS // tape( 'main export is a function', function test( t ) { @@ -253,3 +263,103 @@ tape( 'the function throws an error if provided a twelfth argument which is not }; } }); + +tape( 'the function applies Q from the left without transpose (row-major)', function test( t ) { + var expected; + var work; + var data; + var tau; + var out; + var A; + var C; + + data = LEFT_NOTRANS_ROW_MAJOR; + + A = new Float64Array( data.A ); + tau = new Float64Array( data.tau ); + C = new Float64Array( data.C ); + work = new Float64Array( data.work ); + + expected = new Float64Array( data.C_out ); + + out = dorm2r( data.order, data.side, data.trans, data.M, data.N, data.K, A, data.LDA, tau, C, data.LDC, work ); + t.strictEqual( out, C, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies Q from the left without transpose (column-major)', function test( t ) { + var expected; + var work; + var data; + var tau; + var out; + var A; + var C; + + data = LEFT_NOTRANS_COL_MAJOR; + + A = new Float64Array( data.A ); + tau = new Float64Array( data.tau ); + C = new Float64Array( data.C ); + work = new Float64Array( data.work ); + + expected = new Float64Array( data.C_out ); + + out = dorm2r( data.order, data.side, data.trans, data.M, data.N, data.K, A, data.LDA, tau, C, data.LDC, work ); + t.strictEqual( out, C, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies Q from the left with transpose (row-major)', function test( t ) { + var expected; + var work; + var data; + var tau; + var out; + var A; + var C; + + data = LEFT_TRANS_ROW_MAJOR; + + A = new Float64Array( data.A ); + tau = new Float64Array( data.tau ); + C = new Float64Array( data.C ); + work = new Float64Array( data.work ); + + expected = new Float64Array( data.C_out ); + + out = dorm2r( data.order, data.side, data.trans, data.M, data.N, data.K, A, data.LDA, tau, C, data.LDC, work ); + t.strictEqual( out, C, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies Q from the left with transpose (column-major)', function test( t ) { + var expected; + var work; + var data; + var tau; + var out; + var A; + var C; + + data = LEFT_TRANS_COL_MAJOR; + + A = new Float64Array( data.A ); + tau = new Float64Array( data.tau ); + C = new Float64Array( data.C ); + work = new Float64Array( data.work ); + + expected = new Float64Array( data.C_out ); + + out = dorm2r( data.order, data.side, data.trans, data.M, data.N, data.K, A, data.LDA, tau, C, data.LDC, work ); + t.strictEqual( out, C, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); From ec7f59a9e8306da2e5ded347801e1518b5e9d7df Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Thu, 7 Aug 2025 16:06:53 +0530 Subject: [PATCH 05/11] chore: idk whats going on anymore --- 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 status: na - task: lint_package_json status: na - 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: na - 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/lapack/base/dorm2r/lib/dorm2r.js | 7 ++--- .../test/fixtures/left_trans_col_major.json | 26 +++++++++---------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/dorm2r.js b/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/dorm2r.js index f97367e6d0aa..a60581d825bf 100644 --- a/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/dorm2r.js +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/dorm2r.js @@ -81,6 +81,7 @@ function dorm2r( order, side, trans, M, N, K, A, LDA, tau, C, LDC, work ) { // e 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 ) ); } @@ -92,13 +93,13 @@ function dorm2r( order, side, trans, M, N, K, A, LDA, tau, C, LDC, work ) { // e } if ( isColumnMajor( order ) ) { if ( side === 'left' && LDA < max( 1, M ) ) { - throw new RangeError( format( 'invalid argument. Eighth argument must be greater than or equal to max(1,%d) when side is left. Value: `%d`.', M, LDA ) ); + throw new RangeError( format( 'invalid argument. Eighth argument must be greater than or equal to max(1,%d). Value: `%d`.', M, LDA ) ); } if ( side === 'right' && LDA < max( 1, N ) ) { - throw new RangeError( format( 'invalid argument. Eighth argument must be greater than or equal to max(1,%d) when side is right. Value: `%d`.', N, LDA ) ); + throw new RangeError( format( 'invalid argument. Eighth argument must be greater than or equal to max(1,%d). Value: `%d`.', N, LDA ) ); } } else if ( LDA < max( 1, K ) ) { - throw new RangeError( format( 'invalid argument. Eighth argument must be greater than or equal to max(1,%d) for row-major layout. Value: `%d`.', K, LDA ) ); + throw new RangeError( format( 'invalid argument. Eighth argument must be greater than or equal to max(1,%d). Value: `%d`.', K, LDA ) ); } if ( isRowMajor( order ) && LDC < max( 1, N ) ) { throw new RangeError( format( 'invalid argument. Twelfth argument must be greater than or equal to max(1,%d). Value: `%d`.', N, LDC ) ); diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/left_trans_col_major.json b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/left_trans_col_major.json index 4dd2c6aec7bc..9a8ea643f058 100644 --- a/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/left_trans_col_major.json +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/left_trans_col_major.json @@ -7,39 +7,39 @@ "K": 3, "A_mat": [ - [ 1.0, 0.0, 0.0 ], - [ 2.0, 4.0, 0.0 ], - [ 3.0, 5.0, 6.0 ] + [ 10.0, 200.0, 123.0 ], + [ 20.0, 30.0, 200.0 ], + [ 40.0, 50.0, 60.0 ] ], "LDA": 3, "strideA1": 1, "strideA2": 3, "offsetA": 0, - "A": [ 1.0, 2.0, 3.0, 0.0, 4.0, 5.0, 0.0, 0.0, 6.0 ], + "A": [ 10.0, 20.0, 40.0, 200.0, 30.0, 50.0, 123.0, 200.0, 60.0 ], - "tau": [ 7.0, 8.0, 9.0 ], + "tau": [ 2.0, 3.0, 4.0 ], "strideTau": 1, "offsetTau": 0, "C_mat": [ - [ 1.0, 2.0, 3.0 ], - [ 4.0, 5.0, 6.0 ], - [ 7.0, 8.0, 9.0 ] + [ 7.0, 9.0, 11.0 ], + [ 12.0, 14.0, 16.0 ], + [ 17.0, 19.0, 21.0 ] ], "LDC": 3, "strideC1": 1, "strideC2": 3, "offsetC": 0, - "C": [ 1.0, 4.0, 7.0, 2.0, 5.0, 8.0, 3.0, 6.0, 9.0 ], + "C": [ 7.0, 12.0, 17.0, 9.0, 14.0, 19.0, 11.0, 16.0, 21.0 ], "work": [ 0.0, 0.0, 0.0 ], "strideWork": 1, "offsetWork": 0, "C_out_mat": [ - [ -209.0, -250.0, -291.0 ], - [ 27832.0, 33413.0, 38994.0 ], - [ -1124936.0, -1350496.0, -1576056.0 ] + [ -1847.0, -2089.0, -2331.0 ], + [ 11195586.0, 12669042.0, 14142498.0 ], + [ -1684675671.0, -1906396497.0, -2128117323.0 ] ], - "C_out": [ -209.0, 27832.0, -1124936.0, -250.0, 33413.0, -1350496.0, -291.0, 38994.0, -1576056.0 ] + "C_out": [ -1847.0, 11195586.0, -1684675671.0, -2089.0, 12669042.0, -1906396497.0, -2331.0, 14142498.0, -2128117323.0 ] } From 0706df5573d71fc287b7ad39fbbd5ccab5a83287 Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Thu, 7 Aug 2025 16:56:12 +0530 Subject: [PATCH 06/11] chore: test w different fixtures??? --- 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 status: na - task: lint_package_json status: na - 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/lapack/base/dorm2r/lib/base.js | 17 +++++++---------- .../test/fixtures/left_trans_row_major.json | 6 +++--- .../lapack/base/dorm2r/test/test.dorm2r.js | 2 +- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/base.js b/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/base.js index f9b53fbd2f58..68f93b17f0a4 100644 --- a/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/base.js +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/base.js @@ -109,28 +109,25 @@ function dorm2r( side, trans, M, N, K, A, strideA1, strideA2, offsetA, tau, stri // Initialize dimensions if ( left ) { ni = N; - jc = 0; // 0-based indexing + jc = 1; } else { mi = M; - ic = 0; // 0-based indexing + ic = 1; } - // Main loop - for ( i = i1; ( i3 > 0 ) ? ( i <= i2 ) : ( i >= i2 ); i += i3 ) { + for ( i = i1; ( i3 > 0 ) ? ( i <= i2 ) : ( i >= i2 ); i += i3 ) { // loop going from 1..K or K..1 if ( left ) { - // H(i) is applied to C(i:m,1:n) mi = M - i + 1; - ic = i - 1; // Convert to 0-based indexing + ic = i; } else { - // H(i) is applied to C(1:m,i:n) ni = N - i + 1; - jc = i - 1; // Convert to 0-based indexing + jc = i; } - // Apply H(i) using `dlarf1f` tauVal = tau[ offsetTau + ( ( i - 1 ) * strideTau ) ]; aOffset = offsetA + ( ( i - 1 ) * strideA1 ) + ( ( i - 1 ) * strideA2 ); - cOffset = offsetC + ( ic * strideC1 ) + ( jc * strideC2 ); + cOffset = offsetC + ( (ic-1) * strideC1 ) + ( (jc-1) * strideC2 ); + dlarf1f( side, mi, ni, A, strideA1, aOffset, tauVal, C, strideC1, strideC2, cOffset, work, strideWork, offsetWork ); // eslint-disable-line max-len } diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/left_trans_row_major.json b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/left_trans_row_major.json index 78d69e0d693e..b7485a4d8feb 100644 --- a/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/left_trans_row_major.json +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/left_trans_row_major.json @@ -7,15 +7,15 @@ "K": 3, "A_mat": [ - [ 10.0, 0.0, 0.0 ], - [ 20.0, 30.0, 0.0 ], + [ 10.0, 200.0, 123.0 ], + [ 20.0, 30.0, 200.0 ], [ 40.0, 50.0, 60.0 ] ], "LDA": 3, "strideA1": 3, "strideA2": 1, "offsetA": 0, - "A": [ 10.0, 0.0, 0.0, 20.0, 30.0, 0.0, 40.0, 50.0, 60.0 ], + "A": [ 10.0, 200.0, 123.0, 20.0, 30.0, 200.0, 40.0, 50.0, 60.0 ], "tau": [ 2.0, 3.0, 4.0 ], "strideTau": 1, diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/test/test.dorm2r.js b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/test.dorm2r.js index e1407059003a..ed5f017593d5 100644 --- a/lib/node_modules/@stdlib/lapack/base/dorm2r/test/test.dorm2r.js +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/test.dorm2r.js @@ -314,7 +314,7 @@ tape( 'the function applies Q from the left without transpose (column-major)', f t.end(); }); -tape( 'the function applies Q from the left with transpose (row-major)', function test( t ) { +tape.only( 'the function applies Q from the left with transpose (row-major)', function test( t ) { var expected; var work; var data; From d0b53be5487ea531236bc18dd5e44fb550d6f042 Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Thu, 7 Aug 2025 22:12:35 +0530 Subject: [PATCH 07/11] feat: add examples and benchmarks --- 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 status: na - task: lint_package_json status: passed - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: passed - 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../lapack/base/dorm2r/benchmark/benchmark.js | 151 ++++++++++++++++++ .../dorm2r/benchmark/benchmark.ndarray.js | 141 ++++++++++++++++ .../lapack/base/dorm2r/examples/index.js | 43 +++++ .../@stdlib/lapack/base/dorm2r/package.json | 74 +++++++++ .../lapack/base/dorm2r/test/test.dorm2r.js | 2 +- 5 files changed, 410 insertions(+), 1 deletion(-) create mode 100644 lib/node_modules/@stdlib/lapack/base/dorm2r/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/lapack/base/dorm2r/benchmark/benchmark.ndarray.js create mode 100644 lib/node_modules/@stdlib/lapack/base/dorm2r/examples/index.js create mode 100644 lib/node_modules/@stdlib/lapack/base/dorm2r/package.json diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/benchmark/benchmark.js b/lib/node_modules/@stdlib/lapack/base/dorm2r/benchmark/benchmark.js new file mode 100644 index 000000000000..7d43b0a630d0 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/benchmark/benchmark.js @@ -0,0 +1,151 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var Float64Array = require( '@stdlib/array/float64' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var dorm2r = require( './../lib/dorm2r.js' ); + + +// VARIABLES // + +var LAYOUTS = [ + 'row-major', + 'column-major' +]; +var SIDES = [ + 'left', + 'right' +]; +var TRANS = [ + 'no-transpose', + 'transpose' +]; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {string} order - storage layout +* @param {string} side - specifies the side of multiplication +* @param {string} trans - specifies the operation to be performed +* @param {PositiveInteger} N - number of rows/columns in matrix C +* @returns {Function} benchmark function +*/ +function createBenchmark( order, side, trans, N ) { + var work; + var tau; + var A; + var C; + + A = uniform( N*N, 0.01, 0.1, { + 'dtype': 'float64' + }); + tau = uniform( N, 0.01, 0.1, { + 'dtype': 'float64' + }); + C = uniform( N*N, 0.01, 0.1, { + 'dtype': 'float64' + }); + work = new Float64Array( N ); + + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var z; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + z = dorm2r( order, side, trans, N, N, N, A, N, tau, C, N, work ); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var trans; + var side; + var min; + var max; + var ord; + var N; + var f; + var i; + var j; + var k; + var l; + var m; + + min = 1; // 10^min + max = 3; // 10^max + + for ( k = 0; k < LAYOUTS.length; k++ ) { + ord = LAYOUTS[ k ]; + for ( l = 0; l < SIDES.length; l++ ) { + side = SIDES[ l ]; + for ( m = 0; m < TRANS.length; m++ ) { + trans = TRANS[ m ]; + for ( i = min; i <= max; i++ ) { + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + j = 1; + while ( j <= N ) { + f = createBenchmark( ord, side, trans, N ); + bench( pkg+'::square_matrix:order='+ord+',side='+side+',trans='+trans+',M='+N+',N='+N+',K='+N, f ); + j *= 2; + } + } + } + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dorm2r/benchmark/benchmark.ndarray.js new file mode 100644 index 000000000000..7fa825cfec7c --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/benchmark/benchmark.ndarray.js @@ -0,0 +1,141 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var Float64Array = require( '@stdlib/array/float64' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var dorm2r = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var SIDES = [ + 'left', + 'right' +]; +var TRANS = [ + 'no-transpose', + 'transpose' +]; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {string} side - specifies the side of multiplication +* @param {string} trans - specifies the operation to be performed +* @param {PositiveInteger} N - number of rows/columns in matrix C +* @returns {Function} benchmark function +*/ +function createBenchmark( side, trans, N ) { + var work; + var tau; + var A; + var C; + + A = uniform( N*N, 0.01, 0.1, { + 'dtype': 'float64' + }); + tau = uniform( N, 0.01, 0.1, { + 'dtype': 'float64' + }); + C = uniform( N*N, 0.01, 0.1, { + 'dtype': 'float64' + }); + work = new Float64Array( N ); + + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var z; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + z = dorm2r( side, trans, N, N, N, A, N, 1, 0, tau, 1, 0, C, N, 1, 0, work, 1, 0 ); // eslint-disable-line max-len + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var trans; + var side; + var min; + var max; + var N; + var f; + var i; + var j; + var k; + var l; + + min = 1; // 10^min + max = 3; // 10^max + + for ( k = 0; k < SIDES.length; k++ ) { + side = SIDES[ k ]; + for ( l = 0; l < TRANS.length; l++ ) { + trans = TRANS[ l ]; + for ( i = min; i <= max; i++ ) { + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + j = 1; + while ( j <= N ) { + f = createBenchmark( side, trans, N ); + bench( pkg+'::square_matrix:ndarray:side='+side+',trans='+trans+',M='+N+',N='+N+',K='+N, f ); + j *= 2; + } + } + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/examples/index.js b/lib/node_modules/@stdlib/lapack/base/dorm2r/examples/index.js new file mode 100644 index 000000000000..2fab24e1d24b --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/examples/index.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var Float64Array = require( '@stdlib/array/float64' ); +var ndarray2array = require( '@stdlib/ndarray/base/to-array' ); +var dorm2r = require( './../lib' ); + +// Specify matrix meta data: +var shape = [ 3, 3 ]; +var strides = [ 1, 3 ]; +var offset = 0; +var order = 'column-major'; + +// Create matrices stored in linear memory: +var A = new Float64Array( [ 1.0, 0.0, 0.0, 2.0, 4.0, 0.0, 3.0, 5.0, 6.0 ] ); +var tau = new Float64Array( [ 7.0, 8.0, 9.0 ] ); +var C = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ] ); +var work = new Float64Array( 3 ); + +console.log( 'Input matrix C:' ); +console.log( ndarray2array( C, shape, strides, offset, order ) ); + +// Multiply C by Q from the left (no transpose): +dorm2r( order, 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, work ); +console.log( 'Output matrix C (Q * C):' ); +console.log( ndarray2array( C, shape, strides, offset, order ) ); diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/package.json b/lib/node_modules/@stdlib/lapack/base/dorm2r/package.json new file mode 100644 index 000000000000..d064af3582b5 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/package.json @@ -0,0 +1,74 @@ +{ + "name": "@stdlib/lapack/base/dorm2r", + "version": "0.0.0", + "description": "Multiply a matrix by an orthogonal matrix from a QR factorization.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "stdmath", + "mathematics", + "math", + "lapack", + "dorm2r", + "orthogonal", + "matrix", + "multiplication", + "qr", + "factorization", + "reflector", + "elementary", + "linear", + "algebra", + "subroutines", + "array", + "ndarray", + "float64", + "double", + "float64array" + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/test/test.dorm2r.js b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/test.dorm2r.js index ed5f017593d5..e1407059003a 100644 --- a/lib/node_modules/@stdlib/lapack/base/dorm2r/test/test.dorm2r.js +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/test.dorm2r.js @@ -314,7 +314,7 @@ tape( 'the function applies Q from the left without transpose (column-major)', f t.end(); }); -tape.only( 'the function applies Q from the left with transpose (row-major)', function test( t ) { +tape( 'the function applies Q from the left with transpose (row-major)', function test( t ) { var expected; var work; var data; From af74be5ce71ce52f756f515d2101d17bc9c60e62 Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Fri, 8 Aug 2025 10:50:39 +0530 Subject: [PATCH 08/11] chore: test transpose --- .../lapack/base/dorm2r/docs/types/index.d.ts | 174 +++++ .../lapack/base/dorm2r/docs/types/test.ts | 620 ++++++++++++++++++ .../@stdlib/lapack/base/dorm2r/lib/base.js | 21 +- 3 files changed, 814 insertions(+), 1 deletion(-) create mode 100644 lib/node_modules/@stdlib/lapack/base/dorm2r/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/lapack/base/dorm2r/docs/types/test.ts diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/docs/types/index.d.ts b/lib/node_modules/@stdlib/lapack/base/dorm2r/docs/types/index.d.ts new file mode 100644 index 000000000000..9bbb56f058d5 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/docs/types/index.d.ts @@ -0,0 +1,174 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/// + +import { Layout, OperationSide, TransposeOperation } from '@stdlib/types/blas'; + +/** +* Interface describing `dorm2r`. +*/ +interface Routine { + /** + * Multiplies a matrix `C` by an orthogonal matrix `Q` from a QR factorization. + * + * ## Notes + * + * `dorm2r` overwrites the general real M by N matrix C with + * + * - `Q * C` if side = 'left' and trans = 'no-transpose' + * - `Q^T * C` if side = 'left' and trans = 'transpose' + * - `C * Q` if side = 'right' and trans = 'no-transpose' + * - `C * Q^T` if side = 'right' and trans = 'transpose' + * + * where Q is a real orthogonal matrix defined as the product of K elementary reflectors `Q = H(1) H(2) ... H(K)` as returned by `dgeqrf`. Q is of order M if side = 'left' and of order N if side = 'right'. + * + * @param order - storage layout + * @param side - specifies the side of multiplication with `C` + * @param trans - specifies the operation to be performed + * @param M - number of rows in matrix `C` + * @param N - number of columns in matrix `C` + * @param K - number of elementary reflectors whose product defines the matrix `Q` + * @param A - input matrix containing the elementary reflectors + * @param LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) + * @param tau - array containing the scalar factors of the elementary reflectors + * @param C - input/output matrix to be multiplied + * @param LDC - stride of the first dimension of `C` (a.k.a., leading dimension of the matrix `C`) + * @param work - workspace array for intermediate calculations + * @returns the modified matrix `C` + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * var A = new Float64Array( [ 1.0, 0.0, 0.0, 2.0, 4.0, 0.0, 3.0, 5.0, 6.0 ] ); + * var tau = new Float64Array( [ 7.0, 8.0, 9.0 ] ); + * var C = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ] ); + * var work = new Float64Array( 3 ); + * + * dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, work ); + * // C => [ -261638.0, -298618.0, -335598.0, -521066.0, -594715.0, -668364.0, -773933.0, -883324.0, -992715.0 ] + */ + ( order: Layout, side: OperationSide, trans: TransposeOperation, M: number, N: number, K: number, A: Float64Array, LDA: number, tau: Float64Array, C: Float64Array, LDC: number, work: Float64Array ): Float64Array; + + /** + * Multiplies a matrix `C` by an orthogonal matrix `Q` from a QR factorization using alternative indexing semantics. + * + * ## Notes + * + * `dorm2r` overwrites the general real M by N matrix C with + * + * - `Q * C` if side = 'left' and trans = 'no-transpose' + * - `Q^T * C` if side = 'left' and trans = 'transpose' + * - `C * Q` if side = 'right' and trans = 'no-transpose' + * - `C * Q^T` if side = 'right' and trans = 'transpose' + * + * where Q is a real orthogonal matrix defined as the product of K elementary reflectors `Q = H(1) H(2) ... H(K)` as returned by `dgeqrf`. Q is of order M if side = 'left' and of order N if side = 'right'. + * + * @param side - specifies the side of multiplication with `C` + * @param trans - specifies the operation to be performed + * @param M - number of rows in matrix `C` + * @param N - number of columns in matrix `C` + * @param K - number of elementary reflectors whose product defines the matrix `Q` + * @param A - input matrix containing the elementary reflectors + * @param strideA1 - stride length for the first dimension of `A` + * @param strideA2 - stride length for the second dimension of `A` + * @param offsetA - starting index for `A` + * @param tau - array containing the scalar factors of the elementary reflectors + * @param strideTau - stride length for `tau` + * @param offsetTau - starting index for `tau` + * @param C - input/output matrix to be multiplied + * @param strideC1 - stride length for the first dimension of `C` + * @param strideC2 - stride length for the second dimension of `C` + * @param offsetC - starting index for `C` + * @param work - workspace array for intermediate calculations + * @param strideWork - stride length for `work` + * @param offsetWork - starting index for `work` + * @returns the modified matrix `C` + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * var A = new Float64Array( [ 1.0, 0.0, 0.0, 2.0, 4.0, 0.0, 3.0, 5.0, 6.0 ] ); + * var tau = new Float64Array( [ 7.0, 8.0, 9.0 ] ); + * var C = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ] ); + * var work = new Float64Array( 3 ); + * + * dorm2r( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); + * // C => [ -261638.0, -298618.0, -335598.0, -521066.0, -594715.0, -668364.0, -773933.0, -883324.0, -992715.0 ] + */ + ndarray( side: OperationSide, trans: TransposeOperation, M: number, N: number, K: number, A: Float64Array, strideA1: number, strideA2: number, offsetA: number, tau: Float64Array, strideTau: number, offsetTau: number, C: Float64Array, strideC1: number, strideC2: number, offsetC: number, work: Float64Array, strideWork: number, offsetWork: number ): Float64Array; +} + +/** +* Multiplies a matrix `C` by an orthogonal matrix `Q` from a QR factorization. +* +* ## Notes +* +* `dorm2r` overwrites the general real M by N matrix C with +* +* - `Q * C` if side = 'left' and trans = 'no-transpose' +* - `Q^T * C` if side = 'left' and trans = 'transpose' +* - `C * Q` if side = 'right' and trans = 'no-transpose' +* - `C * Q^T` if side = 'right' and trans = 'transpose' +* +* where Q is a real orthogonal matrix defined as the product of K elementary reflectors `Q = H(1) H(2) ... H(K)` as returned by `dgeqrf`. Q is of order M if side = 'left' and of order N if side = 'right'. +* +* @param order - storage layout +* @param side - specifies the side of multiplication with `C` +* @param trans - specifies the operation to be performed +* @param M - number of rows in matrix `C` +* @param N - number of columns in matrix `C` +* @param K - number of elementary reflectors whose product defines the matrix `Q` +* @param A - input matrix containing the elementary reflectors +* @param LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) +* @param tau - array containing the scalar factors of the elementary reflectors +* @param C - input/output matrix to be multiplied +* @param LDC - stride of the first dimension of `C` (a.k.a., leading dimension of the matrix `C`) +* @param work - workspace array for intermediate calculations +* @returns the modified matrix `C` +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( [ 1.0, 0.0, 0.0, 2.0, 4.0, 0.0, 3.0, 5.0, 6.0 ] ); +* var tau = new Float64Array( [ 7.0, 8.0, 9.0 ] ); +* var C = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ] ); +* var work = new Float64Array( 3 ); +* +* dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, work ); +* // C => [ -261638.0, -298618.0, -335598.0, -521066.0, -594715.0, -668364.0, -773933.0, -883324.0, -992715.0 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( [ 1.0, 0.0, 0.0, 2.0, 4.0, 0.0, 3.0, 5.0, 6.0 ] ); +* var tau = new Float64Array( [ 7.0, 8.0, 9.0 ] ); +* var C = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ] ); +* var work = new Float64Array( 3 ); +* +* dorm2r( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); +* // C => [ -261638.0, -298618.0, -335598.0, -521066.0, -594715.0, -668364.0, -773933.0, -883324.0, -992715.0 ] +*/ +declare var dorm2r: Routine; + + +// EXPORTS // + +export = dorm2r; diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/docs/types/test.ts b/lib/node_modules/@stdlib/lapack/base/dorm2r/docs/types/test.ts new file mode 100644 index 000000000000..2bafd67b038e --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/docs/types/test.ts @@ -0,0 +1,620 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import dorm2r = require( './index' ); + + +// TESTS // + +// The function returns a Float64Array... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, work ); // $ExpectType Float64Array +} + +// The compiler throws an error if the function is provided a first argument which is not a string... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r( 5, 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( true, 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( false, 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( null, 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( void 0, 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( [], 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( {}, 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( ( x: number ): number => x, 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError +} + +// The compiler throws an error if the function is provided a second argument which is not a string... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r( 'row-major', 5, 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', true, 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', false, 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', null, 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', void 0, 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', [], 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', {}, 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', ( x: number ): number => x, 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError +} + +// The compiler throws an error if the function is provided a third argument which is not a string... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r( 'row-major', 'left', 5, 3, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', true, 3, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', false, 3, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', null, 3, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', void 0, 3, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', [], 3, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', {}, 3, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', ( x: number ): number => x, 3, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fourth argument which is not a number... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r( 'row-major', 'left', 'no-transpose', '5', 3, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', true, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', false, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', null, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', void 0, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', [], 3, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', {}, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', ( x: number ): number => x, 3, 3, A, 3, tau, C, 3, work ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fifth argument which is not a number... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r( 'row-major', 'left', 'no-transpose', 3, '5', 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, true, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, false, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, null, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, void 0, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, [], 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, {}, 3, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, ( x: number ): number => x, 3, A, 3, tau, C, 3, work ); // $ExpectError +} + +// The compiler throws an error if the function is provided a sixth argument which is not a number... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, '5', A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, true, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, false, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, null, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, void 0, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, [], A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, {}, A, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, ( x: number ): number => x, A, 3, tau, C, 3, work ); // $ExpectError +} + +// The compiler throws an error if the function is provided a seventh argument which is not a Float64Array... +{ + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, '5', 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, 5, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, true, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, false, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, null, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, void 0, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, [], 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, {}, 3, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, ( x: number ): number => x, 3, tau, C, 3, work ); // $ExpectError +} + +// The compiler throws an error if the function is provided an eighth argument which is not a number... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, '5', tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, true, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, false, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, null, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, void 0, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, [], tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, {}, tau, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, ( x: number ): number => x, tau, C, 3, work ); // $ExpectError +} + +// The compiler throws an error if the function is provided a ninth argument which is not a Float64Array... +{ + const A = new Float64Array( 9 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, '5', C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, 5, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, true, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, false, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, null, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, void 0, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, [], C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, {}, C, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, ( x: number ): number => x, C, 3, work ); // $ExpectError +} + +// The compiler throws an error if the function is provided a tenth argument which is not a Float64Array... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const work = new Float64Array( 3 ); + + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, '5', 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, 5, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, true, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, false, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, null, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, void 0, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, [], 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, {}, 3, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, ( x: number ): number => x, 3, work ); // $ExpectError +} + +// The compiler throws an error if the function is provided an eleventh argument which is not a number... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, '5', work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, true, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, false, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, null, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, void 0, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, [], work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, {}, work ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, ( x: number ): number => x, work ); // $ExpectError +} + +// The compiler throws an error if the function is provided a twelfth argument which is not a Float64Array... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, '5' ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, 5 ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, true ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, false ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, null ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, void 0 ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, [] ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, {} ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r(); // $ExpectError + dorm2r( 'row-major' ); // $ExpectError + dorm2r( 'row-major', 'left' ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose' ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3 ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3 ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3 ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3 ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, 3 ); // $ExpectError + dorm2r( 'row-major', 'left', 'no-transpose', 3, 3, 3, A, 3, tau, C, 3, work, 10 ); // $ExpectError +} + +// Attached to main export is an `ndarray` method which returns a Float64Array... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectType Float64Array +} + +// The compiler throws an error if the function is provided a first argument which is not a string... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r.ndarray( 5, 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( true, 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( false, 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( null, 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( void 0, 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( [], 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( {}, 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( ( x: number ): number => x, 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a second argument which is not a string... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r.ndarray( 'left', 5, 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', true, 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', false, 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', null, 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', void 0, 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', [], 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', {}, 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', ( x: number ): number => x, 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a third argument which is not a number... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r.ndarray( 'left', 'no-transpose', '5', 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', true, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', false, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', null, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', void 0, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', [], 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', {}, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', ( x: number ): number => x, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fourth argument which is not a number... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r.ndarray( 'left', 'no-transpose', 3, '5', 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, true, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, false, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, null, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, void 0, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, [], 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, {}, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, ( x: number ): number => x, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fifth argument which is not a number... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, '5', A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, true, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, false, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, null, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, void 0, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, [], A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, {}, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, ( x: number ): number => x, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a sixth argument which is not a Float64Array... +{ + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, '5', 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, 5, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, true, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, false, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, null, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, void 0, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, [], 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, {}, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, ( x: number ): number => x, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a seventh argument which is not a number... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, '5', 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, true, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, false, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, null, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, void 0, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, [], 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, {}, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, ( x: number ): number => x, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided an eighth argument which is not a number... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, '5', 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, true, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, false, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, null, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, void 0, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, [], 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, {}, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, ( x: number ): number => x, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a ninth argument which is not a number... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, '5', tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, true, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, false, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, null, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, void 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, [], tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, {}, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, ( x: number ): number => x, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a tenth argument which is not a Float64Array... +{ + const A = new Float64Array( 9 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, '5', 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, 5, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, true, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, false, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, null, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, void 0, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, [], 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, {}, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, ( x: number ): number => x, 1, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided an eleventh argument which is not a number... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, '5', 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, true, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, false, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, null, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, void 0, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, [], 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, {}, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, ( x: number ): number => x, 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a twelfth argument which is not a number... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, '5', C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, true, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, false, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, null, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, void 0, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, [], C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, {}, C, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, ( x: number ): number => x, C, 3, 1, 0, work, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a thirteenth argument which is not a Float64Array... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const work = new Float64Array( 3 ); + + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, '5', 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, 5, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, true, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, false, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, null, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, void 0, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, [], 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, {}, 3, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, ( x: number ): number => x, 3, 1, 0, work, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fourteenth argument which is not a number... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, '5', 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, true, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, false, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, null, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, void 0, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, [], 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, {}, 1, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, ( x: number ): number => x, 1, 0, work, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fifteenth argument which is not a number... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, '5', 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, true, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, false, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, null, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, void 0, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, [], 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, {}, 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, ( x: number ): number => x, 0, work, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a sixteenth argument which is not a number... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, '5', work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, true, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, false, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, null, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, void 0, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, [], work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, {}, work, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, ( x: number ): number => x, work, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a seventeenth argument which is not a Float64Array... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, '5', 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, 5, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, true, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, false, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, null, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, void 0, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, [], 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, {}, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, ( x: number ): number => x, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided an eighteenth argument which is not a number... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, '5', 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, true, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, false, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, null, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, void 0, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, [], 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, {}, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, ( x: number ): number => x, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a nineteenth argument which is not a number... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, '5' ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, true ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, false ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, null ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, void 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, [] ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, {} ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided an unsupported number of arguments... +{ + const A = new Float64Array( 9 ); + const tau = new Float64Array( 3 ); + const C = new Float64Array( 9 ); + const work = new Float64Array( 3 ); + + dorm2r.ndarray(); // $ExpectError + dorm2r.ndarray( 'left' ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose' ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1 ); // $ExpectError + dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0, 10 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/base.js b/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/base.js index 68f93b17f0a4..54398848d33f 100644 --- a/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/base.js +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/base.js @@ -77,6 +77,9 @@ function dorm2r( side, trans, M, N, K, A, strideA1, strideA2, offsetA, tau, stri var cOffset; var tauVal; var notran; + var passC1; + var passC2; + var passA; var left; var i1; var i2; @@ -126,9 +129,25 @@ function dorm2r( side, trans, M, N, K, A, strideA1, strideA2, offsetA, tau, stri tauVal = tau[ offsetTau + ( ( i - 1 ) * strideTau ) ]; aOffset = offsetA + ( ( i - 1 ) * strideA1 ) + ( ( i - 1 ) * strideA2 ); + + // if ( notran ) { + // passA = strideA1; + // passC1 = strideC1; + // passC2 = strideC2; + // cOffset = offsetC + ( (ic-1) * strideC1 ) + ( (jc-1) * strideC2 ); + // } else { + // passA = strideA2; + // passC1 = strideC2; + // passC2 = strideC1; + // cOffset = offsetC + ( (jc-1) * strideC1 ) + ( (ic-1) * strideC2 ); + // } + + passA = strideA1; + passC1 = strideC1; + passC2 = strideC2; cOffset = offsetC + ( (ic-1) * strideC1 ) + ( (jc-1) * strideC2 ); - dlarf1f( side, mi, ni, A, strideA1, aOffset, tauVal, C, strideC1, strideC2, cOffset, work, strideWork, offsetWork ); // eslint-disable-line max-len + dlarf1f( side, mi, ni, A, passA, aOffset, tauVal, C, passC1, passC2, cOffset, work, strideWork, offsetWork ); // eslint-disable-line max-len } return C; From 13bb8de79e52d52d7f60dc2078d459fcd58a46ae Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Sun, 2 Aug 2026 11:30:51 +0530 Subject: [PATCH 09/11] chore: use merged dlarf1f 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: 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: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - 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/dorm2r/lib/base.js | 15 +- .../@stdlib/lapack/base/dorm2r/lib/dlarf1f.js | 128 ------------------ 2 files changed, 1 insertion(+), 142 deletions(-) delete mode 100644 lib/node_modules/@stdlib/lapack/base/dorm2r/lib/dlarf1f.js diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/base.js b/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/base.js index 54398848d33f..baa99539fa68 100644 --- a/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/base.js +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/base.js @@ -20,7 +20,7 @@ // MODULES // -var dlarf1f = require( './dlarf1f.js' ); +var dlarf1f = require( '@stdlib/lapack/base/dlarf1f' ).ndarray; // MAIN // @@ -129,19 +129,6 @@ function dorm2r( side, trans, M, N, K, A, strideA1, strideA2, offsetA, tau, stri tauVal = tau[ offsetTau + ( ( i - 1 ) * strideTau ) ]; aOffset = offsetA + ( ( i - 1 ) * strideA1 ) + ( ( i - 1 ) * strideA2 ); - - // if ( notran ) { - // passA = strideA1; - // passC1 = strideC1; - // passC2 = strideC2; - // cOffset = offsetC + ( (ic-1) * strideC1 ) + ( (jc-1) * strideC2 ); - // } else { - // passA = strideA2; - // passC1 = strideC2; - // passC2 = strideC1; - // cOffset = offsetC + ( (jc-1) * strideC1 ) + ( (ic-1) * strideC2 ); - // } - passA = strideA1; passC1 = strideC1; passC2 = strideC2; diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/dlarf1f.js b/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/dlarf1f.js deleted file mode 100644 index 1da894fe3c3c..000000000000 --- a/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/dlarf1f.js +++ /dev/null @@ -1,128 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/* eslint-disable max-len */ - -// MODULES // - -var iladlc = require( '@stdlib/lapack/base/iladlc' ).ndarray; -var iladlr = require( '@stdlib/lapack/base/iladlr' ).ndarray; -var dgemv = require( '@stdlib/blas/base/dgemv' ).ndarray; -var dger = require( '@stdlib/blas/base/dger' ).ndarray; -var daxpy = require( '@stdlib/blas/base/daxpy' ).ndarray; -var dscal = require( '@stdlib/blas/base/dscal' ).ndarray; - - -// MAIN // - -/** -* Applies a real elementary reflector `H = I - tau * v * v ^ T` to a real M by N matrix `C`. -* -* ## Notes -* -* - `work` should have `N` indexed elements if side = `left` and `M` indexed elements if side = `right`. -* - `V` should have `1 + (M-1) * abs(strideV)` indexed elements if side = `left` and `1 + (N-1) * abs(strideV)` indexed elements if side = `right`. -* - `C` is overwritten by `H * C` if side = `left` and `C * H` if side = `right`. -* -* @private -* @param {string} side - specifies the side of multiplication with `C`. Use `left` to form `H * C` and `right` to from `C * H`. -* @param {NonNegativeInteger} M - number of rows in `C` -* @param {NonNegativeInteger} N - number of columns in `C` -* @param {Float64Array} V - the vector `v` in the representation of `H` -* @param {integer} strideV - stride length for `V` -* @param {NonNegativeInteger} offsetV - starting index for `V` -* @param {number} tau - the value of `tau` in representation of `H` -* @param {Float64Array} C - input matrix -* @param {integer} strideC1 - stride of the first dimension of `C` -* @param {integer} strideC2 - stride of the second dimension of `C` -* @param {NonNegativeInteger} offsetC - starting index for `C` -* @param {Float64Array} work - workspace array -* @param {integer} strideWork - stride length for `work` -* @param {NonNegativeInteger} offsetWork - starting index for `work` -* @returns {Float64Array} `C * H` or `H * C` -* -* @example -* var Float64Array = require( '@stdlib/array/float64' ); -* -* var C = new Float64Array( [ 1.0, 5.0, 9.0, 2.0, 6.0, 10.0, 3.0, 7.0, 11.0, 4.0, 8.0, 12.0 ] ); -* var V = new Float64Array( [ 0.5, 0.5, 0.5, 0.5 ] ); -* var work = new Float64Array( 3 ); -* -* var out = dlarf1f( 'left', 4, 3, V, 1, 0, 1.0, C, 3, 1, 0, work, 1, 0 ); -* // returns [ -4.5, -10.5, -16.5, -0.75, -1.75, -2.75, 0.25, -0.75, -1.75, 1.25, 0.25, -0.75 ] -*/ -function dlarf1f( side, M, N, V, strideV, offsetV, tau, C, strideC1, strideC2, offsetC, work, strideWork, offsetWork ) { // eslint-disable-line max-params - var lastv; - var lastc; - var i; - - lastv = 1; - lastc = 0; - if ( tau !== 0.0 ) { - if ( side === 'left' ) { - lastv = M; - } else { - lastv = N; - } - - // i points to the last element in V - i = offsetV + ( ( lastv - 1 ) * strideV ); - - // Move i to the last non-zero element in V - while ( lastv > 0 && V[ i ] === 0.0 ) { - lastv -= 1; - i -= strideV; - } - if ( side === 'left' ) { - lastc = iladlc( lastv + 1, N, C, strideC1, strideC2, offsetC ) + 1; // to account for the difference between zero-based and one-based indexing - } else { - lastc = iladlr( M, lastv + 1, C, strideC1, strideC2, offsetC ) + 1; // to account for the difference between zero-based and one-based indexing - } - // lastc is zero if a matrix is filled with zeros - } - if ( lastc === 0 ) { - // Returns C unchanged if tau is zero or all elements in C are zero - return C; - } - if ( side === 'left' ) { - if ( lastv === 0 ) { - dscal( lastc, 1.0 - tau, C, strideC2, offsetC ); // scale the first row - } else { - dgemv( 'transpose', lastv-1, lastc, 1.0, C, strideC1, strideC2, offsetC + strideC1, V, strideV, offsetV + strideV, 0.0, work, strideWork, offsetWork ); // C( 1, 0 ) is accessed here - daxpy( lastc, 1.0, C, strideC2, offsetC, work, strideWork, offsetWork ); // operates on the first row of C - daxpy( lastc, -tau, work, strideWork, offsetWork, C, strideC2, offsetC ); // operates on the first row of C - dger( lastv-1, lastc, -tau, V, strideV, offsetV + strideV, work, strideWork, offsetWork, C, strideC1, strideC2, offsetC + strideC1 ); // C( 1, 0 ) is accessed here - } - } else if ( lastv === 0 ) { - dscal( lastc, 1.0 - tau, C, strideC1, offsetC ); // scale the first column - } else { - dgemv( 'no-transpose', lastc, lastv-1, 1.0, C, strideC1, strideC2, offsetC + strideC2, V, strideV, offsetV + strideV, 0.0, work, strideWork, offsetWork ); // C( 0, 1 ) is accessed here - daxpy( lastc, 1.0, C, strideC1, offsetC, work, strideWork, offsetWork ); // operates on the first column of C - daxpy( lastc, -tau, work, strideWork, offsetWork, C, strideC1, offsetC ); // operates on the first column of C - dger( lastc, lastv-1, -tau, work, strideWork, offsetWork, V, strideV, offsetV + strideV, C, strideC1, strideC2, offsetC + strideC2 ); // C( 0, 1 ) is accessed here - } - - return C; -} - - -// EXPORTS // - -module.exports = dlarf1f; From 228dddb6bb9f0a6c0e0831fd268fff17cdb89d78 Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Sun, 2 Aug 2026 11:52:02 +0530 Subject: [PATCH 10/11] chore: cleanup --- 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: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: passed - 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 --- --- .../lapack/base/dorm2r/benchmark/benchmark.js | 45 +- .../dorm2r/benchmark/benchmark.ndarray.js | 39 +- .../lapack/base/dorm2r/docs/types/index.d.ts | 6 +- .../lapack/base/dorm2r/docs/types/test.ts | 2 +- .../lapack/base/dorm2r/examples/index.js | 2 +- .../@stdlib/lapack/base/dorm2r/lib/base.js | 2 +- .../@stdlib/lapack/base/dorm2r/lib/dorm2r.js | 2 +- .../@stdlib/lapack/base/dorm2r/lib/index.js | 2 +- .../@stdlib/lapack/base/dorm2r/lib/main.js | 2 +- .../@stdlib/lapack/base/dorm2r/lib/ndarray.js | 2 +- .../large_strides/left_notrans_col_major.json | 147 +++++ .../large_strides/left_notrans_row_major.json | 147 +++++ .../large_strides/left_trans_col_major.json | 147 +++++ .../large_strides/left_trans_row_major.json | 147 +++++ .../mixed_strides/left_notrans_col_major.json | 114 ++++ .../mixed_strides/left_notrans_row_major.json | 114 ++++ .../mixed_strides/left_trans_col_major.json | 114 ++++ .../mixed_strides/left_trans_row_major.json | 114 ++++ .../left_notrans_col_major.json | 114 ++++ .../left_notrans_row_major.json | 114 ++++ .../left_trans_col_major.json | 114 ++++ .../left_trans_row_major.json | 114 ++++ .../offsets/left_notrans_col_major.json | 119 ++++ .../offsets/left_notrans_row_major.json | 119 ++++ .../offsets/left_trans_col_major.json | 119 ++++ .../offsets/left_trans_row_major.json | 119 ++++ .../lapack/base/dorm2r/test/test.dorm2r.js | 2 +- .../@stdlib/lapack/base/dorm2r/test/test.js | 2 +- .../lapack/base/dorm2r/test/test.ndarray.js | 526 +++++++++++++++++- 29 files changed, 2548 insertions(+), 62 deletions(-) create mode 100644 lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/large_strides/left_notrans_col_major.json create mode 100644 lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/large_strides/left_notrans_row_major.json create mode 100644 lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/large_strides/left_trans_col_major.json create mode 100644 lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/large_strides/left_trans_row_major.json create mode 100644 lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/mixed_strides/left_notrans_col_major.json create mode 100644 lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/mixed_strides/left_notrans_row_major.json create mode 100644 lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/mixed_strides/left_trans_col_major.json create mode 100644 lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/mixed_strides/left_trans_row_major.json create mode 100644 lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/negative_strides/left_notrans_col_major.json create mode 100644 lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/negative_strides/left_notrans_row_major.json create mode 100644 lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/negative_strides/left_trans_col_major.json create mode 100644 lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/negative_strides/left_trans_row_major.json create mode 100644 lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/offsets/left_notrans_col_major.json create mode 100644 lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/offsets/left_notrans_row_major.json create mode 100644 lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/offsets/left_trans_col_major.json create mode 100644 lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/offsets/left_trans_row_major.json diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/benchmark/benchmark.js b/lib/node_modules/@stdlib/lapack/base/dorm2r/benchmark/benchmark.js index 7d43b0a630d0..a798efcb6868 100644 --- a/lib/node_modules/@stdlib/lapack/base/dorm2r/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/benchmark/benchmark.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* 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. @@ -26,6 +26,7 @@ var isnan = require( '@stdlib/math/base/assert/is-nan' ); var Float64Array = require( '@stdlib/array/float64' ); var pow = require( '@stdlib/math/base/special/pow' ); var floor = require( '@stdlib/math/base/special/floor' ); +var format = require( '@stdlib/string/format' ); var pkg = require( './../package.json' ).name; var dorm2r = require( './../lib/dorm2r.js' ); @@ -59,20 +60,19 @@ var TRANS = [ * @returns {Function} benchmark function */ function createBenchmark( order, side, trans, N ) { + var opts; var work; var tau; var A; var C; - A = uniform( N*N, 0.01, 0.1, { + opts = { 'dtype': 'float64' - }); - tau = uniform( N, 0.01, 0.1, { - 'dtype': 'float64' - }); - C = uniform( N*N, 0.01, 0.1, { - 'dtype': 'float64' - }); + }; + + A = uniform( N*N, -10.0, 10.0, opts ); + tau = uniform( N, -10.0, 10.0, opts ); + C = uniform( N*N, -10.0, 10.0, opts ); work = new Float64Array( N ); return benchmark; @@ -114,34 +114,27 @@ function createBenchmark( order, side, trans, N ) { function main() { var trans; var side; + var ord; var min; var max; - var ord; var N; var f; var i; var j; var k; - var l; - var m; min = 1; // 10^min max = 3; // 10^max - for ( k = 0; k < LAYOUTS.length; k++ ) { - ord = LAYOUTS[ k ]; - for ( l = 0; l < SIDES.length; l++ ) { - side = SIDES[ l ]; - for ( m = 0; m < TRANS.length; m++ ) { - trans = TRANS[ m ]; - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); - j = 1; - while ( j <= N ) { - f = createBenchmark( ord, side, trans, N ); - bench( pkg+'::square_matrix:order='+ord+',side='+side+',trans='+trans+',M='+N+',N='+N+',K='+N, f ); - j *= 2; - } + for ( i = 0; i < LAYOUTS.length; i++ ) { + ord = LAYOUTS[ i ]; + for ( j = 0; j < SIDES.length; j++ ) { + side = SIDES[ j ]; + for ( k = 0; k < TRANS.length; k++ ) { + trans = TRANS[ k ]; + for ( N = min; N <= max; N++ ) { + f = createBenchmark( ord, side, trans, floor( pow( pow( 10, N ), 1.0/2.0 ) ) ); + bench( format( '%s:order=%s,side=%s,trans=%s,size=%d', pkg, ord, side, trans, N*N ), f ); } } } diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dorm2r/benchmark/benchmark.ndarray.js index 7fa825cfec7c..092de248e4b4 100644 --- a/lib/node_modules/@stdlib/lapack/base/dorm2r/benchmark/benchmark.ndarray.js +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/benchmark/benchmark.ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* 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. @@ -26,6 +26,7 @@ var isnan = require( '@stdlib/math/base/assert/is-nan' ); var Float64Array = require( '@stdlib/array/float64' ); var pow = require( '@stdlib/math/base/special/pow' ); var floor = require( '@stdlib/math/base/special/floor' ); +var format = require( '@stdlib/string/format' ); var pkg = require( './../package.json' ).name; var dorm2r = require( './../lib/ndarray.js' ); @@ -54,20 +55,19 @@ var TRANS = [ * @returns {Function} benchmark function */ function createBenchmark( side, trans, N ) { + var opts; var work; var tau; var A; var C; - A = uniform( N*N, 0.01, 0.1, { + opts = { 'dtype': 'float64' - }); - tau = uniform( N, 0.01, 0.1, { - 'dtype': 'float64' - }); - C = uniform( N*N, 0.01, 0.1, { - 'dtype': 'float64' - }); + }; + + A = uniform( N*N, -10.0, 10.0, opts ); + tau = uniform( N, -10.0, 10.0, opts ); + C = uniform( N*N, -10.0, 10.0, opts ); work = new Float64Array( N ); return benchmark; @@ -115,24 +115,17 @@ function main() { var f; var i; var j; - var k; - var l; min = 1; // 10^min max = 3; // 10^max - for ( k = 0; k < SIDES.length; k++ ) { - side = SIDES[ k ]; - for ( l = 0; l < TRANS.length; l++ ) { - trans = TRANS[ l ]; - for ( i = min; i <= max; i++ ) { - N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); - j = 1; - while ( j <= N ) { - f = createBenchmark( side, trans, N ); - bench( pkg+'::square_matrix:ndarray:side='+side+',trans='+trans+',M='+N+',N='+N+',K='+N, f ); - j *= 2; - } + for ( i = 0; i < SIDES.length; i++ ) { + side = SIDES[ i ]; + for ( j = 0; j < TRANS.length; j++ ) { + trans = TRANS[ j ]; + for ( N = min; N <= max; N++ ) { + f = createBenchmark( side, trans, floor( pow( pow( 10, N ), 1.0/2.0 ) ) ); + bench( format( '%s:ndarray:side=%s,trans=%s,size=%d', pkg, side, trans, N*N ), f ); } } } diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/docs/types/index.d.ts b/lib/node_modules/@stdlib/lapack/base/dorm2r/docs/types/index.d.ts index 9bbb56f058d5..98f84988c41f 100644 --- a/lib/node_modules/@stdlib/lapack/base/dorm2r/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/docs/types/index.d.ts @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* 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. @@ -110,7 +110,7 @@ interface Routine { * var C = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ] ); * var work = new Float64Array( 3 ); * - * dorm2r( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); + * dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); * // C => [ -261638.0, -298618.0, -335598.0, -521066.0, -594715.0, -668364.0, -773933.0, -883324.0, -992715.0 ] */ ndarray( side: OperationSide, trans: TransposeOperation, M: number, N: number, K: number, A: Float64Array, strideA1: number, strideA2: number, offsetA: number, tau: Float64Array, strideTau: number, offsetTau: number, C: Float64Array, strideC1: number, strideC2: number, offsetC: number, work: Float64Array, strideWork: number, offsetWork: number ): Float64Array; @@ -163,7 +163,7 @@ interface Routine { * var C = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ] ); * var work = new Float64Array( 3 ); * -* dorm2r( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); +* dorm2r.ndarray( 'left', 'no-transpose', 3, 3, 3, A, 3, 1, 0, tau, 1, 0, C, 3, 1, 0, work, 1, 0 ); * // C => [ -261638.0, -298618.0, -335598.0, -521066.0, -594715.0, -668364.0, -773933.0, -883324.0, -992715.0 ] */ declare var dorm2r: Routine; diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/docs/types/test.ts b/lib/node_modules/@stdlib/lapack/base/dorm2r/docs/types/test.ts index 2bafd67b038e..bc02cc976312 100644 --- a/lib/node_modules/@stdlib/lapack/base/dorm2r/docs/types/test.ts +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/docs/types/test.ts @@ -1,7 +1,7 @@ /* * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/examples/index.js b/lib/node_modules/@stdlib/lapack/base/dorm2r/examples/index.js index 2fab24e1d24b..944cc776db45 100644 --- a/lib/node_modules/@stdlib/lapack/base/dorm2r/examples/index.js +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/examples/index.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/base.js b/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/base.js index baa99539fa68..5a83b630bae8 100644 --- a/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/base.js +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/base.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/dorm2r.js b/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/dorm2r.js index a60581d825bf..f423cb61d86c 100644 --- a/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/dorm2r.js +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/dorm2r.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/index.js b/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/index.js index 556056d588ac..9b15ae757bcb 100644 --- a/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/index.js +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/index.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/main.js b/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/main.js index d7972eb91091..1d4981b50aee 100644 --- a/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/main.js +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/main.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/ndarray.js b/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/ndarray.js index cdeb7adb6c81..33aaaa88195d 100644 --- a/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/ndarray.js +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/lib/ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/large_strides/left_notrans_col_major.json b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/large_strides/left_notrans_col_major.json new file mode 100644 index 000000000000..ac5167f1e496 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/large_strides/left_notrans_col_major.json @@ -0,0 +1,147 @@ +{ + "order": "column-major", + "side": "left", + "trans": "no-transpose", + "M": 3, + "N": 3, + "K": 3, + "A_mat": [ + [ + 1, + 0, + 0 + ], + [ + 2, + 4, + 0 + ], + [ + 3, + 5, + 6 + ] + ], + "LDA": 3, + "strideA1": 2, + "strideA2": 6, + "offsetA": 0, + "A": [ + 1, + 9999, + 2, + 9999, + 3, + 9999, + 0, + 9999, + 4, + 9999, + 5, + 9999, + 0, + 9999, + 0, + 9999, + 6, + 9999 + ], + "tau": [ + 7, + 9999, + 8, + 9999, + 9, + 9999 + ], + "strideTau": 2, + "offsetTau": 0, + "C_mat": [ + [ + 1, + 2, + 3 + ], + [ + 4, + 5, + 6 + ], + [ + 7, + 8, + 9 + ] + ], + "LDC": 3, + "strideC1": 2, + "strideC2": 6, + "offsetC": 0, + "C": [ + 1, + 9999, + 4, + 9999, + 7, + 9999, + 2, + 9999, + 5, + 9999, + 8, + 9999, + 3, + 9999, + 6, + 9999, + 9, + 9999 + ], + "work": [ + 0, + 9999, + 0, + 9999, + 0, + 9999 + ], + "strideWork": 2, + "offsetWork": 0, + "C_out_mat": [ + [ + -261638, + -298618, + -335598 + ], + [ + -521066, + -594715, + -668364 + ], + [ + -773933, + -883324, + -992715 + ] + ], + "C_out": [ + -261638, + 9999, + -521066, + 9999, + -773933, + 9999, + -298618, + 9999, + -594715, + 9999, + -883324, + 9999, + -335598, + 9999, + -668364, + 9999, + -992715, + 9999 + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/large_strides/left_notrans_row_major.json b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/large_strides/left_notrans_row_major.json new file mode 100644 index 000000000000..615839ee2d50 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/large_strides/left_notrans_row_major.json @@ -0,0 +1,147 @@ +{ + "order": "row-major", + "side": "left", + "trans": "no-transpose", + "M": 3, + "N": 3, + "K": 3, + "A_mat": [ + [ + 1, + 0, + 0 + ], + [ + 2, + 4, + 0 + ], + [ + 3, + 5, + 6 + ] + ], + "LDA": 3, + "strideA1": 6, + "strideA2": 2, + "offsetA": 0, + "A": [ + 1, + 9999, + 0, + 9999, + 0, + 9999, + 2, + 9999, + 4, + 9999, + 0, + 9999, + 3, + 9999, + 5, + 9999, + 6, + 9999 + ], + "tau": [ + 7, + 9999, + 8, + 9999, + 9, + 9999 + ], + "strideTau": 2, + "offsetTau": 0, + "C_mat": [ + [ + 1, + 2, + 3 + ], + [ + 4, + 5, + 6 + ], + [ + 7, + 8, + 9 + ] + ], + "LDC": 3, + "strideC1": 6, + "strideC2": 2, + "offsetC": 0, + "C": [ + 1, + 9999, + 2, + 9999, + 3, + 9999, + 4, + 9999, + 5, + 9999, + 6, + 9999, + 7, + 9999, + 8, + 9999, + 9, + 9999 + ], + "work": [ + 0, + 9999, + 0, + 9999, + 0, + 9999 + ], + "strideWork": 2, + "offsetWork": 0, + "C_out_mat": [ + [ + -261638, + -298618, + -335598 + ], + [ + -521066, + -594715, + -668364 + ], + [ + -773933, + -883324, + -992715 + ] + ], + "C_out": [ + -261638, + 9999, + -298618, + 9999, + -335598, + 9999, + -521066, + 9999, + -594715, + 9999, + -668364, + 9999, + -773933, + 9999, + -883324, + 9999, + -992715, + 9999 + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/large_strides/left_trans_col_major.json b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/large_strides/left_trans_col_major.json new file mode 100644 index 000000000000..2001ddfa7648 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/large_strides/left_trans_col_major.json @@ -0,0 +1,147 @@ +{ + "order": "column-major", + "side": "left", + "trans": "transpose", + "M": 3, + "N": 3, + "K": 3, + "A_mat": [ + [ + 10, + 200, + 123 + ], + [ + 20, + 30, + 200 + ], + [ + 40, + 50, + 60 + ] + ], + "LDA": 3, + "strideA1": 2, + "strideA2": 6, + "offsetA": 0, + "A": [ + 10, + 9999, + 20, + 9999, + 40, + 9999, + 200, + 9999, + 30, + 9999, + 50, + 9999, + 123, + 9999, + 200, + 9999, + 60, + 9999 + ], + "tau": [ + 2, + 9999, + 3, + 9999, + 4, + 9999 + ], + "strideTau": 2, + "offsetTau": 0, + "C_mat": [ + [ + 7, + 9, + 11 + ], + [ + 12, + 14, + 16 + ], + [ + 17, + 19, + 21 + ] + ], + "LDC": 3, + "strideC1": 2, + "strideC2": 6, + "offsetC": 0, + "C": [ + 7, + 9999, + 12, + 9999, + 17, + 9999, + 9, + 9999, + 14, + 9999, + 19, + 9999, + 11, + 9999, + 16, + 9999, + 21, + 9999 + ], + "work": [ + 0, + 9999, + 0, + 9999, + 0, + 9999 + ], + "strideWork": 2, + "offsetWork": 0, + "C_out_mat": [ + [ + -1847, + -2089, + -2331 + ], + [ + 11195586, + 12669042, + 14142498 + ], + [ + -1684675671, + -1906396497, + -2128117323 + ] + ], + "C_out": [ + -1847, + 9999, + 11195586, + 9999, + -1684675671, + 9999, + -2089, + 9999, + 12669042, + 9999, + -1906396497, + 9999, + -2331, + 9999, + 14142498, + 9999, + -2128117323, + 9999 + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/large_strides/left_trans_row_major.json b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/large_strides/left_trans_row_major.json new file mode 100644 index 000000000000..a33a2c88cb0f --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/large_strides/left_trans_row_major.json @@ -0,0 +1,147 @@ +{ + "order": "row-major", + "side": "left", + "trans": "transpose", + "M": 3, + "N": 3, + "K": 3, + "A_mat": [ + [ + 10, + 200, + 123 + ], + [ + 20, + 30, + 200 + ], + [ + 40, + 50, + 60 + ] + ], + "LDA": 3, + "strideA1": 6, + "strideA2": 2, + "offsetA": 0, + "A": [ + 10, + 9999, + 200, + 9999, + 123, + 9999, + 20, + 9999, + 30, + 9999, + 200, + 9999, + 40, + 9999, + 50, + 9999, + 60, + 9999 + ], + "tau": [ + 2, + 9999, + 3, + 9999, + 4, + 9999 + ], + "strideTau": 2, + "offsetTau": 0, + "C_mat": [ + [ + 7, + 9, + 11 + ], + [ + 12, + 14, + 16 + ], + [ + 17, + 19, + 21 + ] + ], + "LDC": 3, + "strideC1": 6, + "strideC2": 2, + "offsetC": 0, + "C": [ + 7, + 9999, + 9, + 9999, + 11, + 9999, + 12, + 9999, + 14, + 9999, + 16, + 9999, + 17, + 9999, + 19, + 9999, + 21, + 9999 + ], + "work": [ + 0, + 9999, + 0, + 9999, + 0, + 9999 + ], + "strideWork": 2, + "offsetWork": 0, + "C_out_mat": [ + [ + -1847, + -2089, + -2331 + ], + [ + 11195586, + 12669042, + 14142498 + ], + [ + -1684675671, + -1906396497, + -2128117323 + ] + ], + "C_out": [ + -1847, + 9999, + -2089, + 9999, + -2331, + 9999, + 11195586, + 9999, + 12669042, + 9999, + 14142498, + 9999, + -1684675671, + 9999, + -1906396497, + 9999, + -2128117323, + 9999 + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/mixed_strides/left_notrans_col_major.json b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/mixed_strides/left_notrans_col_major.json new file mode 100644 index 000000000000..96528a123a1b --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/mixed_strides/left_notrans_col_major.json @@ -0,0 +1,114 @@ +{ + "order": "column-major", + "side": "left", + "trans": "no-transpose", + "M": 3, + "N": 3, + "K": 3, + "A_mat": [ + [ + 1, + 0, + 0 + ], + [ + 2, + 4, + 0 + ], + [ + 3, + 5, + 6 + ] + ], + "LDA": 3, + "strideA1": 1, + "strideA2": -3, + "offsetA": 6, + "A": [ + 0, + 0, + 6, + 0, + 4, + 5, + 1, + 2, + 3 + ], + "tau": [ + 7, + 8, + 9 + ], + "strideTau": 1, + "offsetTau": 0, + "C_mat": [ + [ + 1, + 2, + 3 + ], + [ + 4, + 5, + 6 + ], + [ + 7, + 8, + 9 + ] + ], + "LDC": 3, + "strideC1": 1, + "strideC2": -3, + "offsetC": 6, + "C": [ + 3, + 6, + 9, + 2, + 5, + 8, + 1, + 4, + 7 + ], + "work": [ + 0, + 0, + 0 + ], + "strideWork": 1, + "offsetWork": 0, + "C_out_mat": [ + [ + -261638, + -298618, + -335598 + ], + [ + -521066, + -594715, + -668364 + ], + [ + -773933, + -883324, + -992715 + ] + ], + "C_out": [ + -335598, + -668364, + -992715, + -298618, + -594715, + -883324, + -261638, + -521066, + -773933 + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/mixed_strides/left_notrans_row_major.json b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/mixed_strides/left_notrans_row_major.json new file mode 100644 index 000000000000..0b4884825708 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/mixed_strides/left_notrans_row_major.json @@ -0,0 +1,114 @@ +{ + "order": "row-major", + "side": "left", + "trans": "no-transpose", + "M": 3, + "N": 3, + "K": 3, + "A_mat": [ + [ + 1, + 0, + 0 + ], + [ + 2, + 4, + 0 + ], + [ + 3, + 5, + 6 + ] + ], + "LDA": 3, + "strideA1": -3, + "strideA2": 1, + "offsetA": 6, + "A": [ + 3, + 5, + 6, + 2, + 4, + 0, + 1, + 0, + 0 + ], + "tau": [ + 7, + 8, + 9 + ], + "strideTau": 1, + "offsetTau": 0, + "C_mat": [ + [ + 1, + 2, + 3 + ], + [ + 4, + 5, + 6 + ], + [ + 7, + 8, + 9 + ] + ], + "LDC": 3, + "strideC1": -3, + "strideC2": 1, + "offsetC": 6, + "C": [ + 7, + 8, + 9, + 4, + 5, + 6, + 1, + 2, + 3 + ], + "work": [ + 0, + 0, + 0 + ], + "strideWork": 1, + "offsetWork": 0, + "C_out_mat": [ + [ + -261638, + -298618, + -335598 + ], + [ + -521066, + -594715, + -668364 + ], + [ + -773933, + -883324, + -992715 + ] + ], + "C_out": [ + -773933, + -883324, + -992715, + -521066, + -594715, + -668364, + -261638, + -298618, + -335598 + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/mixed_strides/left_trans_col_major.json b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/mixed_strides/left_trans_col_major.json new file mode 100644 index 000000000000..18ee12fe2387 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/mixed_strides/left_trans_col_major.json @@ -0,0 +1,114 @@ +{ + "order": "column-major", + "side": "left", + "trans": "transpose", + "M": 3, + "N": 3, + "K": 3, + "A_mat": [ + [ + 10, + 200, + 123 + ], + [ + 20, + 30, + 200 + ], + [ + 40, + 50, + 60 + ] + ], + "LDA": 3, + "strideA1": 1, + "strideA2": -3, + "offsetA": 6, + "A": [ + 123, + 200, + 60, + 200, + 30, + 50, + 10, + 20, + 40 + ], + "tau": [ + 2, + 3, + 4 + ], + "strideTau": 1, + "offsetTau": 0, + "C_mat": [ + [ + 7, + 9, + 11 + ], + [ + 12, + 14, + 16 + ], + [ + 17, + 19, + 21 + ] + ], + "LDC": 3, + "strideC1": 1, + "strideC2": -3, + "offsetC": 6, + "C": [ + 11, + 16, + 21, + 9, + 14, + 19, + 7, + 12, + 17 + ], + "work": [ + 0, + 0, + 0 + ], + "strideWork": 1, + "offsetWork": 0, + "C_out_mat": [ + [ + -1847, + -2089, + -2331 + ], + [ + 11195586, + 12669042, + 14142498 + ], + [ + -1684675671, + -1906396497, + -2128117323 + ] + ], + "C_out": [ + -2331, + 14142498, + -2128117323, + -2089, + 12669042, + -1906396497, + -1847, + 11195586, + -1684675671 + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/mixed_strides/left_trans_row_major.json b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/mixed_strides/left_trans_row_major.json new file mode 100644 index 000000000000..c21103fcff86 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/mixed_strides/left_trans_row_major.json @@ -0,0 +1,114 @@ +{ + "order": "row-major", + "side": "left", + "trans": "transpose", + "M": 3, + "N": 3, + "K": 3, + "A_mat": [ + [ + 10, + 200, + 123 + ], + [ + 20, + 30, + 200 + ], + [ + 40, + 50, + 60 + ] + ], + "LDA": 3, + "strideA1": -3, + "strideA2": 1, + "offsetA": 6, + "A": [ + 40, + 50, + 60, + 20, + 30, + 200, + 10, + 200, + 123 + ], + "tau": [ + 2, + 3, + 4 + ], + "strideTau": 1, + "offsetTau": 0, + "C_mat": [ + [ + 7, + 9, + 11 + ], + [ + 12, + 14, + 16 + ], + [ + 17, + 19, + 21 + ] + ], + "LDC": 3, + "strideC1": -3, + "strideC2": 1, + "offsetC": 6, + "C": [ + 17, + 19, + 21, + 12, + 14, + 16, + 7, + 9, + 11 + ], + "work": [ + 0, + 0, + 0 + ], + "strideWork": 1, + "offsetWork": 0, + "C_out_mat": [ + [ + -1847, + -2089, + -2331 + ], + [ + 11195586, + 12669042, + 14142498 + ], + [ + -1684675671, + -1906396497, + -2128117323 + ] + ], + "C_out": [ + -1684675671, + -1906396497, + -2128117323, + 11195586, + 12669042, + 14142498, + -1847, + -2089, + -2331 + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/negative_strides/left_notrans_col_major.json b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/negative_strides/left_notrans_col_major.json new file mode 100644 index 000000000000..b3215c73c45d --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/negative_strides/left_notrans_col_major.json @@ -0,0 +1,114 @@ +{ + "order": "column-major", + "side": "left", + "trans": "no-transpose", + "M": 3, + "N": 3, + "K": 3, + "A_mat": [ + [ + 1, + 0, + 0 + ], + [ + 2, + 4, + 0 + ], + [ + 3, + 5, + 6 + ] + ], + "LDA": 3, + "strideA1": -1, + "strideA2": -3, + "offsetA": 8, + "A": [ + 6, + 0, + 0, + 5, + 4, + 0, + 3, + 2, + 1 + ], + "tau": [ + 9, + 8, + 7 + ], + "strideTau": -1, + "offsetTau": 2, + "C_mat": [ + [ + 1, + 2, + 3 + ], + [ + 4, + 5, + 6 + ], + [ + 7, + 8, + 9 + ] + ], + "LDC": 3, + "strideC1": -1, + "strideC2": -3, + "offsetC": 8, + "C": [ + 9, + 6, + 3, + 8, + 5, + 2, + 7, + 4, + 1 + ], + "work": [ + 0, + 0, + 0 + ], + "strideWork": -1, + "offsetWork": 2, + "C_out_mat": [ + [ + -261638, + -298618, + -335598 + ], + [ + -521066, + -594715, + -668364 + ], + [ + -773933, + -883324, + -992715 + ] + ], + "C_out": [ + -992715, + -668364, + -335598, + -883324, + -594715, + -298618, + -773933, + -521066, + -261638 + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/negative_strides/left_notrans_row_major.json b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/negative_strides/left_notrans_row_major.json new file mode 100644 index 000000000000..6ac04d19a622 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/negative_strides/left_notrans_row_major.json @@ -0,0 +1,114 @@ +{ + "order": "row-major", + "side": "left", + "trans": "no-transpose", + "M": 3, + "N": 3, + "K": 3, + "A_mat": [ + [ + 1, + 0, + 0 + ], + [ + 2, + 4, + 0 + ], + [ + 3, + 5, + 6 + ] + ], + "LDA": 3, + "strideA1": -3, + "strideA2": -1, + "offsetA": 8, + "A": [ + 6, + 5, + 3, + 0, + 4, + 2, + 0, + 0, + 1 + ], + "tau": [ + 9, + 8, + 7 + ], + "strideTau": -1, + "offsetTau": 2, + "C_mat": [ + [ + 1, + 2, + 3 + ], + [ + 4, + 5, + 6 + ], + [ + 7, + 8, + 9 + ] + ], + "LDC": 3, + "strideC1": -3, + "strideC2": -1, + "offsetC": 8, + "C": [ + 9, + 8, + 7, + 6, + 5, + 4, + 3, + 2, + 1 + ], + "work": [ + 0, + 0, + 0 + ], + "strideWork": -1, + "offsetWork": 2, + "C_out_mat": [ + [ + -261638, + -298618, + -335598 + ], + [ + -521066, + -594715, + -668364 + ], + [ + -773933, + -883324, + -992715 + ] + ], + "C_out": [ + -992715, + -883324, + -773933, + -668364, + -594715, + -521066, + -335598, + -298618, + -261638 + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/negative_strides/left_trans_col_major.json b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/negative_strides/left_trans_col_major.json new file mode 100644 index 000000000000..37cfa5b3b2c1 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/negative_strides/left_trans_col_major.json @@ -0,0 +1,114 @@ +{ + "order": "column-major", + "side": "left", + "trans": "transpose", + "M": 3, + "N": 3, + "K": 3, + "A_mat": [ + [ + 10, + 200, + 123 + ], + [ + 20, + 30, + 200 + ], + [ + 40, + 50, + 60 + ] + ], + "LDA": 3, + "strideA1": -1, + "strideA2": -3, + "offsetA": 8, + "A": [ + 60, + 200, + 123, + 50, + 30, + 200, + 40, + 20, + 10 + ], + "tau": [ + 4, + 3, + 2 + ], + "strideTau": -1, + "offsetTau": 2, + "C_mat": [ + [ + 7, + 9, + 11 + ], + [ + 12, + 14, + 16 + ], + [ + 17, + 19, + 21 + ] + ], + "LDC": 3, + "strideC1": -1, + "strideC2": -3, + "offsetC": 8, + "C": [ + 21, + 16, + 11, + 19, + 14, + 9, + 17, + 12, + 7 + ], + "work": [ + 0, + 0, + 0 + ], + "strideWork": -1, + "offsetWork": 2, + "C_out_mat": [ + [ + -1847, + -2089, + -2331 + ], + [ + 11195586, + 12669042, + 14142498 + ], + [ + -1684675671, + -1906396497, + -2128117323 + ] + ], + "C_out": [ + -2128117323, + 14142498, + -2331, + -1906396497, + 12669042, + -2089, + -1684675671, + 11195586, + -1847 + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/negative_strides/left_trans_row_major.json b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/negative_strides/left_trans_row_major.json new file mode 100644 index 000000000000..f33e3ed24e6d --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/negative_strides/left_trans_row_major.json @@ -0,0 +1,114 @@ +{ + "order": "row-major", + "side": "left", + "trans": "transpose", + "M": 3, + "N": 3, + "K": 3, + "A_mat": [ + [ + 10, + 200, + 123 + ], + [ + 20, + 30, + 200 + ], + [ + 40, + 50, + 60 + ] + ], + "LDA": 3, + "strideA1": -3, + "strideA2": -1, + "offsetA": 8, + "A": [ + 60, + 50, + 40, + 200, + 30, + 20, + 123, + 200, + 10 + ], + "tau": [ + 4, + 3, + 2 + ], + "strideTau": -1, + "offsetTau": 2, + "C_mat": [ + [ + 7, + 9, + 11 + ], + [ + 12, + 14, + 16 + ], + [ + 17, + 19, + 21 + ] + ], + "LDC": 3, + "strideC1": -3, + "strideC2": -1, + "offsetC": 8, + "C": [ + 21, + 19, + 17, + 16, + 14, + 12, + 11, + 9, + 7 + ], + "work": [ + 0, + 0, + 0 + ], + "strideWork": -1, + "offsetWork": 2, + "C_out_mat": [ + [ + -1847, + -2089, + -2331 + ], + [ + 11195586, + 12669042, + 14142498 + ], + [ + -1684675671, + -1906396497, + -2128117323 + ] + ], + "C_out": [ + -2128117323, + -1906396497, + -1684675671, + 14142498, + 12669042, + 11195586, + -2331, + -2089, + -1847 + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/offsets/left_notrans_col_major.json b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/offsets/left_notrans_col_major.json new file mode 100644 index 000000000000..0ad2e824545f --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/offsets/left_notrans_col_major.json @@ -0,0 +1,119 @@ +{ + "order": "column-major", + "side": "left", + "trans": "no-transpose", + "M": 3, + "N": 3, + "K": 3, + "A_mat": [ + [ + 1, + 0, + 0 + ], + [ + 2, + 4, + 0 + ], + [ + 3, + 5, + 6 + ] + ], + "LDA": 3, + "strideA1": 1, + "strideA2": 3, + "offsetA": 1, + "A": [ + 9999, + 1, + 2, + 3, + 0, + 4, + 5, + 0, + 0, + 6 + ], + "tau": [ + 9999, + 7, + 8, + 9 + ], + "strideTau": 1, + "offsetTau": 1, + "C_mat": [ + [ + 1, + 2, + 3 + ], + [ + 4, + 5, + 6 + ], + [ + 7, + 8, + 9 + ] + ], + "LDC": 3, + "strideC1": 1, + "strideC2": 3, + "offsetC": 1, + "C": [ + 9999, + 1, + 4, + 7, + 2, + 5, + 8, + 3, + 6, + 9 + ], + "work": [ + 9999, + 0, + 0, + 0 + ], + "strideWork": 1, + "offsetWork": 1, + "C_out_mat": [ + [ + -261638, + -298618, + -335598 + ], + [ + -521066, + -594715, + -668364 + ], + [ + -773933, + -883324, + -992715 + ] + ], + "C_out": [ + 9999, + -261638, + -521066, + -773933, + -298618, + -594715, + -883324, + -335598, + -668364, + -992715 + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/offsets/left_notrans_row_major.json b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/offsets/left_notrans_row_major.json new file mode 100644 index 000000000000..1f957a15c4a0 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/offsets/left_notrans_row_major.json @@ -0,0 +1,119 @@ +{ + "order": "row-major", + "side": "left", + "trans": "no-transpose", + "M": 3, + "N": 3, + "K": 3, + "A_mat": [ + [ + 1, + 0, + 0 + ], + [ + 2, + 4, + 0 + ], + [ + 3, + 5, + 6 + ] + ], + "LDA": 3, + "strideA1": 3, + "strideA2": 1, + "offsetA": 1, + "A": [ + 9999, + 1, + 0, + 0, + 2, + 4, + 0, + 3, + 5, + 6 + ], + "tau": [ + 9999, + 7, + 8, + 9 + ], + "strideTau": 1, + "offsetTau": 1, + "C_mat": [ + [ + 1, + 2, + 3 + ], + [ + 4, + 5, + 6 + ], + [ + 7, + 8, + 9 + ] + ], + "LDC": 3, + "strideC1": 3, + "strideC2": 1, + "offsetC": 1, + "C": [ + 9999, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9 + ], + "work": [ + 9999, + 0, + 0, + 0 + ], + "strideWork": 1, + "offsetWork": 1, + "C_out_mat": [ + [ + -261638, + -298618, + -335598 + ], + [ + -521066, + -594715, + -668364 + ], + [ + -773933, + -883324, + -992715 + ] + ], + "C_out": [ + 9999, + -261638, + -298618, + -335598, + -521066, + -594715, + -668364, + -773933, + -883324, + -992715 + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/offsets/left_trans_col_major.json b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/offsets/left_trans_col_major.json new file mode 100644 index 000000000000..371be11e48c2 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/offsets/left_trans_col_major.json @@ -0,0 +1,119 @@ +{ + "order": "column-major", + "side": "left", + "trans": "transpose", + "M": 3, + "N": 3, + "K": 3, + "A_mat": [ + [ + 10, + 200, + 123 + ], + [ + 20, + 30, + 200 + ], + [ + 40, + 50, + 60 + ] + ], + "LDA": 3, + "strideA1": 1, + "strideA2": 3, + "offsetA": 1, + "A": [ + 9999, + 10, + 20, + 40, + 200, + 30, + 50, + 123, + 200, + 60 + ], + "tau": [ + 9999, + 2, + 3, + 4 + ], + "strideTau": 1, + "offsetTau": 1, + "C_mat": [ + [ + 7, + 9, + 11 + ], + [ + 12, + 14, + 16 + ], + [ + 17, + 19, + 21 + ] + ], + "LDC": 3, + "strideC1": 1, + "strideC2": 3, + "offsetC": 1, + "C": [ + 9999, + 7, + 12, + 17, + 9, + 14, + 19, + 11, + 16, + 21 + ], + "work": [ + 9999, + 0, + 0, + 0 + ], + "strideWork": 1, + "offsetWork": 1, + "C_out_mat": [ + [ + -1847, + -2089, + -2331 + ], + [ + 11195586, + 12669042, + 14142498 + ], + [ + -1684675671, + -1906396497, + -2128117323 + ] + ], + "C_out": [ + 9999, + -1847, + 11195586, + -1684675671, + -2089, + 12669042, + -1906396497, + -2331, + 14142498, + -2128117323 + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/offsets/left_trans_row_major.json b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/offsets/left_trans_row_major.json new file mode 100644 index 000000000000..0cd828076ca0 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/fixtures/offsets/left_trans_row_major.json @@ -0,0 +1,119 @@ +{ + "order": "row-major", + "side": "left", + "trans": "transpose", + "M": 3, + "N": 3, + "K": 3, + "A_mat": [ + [ + 10, + 200, + 123 + ], + [ + 20, + 30, + 200 + ], + [ + 40, + 50, + 60 + ] + ], + "LDA": 3, + "strideA1": 3, + "strideA2": 1, + "offsetA": 1, + "A": [ + 9999, + 10, + 200, + 123, + 20, + 30, + 200, + 40, + 50, + 60 + ], + "tau": [ + 9999, + 2, + 3, + 4 + ], + "strideTau": 1, + "offsetTau": 1, + "C_mat": [ + [ + 7, + 9, + 11 + ], + [ + 12, + 14, + 16 + ], + [ + 17, + 19, + 21 + ] + ], + "LDC": 3, + "strideC1": 3, + "strideC2": 1, + "offsetC": 1, + "C": [ + 9999, + 7, + 9, + 11, + 12, + 14, + 16, + 17, + 19, + 21 + ], + "work": [ + 9999, + 0, + 0, + 0 + ], + "strideWork": 1, + "offsetWork": 1, + "C_out_mat": [ + [ + -1847, + -2089, + -2331 + ], + [ + 11195586, + 12669042, + 14142498 + ], + [ + -1684675671, + -1906396497, + -2128117323 + ] + ], + "C_out": [ + 9999, + -1847, + -2089, + -2331, + 11195586, + 12669042, + 14142498, + -1684675671, + -1906396497, + -2128117323 + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/test/test.dorm2r.js b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/test.dorm2r.js index e1407059003a..dd6a276a1502 100644 --- a/lib/node_modules/@stdlib/lapack/base/dorm2r/test/test.dorm2r.js +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/test.dorm2r.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/test/test.js b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/test.js index 63f9d011be26..1243475c2c71 100644 --- a/lib/node_modules/@stdlib/lapack/base/dorm2r/test/test.js +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/test.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/test/test.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/test.ndarray.js index d71ece4eab43..0d3f80515ae2 100644 --- a/lib/node_modules/@stdlib/lapack/base/dorm2r/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/test/test.ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* 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. @@ -25,6 +25,30 @@ var Float64Array = require( '@stdlib/array/float64' ); var dorm2r = require( './../lib/ndarray.js' ); +// FIXTURES // + +var LEFT_NOTRANS_ROW_MAJOR = require( './fixtures/left_notrans_row_major.json' ); +var LEFT_NOTRANS_COL_MAJOR = require( './fixtures/left_notrans_col_major.json' ); +var LEFT_TRANS_ROW_MAJOR = require( './fixtures/left_trans_row_major.json' ); +var LEFT_TRANS_COL_MAJOR = require( './fixtures/left_trans_col_major.json' ); +var LARGE_STRIDES_LEFT_NOTRANS_ROW_MAJOR = require( './fixtures/large_strides/left_notrans_row_major.json' ); +var LARGE_STRIDES_LEFT_NOTRANS_COL_MAJOR = require( './fixtures/large_strides/left_notrans_col_major.json' ); +var LARGE_STRIDES_LEFT_TRANS_ROW_MAJOR = require( './fixtures/large_strides/left_trans_row_major.json' ); +var LARGE_STRIDES_LEFT_TRANS_COL_MAJOR = require( './fixtures/large_strides/left_trans_col_major.json' ); +var MIXED_STRIDES_LEFT_NOTRANS_ROW_MAJOR = require( './fixtures/mixed_strides/left_notrans_row_major.json' ); +var MIXED_STRIDES_LEFT_NOTRANS_COL_MAJOR = require( './fixtures/mixed_strides/left_notrans_col_major.json' ); +var MIXED_STRIDES_LEFT_TRANS_ROW_MAJOR = require( './fixtures/mixed_strides/left_trans_row_major.json' ); +var MIXED_STRIDES_LEFT_TRANS_COL_MAJOR = require( './fixtures/mixed_strides/left_trans_col_major.json' ); +var NEGATIVE_STRIDES_LEFT_NOTRANS_ROW_MAJOR = require( './fixtures/negative_strides/left_notrans_row_major.json' ); +var NEGATIVE_STRIDES_LEFT_NOTRANS_COL_MAJOR = require( './fixtures/negative_strides/left_notrans_col_major.json' ); +var NEGATIVE_STRIDES_LEFT_TRANS_ROW_MAJOR = require( './fixtures/negative_strides/left_trans_row_major.json' ); +var NEGATIVE_STRIDES_LEFT_TRANS_COL_MAJOR = require( './fixtures/negative_strides/left_trans_col_major.json' ); +var OFFSETS_LEFT_NOTRANS_ROW_MAJOR = require( './fixtures/offsets/left_notrans_row_major.json' ); +var OFFSETS_LEFT_NOTRANS_COL_MAJOR = require( './fixtures/offsets/left_notrans_col_major.json' ); +var OFFSETS_LEFT_TRANS_ROW_MAJOR = require( './fixtures/offsets/left_trans_row_major.json' ); +var OFFSETS_LEFT_TRANS_COL_MAJOR = require( './fixtures/offsets/left_trans_col_major.json' ); + + // TESTS // tape( 'main export is a function', function test( t ) { @@ -119,3 +143,503 @@ tape( 'the function throws an error if provided a second argument which is not a }; } }); + +tape( 'the function applies Q from the left without transpose (row-major)', function test( t ) { + var expected; + var data; + var work; + var tau; + var out; + var A; + var C; + + data = LEFT_NOTRANS_ROW_MAJOR; + + A = new Float64Array( data.A ); + tau = new Float64Array( data.tau ); + C = new Float64Array( data.C ); + work = new Float64Array( data.work ); + + expected = new Float64Array( data.C_out ); + + out = dorm2r( data.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( out, C, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies Q from the left without transpose (column-major)', function test( t ) { + var expected; + var data; + var work; + var tau; + var out; + var A; + var C; + + data = LEFT_NOTRANS_COL_MAJOR; + + A = new Float64Array( data.A ); + tau = new Float64Array( data.tau ); + C = new Float64Array( data.C ); + work = new Float64Array( data.work ); + + expected = new Float64Array( data.C_out ); + + out = dorm2r( data.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( out, C, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies Q from the left with transpose (row-major)', function test( t ) { + var expected; + var data; + var work; + var tau; + var out; + var A; + var C; + + data = LEFT_TRANS_ROW_MAJOR; + + A = new Float64Array( data.A ); + tau = new Float64Array( data.tau ); + C = new Float64Array( data.C ); + work = new Float64Array( data.work ); + + expected = new Float64Array( data.C_out ); + + out = dorm2r( data.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( out, C, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies Q from the left with transpose (column-major)', function test( t ) { + var expected; + var data; + var work; + var tau; + var out; + var A; + var C; + + data = LEFT_TRANS_COL_MAJOR; + + A = new Float64Array( data.A ); + tau = new Float64Array( data.tau ); + C = new Float64Array( data.C ); + work = new Float64Array( data.work ); + + expected = new Float64Array( data.C_out ); + + out = dorm2r( data.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( out, C, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies Q from the left without transpose (large strides, row-major)', function test( t ) { + var expected; + var data; + var work; + var tau; + var out; + var A; + var C; + + data = LARGE_STRIDES_LEFT_NOTRANS_ROW_MAJOR; + + A = new Float64Array( data.A ); + tau = new Float64Array( data.tau ); + C = new Float64Array( data.C ); + work = new Float64Array( data.work ); + + expected = new Float64Array( data.C_out ); + + out = dorm2r( data.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( out, C, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies Q from the left without transpose (large strides, column-major)', function test( t ) { + var expected; + var data; + var work; + var tau; + var out; + var A; + var C; + + data = LARGE_STRIDES_LEFT_NOTRANS_COL_MAJOR; + + A = new Float64Array( data.A ); + tau = new Float64Array( data.tau ); + C = new Float64Array( data.C ); + work = new Float64Array( data.work ); + + expected = new Float64Array( data.C_out ); + + out = dorm2r( data.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( out, C, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies Q from the left with transpose (large strides, row-major)', function test( t ) { + var expected; + var data; + var work; + var tau; + var out; + var A; + var C; + + data = LARGE_STRIDES_LEFT_TRANS_ROW_MAJOR; + + A = new Float64Array( data.A ); + tau = new Float64Array( data.tau ); + C = new Float64Array( data.C ); + work = new Float64Array( data.work ); + + expected = new Float64Array( data.C_out ); + + out = dorm2r( data.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( out, C, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies Q from the left with transpose (large strides, column-major)', function test( t ) { + var expected; + var data; + var work; + var tau; + var out; + var A; + var C; + + data = LARGE_STRIDES_LEFT_TRANS_COL_MAJOR; + + A = new Float64Array( data.A ); + tau = new Float64Array( data.tau ); + C = new Float64Array( data.C ); + work = new Float64Array( data.work ); + + expected = new Float64Array( data.C_out ); + + out = dorm2r( data.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( out, C, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies Q from the left without transpose (mixed strides, row-major)', function test( t ) { + var expected; + var data; + var work; + var tau; + var out; + var A; + var C; + + data = MIXED_STRIDES_LEFT_NOTRANS_ROW_MAJOR; + + A = new Float64Array( data.A ); + tau = new Float64Array( data.tau ); + C = new Float64Array( data.C ); + work = new Float64Array( data.work ); + + expected = new Float64Array( data.C_out ); + + out = dorm2r( data.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( out, C, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies Q from the left without transpose (mixed strides, column-major)', function test( t ) { + var expected; + var data; + var work; + var tau; + var out; + var A; + var C; + + data = MIXED_STRIDES_LEFT_NOTRANS_COL_MAJOR; + + A = new Float64Array( data.A ); + tau = new Float64Array( data.tau ); + C = new Float64Array( data.C ); + work = new Float64Array( data.work ); + + expected = new Float64Array( data.C_out ); + + out = dorm2r( data.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( out, C, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies Q from the left with transpose (mixed strides, row-major)', function test( t ) { + var expected; + var data; + var work; + var tau; + var out; + var A; + var C; + + data = MIXED_STRIDES_LEFT_TRANS_ROW_MAJOR; + + A = new Float64Array( data.A ); + tau = new Float64Array( data.tau ); + C = new Float64Array( data.C ); + work = new Float64Array( data.work ); + + expected = new Float64Array( data.C_out ); + + out = dorm2r( data.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( out, C, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies Q from the left with transpose (mixed strides, column-major)', function test( t ) { + var expected; + var data; + var work; + var tau; + var out; + var A; + var C; + + data = MIXED_STRIDES_LEFT_TRANS_COL_MAJOR; + + A = new Float64Array( data.A ); + tau = new Float64Array( data.tau ); + C = new Float64Array( data.C ); + work = new Float64Array( data.work ); + + expected = new Float64Array( data.C_out ); + + out = dorm2r( data.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( out, C, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies Q from the left without transpose (negative strides, row-major)', function test( t ) { + var expected; + var data; + var work; + var tau; + var out; + var A; + var C; + + data = NEGATIVE_STRIDES_LEFT_NOTRANS_ROW_MAJOR; + + A = new Float64Array( data.A ); + tau = new Float64Array( data.tau ); + C = new Float64Array( data.C ); + work = new Float64Array( data.work ); + + expected = new Float64Array( data.C_out ); + + out = dorm2r( data.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( out, C, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies Q from the left without transpose (negative strides, column-major)', function test( t ) { + var expected; + var data; + var work; + var tau; + var out; + var A; + var C; + + data = NEGATIVE_STRIDES_LEFT_NOTRANS_COL_MAJOR; + + A = new Float64Array( data.A ); + tau = new Float64Array( data.tau ); + C = new Float64Array( data.C ); + work = new Float64Array( data.work ); + + expected = new Float64Array( data.C_out ); + + out = dorm2r( data.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( out, C, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies Q from the left with transpose (negative strides, row-major)', function test( t ) { + var expected; + var data; + var work; + var tau; + var out; + var A; + var C; + + data = NEGATIVE_STRIDES_LEFT_TRANS_ROW_MAJOR; + + A = new Float64Array( data.A ); + tau = new Float64Array( data.tau ); + C = new Float64Array( data.C ); + work = new Float64Array( data.work ); + + expected = new Float64Array( data.C_out ); + + out = dorm2r( data.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( out, C, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies Q from the left with transpose (negative strides, column-major)', function test( t ) { + var expected; + var data; + var work; + var tau; + var out; + var A; + var C; + + data = NEGATIVE_STRIDES_LEFT_TRANS_COL_MAJOR; + + A = new Float64Array( data.A ); + tau = new Float64Array( data.tau ); + C = new Float64Array( data.C ); + work = new Float64Array( data.work ); + + expected = new Float64Array( data.C_out ); + + out = dorm2r( data.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( out, C, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies Q from the left without transpose (offsets, row-major)', function test( t ) { + var expected; + var data; + var work; + var tau; + var out; + var A; + var C; + + data = OFFSETS_LEFT_NOTRANS_ROW_MAJOR; + + A = new Float64Array( data.A ); + tau = new Float64Array( data.tau ); + C = new Float64Array( data.C ); + work = new Float64Array( data.work ); + + expected = new Float64Array( data.C_out ); + + out = dorm2r( data.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( out, C, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies Q from the left without transpose (offsets, column-major)', function test( t ) { + var expected; + var data; + var work; + var tau; + var out; + var A; + var C; + + data = OFFSETS_LEFT_NOTRANS_COL_MAJOR; + + A = new Float64Array( data.A ); + tau = new Float64Array( data.tau ); + C = new Float64Array( data.C ); + work = new Float64Array( data.work ); + + expected = new Float64Array( data.C_out ); + + out = dorm2r( data.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( out, C, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies Q from the left with transpose (offsets, row-major)', function test( t ) { + var expected; + var data; + var work; + var tau; + var out; + var A; + var C; + + data = OFFSETS_LEFT_TRANS_ROW_MAJOR; + + A = new Float64Array( data.A ); + tau = new Float64Array( data.tau ); + C = new Float64Array( data.C ); + work = new Float64Array( data.work ); + + expected = new Float64Array( data.C_out ); + + out = dorm2r( data.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( out, C, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies Q from the left with transpose (offsets, column-major)', function test( t ) { + var expected; + var data; + var work; + var tau; + var out; + var A; + var C; + + data = OFFSETS_LEFT_TRANS_COL_MAJOR; + + A = new Float64Array( data.A ); + tau = new Float64Array( data.tau ); + C = new Float64Array( data.C ); + work = new Float64Array( data.work ); + + expected = new Float64Array( data.C_out ); + + out = dorm2r( data.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( out, C, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); From cad6b4e3e0f58d741767edaec00d2687ef49c5b6 Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Sun, 2 Aug 2026 12:04:01 +0530 Subject: [PATCH 11/11] bench: fix overflowing benchmarks --- 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: na - task: lint_javascript_benchmarks status: passed - 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/dorm2r/benchmark/benchmark.js | 5 +++-- .../lapack/base/dorm2r/benchmark/benchmark.ndarray.js | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/benchmark/benchmark.js b/lib/node_modules/@stdlib/lapack/base/dorm2r/benchmark/benchmark.js index a798efcb6868..d85886f1ada7 100644 --- a/lib/node_modules/@stdlib/lapack/base/dorm2r/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/benchmark/benchmark.js @@ -22,6 +22,7 @@ var bench = require( '@stdlib/bench' ); var uniform = require( '@stdlib/random/array/uniform' ); +var zeros = require( '@stdlib/array/zeros' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var Float64Array = require( '@stdlib/array/float64' ); var pow = require( '@stdlib/math/base/special/pow' ); @@ -70,9 +71,9 @@ function createBenchmark( order, side, trans, N ) { 'dtype': 'float64' }; - A = uniform( N*N, -10.0, 10.0, opts ); - tau = uniform( N, -10.0, 10.0, opts ); + A = zeros( N*N, 'float64' ); C = uniform( N*N, -10.0, 10.0, opts ); + tau = uniform( N, 0.0, 2.0, opts ); work = new Float64Array( N ); return benchmark; diff --git a/lib/node_modules/@stdlib/lapack/base/dorm2r/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dorm2r/benchmark/benchmark.ndarray.js index 092de248e4b4..43c18c744d4f 100644 --- a/lib/node_modules/@stdlib/lapack/base/dorm2r/benchmark/benchmark.ndarray.js +++ b/lib/node_modules/@stdlib/lapack/base/dorm2r/benchmark/benchmark.ndarray.js @@ -22,6 +22,7 @@ var bench = require( '@stdlib/bench' ); var uniform = require( '@stdlib/random/array/uniform' ); +var zeros = require( '@stdlib/array/zeros' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var Float64Array = require( '@stdlib/array/float64' ); var pow = require( '@stdlib/math/base/special/pow' ); @@ -65,9 +66,9 @@ function createBenchmark( side, trans, N ) { 'dtype': 'float64' }; - A = uniform( N*N, -10.0, 10.0, opts ); - tau = uniform( N, -10.0, 10.0, opts ); + A = zeros( N*N, 'float64' ); C = uniform( N*N, -10.0, 10.0, opts ); + tau = uniform( N, 0.0, 2.0, opts ); work = new Float64Array( N ); return benchmark;