From 191fc9171cafab1ae66c52237ad2731d6e05fd2d Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Mon, 12 May 2025 07:50:32 +0000 Subject: [PATCH 01/43] feat: add base 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 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/dgebal/lib/base.js | 283 ++++++++++++++++++ 1 file changed, 283 insertions(+) create mode 100644 lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js new file mode 100644 index 000000000000..3519db06a375 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js @@ -0,0 +1,283 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-len, max-params, max-statements */ + +'use strict'; + +// MODULES // + +var dswap = require( '@stdlib/blas/base/dswap' ).ndarray; +var dlamch = require( '@stdlib/lapack/base/dlamch' ); +var dnrm2 = require( '@stdlib/blas/base/dnrm2' ).ndarray; +var idamax = require( '@stdlib/blas/base/idamax' ).ndarray; +var abs = require( '@stdlib/math/base/special/abs' ); +var isnan = require( '@stdlib/assert/is-nan' ); +var max = require( '@stdlib/math/base/special/maxn' ); +var min = require( '@stdlib/math/base/special/minn' ); +var dscal = require( '@stdlib/blas/base/dscal' ).ndarray; + + +// MAIN // + +/** +* Balances a general real matrix `A`. +* +* ## Notes +* +* The job parameter can be one of the following: +* +* - 'N': none, return immediately +* - 'P': permute only +* - 'S': scale only +* - 'B': both permute and scale +* - The matrix `A` is overwritten by the balanced matrix. +* +* @private +* @param {string} job - indicates the operations to be performed +* @param {NonNegativeInteger} N - number of rows/columns in matrix `A` +* @param {Float64Array} A - input matrix to be balanced +* @param {integer} strideA1 - stride of the first dimension of `A` +* @param {integer} strideA2 - stride of the second dimension of `A` +* @param {NonNegativeInteger} offsetA - starting index for `A` +* @param {Float64Array} out - stores the first and last row/column of the balanced submatrix +* @param {integer} strideOut - stride of `out` +* @param {NonNegativeInteger} offsetOut - starting index for `out` +* @param {Float64Array} scale - array containing permutation and scaling information +* @param {integer} strideScale - stride of `scale` +* @param {NonNegativeInteger} offsetScale - starting index for `scale` +* @returns {integer} status code +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( [ 1.0, 100.0, 0.0, 2.0, 200.0, 0.0, 0.0, 0.0, 3.0 ] ); +* var out = new Float64Array( 2 ); +* var scale = new Float64Array( 3 ); +* +* dgebal( 'B', 3, A, 3, 1, 0, out, 1, 0, scale, 1, 0 ); +* // A => [ 1, 12.5, 0, 16, 200, 0, 0, 0, 3 ] +* // out => [ 0, 1 ] +* // scale => [ 8, 1, 2 ] +*/ +function dgebal( job, N, A, strideA1, strideA2, offsetA, out, strideOut, offsetOut, scale, strideScale, offsetScale ) { + var canSwap; + var noconv; + var sfmin1; + var sfmin2; + var sfmax1; + var sfmax2; + var sclfac; + var factor; + var ica; + var ira; + var ca; + var ra; + var is; + var c; + var r; + var k; + var l; + var i; + var j; + var g; + var f; + var s; + + sclfac = 2.0; + factor = 0.95; + + // Quick return if possible + if ( N === 0 ) { + out[ offsetOut ] = 0.0; // ilo + out[ offsetOut + strideOut ] = -1.0; // ihi (invalid) + return 0; + } + + if ( job === 'N' ) { + is = offsetScale; + for ( i = 0; i < N; i++ ) { + scale[ is ] = 1.0; + is += strideScale; + } + + out[ offsetOut ] = 0.0; // ilo + out[ offsetOut + strideOut ] = N - 1; // ihi + return 0; + } + + // Permutation to isolate eigenvalues if possible + k = 0; + l = N - 1; + + if ( job !== 'S' ) { + // Row and column exchange + noconv = true; + while ( noconv ) { + // Search for rows isolating an eigenvalue and push them down + noconv = false; + for ( i = l; i >= 0; i-- ) { + canSwap = true; + for ( j = 0; j <= l; j++ ) { + if ( i !== j && A[ offsetA + (i*strideA1) + (j*strideA2) ] !== 0.0 ) { + canSwap = false; + break; + } + } + + if ( canSwap ) { + scale[ offsetScale + (l*strideScale) ] = i; + if ( i !== l ) { + dswap( l+1, A, strideA1, offsetA + (i*strideA2), A, strideA1, offsetA + (l*strideA2) ); + dswap( N - k, A, strideA2, offsetA + (i*strideA1) + (k*strideA2), A, strideA2, offsetA + (l*strideA1) + (k*strideA2) ); + } + noconv = true; + + if ( l === 0.0 ) { + out[ offsetOut ] = 0.0; // ilo + out[ offsetOut + strideOut ] = 0.0; // ihi + return 0; + } + l -= 1; + } + } + } + + noconv = true; + while ( noconv ) { + // Search for columns isolating an eigenvalue and push them left + noconv = false; + for ( j = k; j <= l; j++ ) { + canSwap = true; + for ( i = k; i <= l; i++ ) { + if ( i !== j && A[ offsetA + (i*strideA1) + (j*strideA2) ] !== 0.0 ) { + canSwap = false; + break; + } + } + + if ( canSwap ) { + scale[ offsetScale + (k*strideScale) ] = j; + if ( j !== k ) { + dswap( l+1, A, strideA1, offsetA + (j*strideA2), A, strideA1, offsetA + (k*strideA2) ); + dswap( N-k, A, strideA2, offsetA + (j*strideA1), A, strideA2, offsetA + (k*strideA1) ); + } + noconv = true; + k += 1; + } + } + } + } + + // Initialize `scale` for non-permuted submatrix + is = offsetScale; + for ( i = k; i <= l; i++ ) { + scale[ is ] = 1.0; + is += strideScale; + } + + if ( job === 'P' ) { + out[ offsetOut ] = k; // ilo + out[ offsetOut + strideOut ] = l; // ihi + return 0; + } + + // Balance the submatrix in rows K to L, iterative loop for norm reduction + sfmin1 = dlamch( 'S' ) / dlamch( 'P' ); + sfmax1 = 1.0 / sfmin1; + sfmin2 = sfmin1 * sclfac; + sfmax2 = 1.0 / sfmin2; + + noconv = true; + while ( noconv ) { + noconv = false; + for ( i = k; i <= l; i++ ) { + c = dnrm2( l-k+1, A, strideA1, offsetA + (k*strideA1) + (i*strideA2) ); + r = dnrm2( l-k+1, A, strideA2, offsetA + (i*strideA1) + (k*strideA2) ); + ica = idamax( l+1, A, strideA1, offsetA + (i*strideA2) ); + ca = abs( A[ offsetA + (ica*strideA1) + (i*strideA2) ] ); + ira = idamax( N-k+1, A, strideA2, offsetA + (i*strideA1) + (k*strideA2) ); + ra = abs( A[ offsetA + (i*strideA1) + ((ira+k)*strideA2) ] ); + + if ( c === 0.0 || r === 0.0 ) { + continue; + } + + if ( isnan( c ) || isnan( r ) || isnan( ca ) || isnan( ra ) ) { + return -3; + } + + g = r / sclfac; + f = 1.0; + s = c + r; + + while ( c < g && max( f, c, ca ) < sfmax2 && min( r, g, ra ) > sfmin2 ) { + f *= sclfac; + c *= sclfac; + ca *= sclfac; + r /= sclfac; + g /= sclfac; + ra /= sclfac; + } + + g = c / sclfac; + + while ( g >= r && max( r, ra ) < sfmax2 && min( f, c, g, ca ) > sfmin2 ) { + f /= sclfac; + c /= sclfac; + g /= sclfac; + ca /= sclfac; + r *= sclfac; + ra *= sclfac; + } + + // Now balance + if ( ( c + r ) >= factor * s ) { + continue; + } + + if ( f < 1.0 && scale[ offsetScale + (i*strideScale) ] < 1.0 ) { + if ( f * scale[ offsetScale + (i*strideScale) ] <= sfmin1 ) { + continue; + } + } + + if ( f > 1.0 && scale[ offsetScale + (i*strideScale) ] > 1.0 ) { + if ( scale[ offsetScale + (i*strideScale) ] >= sfmax1 / f ) { + continue; + } + } + + g = 1.0 / f; + scale[ offsetScale + (i*strideScale) ] *= f; + noconv = true; + + dscal( N-k, g, A, strideA2, offsetA + (i*strideA1) + (k*strideA2) ); + dscal( l+1, f, A, strideA1, offsetA + (i*strideA2) ); + } + } + + out[ offsetOut ] = k; // ilo + out[ offsetOut + strideOut ] = l; // ihi + return 0; +} + + +// EXPORTS // + +module.exports = dgebal; From 08cc97dbd3606ef3fb7dc90cb4cc786e5f83c717 Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Mon, 12 May 2025 09:04:03 +0000 Subject: [PATCH 02/43] feat: add main export --- 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/dgebal/lib/dgebal.js | 96 +++++++++++++++++++ .../@stdlib/lapack/base/dgebal/lib/index.js | 76 +++++++++++++++ .../@stdlib/lapack/base/dgebal/lib/main.js | 35 +++++++ .../@stdlib/lapack/base/dgebal/lib/ndarray.js | 80 ++++++++++++++++ 4 files changed, 287 insertions(+) create mode 100644 lib/node_modules/@stdlib/lapack/base/dgebal/lib/dgebal.js create mode 100644 lib/node_modules/@stdlib/lapack/base/dgebal/lib/index.js create mode 100644 lib/node_modules/@stdlib/lapack/base/dgebal/lib/main.js create mode 100644 lib/node_modules/@stdlib/lapack/base/dgebal/lib/ndarray.js diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/dgebal.js b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/dgebal.js new file mode 100644 index 000000000000..4ab070999c4a --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/dgebal.js @@ -0,0 +1,96 @@ +/** +* @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 isColumnMajor = require( '@stdlib/ndarray/base/assert/is-column-major-string' ); +var format = require( '@stdlib/string/format' ); +var base = require( './base.js' ); + + +// MAIN // + +/** +* Balances a general real matrix `A`. +* +* ## Notes +* +* The job parameter can be one of the following: +* +* - 'N': none, return immediately +* - 'P': permute only +* - 'S': scale only +* - 'B': both permute and scale +* - The matrix `A` is overwritten by the balanced matrix. +* +* @private +* @param {string} order - storage layout of `A` +* @param {string} job - indicates the operations to be performed +* @param {NonNegativeInteger} N - number of rows/columns in matrix `A` +* @param {Float64Array} A - input matrix to be balanced +* @param {NonNegativeInteger} LDA - leading dimension of `A` +* @param {Float64Array} out - stores the first and last row/column of the balanced submatrix +* @param {Float64Array} scale - array containing permutation and scaling information +* @throws {TypeError} first argument must be a valid order +* @throws {TypeError} second argument must be a valid job +* @throws {RangeError} fifth argument must be greater than or equal to `N` +* @returns {integer} status code +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( [ 1.0, 100.0, 0.0, 2.0, 200.0, 0.0, 0.0, 0.0, 3.0 ] ); +* var out = new Float64Array( 2 ); +* var scale = new Float64Array( 3 ); +* +* dgebal( 'row-major', 'B', 3, A, 3, out, scale ); +* // A => [ 1, 12.5, 0, 16, 200, 0, 0, 0, 3 ] +* // out => [ 0, 1 ] +* // scale => [ 8, 1, 2 ] +*/ +function dgebal( order, job, N, A, LDA, out, scale ) { + var sa1; + var sa2; + + if ( !isLayout( order ) ) { + throw new TypeError( format( 'invalid argument. First argument must be a valid order. Value: `%s`.', order ) ); + } + if ( job !== 'B' && job !== 'S' && job !== 'P' && job !== 'N' ) { + throw new TypeError( format( 'invalid argument. Second argument must be one of the following: `B`, `S`, `P`, or `N`. Value: `%s`.', job ) ); + } + if ( isColumnMajor( order ) ) { + sa1 = 1; + sa2 = LDA; + } else { // order === 'row-major' + if ( LDA < N ) { + throw new RangeError( format( 'invalid argument. Eighth argument must be greater than or equal to %d. Value: `%d`.', N, LDA ) ); + } + sa1 = LDA; + sa2 = 1; + } + + return base( job, N, A, sa1, sa2, 0, out, 1, 0, scale, 1, 0 ); +} + + +// EXPORTS // + +module.exports = dgebal; diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/index.js b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/index.js new file mode 100644 index 000000000000..8940386fac3b --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/index.js @@ -0,0 +1,76 @@ +/** +* @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 balance a general real matrix `A`. +* +* @module @stdlib/lapack/base/dgebal +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var dgebal = require( '@stdlib/lapack/base/dgebal' ); +* +* var A = new Float64Array( [ 1.0, 100.0, 0.0, 2.0, 200.0, 0.0, 0.0, 0.0, 3.0 ] ); +* var out = new Float64Array( 2 ); +* var scale = new Float64Array( 3 ); +* +* dgebal( 'row-major', 'B', 3, A, 3, out, scale ); +* // A => [ 1, 12.5, 0, 16, 200, 0, 0, 0, 3 ] +* // out => [ 0, 1 ] +* // scale => [ 8, 1, 2 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var dgebal = require( '@stdlib/lapack/base/dgebal' ); +* +* var A = new Float64Array( [ 1.0, 100.0, 0.0, 2.0, 200.0, 0.0, 0.0, 0.0, 3.0 ] ); +* var out = new Float64Array( 2 ); +* var scale = new Float64Array( 3 ); +* +* dgebal.ndarray( 'B', 3, A, 3, 1, 0, out, 1, 0, scale, 1, 0 ); +* // A => [ 1, 12.5, 0, 16, 200, 0, 0, 0, 3 ] +* // out => [ 0, 1 ] +* // scale => [ 8, 1, 2 ] +*/ + +// 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 dgebal; +var tmp = tryRequire( join( __dirname, './native.js' ) ); +if ( isError( tmp ) ) { + dgebal = main; +} else { + dgebal = tmp; +} + + +// EXPORTS // + +module.exports = dgebal; + +// exports: { "ndarray": "dgebal.ndarray" } diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/main.js b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/main.js new file mode 100644 index 000000000000..b9c15110c92a --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/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 dgebal = require( './dgebal.js' ); +var ndarray = require( './ndarray.js' ); + + +// MAIN // + +setReadOnly( dgebal, 'ndarray', ndarray ); + + +// EXPORTS // + +module.exports = dgebal; diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/ndarray.js b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/ndarray.js new file mode 100644 index 000000000000..89825609aeba --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/ndarray.js @@ -0,0 +1,80 @@ +/** +* @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 format = require( '@stdlib/string/format' ); +var base = require( './base.js' ); + + +// MAIN // + +/** +* Balances a general real matrix `A` using alternative indexing semantics. +* +* ## Notes +* +* The job parameter can be one of the following: +* +* - 'N': none, return immediately +* - 'P': permute only +* - 'S': scale only +* - 'B': both permute and scale +* - The matrix `A` is overwritten by the balanced matrix. +* +* @private +* @param {string} job - indicates the operations to be performed +* @param {NonNegativeInteger} N - number of rows/columns in matrix `A` +* @param {Float64Array} A - input matrix to be balanced +* @param {integer} strideA1 - stride of the first dimension of `A` +* @param {integer} strideA2 - stride of the second dimension of `A` +* @param {NonNegativeInteger} offsetA - starting index for `A` +* @param {Float64Array} out - stores the first and last row/column of the balanced submatrix +* @param {integer} strideOut - stride of `out` +* @param {NonNegativeInteger} offsetOut - starting index for `out` +* @param {Float64Array} scale - array containing permutation and scaling information +* @param {integer} strideScale - stride of `scale` +* @param {NonNegativeInteger} offsetScale - starting index for `scale` +* @throws {TypeError} second argument must be a valid job +* @returns {integer} status code +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( [ 1.0, 100.0, 0.0, 2.0, 200.0, 0.0, 0.0, 0.0, 3.0 ] ); +* var out = new Float64Array( 2 ); +* var scale = new Float64Array( 3 ); +* +* dgebal( 'B', 3, A, 3, 1, 0, out, 1, 0, scale, 1, 0 ); +* // A => [ 1, 12.5, 0, 16, 200, 0, 0, 0, 3 ] +* // out => [ 0, 1 ] +* // scale => [ 8, 1, 2 ] +*/ +function dgebal( job, N, A, strideA1, strideA2, offsetA, out, strideOut, offsetOut, scale, strideScale, offsetScale ) { // eslint-disable-line max-len, max-params + if ( job !== 'B' && job !== 'S' && job !== 'P' && job !== 'N' ) { + throw new TypeError( format( 'invalid argument. Second argument must be one of the following: `B`, `S`, `P`, or `N`. Value: `%s`.', job ) ); + } + return base( job, N, A, strideA1, strideA2, offsetA, out, strideOut, offsetOut, scale, strideScale, offsetScale ); // eslint-disable-line max-len +} + + +// EXPORTS // + +module.exports = dgebal; From 3a1229838a5b3b18e0b775dd87c57e0ac84a08f2 Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Mon, 12 May 2025 18:17:37 +0000 Subject: [PATCH 03/43] 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: 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/dgebal/lib/base.js | 5 +- .../lapack/base/dgebal/test/test.dgebal.js | 215 ++++++++++++++++++ .../@stdlib/lapack/base/dgebal/test/test.js | 82 +++++++ 3 files changed, 300 insertions(+), 2 deletions(-) create mode 100644 lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js create mode 100644 lib/node_modules/@stdlib/lapack/base/dgebal/test/test.js diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js index 3519db06a375..dd6300fa4cc3 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js @@ -46,7 +46,8 @@ var dscal = require( '@stdlib/blas/base/dscal' ).ndarray; * - 'P': permute only * - 'S': scale only * - 'B': both permute and scale -* - The matrix `A` is overwritten by the balanced matrix. +* +* The matrix `A` is overwritten by the balanced matrix. Scale factors are stored in the `scale` array. * * @private * @param {string} job - indicates the operations to be performed @@ -197,7 +198,7 @@ function dgebal( job, N, A, strideA1, strideA2, offsetA, out, strideOut, offsetO return 0; } - // Balance the submatrix in rows K to L, iterative loop for norm reduction + // Balance the submatrix in rows K to L, iterative loop for norm reduction (job = 'B') sfmin1 = dlamch( 'S' ) / dlamch( 'P' ); sfmax1 = 1.0 / sfmin1; sfmin2 = sfmin1 * sclfac; diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js new file mode 100644 index 000000000000..34dcfd193ed7 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js @@ -0,0 +1,215 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable array-element-newline */ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Float64Array = require( '@stdlib/array/float64' ); +var dgebal = require( './../lib/dgebal.js' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof dgebal, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 7', function test( t ) { + t.strictEqual( dgebal.length, 7, 'returns expected value' ); + t.end(); +}); + +tape( 'the function throws an error if provided an invalid first argument', function test( t ) { + var values; + var scale; + var out; + var A; + var i; + + values = [ + 'foo', + 'bar', + 'beep', + 'boop' + ]; + + A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + out = new Float64Array( 2 ); + scale = new Float64Array( 2 ); + + 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() { + dgebal( value, 'B', 2, A, 2, out, scale ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid second argument', function test( t ) { + var values; + var scale; + var out; + var A; + var i; + + values = [ + 'foo', + 'bar', + 'beep', + 'boop' + ]; + + A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + out = new Float64Array( 2 ); + scale = new Float64Array( 2 ); + + 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() { + dgebal( 'row-major', value, 2, A, 2, out, scale ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid second argument', function test( t ) { + var values; + var scale; + var out; + var A; + var i; + + values = [ + 0, + 1 + ]; + + A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + out = new Float64Array( 2 ); + scale = new Float64Array( 2 ); + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + dgebal( 'row-major', 'B', 2, A, value, out, scale ); + }; + } +}); + +tape( 'the function returns invalid indices and leaves the input array unchanged for N = 0', function test( t ) { + var expectedOut; + var scale; + var info; + var out; + var A; + + A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + out = new Float64Array( 2 ); + scale = new Float64Array( 2 ); + + info = dgebal( 'row-major', 'B', 0, A, 2, out, scale ); + + expectedOut = new Float64Array( [ 0.0, -1.0 ] ); + + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = N (row-major)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 1.0, 2.0, 3.0, + 4.0, 5.0, 6.0, + 7.0, 8.0, 9.0 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 0.0, 2.0 ] ); + expectedScale = new Float64Array( [ 1.0, 1.0, 1.0 ] ); + expectedA = new Float64Array([ + 1.0, 2.0, 3.0, + 4.0, 5.0, 6.0, + 7.0, 8.0, 9.0 + ]); + + info = dgebal( 'row-major', 'N', 3, A, 3, out, scale ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = N (column-major)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 1.0, 4.0, 7.0, + 2.0, 5.0, 8.0, + 3.0, 6.0, 9.0 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 0.0, 2.0 ] ); + expectedScale = new Float64Array( [ 1.0, 1.0, 1.0 ] ); + expectedA = new Float64Array([ + 1.0, 4.0, 7.0, + 2.0, 5.0, 8.0, + 3.0, 6.0, 9.0 + ]); + + info = dgebal( 'column-major', 'N', 3, A, 3, out, scale ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.js b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.js new file mode 100644 index 000000000000..235e7935d161 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.js @@ -0,0 +1,82 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 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 dgebal = 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 dgebal, '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 dgebal.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 dgebal = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( dgebal, 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 dgebal; + var main; + + main = require( './../lib/dgebal.js' ); + + dgebal = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( dgebal, main, 'returns expected value' ); + t.end(); + + function tryRequire() { + return new Error( 'Cannot find module' ); + } +}); From 080ed5038111b94f75d6c0dab859b1c86cdfb369 Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Mon, 12 May 2025 19:00:35 +0000 Subject: [PATCH 04/43] test: add P job test --- 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 --- --- .../lapack/base/dgebal/test/test.dgebal.js | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js index 34dcfd193ed7..93730d81affe 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js @@ -213,3 +213,69 @@ tape( 'the function returns expected values for job = N (column-major)', functio t.deepEqual( scale, expectedScale, 'returns expected value' ); t.end(); }); + +tape( 'the function returns expected values for job = P (row-major)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 1.0, 0.0, 2.0, + 0.0, 5.0, 0.0, + 3.0, 0.0, 4.0 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 0.0, 1.0 ] ); + expectedScale = new Float64Array( [ 1.0, 1.0, 1.0 ] ); + expectedA = new Float64Array([ + 1.0, 2.0, 0.0, + 3.0, 4.0, 0.0, + 0.0, 0.0, 5.0 + ]); + + info = dgebal( 'row-major', 'P', 3, A, 3, out, scale ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = P (column-major)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 1.0, 0.0, 3.0, + 0.0, 5.0, 0.0, + 2.0, 0.0, 4.0 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 0.0, 1.0 ] ); + expectedScale = new Float64Array( [ 1.0, 1.0, 1.0 ] ); + expectedA = new Float64Array([ + 1.0, 3.0, 0.0, + 2.0, 4.0, 0.0, + 0.0, 0.0, 5.0 + ]); + + info = dgebal( 'column-major', 'P', 3, A, 3, out, scale ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); From 02f5d2d391696817b12650e00ee508242a01fe34 Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Mon, 12 May 2025 19:07:04 +0000 Subject: [PATCH 05/43] test: add test for S job --- 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 --- --- .../lapack/base/dgebal/test/test.dgebal.js | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js index 93730d81affe..732efcdc21c4 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js @@ -279,3 +279,69 @@ tape( 'the function returns expected values for job = P (column-major)', functio t.deepEqual( scale, expectedScale, 'returns expected value' ); t.end(); }); + +tape( 'the function returns expected values for job = S (row-major)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 16.0, 16.0, 16.0, + 0.25, 0.25, 0.25, + 0.25, 0.25, 0.25 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 0.0, 2.0 ] ); + expectedScale = new Float64Array( [ 1.0, 0.125, 0.125 ] ); + expectedA = new Float64Array([ + 16.0, 2.0, 2.0, + 2.0, 0.25, 0.25, + 2.0, 0.25, 0.25 + ]); + + info = dgebal( 'row-major', 'S', 3, A, 3, out, scale ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = S (column-major)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 16.0, 0.25, 0.25, + 16.0, 0.25, 0.25, + 16.0, 0.25, 0.25 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 0.0, 2.0 ] ); + expectedScale = new Float64Array( [ 1.0, 0.125, 0.125 ] ); + expectedA = new Float64Array([ + 16.0, 2.0, 2.0, + 2.0, 0.25, 0.25, + 2.0, 0.25, 0.25 + ]); + + info = dgebal( 'column-major', 'S', 3, A, 3, out, scale ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); From 0b4af093cfa68c799aafbbce57d202c3bf20ab1f Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Mon, 12 May 2025 19:19:25 +0000 Subject: [PATCH 06/43] test: add test for job = B --- 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 --- --- .../lapack/base/dgebal/test/test.dgebal.js | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js index 732efcdc21c4..96344b697b67 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js @@ -345,3 +345,69 @@ tape( 'the function returns expected values for job = S (column-major)', functio t.deepEqual( scale, expectedScale, 'returns expected value' ); t.end(); }); + +tape( 'the function returns expected values for job = B (row-major)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 1.0, 0.0, 2.0, + 0.0, 5.0, 0.0, + 100.0, 0.0, 4.0 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 0.0, 1.0 ] ); + expectedScale = new Float64Array( [ 0.125, 1.0, 1.0 ] ); + expectedA = new Float64Array([ + 1.0, 16.0, 0.0, + 12.5, 4.0, 0.0, + 0.0, 0.0, 5.0 + ]); + + info = dgebal( 'row-major', 'B', 3, A, 3, out, scale ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = B (column-major)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 1.0, 0.0, 100.0, + 0.0, 5.0, 0.0, + 2.0, 0.0, 4.0 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 0.0, 1.0 ] ); + expectedScale = new Float64Array( [ 0.125, 1.0, 1.0 ] ); + expectedA = new Float64Array([ + 1.0, 12.5, 0.0, + 16.0, 4.0, 0.0, + 0.0, 0.0, 5.0 + ]); + + info = dgebal( 'column-major', 'B', 3, A, 3, out, scale ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); From aeaff94777663be43967781b6dc98cc2567528eb Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Mon, 12 May 2025 19:35:20 +0000 Subject: [PATCH 07/43] test: add ndarray 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 --- --- .../@stdlib/lapack/base/dgebal/test/test.js | 2 +- .../lapack/base/dgebal/test/test.ndarray.js | 355 ++++++++++++++++++ 2 files changed, 356 insertions(+), 1 deletion(-) create mode 100644 lib/node_modules/@stdlib/lapack/base/dgebal/test/test.ndarray.js diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.js b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.js index 235e7935d161..f22291acb9fc 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.ndarray.js new file mode 100644 index 000000000000..6b079260279c --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.ndarray.js @@ -0,0 +1,355 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable array-element-newline */ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Float64Array = require( '@stdlib/array/float64' ); +var dgebal = require( './../lib/ndarray.js' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof dgebal, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 12', function test( t ) { + t.strictEqual( dgebal.length, 12, 'returns expected value' ); + t.end(); +}); + +tape( 'the function throws an error if provided an invalid second argument', function test( t ) { + var values; + var scale; + var out; + var A; + var i; + + values = [ + 'foo', + 'bar', + 'beep', + 'boop' + ]; + + A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + out = new Float64Array( 2 ); + scale = new Float64Array( 2 ); + + 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() { + dgebal( value, 2, A, 2, 1, 0, out, 1, 0, scale, 1, 0 ); + }; + } +}); + +tape( 'the function returns invalid indices and leaves the input array unchanged for N = 0', function test( t ) { + var expectedOut; + var scale; + var info; + var out; + var A; + + A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + out = new Float64Array( 2 ); + scale = new Float64Array( 2 ); + + info = dgebal( 'B', 0, A, 2, 1, 0, out, 1, 0, scale, 1, 0 ); + + expectedOut = new Float64Array( [ 0.0, -1.0 ] ); + + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = N (row-major)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 1.0, 2.0, 3.0, + 4.0, 5.0, 6.0, + 7.0, 8.0, 9.0 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 0.0, 2.0 ] ); + expectedScale = new Float64Array( [ 1.0, 1.0, 1.0 ] ); + expectedA = new Float64Array([ + 1.0, 2.0, 3.0, + 4.0, 5.0, 6.0, + 7.0, 8.0, 9.0 + ]); + + info = dgebal( 'N', 3, A, 3, 1, 0, out, 1, 0, scale, 1, 0 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = N (column-major)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 1.0, 4.0, 7.0, + 2.0, 5.0, 8.0, + 3.0, 6.0, 9.0 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 0.0, 2.0 ] ); + expectedScale = new Float64Array( [ 1.0, 1.0, 1.0 ] ); + expectedA = new Float64Array([ + 1.0, 4.0, 7.0, + 2.0, 5.0, 8.0, + 3.0, 6.0, 9.0 + ]); + + info = dgebal( 'B', 3, A, 1, 3, 0, out, 1, 0, scale, 1, 0 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = P (row-major)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 1.0, 0.0, 2.0, + 0.0, 5.0, 0.0, + 3.0, 0.0, 4.0 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 0.0, 1.0 ] ); + expectedScale = new Float64Array( [ 1.0, 1.0, 1.0 ] ); + expectedA = new Float64Array([ + 1.0, 2.0, 0.0, + 3.0, 4.0, 0.0, + 0.0, 0.0, 5.0 + ]); + + info = dgebal( 'P', 3, A, 3, 1, 0, out, 1, 0, scale, 1, 0 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = P (column-major)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 1.0, 0.0, 3.0, + 0.0, 5.0, 0.0, + 2.0, 0.0, 4.0 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 0.0, 1.0 ] ); + expectedScale = new Float64Array( [ 1.0, 1.0, 1.0 ] ); + expectedA = new Float64Array([ + 1.0, 3.0, 0.0, + 2.0, 4.0, 0.0, + 0.0, 0.0, 5.0 + ]); + + info = dgebal( 'B', 3, A, 1, 3, 0, out, 1, 0, scale, 1, 0 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = S (row-major)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 16.0, 16.0, 16.0, + 0.25, 0.25, 0.25, + 0.25, 0.25, 0.25 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 0.0, 2.0 ] ); + expectedScale = new Float64Array( [ 1.0, 0.125, 0.125 ] ); + expectedA = new Float64Array([ + 16.0, 2.0, 2.0, + 2.0, 0.25, 0.25, + 2.0, 0.25, 0.25 + ]); + + info = dgebal( 'S', 3, A, 3, 1, 0, out, 1, 0, scale, 1, 0 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = S (column-major)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 16.0, 0.25, 0.25, + 16.0, 0.25, 0.25, + 16.0, 0.25, 0.25 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 0.0, 2.0 ] ); + expectedScale = new Float64Array( [ 1.0, 0.125, 0.125 ] ); + expectedA = new Float64Array([ + 16.0, 2.0, 2.0, + 2.0, 0.25, 0.25, + 2.0, 0.25, 0.25 + ]); + + info = dgebal( 'B', 3, A, 1, 3, 0, out, 1, 0, scale, 1, 0 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = B (row-major)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 1.0, 0.0, 2.0, + 0.0, 5.0, 0.0, + 100.0, 0.0, 4.0 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 0.0, 1.0 ] ); + expectedScale = new Float64Array( [ 0.125, 1.0, 1.0 ] ); + expectedA = new Float64Array([ + 1.0, 16.0, 0.0, + 12.5, 4.0, 0.0, + 0.0, 0.0, 5.0 + ]); + + info = dgebal( 'B', 3, A, 3, 1, 0, out, 1, 0, scale, 1, 0 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = B (column-major)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 1.0, 0.0, 100.0, + 0.0, 5.0, 0.0, + 2.0, 0.0, 4.0 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 0.0, 1.0 ] ); + expectedScale = new Float64Array( [ 0.125, 1.0, 1.0 ] ); + expectedA = new Float64Array([ + 1.0, 12.5, 0.0, + 16.0, 4.0, 0.0, + 0.0, 0.0, 5.0 + ]); + + info = dgebal( 'B', 3, A, 1, 3, 0, out, 1, 0, scale, 1, 0 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); From 03a6986552d16e5c035e7b675ea2e3aa27f5753b Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Mon, 12 May 2025 19:41:07 +0000 Subject: [PATCH 08/43] 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 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 --- --- .../@stdlib/lapack/base/dgebal/test/test.ndarray.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.ndarray.js index 6b079260279c..18df6a4123d4 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.ndarray.js @@ -40,7 +40,7 @@ tape( 'the function has an arity of 12', function test( t ) { t.end(); }); -tape( 'the function throws an error if provided an invalid second argument', function test( t ) { +tape( 'the function throws an error if provided an invalid first argument', function test( t ) { var values; var scale; var out; From 5f956b071a3ff8026f632f80c4b96c4925fb60f9 Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Tue, 13 May 2025 05:40:15 +0000 Subject: [PATCH 09/43] test: add tests for empty submatrix --- 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/dgebal/lib/base.js | 1 + .../lapack/base/dgebal/test/test.dgebal.js | 66 +++++++++++++++++++ 2 files changed, 67 insertions(+) diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js index dd6300fa4cc3..3b48c79f856b 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js @@ -149,6 +149,7 @@ function dgebal( job, N, A, strideA1, strideA2, offsetA, out, strideOut, offsetO } noconv = true; + // Check if remaining submatrix is empty and return if ( l === 0.0 ) { out[ offsetOut ] = 0.0; // ilo out[ offsetOut + strideOut ] = 0.0; // ihi diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js index 96344b697b67..ccb6acca625f 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js @@ -411,3 +411,69 @@ tape( 'the function returns expected values for job = B (column-major)', functio t.deepEqual( scale, expectedScale, 'returns expected value' ); t.end(); }); + +tape( 'the function returns expected values for job = B with complex input (row-major)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 1.0, 1.0, 0.0, + 0.0, 2.0, 0.0, + 0.0, 0.0, 3.0 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 0.0, 0.0 ] ); + expectedScale = new Float64Array( [ 0.0, 1.0, 2.0 ] ); + expectedA = new Float64Array([ + 1.0, 1.0, 0.0, + 0.0, 2.0, 0.0, + 0.0, 0.0, 3.0 + ]); + + info = dgebal( 'row-major', 'B', 3, A, 3, out, scale ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = B with complex input (column-major)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 1.0, 0.0, 0.0, + 1.0, 2.0, 0.0, + 0.0, 0.0, 3.0 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 0.0, 0.0 ] ); + expectedScale = new Float64Array( [ 0.0, 1.0, 2.0 ] ); + expectedA = new Float64Array([ + 1.0, 0.0, 0.0, + 1.0, 2.0, 0.0, + 0.0, 0.0, 3.0 + ]); + + info = dgebal( 'column-major', 'B', 3, A, 3, out, scale ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); From 4ab038041bde6f91ea746d12361763a240a6d700 Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Tue, 13 May 2025 10:45:33 +0000 Subject: [PATCH 10/43] test: add more 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/dgebal/lib/base.js | 2 +- .../lapack/base/dgebal/test/test.dgebal.js | 66 +++++++++++++++++++ 2 files changed, 67 insertions(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js index 3b48c79f856b..69d733e28e11 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js @@ -187,7 +187,7 @@ function dgebal( job, N, A, strideA1, strideA2, offsetA, out, strideOut, offsetO } // Initialize `scale` for non-permuted submatrix - is = offsetScale; + is = offsetScale + (k*strideScale); for ( i = k; i <= l; i++ ) { scale[ is ] = 1.0; is += strideScale; diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js index ccb6acca625f..b98f429cbad3 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js @@ -477,3 +477,69 @@ tape( 'the function returns expected values for job = B with complex input (colu t.deepEqual( scale, expectedScale, 'returns expected value' ); t.end(); }); + +tape( 'the function returns expected values for job = B with complex input (row-major)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 1.0, 0.0, 2.0, + 3.0, 4.0, 5.0, + 6.0, 0.0, 7.0 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 1.0, 2.0 ] ); + expectedScale = new Float64Array( [ 1.0, 0.5, 1.0 ] ); + expectedA = new Float64Array([ + 4.0, 1.5, 5.0, + 0.0, 1.0, 4.0, + 0.0, 3.0, 7.0 + ]); + + info = dgebal( 'row-major', 'B', 3, A, 3, out, scale ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = B with complex input (column-major)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 1.0, 3.0, 6.0, + 0.0, 4.0, 0.0, + 2.0, 5.0, 7.0 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 1.0, 2.0 ] ); + expectedScale = new Float64Array( [ 1.0, 0.5, 1.0 ] ); + expectedA = new Float64Array([ + 4.0, 0.0, 0.0, + 1.5, 1.0, 3.0, + 5.0, 4.0, 7.0 + ]); + + info = dgebal( 'column-major', 'B', 3, A, 3, out, scale ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); From 8192ae8180b0590f2b8e8e6bafa4806e6dce4ead Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Tue, 13 May 2025 13:03:27 +0000 Subject: [PATCH 11/43] test: add test for norm = 0 --- 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 --- --- .../lapack/base/dgebal/test/test.dgebal.js | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js index b98f429cbad3..3871974f5f0c 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js @@ -543,3 +543,69 @@ tape( 'the function returns expected values for job = B with complex input (colu t.deepEqual( scale, expectedScale, 'returns expected value' ); t.end(); }); + +tape( 'the function returns expected values for job = S with zero norm (row-major)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 1.0, 0.0, 4.0, + 2.0, 0.0, 5.0, + 3.0, 0.0, 6.0 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 0.0, 2.0 ] ); + expectedScale = new Float64Array( [ 1.0, 1.0, 1.0 ] ); + expectedA = new Float64Array([ + 1.0, 0.0, 4.0, + 2.0, 0.0, 5.0, + 3.0, 0.0, 6.0 + ]); + + info = dgebal( 'row-major', 'S', 3, A, 3, out, scale ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = S with zero norm (column-major)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 1.0, 2.0, 3.0, + 0.0, 0.0, 0.0, + 4.0, 5.0, 6.0 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 0.0, 2.0 ] ); + expectedScale = new Float64Array( [ 1.0, 1.0, 1.0 ] ); + expectedA = new Float64Array([ + 1.0, 2.0, 3.0, + 0.0, 0.0, 0.0, + 4.0, 5.0, 6.0 + ]); + + info = dgebal( 'column-major', 'S', 3, A, 3, out, scale ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); From f70eec063734fb5c3215a1a469959bddb524b5bd Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Tue, 13 May 2025 14:51:52 +0000 Subject: [PATCH 12/43] test: add test for small values --- 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 --- --- .../lapack/base/dgebal/test/test.dgebal.js | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js index 3871974f5f0c..97e5a95c2aff 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js @@ -609,3 +609,73 @@ tape( 'the function returns expected values for job = S with zero norm (column-m t.deepEqual( scale, expectedScale, 'returns expected value' ); t.end(); }); + +tape( 'the function returns expected values for job = S with small values (row-major)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 1.0e-4, 1.0, 2.0, 1.0e4, + 2.0e-4, 1.0, 2.0, 2.0e4, + 3.0e-4, 1.0, 2.0, 3.0e4, + 4.0e-4, 1.0, 2.0, 4.0e4 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 4 ); + + expectedOut = new Float64Array( [ 0.0, 3.0 ] ); + expectedScale = new Float64Array( [ 4096.0, 128.0, 128.0, 1.0 ] ); + expectedA = new Float64Array([ + 1.0e-4, 3.125e-2, 6.25e-2, 2.44140625, + 6.4e-3, 1.0, 2.0, 1.5625e+2, + 9.6e-3, 1.0, 2.0, 2.34375e+2, + 1.6384, 1.28e+2, 2.56e+2, 4.0e+4 + ]); + + info = dgebal( 'row-major', 'S', 4, A, 4, out, scale ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = S with small values (column-major)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 1.0e-4, 2.0e-4, 3.0e-4, 4.0e-4, + 1.0, 1.0, 1.0, 1.0, + 2.0, 2.0, 2.0, 2.0, + 1.0e4, 2.0e4, 3.0e4, 4.0e4 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 4 ); + + expectedOut = new Float64Array( [ 0.0, 3.0 ] ); + expectedScale = new Float64Array( [ 4096.0, 128.0, 128.0, 1.0 ] ); + expectedA = new Float64Array([ + 1.0e-4, 6.4e-3, 9.6e-3, 1.6384, + 3.125e-2, 1.0, 1.0, 1.28e+2, + 6.25e-2, 2.0, 2.0, 2.56e+2, + 2.44140625, 1.5625e+2, 2.34375e+2, 4.0e+4 + ]); + + info = dgebal( 'column-major', 'S', 4, A, 4, out, scale ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); From c9ded9845828c57b17447928be11d48ed4d2ec30 Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Tue, 13 May 2025 18:37:14 +0000 Subject: [PATCH 13/43] refactor: update job names --- 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/dgebal/lib/base.js | 16 ++--- .../@stdlib/lapack/base/dgebal/lib/dgebal.js | 14 ++-- .../@stdlib/lapack/base/dgebal/lib/index.js | 4 +- .../@stdlib/lapack/base/dgebal/lib/ndarray.js | 14 ++-- .../lapack/base/dgebal/test/test.dgebal.js | 72 +++++++++---------- .../lapack/base/dgebal/test/test.ndarray.js | 36 +++++----- 6 files changed, 78 insertions(+), 78 deletions(-) diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js index 69d733e28e11..df6482de6d99 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js @@ -42,10 +42,10 @@ var dscal = require( '@stdlib/blas/base/dscal' ).ndarray; * * The job parameter can be one of the following: * -* - 'N': none, return immediately -* - 'P': permute only -* - 'S': scale only -* - 'B': both permute and scale +* - 'none': none, return immediately +* - 'permutate': permute only +* - 'scale': scale only +* - 'both': both permute and scale * * The matrix `A` is overwritten by the balanced matrix. Scale factors are stored in the `scale` array. * @@ -71,7 +71,7 @@ var dscal = require( '@stdlib/blas/base/dscal' ).ndarray; * var out = new Float64Array( 2 ); * var scale = new Float64Array( 3 ); * -* dgebal( 'B', 3, A, 3, 1, 0, out, 1, 0, scale, 1, 0 ); +* dgebal( 'both', 3, A, 3, 1, 0, out, 1, 0, scale, 1, 0 ); * // A => [ 1, 12.5, 0, 16, 200, 0, 0, 0, 3 ] * // out => [ 0, 1 ] * // scale => [ 8, 1, 2 ] @@ -110,7 +110,7 @@ function dgebal( job, N, A, strideA1, strideA2, offsetA, out, strideOut, offsetO return 0; } - if ( job === 'N' ) { + if ( job === 'none' ) { is = offsetScale; for ( i = 0; i < N; i++ ) { scale[ is ] = 1.0; @@ -126,7 +126,7 @@ function dgebal( job, N, A, strideA1, strideA2, offsetA, out, strideOut, offsetO k = 0; l = N - 1; - if ( job !== 'S' ) { + if ( job !== 'scale' ) { // Row and column exchange noconv = true; while ( noconv ) { @@ -193,7 +193,7 @@ function dgebal( job, N, A, strideA1, strideA2, offsetA, out, strideOut, offsetO is += strideScale; } - if ( job === 'P' ) { + if ( job === 'permutate' ) { out[ offsetOut ] = k; // ilo out[ offsetOut + strideOut ] = l; // ihi return 0; diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/dgebal.js b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/dgebal.js index 4ab070999c4a..a5506edd5b38 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/dgebal.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/dgebal.js @@ -35,10 +35,10 @@ var base = require( './base.js' ); * * The job parameter can be one of the following: * -* - 'N': none, return immediately -* - 'P': permute only -* - 'S': scale only -* - 'B': both permute and scale +* - 'none': none, return immediately +* - 'permutate': permute only +* - 'scale': scale only +* - 'both': both permute and scale * - The matrix `A` is overwritten by the balanced matrix. * * @private @@ -61,7 +61,7 @@ var base = require( './base.js' ); * var out = new Float64Array( 2 ); * var scale = new Float64Array( 3 ); * -* dgebal( 'row-major', 'B', 3, A, 3, out, scale ); +* dgebal( 'row-major', 'both', 3, A, 3, out, scale ); * // A => [ 1, 12.5, 0, 16, 200, 0, 0, 0, 3 ] * // out => [ 0, 1 ] * // scale => [ 8, 1, 2 ] @@ -73,8 +73,8 @@ function dgebal( order, job, N, A, LDA, out, scale ) { if ( !isLayout( order ) ) { throw new TypeError( format( 'invalid argument. First argument must be a valid order. Value: `%s`.', order ) ); } - if ( job !== 'B' && job !== 'S' && job !== 'P' && job !== 'N' ) { - throw new TypeError( format( 'invalid argument. Second argument must be one of the following: `B`, `S`, `P`, or `N`. Value: `%s`.', job ) ); + if ( job !== 'both' && job !== 'scale' && job !== 'permutate' && job !== 'none' ) { + throw new TypeError( format( 'invalid argument. Second argument must be one of the following: `both`, `scale`, `permutate`, or `none`. Value: `%s`.', job ) ); } if ( isColumnMajor( order ) ) { sa1 = 1; diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/index.js b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/index.js index 8940386fac3b..75b2826b6ba8 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/index.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/index.js @@ -31,7 +31,7 @@ * var out = new Float64Array( 2 ); * var scale = new Float64Array( 3 ); * -* dgebal( 'row-major', 'B', 3, A, 3, out, scale ); +* dgebal( 'row-major', 'both', 3, A, 3, out, scale ); * // A => [ 1, 12.5, 0, 16, 200, 0, 0, 0, 3 ] * // out => [ 0, 1 ] * // scale => [ 8, 1, 2 ] @@ -44,7 +44,7 @@ * var out = new Float64Array( 2 ); * var scale = new Float64Array( 3 ); * -* dgebal.ndarray( 'B', 3, A, 3, 1, 0, out, 1, 0, scale, 1, 0 ); +* dgebal.ndarray( 'both', 3, A, 3, 1, 0, out, 1, 0, scale, 1, 0 ); * // A => [ 1, 12.5, 0, 16, 200, 0, 0, 0, 3 ] * // out => [ 0, 1 ] * // scale => [ 8, 1, 2 ] diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/ndarray.js b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/ndarray.js index 89825609aeba..e05576f03767 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/ndarray.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/ndarray.js @@ -33,10 +33,10 @@ var base = require( './base.js' ); * * The job parameter can be one of the following: * -* - 'N': none, return immediately -* - 'P': permute only -* - 'S': scale only -* - 'B': both permute and scale +* - 'none': none, return immediately +* - 'permutate': permute only +* - 'scale': scale only +* - 'both': both permute and scale * - The matrix `A` is overwritten by the balanced matrix. * * @private @@ -62,14 +62,14 @@ var base = require( './base.js' ); * var out = new Float64Array( 2 ); * var scale = new Float64Array( 3 ); * -* dgebal( 'B', 3, A, 3, 1, 0, out, 1, 0, scale, 1, 0 ); +* dgebal( 'both', 3, A, 3, 1, 0, out, 1, 0, scale, 1, 0 ); * // A => [ 1, 12.5, 0, 16, 200, 0, 0, 0, 3 ] * // out => [ 0, 1 ] * // scale => [ 8, 1, 2 ] */ function dgebal( job, N, A, strideA1, strideA2, offsetA, out, strideOut, offsetOut, scale, strideScale, offsetScale ) { // eslint-disable-line max-len, max-params - if ( job !== 'B' && job !== 'S' && job !== 'P' && job !== 'N' ) { - throw new TypeError( format( 'invalid argument. Second argument must be one of the following: `B`, `S`, `P`, or `N`. Value: `%s`.', job ) ); + if ( job !== 'both' && job !== 'scale' && job !== 'permutate' && job !== 'none' ) { + throw new TypeError( format( 'invalid argument. Second argument must be one of the following: `both`, `scale`, `permutate`, or `none`. Value: `%s`.', job ) ); } return base( job, N, A, strideA1, strideA2, offsetA, out, strideOut, offsetOut, scale, strideScale, offsetScale ); // eslint-disable-line max-len } diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js index 97e5a95c2aff..aa0c48681ae9 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js @@ -65,7 +65,7 @@ tape( 'the function throws an error if provided an invalid first argument', func function badValue( value ) { return function badValue() { - dgebal( value, 'B', 2, A, 2, out, scale ); + dgebal( value, 'both', 2, A, 2, out, scale ); }; } }); @@ -123,12 +123,12 @@ tape( 'the function throws an error if provided an invalid second argument', fun function badValue( value ) { return function badValue() { - dgebal( 'row-major', 'B', 2, A, value, out, scale ); + dgebal( 'row-major', 'both', 2, A, value, out, scale ); }; } }); -tape( 'the function returns invalid indices and leaves the input array unchanged for N = 0', function test( t ) { +tape( 'the function returns invalid indices and leaves the input array unchanged for none = 0', function test( t ) { var expectedOut; var scale; var info; @@ -139,7 +139,7 @@ tape( 'the function returns invalid indices and leaves the input array unchanged out = new Float64Array( 2 ); scale = new Float64Array( 2 ); - info = dgebal( 'row-major', 'B', 0, A, 2, out, scale ); + info = dgebal( 'row-major', 'both', 0, A, 2, out, scale ); expectedOut = new Float64Array( [ 0.0, -1.0 ] ); @@ -148,7 +148,7 @@ tape( 'the function returns invalid indices and leaves the input array unchanged t.end(); }); -tape( 'the function returns expected values for job = N (row-major)', function test( t ) { +tape( 'the function returns expected values for job = none (row-major)', function test( t ) { var expectedScale; var expectedOut; var expectedA; @@ -173,7 +173,7 @@ tape( 'the function returns expected values for job = N (row-major)', function t 7.0, 8.0, 9.0 ]); - info = dgebal( 'row-major', 'N', 3, A, 3, out, scale ); + info = dgebal( 'row-major', 'none', 3, A, 3, out, scale ); t.strictEqual( info, 0, 'returns expected value' ); t.deepEqual( out, expectedOut, 'returns expected value' ); t.deepEqual( A, expectedA, 'returns expected value' ); @@ -181,7 +181,7 @@ tape( 'the function returns expected values for job = N (row-major)', function t t.end(); }); -tape( 'the function returns expected values for job = N (column-major)', function test( t ) { +tape( 'the function returns expected values for job = none (column-major)', function test( t ) { var expectedScale; var expectedOut; var expectedA; @@ -206,7 +206,7 @@ tape( 'the function returns expected values for job = N (column-major)', functio 3.0, 6.0, 9.0 ]); - info = dgebal( 'column-major', 'N', 3, A, 3, out, scale ); + info = dgebal( 'column-major', 'none', 3, A, 3, out, scale ); t.strictEqual( info, 0, 'returns expected value' ); t.deepEqual( out, expectedOut, 'returns expected value' ); t.deepEqual( A, expectedA, 'returns expected value' ); @@ -214,7 +214,7 @@ tape( 'the function returns expected values for job = N (column-major)', functio t.end(); }); -tape( 'the function returns expected values for job = P (row-major)', function test( t ) { +tape( 'the function returns expected values for job = permutate (row-major)', function test( t ) { var expectedScale; var expectedOut; var expectedA; @@ -239,7 +239,7 @@ tape( 'the function returns expected values for job = P (row-major)', function t 0.0, 0.0, 5.0 ]); - info = dgebal( 'row-major', 'P', 3, A, 3, out, scale ); + info = dgebal( 'row-major', 'permutate', 3, A, 3, out, scale ); t.strictEqual( info, 0, 'returns expected value' ); t.deepEqual( out, expectedOut, 'returns expected value' ); t.deepEqual( A, expectedA, 'returns expected value' ); @@ -247,7 +247,7 @@ tape( 'the function returns expected values for job = P (row-major)', function t t.end(); }); -tape( 'the function returns expected values for job = P (column-major)', function test( t ) { +tape( 'the function returns expected values for job = permutate (column-major)', function test( t ) { var expectedScale; var expectedOut; var expectedA; @@ -272,7 +272,7 @@ tape( 'the function returns expected values for job = P (column-major)', functio 0.0, 0.0, 5.0 ]); - info = dgebal( 'column-major', 'P', 3, A, 3, out, scale ); + info = dgebal( 'column-major', 'permutate', 3, A, 3, out, scale ); t.strictEqual( info, 0, 'returns expected value' ); t.deepEqual( out, expectedOut, 'returns expected value' ); t.deepEqual( A, expectedA, 'returns expected value' ); @@ -280,7 +280,7 @@ tape( 'the function returns expected values for job = P (column-major)', functio t.end(); }); -tape( 'the function returns expected values for job = S (row-major)', function test( t ) { +tape( 'the function returns expected values for job = scale (row-major)', function test( t ) { var expectedScale; var expectedOut; var expectedA; @@ -305,7 +305,7 @@ tape( 'the function returns expected values for job = S (row-major)', function t 2.0, 0.25, 0.25 ]); - info = dgebal( 'row-major', 'S', 3, A, 3, out, scale ); + info = dgebal( 'row-major', 'scale', 3, A, 3, out, scale ); t.strictEqual( info, 0, 'returns expected value' ); t.deepEqual( out, expectedOut, 'returns expected value' ); t.deepEqual( A, expectedA, 'returns expected value' ); @@ -313,7 +313,7 @@ tape( 'the function returns expected values for job = S (row-major)', function t t.end(); }); -tape( 'the function returns expected values for job = S (column-major)', function test( t ) { +tape( 'the function returns expected values for job = scale (column-major)', function test( t ) { var expectedScale; var expectedOut; var expectedA; @@ -338,7 +338,7 @@ tape( 'the function returns expected values for job = S (column-major)', functio 2.0, 0.25, 0.25 ]); - info = dgebal( 'column-major', 'S', 3, A, 3, out, scale ); + info = dgebal( 'column-major', 'scale', 3, A, 3, out, scale ); t.strictEqual( info, 0, 'returns expected value' ); t.deepEqual( out, expectedOut, 'returns expected value' ); t.deepEqual( A, expectedA, 'returns expected value' ); @@ -346,7 +346,7 @@ tape( 'the function returns expected values for job = S (column-major)', functio t.end(); }); -tape( 'the function returns expected values for job = B (row-major)', function test( t ) { +tape( 'the function returns expected values for job = both (row-major)', function test( t ) { var expectedScale; var expectedOut; var expectedA; @@ -371,7 +371,7 @@ tape( 'the function returns expected values for job = B (row-major)', function t 0.0, 0.0, 5.0 ]); - info = dgebal( 'row-major', 'B', 3, A, 3, out, scale ); + info = dgebal( 'row-major', 'both', 3, A, 3, out, scale ); t.strictEqual( info, 0, 'returns expected value' ); t.deepEqual( out, expectedOut, 'returns expected value' ); t.deepEqual( A, expectedA, 'returns expected value' ); @@ -379,7 +379,7 @@ tape( 'the function returns expected values for job = B (row-major)', function t t.end(); }); -tape( 'the function returns expected values for job = B (column-major)', function test( t ) { +tape( 'the function returns expected values for job = both (column-major)', function test( t ) { var expectedScale; var expectedOut; var expectedA; @@ -404,7 +404,7 @@ tape( 'the function returns expected values for job = B (column-major)', functio 0.0, 0.0, 5.0 ]); - info = dgebal( 'column-major', 'B', 3, A, 3, out, scale ); + info = dgebal( 'column-major', 'both', 3, A, 3, out, scale ); t.strictEqual( info, 0, 'returns expected value' ); t.deepEqual( out, expectedOut, 'returns expected value' ); t.deepEqual( A, expectedA, 'returns expected value' ); @@ -412,7 +412,7 @@ tape( 'the function returns expected values for job = B (column-major)', functio t.end(); }); -tape( 'the function returns expected values for job = B with complex input (row-major)', function test( t ) { +tape( 'the function returns expected values for job = both with complex input (row-major)', function test( t ) { var expectedScale; var expectedOut; var expectedA; @@ -437,7 +437,7 @@ tape( 'the function returns expected values for job = B with complex input (row- 0.0, 0.0, 3.0 ]); - info = dgebal( 'row-major', 'B', 3, A, 3, out, scale ); + info = dgebal( 'row-major', 'both', 3, A, 3, out, scale ); t.strictEqual( info, 0, 'returns expected value' ); t.deepEqual( out, expectedOut, 'returns expected value' ); t.deepEqual( A, expectedA, 'returns expected value' ); @@ -445,7 +445,7 @@ tape( 'the function returns expected values for job = B with complex input (row- t.end(); }); -tape( 'the function returns expected values for job = B with complex input (column-major)', function test( t ) { +tape( 'the function returns expected values for job = both with complex input (column-major)', function test( t ) { var expectedScale; var expectedOut; var expectedA; @@ -470,7 +470,7 @@ tape( 'the function returns expected values for job = B with complex input (colu 0.0, 0.0, 3.0 ]); - info = dgebal( 'column-major', 'B', 3, A, 3, out, scale ); + info = dgebal( 'column-major', 'both', 3, A, 3, out, scale ); t.strictEqual( info, 0, 'returns expected value' ); t.deepEqual( out, expectedOut, 'returns expected value' ); t.deepEqual( A, expectedA, 'returns expected value' ); @@ -478,7 +478,7 @@ tape( 'the function returns expected values for job = B with complex input (colu t.end(); }); -tape( 'the function returns expected values for job = B with complex input (row-major)', function test( t ) { +tape( 'the function returns expected values for job = both with complex input (row-major)', function test( t ) { var expectedScale; var expectedOut; var expectedA; @@ -503,7 +503,7 @@ tape( 'the function returns expected values for job = B with complex input (row- 0.0, 3.0, 7.0 ]); - info = dgebal( 'row-major', 'B', 3, A, 3, out, scale ); + info = dgebal( 'row-major', 'both', 3, A, 3, out, scale ); t.strictEqual( info, 0, 'returns expected value' ); t.deepEqual( out, expectedOut, 'returns expected value' ); t.deepEqual( A, expectedA, 'returns expected value' ); @@ -511,7 +511,7 @@ tape( 'the function returns expected values for job = B with complex input (row- t.end(); }); -tape( 'the function returns expected values for job = B with complex input (column-major)', function test( t ) { +tape( 'the function returns expected values for job = both with complex input (column-major)', function test( t ) { var expectedScale; var expectedOut; var expectedA; @@ -536,7 +536,7 @@ tape( 'the function returns expected values for job = B with complex input (colu 5.0, 4.0, 7.0 ]); - info = dgebal( 'column-major', 'B', 3, A, 3, out, scale ); + info = dgebal( 'column-major', 'both', 3, A, 3, out, scale ); t.strictEqual( info, 0, 'returns expected value' ); t.deepEqual( out, expectedOut, 'returns expected value' ); t.deepEqual( A, expectedA, 'returns expected value' ); @@ -544,7 +544,7 @@ tape( 'the function returns expected values for job = B with complex input (colu t.end(); }); -tape( 'the function returns expected values for job = S with zero norm (row-major)', function test( t ) { +tape( 'the function returns expected values for job = scale with zero norm (row-major)', function test( t ) { var expectedScale; var expectedOut; var expectedA; @@ -569,7 +569,7 @@ tape( 'the function returns expected values for job = S with zero norm (row-majo 3.0, 0.0, 6.0 ]); - info = dgebal( 'row-major', 'S', 3, A, 3, out, scale ); + info = dgebal( 'row-major', 'scale', 3, A, 3, out, scale ); t.strictEqual( info, 0, 'returns expected value' ); t.deepEqual( out, expectedOut, 'returns expected value' ); t.deepEqual( A, expectedA, 'returns expected value' ); @@ -577,7 +577,7 @@ tape( 'the function returns expected values for job = S with zero norm (row-majo t.end(); }); -tape( 'the function returns expected values for job = S with zero norm (column-major)', function test( t ) { +tape( 'the function returns expected values for job = scale with zero norm (column-major)', function test( t ) { var expectedScale; var expectedOut; var expectedA; @@ -602,7 +602,7 @@ tape( 'the function returns expected values for job = S with zero norm (column-m 4.0, 5.0, 6.0 ]); - info = dgebal( 'column-major', 'S', 3, A, 3, out, scale ); + info = dgebal( 'column-major', 'scale', 3, A, 3, out, scale ); t.strictEqual( info, 0, 'returns expected value' ); t.deepEqual( out, expectedOut, 'returns expected value' ); t.deepEqual( A, expectedA, 'returns expected value' ); @@ -610,7 +610,7 @@ tape( 'the function returns expected values for job = S with zero norm (column-m t.end(); }); -tape( 'the function returns expected values for job = S with small values (row-major)', function test( t ) { +tape( 'the function returns expected values for job = scale with small values (row-major)', function test( t ) { var expectedScale; var expectedOut; var expectedA; @@ -637,7 +637,7 @@ tape( 'the function returns expected values for job = S with small values (row-m 1.6384, 1.28e+2, 2.56e+2, 4.0e+4 ]); - info = dgebal( 'row-major', 'S', 4, A, 4, out, scale ); + info = dgebal( 'row-major', 'scale', 4, A, 4, out, scale ); t.strictEqual( info, 0, 'returns expected value' ); t.deepEqual( out, expectedOut, 'returns expected value' ); t.deepEqual( A, expectedA, 'returns expected value' ); @@ -645,7 +645,7 @@ tape( 'the function returns expected values for job = S with small values (row-m t.end(); }); -tape( 'the function returns expected values for job = S with small values (column-major)', function test( t ) { +tape( 'the function returns expected values for job = scale with small values (column-major)', function test( t ) { var expectedScale; var expectedOut; var expectedA; @@ -672,7 +672,7 @@ tape( 'the function returns expected values for job = S with small values (colum 2.44140625, 1.5625e+2, 2.34375e+2, 4.0e+4 ]); - info = dgebal( 'column-major', 'S', 4, A, 4, out, scale ); + info = dgebal( 'column-major', 'scale', 4, A, 4, out, scale ); t.strictEqual( info, 0, 'returns expected value' ); t.deepEqual( out, expectedOut, 'returns expected value' ); t.deepEqual( A, expectedA, 'returns expected value' ); diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.ndarray.js index 18df6a4123d4..3e2813a30af3 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.ndarray.js @@ -70,7 +70,7 @@ tape( 'the function throws an error if provided an invalid first argument', func } }); -tape( 'the function returns invalid indices and leaves the input array unchanged for N = 0', function test( t ) { +tape( 'the function returns invalid indices and leaves the input array unchanged for none = 0', function test( t ) { var expectedOut; var scale; var info; @@ -81,7 +81,7 @@ tape( 'the function returns invalid indices and leaves the input array unchanged out = new Float64Array( 2 ); scale = new Float64Array( 2 ); - info = dgebal( 'B', 0, A, 2, 1, 0, out, 1, 0, scale, 1, 0 ); + info = dgebal( 'both', 0, A, 2, 1, 0, out, 1, 0, scale, 1, 0 ); expectedOut = new Float64Array( [ 0.0, -1.0 ] ); @@ -90,7 +90,7 @@ tape( 'the function returns invalid indices and leaves the input array unchanged t.end(); }); -tape( 'the function returns expected values for job = N (row-major)', function test( t ) { +tape( 'the function returns expected values for job = none (row-major)', function test( t ) { var expectedScale; var expectedOut; var expectedA; @@ -115,7 +115,7 @@ tape( 'the function returns expected values for job = N (row-major)', function t 7.0, 8.0, 9.0 ]); - info = dgebal( 'N', 3, A, 3, 1, 0, out, 1, 0, scale, 1, 0 ); + info = dgebal( 'none', 3, A, 3, 1, 0, out, 1, 0, scale, 1, 0 ); t.strictEqual( info, 0, 'returns expected value' ); t.deepEqual( out, expectedOut, 'returns expected value' ); t.deepEqual( A, expectedA, 'returns expected value' ); @@ -123,7 +123,7 @@ tape( 'the function returns expected values for job = N (row-major)', function t t.end(); }); -tape( 'the function returns expected values for job = N (column-major)', function test( t ) { +tape( 'the function returns expected values for job = none (column-major)', function test( t ) { var expectedScale; var expectedOut; var expectedA; @@ -148,7 +148,7 @@ tape( 'the function returns expected values for job = N (column-major)', functio 3.0, 6.0, 9.0 ]); - info = dgebal( 'B', 3, A, 1, 3, 0, out, 1, 0, scale, 1, 0 ); + info = dgebal( 'both', 3, A, 1, 3, 0, out, 1, 0, scale, 1, 0 ); t.strictEqual( info, 0, 'returns expected value' ); t.deepEqual( out, expectedOut, 'returns expected value' ); t.deepEqual( A, expectedA, 'returns expected value' ); @@ -156,7 +156,7 @@ tape( 'the function returns expected values for job = N (column-major)', functio t.end(); }); -tape( 'the function returns expected values for job = P (row-major)', function test( t ) { +tape( 'the function returns expected values for job = permutate (row-major)', function test( t ) { var expectedScale; var expectedOut; var expectedA; @@ -181,7 +181,7 @@ tape( 'the function returns expected values for job = P (row-major)', function t 0.0, 0.0, 5.0 ]); - info = dgebal( 'P', 3, A, 3, 1, 0, out, 1, 0, scale, 1, 0 ); + info = dgebal( 'permutate', 3, A, 3, 1, 0, out, 1, 0, scale, 1, 0 ); t.strictEqual( info, 0, 'returns expected value' ); t.deepEqual( out, expectedOut, 'returns expected value' ); t.deepEqual( A, expectedA, 'returns expected value' ); @@ -189,7 +189,7 @@ tape( 'the function returns expected values for job = P (row-major)', function t t.end(); }); -tape( 'the function returns expected values for job = P (column-major)', function test( t ) { +tape( 'the function returns expected values for job = permutate (column-major)', function test( t ) { var expectedScale; var expectedOut; var expectedA; @@ -214,7 +214,7 @@ tape( 'the function returns expected values for job = P (column-major)', functio 0.0, 0.0, 5.0 ]); - info = dgebal( 'B', 3, A, 1, 3, 0, out, 1, 0, scale, 1, 0 ); + info = dgebal( 'both', 3, A, 1, 3, 0, out, 1, 0, scale, 1, 0 ); t.strictEqual( info, 0, 'returns expected value' ); t.deepEqual( out, expectedOut, 'returns expected value' ); t.deepEqual( A, expectedA, 'returns expected value' ); @@ -222,7 +222,7 @@ tape( 'the function returns expected values for job = P (column-major)', functio t.end(); }); -tape( 'the function returns expected values for job = S (row-major)', function test( t ) { +tape( 'the function returns expected values for job = scale (row-major)', function test( t ) { var expectedScale; var expectedOut; var expectedA; @@ -247,7 +247,7 @@ tape( 'the function returns expected values for job = S (row-major)', function t 2.0, 0.25, 0.25 ]); - info = dgebal( 'S', 3, A, 3, 1, 0, out, 1, 0, scale, 1, 0 ); + info = dgebal( 'scale', 3, A, 3, 1, 0, out, 1, 0, scale, 1, 0 ); t.strictEqual( info, 0, 'returns expected value' ); t.deepEqual( out, expectedOut, 'returns expected value' ); t.deepEqual( A, expectedA, 'returns expected value' ); @@ -255,7 +255,7 @@ tape( 'the function returns expected values for job = S (row-major)', function t t.end(); }); -tape( 'the function returns expected values for job = S (column-major)', function test( t ) { +tape( 'the function returns expected values for job = scale (column-major)', function test( t ) { var expectedScale; var expectedOut; var expectedA; @@ -280,7 +280,7 @@ tape( 'the function returns expected values for job = S (column-major)', functio 2.0, 0.25, 0.25 ]); - info = dgebal( 'B', 3, A, 1, 3, 0, out, 1, 0, scale, 1, 0 ); + info = dgebal( 'both', 3, A, 1, 3, 0, out, 1, 0, scale, 1, 0 ); t.strictEqual( info, 0, 'returns expected value' ); t.deepEqual( out, expectedOut, 'returns expected value' ); t.deepEqual( A, expectedA, 'returns expected value' ); @@ -288,7 +288,7 @@ tape( 'the function returns expected values for job = S (column-major)', functio t.end(); }); -tape( 'the function returns expected values for job = B (row-major)', function test( t ) { +tape( 'the function returns expected values for job = both (row-major)', function test( t ) { var expectedScale; var expectedOut; var expectedA; @@ -313,7 +313,7 @@ tape( 'the function returns expected values for job = B (row-major)', function t 0.0, 0.0, 5.0 ]); - info = dgebal( 'B', 3, A, 3, 1, 0, out, 1, 0, scale, 1, 0 ); + info = dgebal( 'both', 3, A, 3, 1, 0, out, 1, 0, scale, 1, 0 ); t.strictEqual( info, 0, 'returns expected value' ); t.deepEqual( out, expectedOut, 'returns expected value' ); t.deepEqual( A, expectedA, 'returns expected value' ); @@ -321,7 +321,7 @@ tape( 'the function returns expected values for job = B (row-major)', function t t.end(); }); -tape( 'the function returns expected values for job = B (column-major)', function test( t ) { +tape( 'the function returns expected values for job = both (column-major)', function test( t ) { var expectedScale; var expectedOut; var expectedA; @@ -346,7 +346,7 @@ tape( 'the function returns expected values for job = B (column-major)', functio 0.0, 0.0, 5.0 ]); - info = dgebal( 'B', 3, A, 1, 3, 0, out, 1, 0, scale, 1, 0 ); + info = dgebal( 'both', 3, A, 1, 3, 0, out, 1, 0, scale, 1, 0 ); t.strictEqual( info, 0, 'returns expected value' ); t.deepEqual( out, expectedOut, 'returns expected value' ); t.deepEqual( A, expectedA, 'returns expected value' ); From 2c45388da8f4b494d9fcb65f8bd1371b537d8d23 Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Tue, 13 May 2025 19:00:56 +0000 Subject: [PATCH 14/43] test: add tests with weird values --- 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 --- --- .../lapack/base/dgebal/test/test.dgebal.js | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js index aa0c48681ae9..bc528d51e490 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js @@ -679,3 +679,69 @@ tape( 'the function returns expected values for job = scale with small values (c t.deepEqual( scale, expectedScale, 'returns expected value' ); t.end(); }); + +tape( 'the function returns expected values for job = both with large values (row-major)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 1.0e30, 1.0, 1.0e-30, + 1.0e30, 1.0, 1.0e-30, + 1.0e30, 1.0, 1.0e-30 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 0.0, 2.0 ] ); + expectedScale = new Float64Array( [ 1.0, 1125899906842624.0, 1.2676506002282294e+30 ] ); // eslint-disable-line max-len + expectedA = new Float64Array([ + 1.0e30, 1.1258999068426240e15, 1.2676506002282295, + 8.8817841970012525e14, 1.0, 1.1258999068426241e-15, + 7.8886090522101182e-1, 8.8817841970012523e-16, 1.0e-30 + ]); + + info = dgebal( 'row-major', 'both', 3, A, 3, out, scale ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = both with large values (column-major)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 1.0e30, 1.0e30, 1.0e30, + 1.0, 1.0, 1.0, + 1.0e-30, 1.0e-30, 1.0e-30 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 0.0, 2.0 ] ); + expectedScale = new Float64Array( [ 1.0, 1125899906842624.0, 1.2676506002282294e+30 ] ); // eslint-disable-line max-len + expectedA = new Float64Array([ + 1.0e30, 8.8817841970012525e14, 7.8886090522101182e-1, + 1.1258999068426240e15, 1.0, 8.8817841970012523e-16, + 1.2676506002282295, 1.1258999068426241e-15, 1.0e-30 + ]); + + info = dgebal( 'column-major', 'both', 3, A, 3, out, scale ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); From 6d755caa8a6de552a4e66b96d2d2b742c1c19937 Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Wed, 14 May 2025 00:42:15 +0530 Subject: [PATCH 15/43] test: add ndarray 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 --- --- .../lapack/base/dgebal/test/test.dgebal.js | 2 +- .../lapack/base/dgebal/test/test.ndarray.js | 335 ++++++++++++++++++ 2 files changed, 336 insertions(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js index bc528d51e490..da614f6e9668 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js @@ -128,7 +128,7 @@ tape( 'the function throws an error if provided an invalid second argument', fun } }); -tape( 'the function returns invalid indices and leaves the input array unchanged for none = 0', function test( t ) { +tape( 'the function returns invalid indices and leaves the input array unchanged for N = 0', function test( t ) { var expectedOut; var scale; var info; diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.ndarray.js index 3e2813a30af3..3c14b02eb506 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.ndarray.js @@ -346,6 +346,341 @@ tape( 'the function returns expected values for job = both (column-major)', func 0.0, 0.0, 5.0 ]); + info = dgebal( 'both', 3, A, 1, 3, 0, out, 1, 0, scale, 1, 0 ); + + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = both with complex input (row-major)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 1.0, 1.0, 0.0, + 0.0, 2.0, 0.0, + 0.0, 0.0, 3.0 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 0.0, 0.0 ] ); + expectedScale = new Float64Array( [ 0.0, 1.0, 2.0 ] ); + expectedA = new Float64Array([ + 1.0, 1.0, 0.0, + 0.0, 2.0, 0.0, + 0.0, 0.0, 3.0 + ]); + + info = dgebal( 'both', 3, A, 3, 1, 0, out, 1, 0, scale, 1, 0 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = both with complex input (column-major)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 1.0, 0.0, 0.0, + 1.0, 2.0, 0.0, + 0.0, 0.0, 3.0 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 0.0, 0.0 ] ); + expectedScale = new Float64Array( [ 0.0, 1.0, 2.0 ] ); + expectedA = new Float64Array([ + 1.0, 0.0, 0.0, + 1.0, 2.0, 0.0, + 0.0, 0.0, 3.0 + ]); + + info = dgebal( 'both', 3, A, 1, 3, 0, out, 1, 0, scale, 1, 0 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = both with complex input (row-major)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 1.0, 0.0, 2.0, + 3.0, 4.0, 5.0, + 6.0, 0.0, 7.0 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 1.0, 2.0 ] ); + expectedScale = new Float64Array( [ 1.0, 0.5, 1.0 ] ); + expectedA = new Float64Array([ + 4.0, 1.5, 5.0, + 0.0, 1.0, 4.0, + 0.0, 3.0, 7.0 + ]); + + info = dgebal( 'both', 3, A, 3, 1, 0, out, 1, 0, scale, 1, 0 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = both with complex input (column-major)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 1.0, 3.0, 6.0, + 0.0, 4.0, 0.0, + 2.0, 5.0, 7.0 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 1.0, 2.0 ] ); + expectedScale = new Float64Array( [ 1.0, 0.5, 1.0 ] ); + expectedA = new Float64Array([ + 4.0, 0.0, 0.0, + 1.5, 1.0, 3.0, + 5.0, 4.0, 7.0 + ]); + + info = dgebal( 'both', 3, A, 1, 3, 0, out, 1, 0, scale, 1, 0 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = scale with zero norm (row-major)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 1.0, 0.0, 4.0, + 2.0, 0.0, 5.0, + 3.0, 0.0, 6.0 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 0.0, 2.0 ] ); + expectedScale = new Float64Array( [ 1.0, 1.0, 1.0 ] ); + expectedA = new Float64Array([ + 1.0, 0.0, 4.0, + 2.0, 0.0, 5.0, + 3.0, 0.0, 6.0 + ]); + + info = dgebal( 'scale', 3, A, 3, 1, 0, out, 1, 0, scale, 1, 0 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = scale with zero norm (column-major)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 1.0, 2.0, 3.0, + 0.0, 0.0, 0.0, + 4.0, 5.0, 6.0 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 0.0, 2.0 ] ); + expectedScale = new Float64Array( [ 1.0, 1.0, 1.0 ] ); + expectedA = new Float64Array([ + 1.0, 2.0, 3.0, + 0.0, 0.0, 0.0, + 4.0, 5.0, 6.0 + ]); + + info = dgebal( 'scale', 3, A, 1, 3, 0, out, 1, 0, scale, 1, 0 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = scale with small values (row-major)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 1.0e-4, 1.0, 2.0, 1.0e4, + 2.0e-4, 1.0, 2.0, 2.0e4, + 3.0e-4, 1.0, 2.0, 3.0e4, + 4.0e-4, 1.0, 2.0, 4.0e4 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 4 ); + + expectedOut = new Float64Array( [ 0.0, 3.0 ] ); + expectedScale = new Float64Array( [ 4096.0, 128.0, 128.0, 1.0 ] ); + expectedA = new Float64Array([ + 1.0e-4, 3.125e-2, 6.25e-2, 2.44140625, + 6.4e-3, 1.0, 2.0, 1.5625e+2, + 9.6e-3, 1.0, 2.0, 2.34375e+2, + 1.6384, 1.28e+2, 2.56e+2, 4.0e+4 + ]); + + info = dgebal( 'scale', 4, A, 4, 1, 0, out, 1, 0, scale, 1, 0 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = scale with small values (column-major)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 1.0e-4, 2.0e-4, 3.0e-4, 4.0e-4, + 1.0, 1.0, 1.0, 1.0, + 2.0, 2.0, 2.0, 2.0, + 1.0e4, 2.0e4, 3.0e4, 4.0e4 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 4 ); + + expectedOut = new Float64Array( [ 0.0, 3.0 ] ); + expectedScale = new Float64Array( [ 4096.0, 128.0, 128.0, 1.0 ] ); + expectedA = new Float64Array([ + 1.0e-4, 6.4e-3, 9.6e-3, 1.6384, + 3.125e-2, 1.0, 1.0, 1.28e+2, + 6.25e-2, 2.0, 2.0, 2.56e+2, + 2.44140625, 1.5625e+2, 2.34375e+2, 4.0e+4 + ]); + + info = dgebal( 'scale', 4, A, 1, 4, 0, out, 1, 0, scale, 1, 0 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = both with large values (row-major)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 1.0e30, 1.0, 1.0e-30, + 1.0e30, 1.0, 1.0e-30, + 1.0e30, 1.0, 1.0e-30 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 0.0, 2.0 ] ); + expectedScale = new Float64Array( [ 1.0, 1125899906842624.0, 1.2676506002282294e+30 ] ); // eslint-disable-line max-len + expectedA = new Float64Array([ + 1.0e30, 1.1258999068426240e15, 1.2676506002282295, + 8.8817841970012525e14, 1.0, 1.1258999068426241e-15, + 7.8886090522101182e-1, 8.8817841970012523e-16, 1.0e-30 + ]); + + info = dgebal( 'both', 3, A, 3, 1, 0, out, 1, 0, scale, 1, 0 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = both with large values (column-major)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 1.0e30, 1.0e30, 1.0e30, + 1.0, 1.0, 1.0, + 1.0e-30, 1.0e-30, 1.0e-30 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 0.0, 2.0 ] ); + expectedScale = new Float64Array( [ 1.0, 1125899906842624.0, 1.2676506002282294e+30 ] ); // eslint-disable-line max-len + expectedA = new Float64Array([ + 1.0e30, 8.8817841970012525e14, 7.8886090522101182e-1, + 1.1258999068426240e15, 1.0, 8.8817841970012523e-16, + 1.2676506002282295, 1.1258999068426241e-15, 1.0e-30 + ]); + info = dgebal( 'both', 3, A, 1, 3, 0, out, 1, 0, scale, 1, 0 ); t.strictEqual( info, 0, 'returns expected value' ); t.deepEqual( out, expectedOut, 'returns expected value' ); From 91366cd782e513723dac3f7f8bdce372577971f9 Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Wed, 14 May 2025 19:23:04 +0000 Subject: [PATCH 16/43] test: add some 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 --- --- .../lapack/base/dgebal/test/test.ndarray.js | 215 +++++++++++++++++- 1 file changed, 214 insertions(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.ndarray.js index 3c14b02eb506..614747678232 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.ndarray.js @@ -280,7 +280,7 @@ tape( 'the function returns expected values for job = scale (column-major)', fun 2.0, 0.25, 0.25 ]); - info = dgebal( 'both', 3, A, 1, 3, 0, out, 1, 0, scale, 1, 0 ); + info = dgebal( 'scale', 3, A, 1, 3, 0, out, 1, 0, scale, 1, 0 ); t.strictEqual( info, 0, 'returns expected value' ); t.deepEqual( out, expectedOut, 'returns expected value' ); t.deepEqual( A, expectedA, 'returns expected value' ); @@ -688,3 +688,216 @@ tape( 'the function returns expected values for job = both with large values (co t.deepEqual( scale, expectedScale, 'returns expected value' ); t.end(); }); + +tape( 'the function returns expected values for job = none (row-major) (negative strides)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 9.0, 8.0, 7.0, + 6.0, 5.0, 4.0, + 3.0, 2.0, 1.0 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 2.0, 0.0 ] ); + expectedScale = new Float64Array( [ 1.0, 1.0, 1.0 ] ); + expectedA = new Float64Array([ + 9.0, 8.0, 7.0, + 6.0, 5.0, 4.0, + 3.0, 2.0, 1.0 + ]); + + info = dgebal( 'none', 3, A, -3, -1, 8, out, -1, 1, scale, -1, 2 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = none (column-major) (negative strides)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 9.0, 6.0, 3.0, + 8.0, 5.0, 2.0, + 7.0, 4.0, 1.0 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 2.0, 0.0 ] ); + expectedScale = new Float64Array( [ 1.0, 1.0, 1.0 ] ); + expectedA = new Float64Array([ + 9.0, 6.0, 3.0, + 8.0, 5.0, 2.0, + 7.0, 4.0, 1.0 + ]); + + info = dgebal( 'both', 3, A, -1, -3, 8, out, -1, 1, scale, -1, 2 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = permutate (row-major) (negative strides)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 4.0, 0.0, 3.0, + 0.0, 5.0, 0.0, + 2.0, 0.0, 1.0 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 1.0, 0.0 ] ); + expectedScale = new Float64Array( [ 1.0, 1.0, 1.0 ] ); + + expectedA = new Float64Array([ + 5.0, 0.0, 0.0, + 0.0, 4.0, 3.0, + 0.0, 2.0, 1.0 + ]); + + info = dgebal( 'permutate', 3, A, -3, -1, 8, out, -1, 1, scale, -1, 2 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = permutate (column-major) (negative strides)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 4.0, 0.0, 2.0, + 0.0, 5.0, 0.0, + 3.0, 0.0, 1.0 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 1.0, 0.0 ] ); + expectedScale = new Float64Array( [ 1.0, 1.0, 1.0 ] ); + expectedA = new Float64Array([ + 5.0, 0.0, 0.0, + 0.0, 4.0, 2.0, + 0.0, 3.0, 1.0 + ]); + + info = dgebal( 'permutate', 3, A, -1, -3, 8, out, -1, 1, scale, -1, 2 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = scale (row-major) (negative strides)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 16.0, 16.0, 16.0, + 0.25, 0.25, 0.25, + 0.25, 0.25, 0.25 + ]); + + A = new Float64Array([ + 0.25, 0.25, 0.25, + 0.25, 0.25, 0.25, + 16.0, 16.0, 16.0 + ]); + + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 2.0, 0.0 ] ); + expectedScale = new Float64Array( [ 0.125, 0.125, 1.0 ] ); + expectedA = new Float64Array([ + 16.0, 2.0, 2.0, + 2.0, 0.25, 0.25, + 2.0, 0.25, 0.25 + ]); + + expectedA = new Float64Array([ + 0.25, 0.25, 2.0, + 0.25, 0.25, 2.0, + 2.0, 2.0, 16.0 + ]); + + info = dgebal( 'scale', 3, A, -3, -1, 8, out, -1, 1, scale, -1, 2 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = scale (column-major) (negative strides)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 0.25, 0.25, 16.0, + 0.25, 0.25, 16.0, + 0.25, 0.25, 16.0 + ]); + + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 2.0, 0.0 ] ); + expectedScale = new Float64Array( [ 0.125, 0.125, 1.0 ] ); + expectedA = new Float64Array([ + 0.25, 0.25, 2.0, + 0.25, 0.25, 2.0, + 2.0, 2.0, 16.0 + ]); + + info = dgebal( 'scale', 3, A, -1, -3, 8, out, -1, 1, scale, -1, 2 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); From ecf4a87c852da80677b9c035607a71cbb44c2160 Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Wed, 14 May 2025 20:02:01 +0000 Subject: [PATCH 17/43] test: more negative stride 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 --- --- .../lapack/base/dgebal/test/test.ndarray.js | 202 ++++++++++++++++++ 1 file changed, 202 insertions(+) diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.ndarray.js index 614747678232..0433261fe1f8 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.ndarray.js @@ -901,3 +901,205 @@ tape( 'the function returns expected values for job = scale (column-major) (nega t.deepEqual( scale, expectedScale, 'returns expected value' ); t.end(); }); + +tape( 'the function returns expected values for job = both (row-major) (negative strides)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 4.0, 0.0, 100.0, + 0.0, 5.0, 0.0, + 2.0, 0.0, 1.0 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 1.0, 0.0 ] ); + expectedScale = new Float64Array( [ 1.0, 1.0, 0.125 ] ); + + expectedA = new Float64Array([ + 5.0, 0.0, 0.0, + 0.0, 4.0, 12.5, + 0.0, 16.0, 1.0 + ]); + + info = dgebal( 'both', 3, A, -3, -1, 8, out, -1, 1, scale, -1, 2 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = both (column-major) (negative strides)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 4.0, 0.0, 2.0, + 0.0, 5.0, 0.0, + 100.0, 0.0, 1.0 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 1.0, 0.0 ] ); + expectedScale = new Float64Array( [ 1.0, 1.0, 0.125 ] ); + expectedA = new Float64Array([ + 5.0, 0.0, 0.0, + 0.0, 4.0, 16.0, + 0.0, 12.5, 1.0 + ]); + + info = dgebal( 'both', 3, A, -1, -3, 8, out, -1, 1, scale, -1, 2 ); + + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = both with complex input (row-major) (negative strides)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 3.0, 0.0, 0.0, + 0.0, 2.0, 0.0, + 0.0, 1.0, 1.0 + ]); + + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 0.0, 0.0 ] ); + expectedScale = new Float64Array( [ 2.0, 1.0, 0.0 ] ); + expectedA = new Float64Array([ + 3.0, 0.0, 0.0, + 0.0, 2.0, 0.0, + 0.0, 1.0, 1.0 + ]); + + info = dgebal( 'both', 3, A, -3, -1, 8, out, -1, 1, scale, -1, 2 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = both with complex input (column-major) (negative strides)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 3.0, 0.0, 0.0, + 0.0, 2.0, 1.0, + 0.0, 0.0, 1.0 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 0.0, 0.0 ] ); + expectedScale = new Float64Array( [ 2.0, 1.0, 0.0 ] ); + + expectedA = new Float64Array([ + 3.0, 0.0, 0.0, + 0.0, 2.0, 1.0, + 0.0, 0.0, 1.0 + ]); + + info = dgebal( 'both', 3, A, -1, -3, 8, out, -1, 1, scale, -1, 2 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = both with complex input (row-major) (negative strides)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 7.0, 0.0, 6.0, + 5.0, 4.0, 3.0, + 2.0, 0.0, 1.0 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 2.0, 1.0 ] ); + expectedScale = new Float64Array( [ 1.0, 0.5, 1.0 ] ); + expectedA = new Float64Array([ + 7.0, 3.0, 0.0, + 4.0, 1.0, 0.0, + 5.0, 1.5, 4.0 + ]); + info = dgebal( 'both', 3, A, -3, -1, 8, out, -1, 1, scale, -1, 2 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = both with complex input (column-major) (negative strides)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 7.0, 5.0, 2.0, + 0.0, 4.0, 0.0, + 6.0, 3.0, 1.0 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 2.0, 1.0 ] ); + expectedScale = new Float64Array( [ 1.0, 0.5, 1.0 ] ); + + expectedA = new Float64Array([ + 7.0, 4.0, 5.0, + 3.0, 1.0, 1.5, + 0.0, 0.0, 4.0 + ]); + + info = dgebal( 'both', 3, A, -1, -3, 8, out, -1, 1, scale, -1, 2 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); From 91d0ec8e517e9415da2cef306cc0bf74eba38322 Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Wed, 14 May 2025 20:22:55 +0000 Subject: [PATCH 18/43] test: add tests for negative strides --- 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 --- --- .../lapack/base/dgebal/test/test.ndarray.js | 148 +++++++++++++++++- 1 file changed, 147 insertions(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.ndarray.js index 0433261fe1f8..c348f6ea25c5 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.ndarray.js @@ -16,7 +16,7 @@ * limitations under the License. */ -/* eslint-disable array-element-newline */ +/* eslint-disable array-element-newline, max-lines */ 'use strict'; @@ -1103,3 +1103,149 @@ tape( 'the function returns expected values for job = both with complex input (c t.deepEqual( scale, expectedScale, 'returns expected value' ); t.end(); }); + +tape( 'the function returns expected values for job = scale with zero norm (row-major) (negative strides)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 6.0, 0.0, 3.0, + 5.0, 0.0, 2.0, + 4.0, 0.0, 1.0 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 2.0, 0.0 ] ); + expectedScale = new Float64Array( [ 1.0, 1.0, 1.0 ] ); + expectedA = new Float64Array([ + 6.0, 0.0, 3.0, + 5.0, 0.0, 2.0, + 4.0, 0.0, 1.0 + ]); + + info = dgebal( 'scale', 3, A, -3, -1, 8, out, -1, 1, scale, -1, 2 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = scale with zero norm (column-major) (negative strides)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 1.0, 2.0, 3.0, + 0.0, 0.0, 0.0, + 4.0, 5.0, 6.0 + ]); + A = new Float64Array([ + 6.0, 5.0, 4.0, + 0.0, 0.0, 0.0, + 3.0, 2.0, 1.0 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 2.0, 0.0 ] ); + expectedScale = new Float64Array( [ 1.0, 1.0, 1.0 ] ); + expectedA = new Float64Array([ + 1.0, 2.0, 3.0, + 0.0, 0.0, 0.0, + 4.0, 5.0, 6.0 + ]); + expectedA = new Float64Array([ + 6.0, 5.0, 4.0, + 0.0, 0.0, 0.0, + 3.0, 2.0, 1.0 + ]); + + info = dgebal( 'scale', 3, A, -1, -3, 8, out, -1, 1, scale, -1, 2 ); + + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = scale with small values (row-major) (negative strides)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 4.0e4, 2.0, 1.0, 4.0e-4, + 3.0e4, 2.0, 1.0, 3.0e-4, + 2.0e4, 2.0, 1.0, 2.0e-4, + 1.0e4, 2.0, 1.0, 1.0e-4 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 4 ); + + expectedOut = new Float64Array( [ 3.0, 0.0 ] ); + expectedScale = new Float64Array( [ 1.0, 128.0, 128.0, 4096.0 ] ); + expectedA = new Float64Array([ + 4.0e4, 2.56e2, 1.28e2, 1.6384, + 2.34375e2, 2.0, 1.0, 9.6e-3, + 1.5625e2, 2.0, 1.0, 6.4e-3, + 2.44140625, 6.25e-2, 3.125e-2, 1.0e-4 + ]); + + info = dgebal( 'scale', 4, A, -4, -1, 15, out, -1, 1, scale, -1, 3 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = scale with small values (column-major)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 4.0e4, 3.0e4, 2.0e4, 1.0e4, + 2.0, 2.0, 2.0, 2.0, + 1.0, 1.0, 1.0, 1.0, + 4.0e-4, 3.0e-4, 2.0e-4, 1.0e-4 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 4 ); + + expectedOut = new Float64Array( [ 3.0, 0.0 ] ); + expectedScale = new Float64Array( [ 1.0, 128.0, 128.0, 4096.0 ] ); + expectedA = new Float64Array([ + 4.0e4, 2.34375e2, 1.5625e2, 2.44140625, + 2.56e2, 2.0, 2.0, 6.25e-2, + 1.28e2, 1.0, 1.0, 3.125e-2, + 1.6384, 9.6e-3, 6.4e-3, 1.0e-4 + ]); + info = dgebal( 'scale', 4, A, -1, -4, 15, out, -1, 1, scale, -1, 3 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); From 7631cbad4df572195ed6a0cb24c2f56f2d38c880 Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Wed, 14 May 2025 20:28:32 +0000 Subject: [PATCH 19/43] chore: clean up --- 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 --- --- .../lapack/base/dgebal/test/test.dgebal.js | 16 ++++++++-------- .../lapack/base/dgebal/test/test.ndarray.js | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js index da614f6e9668..c6fa133108e6 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js @@ -632,9 +632,9 @@ tape( 'the function returns expected values for job = scale with small values (r expectedScale = new Float64Array( [ 4096.0, 128.0, 128.0, 1.0 ] ); expectedA = new Float64Array([ 1.0e-4, 3.125e-2, 6.25e-2, 2.44140625, - 6.4e-3, 1.0, 2.0, 1.5625e+2, - 9.6e-3, 1.0, 2.0, 2.34375e+2, - 1.6384, 1.28e+2, 2.56e+2, 4.0e+4 + 6.4e-3, 1.0, 2.0, 1.5625e2, + 9.6e-3, 1.0, 2.0, 2.34375e2, + 1.6384, 1.28e2, 2.56e2, 4.0e4 ]); info = dgebal( 'row-major', 'scale', 4, A, 4, out, scale ); @@ -667,9 +667,9 @@ tape( 'the function returns expected values for job = scale with small values (c expectedScale = new Float64Array( [ 4096.0, 128.0, 128.0, 1.0 ] ); expectedA = new Float64Array([ 1.0e-4, 6.4e-3, 9.6e-3, 1.6384, - 3.125e-2, 1.0, 1.0, 1.28e+2, - 6.25e-2, 2.0, 2.0, 2.56e+2, - 2.44140625, 1.5625e+2, 2.34375e+2, 4.0e+4 + 3.125e-2, 1.0, 1.0, 1.28e2, + 6.25e-2, 2.0, 2.0, 2.56e2, + 2.44140625, 1.5625e2, 2.34375e2, 4.0e4 ]); info = dgebal( 'column-major', 'scale', 4, A, 4, out, scale ); @@ -698,7 +698,7 @@ tape( 'the function returns expected values for job = both with large values (ro scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 0.0, 2.0 ] ); - expectedScale = new Float64Array( [ 1.0, 1125899906842624.0, 1.2676506002282294e+30 ] ); // eslint-disable-line max-len + expectedScale = new Float64Array( [ 1.0, 1125899906842624.0, 1.2676506002282294e30 ] ); // eslint-disable-line max-len expectedA = new Float64Array([ 1.0e30, 1.1258999068426240e15, 1.2676506002282295, 8.8817841970012525e14, 1.0, 1.1258999068426241e-15, @@ -731,7 +731,7 @@ tape( 'the function returns expected values for job = both with large values (co scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 0.0, 2.0 ] ); - expectedScale = new Float64Array( [ 1.0, 1125899906842624.0, 1.2676506002282294e+30 ] ); // eslint-disable-line max-len + expectedScale = new Float64Array( [ 1.0, 1125899906842624.0, 1.2676506002282294e30 ] ); // eslint-disable-line max-len expectedA = new Float64Array([ 1.0e30, 8.8817841970012525e14, 7.8886090522101182e-1, 1.1258999068426240e15, 1.0, 8.8817841970012523e-16, diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.ndarray.js index c348f6ea25c5..a4139b91bb69 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.ndarray.js @@ -575,9 +575,9 @@ tape( 'the function returns expected values for job = scale with small values (r expectedScale = new Float64Array( [ 4096.0, 128.0, 128.0, 1.0 ] ); expectedA = new Float64Array([ 1.0e-4, 3.125e-2, 6.25e-2, 2.44140625, - 6.4e-3, 1.0, 2.0, 1.5625e+2, - 9.6e-3, 1.0, 2.0, 2.34375e+2, - 1.6384, 1.28e+2, 2.56e+2, 4.0e+4 + 6.4e-3, 1.0, 2.0, 1.5625e2, + 9.6e-3, 1.0, 2.0, 2.34375e2, + 1.6384, 1.28e2, 2.56e2, 4.0e4 ]); info = dgebal( 'scale', 4, A, 4, 1, 0, out, 1, 0, scale, 1, 0 ); @@ -610,9 +610,9 @@ tape( 'the function returns expected values for job = scale with small values (c expectedScale = new Float64Array( [ 4096.0, 128.0, 128.0, 1.0 ] ); expectedA = new Float64Array([ 1.0e-4, 6.4e-3, 9.6e-3, 1.6384, - 3.125e-2, 1.0, 1.0, 1.28e+2, - 6.25e-2, 2.0, 2.0, 2.56e+2, - 2.44140625, 1.5625e+2, 2.34375e+2, 4.0e+4 + 3.125e-2, 1.0, 1.0, 1.28e2, + 6.25e-2, 2.0, 2.0, 2.56e2, + 2.44140625, 1.5625e2, 2.34375e2, 4.0e4 ]); info = dgebal( 'scale', 4, A, 1, 4, 0, out, 1, 0, scale, 1, 0 ); @@ -641,7 +641,7 @@ tape( 'the function returns expected values for job = both with large values (ro scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 0.0, 2.0 ] ); - expectedScale = new Float64Array( [ 1.0, 1125899906842624.0, 1.2676506002282294e+30 ] ); // eslint-disable-line max-len + expectedScale = new Float64Array( [ 1.0, 1125899906842624.0, 1.2676506002282294e30 ] ); // eslint-disable-line max-len expectedA = new Float64Array([ 1.0e30, 1.1258999068426240e15, 1.2676506002282295, 8.8817841970012525e14, 1.0, 1.1258999068426241e-15, @@ -674,7 +674,7 @@ tape( 'the function returns expected values for job = both with large values (co scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 0.0, 2.0 ] ); - expectedScale = new Float64Array( [ 1.0, 1125899906842624.0, 1.2676506002282294e+30 ] ); // eslint-disable-line max-len + expectedScale = new Float64Array( [ 1.0, 1125899906842624.0, 1.2676506002282294e30 ] ); // eslint-disable-line max-len expectedA = new Float64Array([ 1.0e30, 8.8817841970012525e14, 7.8886090522101182e-1, 1.1258999068426240e15, 1.0, 8.8817841970012523e-16, From 7030f4d72bc4a2f99d61cecd6872b886a51d36b5 Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Thu, 15 May 2025 07:08:20 +0000 Subject: [PATCH 20/43] test: add offset 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 --- --- .../lapack/base/dgebal/test/test.ndarray.js | 565 +++++++++++++++++- 1 file changed, 564 insertions(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.ndarray.js index a4139b91bb69..d6d161ccb44f 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.ndarray.js @@ -70,7 +70,7 @@ tape( 'the function throws an error if provided an invalid first argument', func } }); -tape( 'the function returns invalid indices and leaves the input array unchanged for none = 0', function test( t ) { +tape( 'the function returns invalid indices and leaves the input array unchanged for N = 0', function test( t ) { var expectedOut; var scale; var info; @@ -1249,3 +1249,566 @@ tape( 'the function returns expected values for job = scale with small values (c t.deepEqual( scale, expectedScale, 'returns expected value' ); t.end(); }); + +tape( 'the function returns expected values for job = none (row-major) (offsets)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 0.0, 0.0, + 1.0, 2.0, 3.0, + 4.0, 5.0, 6.0, + 7.0, 8.0, 9.0 + ]); + out = new Float64Array( 3 ); + scale = new Float64Array( 6 ); + + expectedOut = new Float64Array( [ 0.0, 0.0, 2.0 ] ); + expectedScale = new Float64Array( [ 0.0, 0.0, 0.0, 1.0, 1.0, 1.0 ] ); + expectedA = new Float64Array([ + 0.0, 0.0, + 1.0, 2.0, 3.0, + 4.0, 5.0, 6.0, + 7.0, 8.0, 9.0 + ]); + + info = dgebal( 'none', 3, A, 3, 1, 2, out, 1, 1, scale, 1, 3 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = none (column-major) (offsets)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 0.0, 0.0, + 1.0, 4.0, 7.0, + 2.0, 5.0, 8.0, + 3.0, 6.0, 9.0 + ]); + out = new Float64Array( 3 ); + scale = new Float64Array( 6 ); + + expectedOut = new Float64Array( [ 0.0, 0.0, 2.0 ] ); + expectedScale = new Float64Array( [ 0.0, 0.0, 0.0, 1.0, 1.0, 1.0 ] ); + expectedA = new Float64Array([ + 0.0, 0.0, + 1.0, 4.0, 7.0, + 2.0, 5.0, 8.0, + 3.0, 6.0, 9.0 + ]); + + info = dgebal( 'both', 3, A, 1, 3, 2, out, 1, 1, scale, 1, 3 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = permutate (row-major) (offsets)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 0.0, 0.0, + 1.0, 0.0, 2.0, + 0.0, 5.0, 0.0, + 3.0, 0.0, 4.0 + ]); + out = new Float64Array( 3 ); + scale = new Float64Array( 6 ); + + expectedOut = new Float64Array( [ 0.0, 0.0, 1.0 ] ); + expectedScale = new Float64Array( [ 0.0, 0.0, 0.0, 1.0, 1.0, 1.0 ] ); + expectedA = new Float64Array([ + 0.0, 0.0, + 1.0, 2.0, 0.0, + 3.0, 4.0, 0.0, + 0.0, 0.0, 5.0 + ]); + + info = dgebal( 'permutate', 3, A, 3, 1, 2, out, 1, 1, scale, 1, 3 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = permutate (column-major) (offsets)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 0.0, 0.0, + 1.0, 0.0, 3.0, + 0.0, 5.0, 0.0, + 2.0, 0.0, 4.0 + ]); + out = new Float64Array( 3 ); + scale = new Float64Array( 6 ); + + expectedOut = new Float64Array( [ 0.0, 0.0, 1.0 ] ); + expectedScale = new Float64Array( [ 0.0, 0.0, 0.0, 1.0, 1.0, 1.0 ] ); + expectedA = new Float64Array([ + 0.0, 0.0, + 1.0, 3.0, 0.0, + 2.0, 4.0, 0.0, + 0.0, 0.0, 5.0 + ]); + + info = dgebal( 'both', 3, A, 1, 3, 2, out, 1, 1, scale, 1, 3 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = scale (row-major) (offsets)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 0.0, 0.0, + 16.0, 16.0, 16.0, + 0.25, 0.25, 0.25, + 0.25, 0.25, 0.25 + ]); + out = new Float64Array( 3 ); + scale = new Float64Array( 6 ); + + expectedOut = new Float64Array( [ 0.0, 0.0, 2.0 ] ); + expectedScale = new Float64Array( [ 0.0, 0.0, 0.0, 1.0, 0.125, 0.125 ] ); + expectedA = new Float64Array([ + 0.0, 0.0, + 16.0, 2.0, 2.0, + 2.0, 0.25, 0.25, + 2.0, 0.25, 0.25 + ]); + + info = dgebal( 'scale', 3, A, 3, 1, 2, out, 1, 1, scale, 1, 3 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = scale (column-major) (offsets)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 0.0, 0.0, + 16.0, 0.25, 0.25, + 16.0, 0.25, 0.25, + 16.0, 0.25, 0.25 + ]); + out = new Float64Array( 3 ); + scale = new Float64Array( 6 ); + + expectedOut = new Float64Array( [ 0.0, 0.0, 2.0 ] ); + expectedScale = new Float64Array( [ 0.0, 0.0, 0.0, 1.0, 0.125, 0.125 ] ); + expectedA = new Float64Array([ + 0.0, 0.0, + 16.0, 2.0, 2.0, + 2.0, 0.25, 0.25, + 2.0, 0.25, 0.25 + ]); + + info = dgebal( 'scale', 3, A, 1, 3, 2, out, 1, 1, scale, 1, 3 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = both (row-major) (offsets)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 0.0, 0.0, + 1.0, 0.0, 2.0, + 0.0, 5.0, 0.0, + 100.0, 0.0, 4.0 + ]); + out = new Float64Array( 3 ); + scale = new Float64Array( 6 ); + + expectedOut = new Float64Array( [ 0.0, 0.0, 1.0 ] ); + expectedScale = new Float64Array( [ 0.0, 0.0, 0.0, 0.125, 1.0, 1.0 ] ); + expectedA = new Float64Array([ + 0.0, 0.0, + 1.0, 16.0, 0.0, + 12.5, 4.0, 0.0, + 0.0, 0.0, 5.0 + ]); + + info = dgebal( 'both', 3, A, 3, 1, 2, out, 1, 1, scale, 1, 3 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = both (column-major) (offsets)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 0.0, 0.0, + 1.0, 0.0, 100.0, + 0.0, 5.0, 0.0, + 2.0, 0.0, 4.0 + ]); + out = new Float64Array( 3 ); + scale = new Float64Array( 6 ); + + expectedOut = new Float64Array( [ 0.0, 0.0, 1.0 ] ); + expectedScale = new Float64Array( [ 0.0, 0.0, 0.0, 0.125, 1.0, 1.0 ] ); + expectedA = new Float64Array([ + 0.0, 0.0, + 1.0, 12.5, 0.0, + 16.0, 4.0, 0.0, + 0.0, 0.0, 5.0 + ]); + + info = dgebal( 'both', 3, A, 1, 3, 2, out, 1, 1, scale, 1, 3 ); + + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = both with complex input (row-major) (offsets)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 1.0, 1.0, 0.0, + 0.0, 2.0, 0.0, + 0.0, 0.0, 3.0 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 0.0, 0.0 ] ); + expectedScale = new Float64Array( [ 0.0, 1.0, 2.0 ] ); + expectedA = new Float64Array([ + 1.0, 1.0, 0.0, + 0.0, 2.0, 0.0, + 0.0, 0.0, 3.0 + ]); + + info = dgebal( 'both', 3, A, 3, 1, 0, out, 1, 0, scale, 1, 0 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = both with complex input (column-major) (offsets)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 0.0, 0.0, + 1.0, 0.0, 0.0, + 1.0, 2.0, 0.0, + 0.0, 0.0, 3.0 + ]); + out = new Float64Array( 3 ); + scale = new Float64Array( 6 ); + + expectedOut = new Float64Array( [ 0.0, 0.0, 0.0 ] ); + expectedScale = new Float64Array( [ 0.0, 0.0, 0.0, 0.0, 1.0, 2.0 ] ); + expectedA = new Float64Array([ + 0.0, 0.0, + 1.0, 0.0, 0.0, + 1.0, 2.0, 0.0, + 0.0, 0.0, 3.0 + ]); + + info = dgebal( 'both', 3, A, 1, 3, 2, out, 1, 1, scale, 1, 3 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = both with complex input (row-major) (offsets)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 0.0, 0.0, + 1.0, 0.0, 2.0, + 3.0, 4.0, 5.0, + 6.0, 0.0, 7.0 + ]); + out = new Float64Array( 3 ); + scale = new Float64Array( 6 ); + + expectedOut = new Float64Array( [ 0.0, 1.0, 2.0 ] ); + expectedScale = new Float64Array( [ 0.0, 0.0, 0.0, 1.0, 0.5, 1.0 ] ); + expectedA = new Float64Array([ + 0.0, 0.0, + 4.0, 1.5, 5.0, + 0.0, 1.0, 4.0, + 0.0, 3.0, 7.0 + ]); + + info = dgebal( 'both', 3, A, 3, 1, 2, out, 1, 1, scale, 1, 3 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = both with complex input (column-major) (offsets)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 0.0, 0.0, + 1.0, 3.0, 6.0, + 0.0, 4.0, 0.0, + 2.0, 5.0, 7.0 + ]); + out = new Float64Array( 3 ); + scale = new Float64Array( 6 ); + + expectedOut = new Float64Array( [ 0.0, 1.0, 2.0 ] ); + expectedScale = new Float64Array( [ 0.0, 0.0, 0.0, 1.0, 0.5, 1.0 ] ); + expectedA = new Float64Array([ + 0.0, 0.0, + 4.0, 0.0, 0.0, + 1.5, 1.0, 3.0, + 5.0, 4.0, 7.0 + ]); + + info = dgebal( 'both', 3, A, 1, 3, 2, out, 1, 1, scale, 1, 3 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = scale with zero norm (row-major) (offsets)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 0.0, 0.0, + 1.0, 0.0, 4.0, + 2.0, 0.0, 5.0, + 3.0, 0.0, 6.0 + ]); + out = new Float64Array( 3 ); + scale = new Float64Array( 6 ); + + expectedOut = new Float64Array( [ 0.0, 0.0, 2.0 ] ); + expectedScale = new Float64Array( [ 0.0, 0.0, 0.0, 1.0, 1.0, 1.0 ] ); + expectedA = new Float64Array([ + 0.0, 0.0, + 1.0, 0.0, 4.0, + 2.0, 0.0, 5.0, + 3.0, 0.0, 6.0 + ]); + + info = dgebal( 'scale', 3, A, 3, 1, 2, out, 1, 1, scale, 1, 3 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = scale with zero norm (column-major) (offsets)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 0.0, 0.0, + 1.0, 2.0, 3.0, + 0.0, 0.0, 0.0, + 4.0, 5.0, 6.0 + ]); + out = new Float64Array( 3 ); + scale = new Float64Array( 6 ); + + expectedOut = new Float64Array( [ 0.0, 0.0, 2.0 ] ); + expectedScale = new Float64Array( [ 0.0, 0.0, 0.0, 1.0, 1.0, 1.0 ] ); + expectedA = new Float64Array([ + 0.0, 0.0, + 1.0, 2.0, 3.0, + 0.0, 0.0, 0.0, + 4.0, 5.0, 6.0 + ]); + + info = dgebal( 'scale', 3, A, 1, 3, 2, out, 1, 1, scale, 1, 3 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = scale with small values (row-major) (offsets)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 0.0, 0.0, + 1.0e-4, 1.0, 2.0, 1.0e4, + 2.0e-4, 1.0, 2.0, 2.0e4, + 3.0e-4, 1.0, 2.0, 3.0e4, + 4.0e-4, 1.0, 2.0, 4.0e4 + ]); + out = new Float64Array( 3 ); + scale = new Float64Array( 7 ); + + expectedOut = new Float64Array( [ 0.0, 0.0, 3.0 ] ); + expectedScale = new Float64Array( [ 0.0, 0.0, 0.0, 4096.0, 128.0, 128.0, 1.0 ] ); // eslint-disable-line max-len + expectedA = new Float64Array([ + 0.0, 0.0, + 1.0e-4, 3.125e-2, 6.25e-2, 2.44140625, + 6.4e-3, 1.0, 2.0, 1.5625e2, + 9.6e-3, 1.0, 2.0, 2.34375e2, + 1.6384, 1.28e2, 2.56e2, 4.0e4 + ]); + + info = dgebal( 'scale', 4, A, 4, 1, 2, out, 1, 1, scale, 1, 3 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = scale with small values (column-major) (offsets)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 0.0, 0.0, + 1.0e-4, 2.0e-4, 3.0e-4, 4.0e-4, + 1.0, 1.0, 1.0, 1.0, + 2.0, 2.0, 2.0, 2.0, + 1.0e4, 2.0e4, 3.0e4, 4.0e4 + ]); + out = new Float64Array( 3 ); + scale = new Float64Array( 7 ); + + expectedOut = new Float64Array( [ 0.0, 0.0, 3.0 ] ); + expectedScale = new Float64Array( [ 0.0, 0.0, 0.0, 4096.0, 128.0, 128.0, 1.0 ] ); // eslint-disable-line max-len + expectedA = new Float64Array([ + 0.0, 0.0, + 1.0e-4, 6.4e-3, 9.6e-3, 1.6384, + 3.125e-2, 1.0, 1.0, 1.28e2, + 6.25e-2, 2.0, 2.0, 2.56e2, + 2.44140625, 1.5625e2, 2.34375e2, 4.0e4 + ]); + + info = dgebal( 'scale', 4, A, 1, 4, 2, out, 1, 1, scale, 1, 3 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); From f6fcf1d20852e286c9749b42f310fa1cb230cc57 Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Thu, 15 May 2025 09:53:27 +0000 Subject: [PATCH 21/43] test: add tests for mixed strides --- 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 --- --- .../lapack/base/dgebal/test/test.ndarray.js | 470 ++++++++++++++++++ 1 file changed, 470 insertions(+) diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.ndarray.js index d6d161ccb44f..aba2c27d9b6a 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.ndarray.js @@ -1812,3 +1812,473 @@ tape( 'the function returns expected values for job = scale with small values (c t.deepEqual( scale, expectedScale, 'returns expected value' ); t.end(); }); + +tape( 'the function returns expected values for job = none (row-major) (mixed strides)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 3.0, 2.0, 1.0, + 6.0, 5.0, 4.0, + 9.0, 8.0, 7.0 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 0.0, 2.0 ] ); + expectedScale = new Float64Array( [ 1.0, 1.0, 1.0 ] ); + + expectedA = new Float64Array([ + 3.0, 2.0, 1.0, + 6.0, 5.0, 4.0, + 9.0, 8.0, 7.0 + ]); + + info = dgebal( 'none', 3, A, 3, -1, 2, out, 1, 0, scale, 1, 0 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = none (column-major) (mixed strides)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 1.0, 4.0, 7.0, + 2.0, 5.0, 8.0, + 3.0, 6.0, 9.0 + ]); + + A = new Float64Array([ + 7.0, 4.0, 1.0, + 8.0, 5.0, 2.0, + 9.0, 6.0, 3.0 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 0.0, 2.0 ] ); + expectedScale = new Float64Array( [ 1.0, 1.0, 1.0 ] ); + expectedA = new Float64Array([ + 7.0, 4.0, 1.0, + 8.0, 5.0, 2.0, + 9.0, 6.0, 3.0 + ]); + + info = dgebal( 'both', 3, A, -1, 3, 2, out, 1, 0, scale, 1, 0 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = permutate (row-major) (mixed strides)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 2.0, 0.0, 1.0, + 0.0, 5.0, 0.0, + 4.0, 0.0, 3.0 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 0.0, 1.0 ] ); + expectedScale = new Float64Array( [ 1.0, 1.0, 1.0 ] ); + expectedA = new Float64Array([ + 0.0, 2.0, 1.0, + 0.0, 4.0, 3.0, + 5.0, 0.0, 0.0 + ]); + + info = dgebal( 'permutate', 3, A, 3, -1, 2, out, 1, 0, scale, 1, 0 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = permutate (column-major) (mixed strides)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 3.0, 0.0, 1.0, + 0.0, 5.0, 0.0, + 4.0, 0.0, 2.0 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 0.0, 1.0 ] ); + expectedScale = new Float64Array( [ 1.0, 1.0, 1.0 ] ); + expectedA = new Float64Array([ + 0.0, 3.0, 1.0, + 0.0, 4.0, 2.0, + 5.0, 0.0, 0.0 + ]); + info = dgebal( 'both', 3, A, -1, 3, 2, out, 1, 0, scale, 1, 0 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = scale (row-major) (mixed strides)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 16.0, 16.0, 16.0, + 0.25, 0.25, 0.25, + 0.25, 0.25, 0.25 + ]); + + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 0.0, 2.0 ] ); + expectedScale = new Float64Array( [ 1.0, 0.125, 0.125 ] ); + expectedA = new Float64Array([ + 2.0, 2.0, 16.0, + 0.25, 0.25, 2.0, + 0.25, 0.25, 2.0 + ]); + + info = dgebal( 'scale', 3, A, 3, -1, 2, out, 1, 0, scale, 1, 0 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = scale (column-major) (mixed strides)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 0.25, 0.25, 16.0, + 0.25, 0.25, 16.0, + 0.25, 0.25, 16.0 + ]); + + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 0.0, 2.0 ] ); + expectedScale = new Float64Array( [ 1.0, 0.125, 0.125 ] ); + expectedA = new Float64Array([ + 2.0, 2.0, 16.0, + 0.25, 0.25, 2.0, + 0.25, 0.25, 2.0 + ]); + + info = dgebal( 'scale', 3, A, -1, 3, 2, out, 1, 0, scale, 1, 0 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = both (row-major) (mixed strides)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 2.0, 0.0, 1.0, + 0.0, 5.0, 0.0, + 4.0, 0.0, 100.0 + ]); + + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 0.0, 1.0 ] ); + expectedScale = new Float64Array( [ 0.125, 1.0, 1.0 ] ); + expectedA = new Float64Array([ + 0.0, 16.0, 1.0, + 0.0, 4.0, 12.5, + 5.0, 0.0, 0.0 + ]); + + info = dgebal( 'both', 3, A, 3, -1, 2, out, 1, 0, scale, 1, 0 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = both (column-major) (mixed strides)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 100.0, 0.0, 1.0, + 0.0, 5.0, 0.0, + 4.0, 0.0, 2.0 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 0.0, 1.0 ] ); + expectedScale = new Float64Array( [ 0.125, 1.0, 1.0 ] ); + expectedA = new Float64Array([ + 0.0, 12.5, 1.0, + 0.0, 4.0, 16.0, + 5.0, 0.0, 0.0 + ]); + info = dgebal( 'both', 3, A, -1, 3, 2, out, 1, 0, scale, 1, 0 ); + + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = both with complex input (row-major) (mixed strides)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 0.0, 1.0, 1.0, + 0.0, 2.0, 0.0, + 3.0, 0.0, 0.0 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 0.0, 0.0 ] ); + expectedScale = new Float64Array( [ 0.0, 1.0, 2.0 ] ); + expectedA = new Float64Array([ + 0.0, 1.0, 1.0, + 0.0, 2.0, 0.0, + 3.0, 0.0, 0.0 + ]); + + info = dgebal( 'both', 3, A, 3, -1, 2, out, 1, 0, scale, 1, 0 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = both with complex input (column-major) (mixed strides)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 0.0, 0.0, 1.0, + 0.0, 2.0, 1.0, + 3.0, 0.0, 0.0 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 0.0, 0.0 ] ); + expectedScale = new Float64Array( [ 0.0, 1.0, 2.0 ] ); + expectedA = new Float64Array([ + 0.0, 0.0, 1.0, + 0.0, 2.0, 1.0, + 3.0, 0.0, 0.0 + ]); + + info = dgebal( 'both', 3, A, -1, 3, 2, out, 1, 0, scale, 1, 0 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = both with complex input (row-major) (mixed strides)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 2.0, 0.0, 1.0, + 5.0, 4.0, 3.0, + 7.0, 0.0, 6.0 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 1.0, 2.0 ] ); + expectedScale = new Float64Array( [ 1.0, 0.5, 1.0 ] ); + expectedA = new Float64Array([ + 5.0, 1.5, 4.0, + 4.0, 1.0, 0.0, + 7.0, 3.0, 0.0 + ]); + + info = dgebal( 'both', 3, A, 3, -1, 2, out, 1, 0, scale, 1, 0 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = both with complex input (column-major) (mixed strides)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 6.0, 3.0, 1.0, + 0.0, 4.0, 0.0, + 7.0, 5.0, 2.0 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 1.0, 2.0 ] ); + expectedScale = new Float64Array( [ 1.0, 0.5, 1.0 ] ); + expectedA = new Float64Array([ + 0.0, 0.0, 4.0, + 3.0, 1.0, 1.5, + 7.0, 4.0, 5.0 + ]); + info = dgebal( 'both', 3, A, -1, 3, 2, out, 1, 0, scale, 1, 0 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = scale with zero norm (row-major) (mixed strides)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 4.0, 0.0, 1.0, + 5.0, 0.0, 2.0, + 6.0, 0.0, 3.0 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 0.0, 2.0 ] ); + expectedScale = new Float64Array( [ 1.0, 1.0, 1.0 ] ); + expectedA = new Float64Array([ + 4.0, 0.0, 1.0, + 5.0, 0.0, 2.0, + 6.0, 0.0, 3.0 + ]); + + info = dgebal( 'scale', 3, A, 3, -1, 2, out, 1, 0, scale, 1, 0 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = scale with zero norm (column-major) (mixed strides)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 3.0, 2.0, 1.0, + 0.0, 0.0, 0.0, + 6.0, 5.0, 4.0 + ]); + out = new Float64Array( 2 ); + scale = new Float64Array( 3 ); + + expectedOut = new Float64Array( [ 0.0, 2.0 ] ); + expectedScale = new Float64Array( [ 1.0, 1.0, 1.0 ] ); + expectedA = new Float64Array([ + 3.0, 2.0, 1.0, + 0.0, 0.0, 0.0, + 6.0, 5.0, 4.0 + ]); + + info = dgebal( 'scale', 3, A, -1, 3, 2, out, 1, 0, scale, 1, 0 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); From f6054c2784e7d7c8d766051af9ebcedac9372bdb Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Thu, 15 May 2025 11:30:17 +0000 Subject: [PATCH 22/43] test: add tests for large strides --- 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 --- --- .../lapack/base/dgebal/test/test.ndarray.js | 463 ++++++++++++++++++ 1 file changed, 463 insertions(+) diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.ndarray.js index aba2c27d9b6a..9beebac33266 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.ndarray.js @@ -2282,3 +2282,466 @@ tape( 'the function returns expected values for job = scale with zero norm (colu t.deepEqual( scale, expectedScale, 'returns expected value' ); t.end(); }); + +tape( 'the function returns expected values for job = none (row-major) (large strides)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 1.0, 9999.0, 2.0, 9999.0, 3.0, 9999.0, + 4.0, 9999.0, 5.0, 9999.0, 6.0, 9999.0, + 7.0, 9999.0, 8.0, 9999.0, 9.0, 9999.0 + ]); + out = new Float64Array( 4 ); + scale = new Float64Array( 6 ); + + expectedOut = new Float64Array( [ 0.0, 0.0, 2.0, 0.0 ] ); + expectedScale = new Float64Array( [ 1.0, 0.0, 1.0, 0.0, 1.0, 0.0 ] ); + expectedA = new Float64Array([ + 1.0, 9999.0, 2.0, 9999.0, 3.0, 9999.0, + 4.0, 9999.0, 5.0, 9999.0, 6.0, 9999.0, + 7.0, 9999.0, 8.0, 9999.0, 9.0, 9999.0 + ]); + + info = dgebal( 'none', 3, A, 6, 2, 0, out, 2, 0, scale, 2, 0 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = none (column-major) (large strides)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 1.0, 9999.0, 4.0, 9999.0, 7.0, 9999.0, + 2.0, 9999.0, 5.0, 9999.0, 8.0, 9999.0, + 3.0, 9999.0, 6.0, 9999.0, 9.0, 9999.0 + ]); + out = new Float64Array( 4 ); + scale = new Float64Array( 6 ); + + expectedOut = new Float64Array( [ 0.0, 0.0, 2.0, 0.0 ] ); + expectedScale = new Float64Array( [ 1.0, 0.0, 1.0, 0.0, 1.0, 0.0 ] ); + expectedA = new Float64Array([ + 1.0, 9999.0, 4.0, 9999.0, 7.0, 9999.0, + 2.0, 9999.0, 5.0, 9999.0, 8.0, 9999.0, + 3.0, 9999.0, 6.0, 9999.0, 9.0, 9999.0 + ]); + + info = dgebal( 'both', 3, A, 2, 6, 0, out, 2, 0, scale, 2, 0 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = permutate (row-major) (large strides)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 1.0, 9999.0, 0.0, 9999.0, 2.0, 9999.0, + 0.0, 9999.0, 5.0, 9999.0, 0.0, 9999.0, + 3.0, 9999.0, 0.0, 9999.0, 4.0, 9999.0 + ]); + out = new Float64Array( 4 ); + scale = new Float64Array( 6 ); + + expectedOut = new Float64Array( [ 0.0, 0.0, 1.0, 0.0 ] ); + expectedScale = new Float64Array( [ 1.0, 0.0, 1.0, 0.0, 1.0, 0.0 ] ); + expectedA = new Float64Array([ + 1.0, 9999.0, 2.0, 9999.0, 0.0, 9999.0, + 3.0, 9999.0, 4.0, 9999.0, 0.0, 9999.0, + 0.0, 9999.0, 0.0, 9999.0, 5.0, 9999.0 + ]); + + info = dgebal( 'permutate', 3, A, 6, 2, 0, out, 2, 0, scale, 2, 0 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = permutate (column-major) (large strides)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 1.0, 9999.0, 0.0, 9999.0, 3.0, 9999.0, + 0.0, 9999.0, 5.0, 9999.0, 0.0, 9999.0, + 2.0, 9999.0, 0.0, 9999.0, 4.0, 9999.0 + ]); + out = new Float64Array( 4 ); + scale = new Float64Array( 6 ); + + expectedOut = new Float64Array( [ 0.0, 0.0, 1.0, 0.0 ] ); + expectedScale = new Float64Array( [ 1.0, 0.0, 1.0, 0.0, 1.0, 0.0 ] ); + expectedA = new Float64Array([ + 1.0, 9999.0, 3.0, 9999.0, 0.0, 9999.0, + 2.0, 9999.0, 4.0, 9999.0, 0.0, 9999.0, + 0.0, 9999.0, 0.0, 9999.0, 5.0, 9999.0 + ]); + + info = dgebal( 'permutate', 3, A, 6, 2, 0, out, 2, 0, scale, 2, 0 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = scale (row-major) (large strides)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 16.0, 9999.0, 16.0, 9999.0, 16.0, 9999.0, + 0.25, 9999.0, 0.25, 9999.0, 0.25, 9999.0, + 0.25, 9999.0, 0.25, 9999.0, 0.25, 9999.0 + ]); + out = new Float64Array( 4 ); + scale = new Float64Array( 6 ); + + expectedOut = new Float64Array( [ 0.0, 0.0, 2.0, 0.0 ] ); + expectedScale = new Float64Array( [ 1.0, 0.0, 0.125, 0.0, 0.125, 0.0 ] ); + expectedA = new Float64Array([ + 16.0, 9999.0, 2.0, 9999.0, 2.0, 9999.0, + 2.0, 9999.0, 0.25, 9999.0, 0.25, 9999.0, + 2.0, 9999.0, 0.25, 9999.0, 0.25, 9999.0 + ]); + + info = dgebal( 'scale', 3, A, 6, 2, 0, out, 2, 0, scale, 2, 0 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = scale (column-major) (large strides)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 16.0, 9999.0, 0.25, 9999.0, 0.25, 9999.0, + 16.0, 9999.0, 0.25, 9999.0, 0.25, 9999.0, + 16.0, 9999.0, 0.25, 9999.0, 0.25, 9999.0 + ]); + out = new Float64Array( 4 ); + scale = new Float64Array( 6 ); + + expectedOut = new Float64Array( [ 0.0, 0.0, 2.0, 0.0 ] ); + expectedScale = new Float64Array( [ 1.0, 0.0, 0.125, 0.0, 0.125, 0.0 ] ); + expectedA = new Float64Array([ + 16.0, 9999.0, 2.0, 9999.0, 2.0, 9999.0, + 2.0, 9999.0, 0.25, 9999.0, 0.25, 9999.0, + 2.0, 9999.0, 0.25, 9999.0, 0.25, 9999.0 + ]); + + info = dgebal( 'scale', 3, A, 2, 6, 0, out, 2, 0, scale, 2, 0 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = both (row-major) (large strides)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 1.0, 9999.0, 0.0, 9999.0, 2.0, 9999.0, + 0.0, 9999.0, 5.0, 9999.0, 0.0, 9999.0, + 100.0, 9999.0, 0.0, 9999.0, 4.0, 9999.0 + ]); + out = new Float64Array( 4 ); + scale = new Float64Array( 6 ); + + expectedOut = new Float64Array( [ 0.0, 0.0, 1.0, 0.0 ] ); + expectedScale = new Float64Array( [ 0.125, 0.0, 1.0, 0.0, 1.0, 0.0 ] ); + expectedA = new Float64Array([ + 1.0, 9999.0, 16.0, 9999.0, 0.0, 9999.0, + 12.5, 9999.0, 4.0, 9999.0, 0.0, 9999.0, + 0.0, 9999.0, 0.0, 9999.0, 5.0, 9999.0 + ]); + + info = dgebal( 'both', 3, A, 6, 2, 0, out, 2, 0, scale, 2, 0 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = both (column-major) (large strides)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 1.0, 9999.0, 0.0, 9999.0, 100.0, 9999.0, + 0.0, 9999.0, 5.0, 9999.0, 0.0, 9999.0, + 2.0, 9999.0, 0.0, 9999.0, 4.0, 9999.0 + ]); + out = new Float64Array( 4 ); + scale = new Float64Array( 6 ); + + expectedOut = new Float64Array( [ 0.0, 0.0, 1.0, 0.0 ] ); + expectedScale = new Float64Array( [ 0.125, 0.0, 1.0, 0.0, 1.0, 0.0 ] ); + expectedA = new Float64Array([ + 1.0, 9999.0, 12.5, 9999.0, 0.0, 9999.0, + 16.0, 9999.0, 4.0, 9999.0, 0.0, 9999.0, + 0.0, 9999.0, 0.0, 9999.0, 5.0, 9999.0 + ]); + + info = dgebal( 'both', 3, A, 2, 6, 0, out, 2, 0, scale, 2, 0 ); + + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = both with complex input (row-major) (large strides)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 1.0, 9999.0, 1.0, 9999.0, 0.0, 9999.0, + 0.0, 9999.0, 2.0, 9999.0, 0.0, 9999.0, + 0.0, 9999.0, 0.0, 9999.0, 3.0, 9999.0 + ]); + out = new Float64Array( 4 ); + scale = new Float64Array( 6 ); + + expectedOut = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + expectedScale = new Float64Array( [ 0.0, 0.0, 1.0, 0.0, 2.0, 0.0 ] ); + expectedA = new Float64Array([ + 1.0, 9999.0, 1.0, 9999.0, 0.0, 9999.0, + 0.0, 9999.0, 2.0, 9999.0, 0.0, 9999.0, + 0.0, 9999.0, 0.0, 9999.0, 3.0, 9999.0 + ]); + + info = dgebal( 'both', 3, A, 6, 2, 0, out, 2, 0, scale, 2, 0 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = both with complex input (column-major) (large strides)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 1.0, 9999.0, 0.0, 9999.0, 0.0, 9999.0, + 1.0, 9999.0, 2.0, 9999.0, 0.0, 9999.0, + 0.0, 9999.0, 0.0, 9999.0, 3.0, 9999.0 + ]); + out = new Float64Array( 4 ); + scale = new Float64Array( 6 ); + + expectedOut = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + expectedScale = new Float64Array( [ 0.0, 0.0, 1.0, 0.0, 2.0, 0.0 ] ); + expectedA = new Float64Array([ + 1.0, 9999.0, 0.0, 9999.0, 0.0, 9999.0, + 1.0, 9999.0, 2.0, 9999.0, 0.0, 9999.0, + 0.0, 9999.0, 0.0, 9999.0, 3.0, 9999.0 + ]); + + info = dgebal( 'both', 3, A, 2, 6, 0, out, 2, 0, scale, 2, 0 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = both with complex input (row-major) (large strides)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 1.0, 9999.0, 0.0, 9999.0, 2.0, 9999.0, + 3.0, 9999.0, 4.0, 9999.0, 5.0, 9999.0, + 6.0, 9999.0, 0.0, 9999.0, 7.0, 9999.0 + ]); + out = new Float64Array( 4 ); + scale = new Float64Array( 6 ); + + expectedOut = new Float64Array( [ 1.0, 0.0, 2.0, 0.0 ] ); + expectedScale = new Float64Array( [ 1.0, 0.0, 0.5, 0.0, 1.0, 0.0 ] ); + expectedA = new Float64Array([ + 4.0, 9999.0, 1.5, 9999.0, 5.0, 9999.0, + 0.0, 9999.0, 1.0, 9999.0, 4.0, 9999.0, + 0.0, 9999.0, 3.0, 9999.0, 7.0, 9999.0 + ]); + + info = dgebal( 'both', 3, A, 6, 2, 0, out, 2, 0, scale, 2, 0 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = both with complex input (column-major) (large strides)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 1.0, 9999.0, 3.0, 9999.0, 6.0, 9999.0, + 0.0, 9999.0, 4.0, 9999.0, 0.0, 9999.0, + 2.0, 9999.0, 5.0, 9999.0, 7.0, 9999.0 + ]); + out = new Float64Array( 4 ); + scale = new Float64Array( 6 ); + + expectedOut = new Float64Array( [ 1.0, 0.0, 2.0, 0.0 ] ); + expectedScale = new Float64Array( [ 1.0, 0.0, 0.5, 0.0, 1.0, 0.0 ] ); + expectedA = new Float64Array([ + 4.0, 9999.0, 0.0, 9999.0, 0.0, 9999.0, + 1.5, 9999.0, 1.0, 9999.0, 3.0, 9999.0, + 5.0, 9999.0, 4.0, 9999.0, 7.0, 9999.0 + ]); + + info = dgebal( 'both', 3, A, 2, 6, 0, out, 2, 0, scale, 2, 0 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = scale with zero norm (row-major) (large strides)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 1.0, 9999.0, 0.0, 9999.0, 4.0, 9999.0, + 2.0, 9999.0, 0.0, 9999.0, 5.0, 9999.0, + 3.0, 9999.0, 0.0, 9999.0, 6.0, 9999.0 + ]); + out = new Float64Array( 4 ); + scale = new Float64Array( 6 ); + + expectedOut = new Float64Array( [ 0.0, 0.0, 2.0, 0.0 ] ); + expectedScale = new Float64Array( [ 1.0, 0.0, 1.0, 0.0, 1.0, 0.0 ] ); + expectedA = new Float64Array([ + 1.0, 9999.0, 0.0, 9999.0, 4.0, 9999.0, + 2.0, 9999.0, 0.0, 9999.0, 5.0, 9999.0, + 3.0, 9999.0, 0.0, 9999.0, 6.0, 9999.0 + ]); + + info = dgebal( 'scale', 3, A, 6, 2, 0, out, 2, 0, scale, 2, 0 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns expected values for job = scale with zero norm (column-major) (large strides)', function test( t ) { + var expectedScale; + var expectedOut; + var expectedA; + var scale; + var info; + var out; + var A; + + A = new Float64Array([ + 1.0, 9999.0, 2.0, 9999.0, 3.0, 9999.0, + 0.0, 9999.0, 0.0, 9999.0, 0.0, 9999.0, + 4.0, 9999.0, 5.0, 9999.0, 6.0, 9999.0 + ]); + out = new Float64Array( 4 ); + scale = new Float64Array( 6 ); + + expectedOut = new Float64Array( [ 0.0, 0.0, 2.0, 0.0 ] ); + expectedScale = new Float64Array( [ 1.0, 0.0, 1.0, 0.0, 1.0, 0.0 ] ); + expectedA = new Float64Array([ + 1.0, 9999.0, 2.0, 9999.0, 3.0, 9999.0, + 0.0, 9999.0, 0.0, 9999.0, 0.0, 9999.0, + 4.0, 9999.0, 5.0, 9999.0, 6.0, 9999.0 + ]); + + info = dgebal( 'scale', 3, A, 2, 6, 0, out, 2, 0, scale, 2, 0 ); + t.strictEqual( info, 0, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( A, expectedA, 'returns expected value' ); + t.deepEqual( scale, expectedScale, 'returns expected value' ); + t.end(); +}); From 099194af8f1e239d24899d5c337494413811ccdb Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Thu, 15 May 2025 17:14:50 +0000 Subject: [PATCH 23/43] docs: add examples --- 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: passed - 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 --- --- .../lapack/base/dgebal/examples/index.js | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 lib/node_modules/@stdlib/lapack/base/dgebal/examples/index.js diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/examples/index.js b/lib/node_modules/@stdlib/lapack/base/dgebal/examples/index.js new file mode 100644 index 000000000000..185d84d0aedc --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/examples/index.js @@ -0,0 +1,41 @@ +/** +* @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 dgebal = require( './../lib' ); + +// Specify matrix meta data: +var shape = [ 3, 3 ]; +var strides = [ 3, 1 ]; +var offset = 0; +var order = 'row-major'; + +// Create a matrix stored in linear memory: +var A = new Float64Array( [ 1.0, 100.0, 0.0, 2.0, 200.0, 0.0, 0.0, 0.0, 3.0 ] ); +console.log( ndarray2array( A, shape, strides, offset, order ) ); + +// Define arrays to store the scaling factors +var out = new Float64Array( 2 ); +var scale = new Float64Array( 3 ); + +// Permute and scale the matrix: +dgebal( order, 'both', shape[ 0 ], A, strides[ 0 ], out, scale ); +console.log( ndarray2array( A, shape, strides, offset, order ) ); From 2ca9245621659d5cd192ecd497fe784a476d4127 Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Fri, 16 May 2025 08:15:15 +0000 Subject: [PATCH 24/43] bench: add benchmarks and 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 status: na - task: lint_package_json status: passed - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: 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/dgebal/benchmark/benchmark.js | 132 ++++++++++++++++ .../dgebal/benchmark/benchmark.ndarray.js | 144 ++++++++++++++++++ .../@stdlib/lapack/base/dgebal/lib/base.js | 4 +- .../@stdlib/lapack/base/dgebal/lib/dgebal.js | 6 +- .../@stdlib/lapack/base/dgebal/lib/ndarray.js | 6 +- .../@stdlib/lapack/base/dgebal/package.json | 71 +++++++++ .../lapack/base/dgebal/test/test.dgebal.js | 8 +- .../lapack/base/dgebal/test/test.ndarray.js | 34 ++--- 8 files changed, 376 insertions(+), 29 deletions(-) create mode 100644 lib/node_modules/@stdlib/lapack/base/dgebal/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/lapack/base/dgebal/benchmark/benchmark.ndarray.js create mode 100644 lib/node_modules/@stdlib/lapack/base/dgebal/package.json diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/benchmark/benchmark.js b/lib/node_modules/@stdlib/lapack/base/dgebal/benchmark/benchmark.js new file mode 100644 index 000000000000..0b2a5517ef73 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/benchmark/benchmark.js @@ -0,0 +1,132 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var Float64Array = require( '@stdlib/array/float64' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var dgebal = require( './../lib/dgebal.js' ); + + +// VARIABLES // + +var LAYOUTS = [ + 'row-major', + 'column-major' +]; +var JOBS = [ + 'permute', + 'scale', + 'both', + 'none' +]; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {string} order - storage layout +* @param {PositiveInteger} N - number of elements along each dimension +* @param {string} job - indicates the operations to be performed +* @returns {Function} benchmark function +*/ +function createBenchmark( order, N, job ) { + var scale; + var out; + var A; + + scale = new Float64Array( N ); + out = new Float64Array( 2 ); + + A = uniform( N*N, -10.0, 10.0, { + 'dtype': 'float64' + }); + 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 = dgebal( order, job, N, A, N, out, scale ); + if ( isnan( z ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var min; + var max; + var ord; + var job; + var N; + var f; + var i; + var j; + var k; + + min = 1; // 10^min + max = 6; // 10^max + + for ( k = 0; k < LAYOUTS.length; k++ ) { + ord = LAYOUTS[ k ]; + for ( i = min; i <= max; i++ ) { + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + for ( j = 0; j < JOBS.length; j++ ) { + job = JOBS[ j ]; + f = createBenchmark( ord, N, job ); + bench( pkg+'::square_matrix:order='+ord+',job='+job+',size='+(N*N), f ); + } + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dgebal/benchmark/benchmark.ndarray.js new file mode 100644 index 000000000000..f3443d4126f9 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/benchmark/benchmark.ndarray.js @@ -0,0 +1,144 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var Float64Array = require( '@stdlib/array/float64' ); +var isColumnMajor = require( '@stdlib/ndarray/base/assert/is-column-major-string' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var dgebal = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var LAYOUTS = [ + 'row-major', + 'column-major' +]; +var JOBS = [ + 'permute', + 'scale', + 'both', + 'none' +]; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {string} order - storage layout +* @param {PositiveInteger} N - number of elements along each dimension +* @param {string} job - indicates the operations to be performed +* @returns {Function} benchmark function +*/ +function createBenchmark( order, N, job ) { + var scale; + var out; + var sa1; + var sa2; + var A; + + scale = new Float64Array( N ); + out = new Float64Array( 2 ); + + A = uniform( N*N, -10.0, 10.0, { + 'dtype': 'float64' + }); + + if ( isColumnMajor( order ) ) { + sa1 = 1; + sa2 = N; + } else { + sa1 = N; + sa2 = 1; + } + + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var z; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + z = dgebal( job, N, A, sa1, sa2, 0, out, 1, 0, scale, 1, 0 ); + if ( isnan( z ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var min; + var max; + var ord; + var job; + var N; + var f; + var i; + var j; + var k; + + min = 1; // 10^min + max = 6; // 10^max + + for ( k = 0; k < LAYOUTS.length; k++ ) { + ord = LAYOUTS[ k ]; + for ( i = min; i <= max; i++ ) { + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + for ( j = 0; j < JOBS.length; j++ ) { + job = JOBS[ j ]; + f = createBenchmark( ord, N, job ); + bench( pkg+'::square_matrix:order='+ord+',job='+job+',size='+(N*N), f ); + } + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js index df6482de6d99..dc17e37bb71d 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js @@ -43,7 +43,7 @@ var dscal = require( '@stdlib/blas/base/dscal' ).ndarray; * The job parameter can be one of the following: * * - 'none': none, return immediately -* - 'permutate': permute only +* - 'permute': permute only * - 'scale': scale only * - 'both': both permute and scale * @@ -193,7 +193,7 @@ function dgebal( job, N, A, strideA1, strideA2, offsetA, out, strideOut, offsetO is += strideScale; } - if ( job === 'permutate' ) { + if ( job === 'permute' ) { out[ offsetOut ] = k; // ilo out[ offsetOut + strideOut ] = l; // ihi return 0; diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/dgebal.js b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/dgebal.js index a5506edd5b38..be457fc8337b 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/dgebal.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/dgebal.js @@ -36,7 +36,7 @@ var base = require( './base.js' ); * The job parameter can be one of the following: * * - 'none': none, return immediately -* - 'permutate': permute only +* - 'permute': permute only * - 'scale': scale only * - 'both': both permute and scale * - The matrix `A` is overwritten by the balanced matrix. @@ -73,8 +73,8 @@ function dgebal( order, job, N, A, LDA, out, scale ) { if ( !isLayout( order ) ) { throw new TypeError( format( 'invalid argument. First argument must be a valid order. Value: `%s`.', order ) ); } - if ( job !== 'both' && job !== 'scale' && job !== 'permutate' && job !== 'none' ) { - throw new TypeError( format( 'invalid argument. Second argument must be one of the following: `both`, `scale`, `permutate`, or `none`. Value: `%s`.', job ) ); + if ( job !== 'both' && job !== 'scale' && job !== 'permute' && job !== 'none' ) { + throw new TypeError( format( 'invalid argument. Second argument must be one of the following: `both`, `scale`, `permute`, or `none`. Value: `%s`.', job ) ); } if ( isColumnMajor( order ) ) { sa1 = 1; diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/ndarray.js b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/ndarray.js index e05576f03767..e728fa87fce5 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/ndarray.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/ndarray.js @@ -34,7 +34,7 @@ var base = require( './base.js' ); * The job parameter can be one of the following: * * - 'none': none, return immediately -* - 'permutate': permute only +* - 'permute': permute only * - 'scale': scale only * - 'both': both permute and scale * - The matrix `A` is overwritten by the balanced matrix. @@ -68,8 +68,8 @@ var base = require( './base.js' ); * // scale => [ 8, 1, 2 ] */ function dgebal( job, N, A, strideA1, strideA2, offsetA, out, strideOut, offsetOut, scale, strideScale, offsetScale ) { // eslint-disable-line max-len, max-params - if ( job !== 'both' && job !== 'scale' && job !== 'permutate' && job !== 'none' ) { - throw new TypeError( format( 'invalid argument. Second argument must be one of the following: `both`, `scale`, `permutate`, or `none`. Value: `%s`.', job ) ); + if ( job !== 'both' && job !== 'scale' && job !== 'permute' && job !== 'none' ) { + throw new TypeError( format( 'invalid argument. Second argument must be one of the following: `both`, `scale`, `permute`, or `none`. Value: `%s`.', job ) ); } return base( job, N, A, strideA1, strideA2, offsetA, out, strideOut, offsetOut, scale, strideScale, offsetScale ); // eslint-disable-line max-len } diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/package.json b/lib/node_modules/@stdlib/lapack/base/dgebal/package.json new file mode 100644 index 000000000000..2287d2b86653 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/package.json @@ -0,0 +1,71 @@ +{ + "name": "@stdlib/lapack/base/dgebal", + "version": "0.0.0", + "description": "LAPACK routine to balance a general real matrix `A`.", + "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", + "dgebal", + "balance", + "scale", + "permute", + "permutedims", + "linear", + "algebra", + "subroutines", + "array", + "ndarray", + "float64", + "double", + "float64array" + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js index c6fa133108e6..9ed26ee38031 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js @@ -214,7 +214,7 @@ tape( 'the function returns expected values for job = none (column-major)', func t.end(); }); -tape( 'the function returns expected values for job = permutate (row-major)', function test( t ) { +tape( 'the function returns expected values for job = permute (row-major)', function test( t ) { var expectedScale; var expectedOut; var expectedA; @@ -239,7 +239,7 @@ tape( 'the function returns expected values for job = permutate (row-major)', fu 0.0, 0.0, 5.0 ]); - info = dgebal( 'row-major', 'permutate', 3, A, 3, out, scale ); + info = dgebal( 'row-major', 'permute', 3, A, 3, out, scale ); t.strictEqual( info, 0, 'returns expected value' ); t.deepEqual( out, expectedOut, 'returns expected value' ); t.deepEqual( A, expectedA, 'returns expected value' ); @@ -247,7 +247,7 @@ tape( 'the function returns expected values for job = permutate (row-major)', fu t.end(); }); -tape( 'the function returns expected values for job = permutate (column-major)', function test( t ) { +tape( 'the function returns expected values for job = permute (column-major)', function test( t ) { var expectedScale; var expectedOut; var expectedA; @@ -272,7 +272,7 @@ tape( 'the function returns expected values for job = permutate (column-major)', 0.0, 0.0, 5.0 ]); - info = dgebal( 'column-major', 'permutate', 3, A, 3, out, scale ); + info = dgebal( 'column-major', 'permute', 3, A, 3, out, scale ); t.strictEqual( info, 0, 'returns expected value' ); t.deepEqual( out, expectedOut, 'returns expected value' ); t.deepEqual( A, expectedA, 'returns expected value' ); diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.ndarray.js index 9beebac33266..e908bff3097b 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.ndarray.js @@ -156,7 +156,7 @@ tape( 'the function returns expected values for job = none (column-major)', func t.end(); }); -tape( 'the function returns expected values for job = permutate (row-major)', function test( t ) { +tape( 'the function returns expected values for job = permute (row-major)', function test( t ) { var expectedScale; var expectedOut; var expectedA; @@ -181,7 +181,7 @@ tape( 'the function returns expected values for job = permutate (row-major)', fu 0.0, 0.0, 5.0 ]); - info = dgebal( 'permutate', 3, A, 3, 1, 0, out, 1, 0, scale, 1, 0 ); + info = dgebal( 'permute', 3, A, 3, 1, 0, out, 1, 0, scale, 1, 0 ); t.strictEqual( info, 0, 'returns expected value' ); t.deepEqual( out, expectedOut, 'returns expected value' ); t.deepEqual( A, expectedA, 'returns expected value' ); @@ -189,7 +189,7 @@ tape( 'the function returns expected values for job = permutate (row-major)', fu t.end(); }); -tape( 'the function returns expected values for job = permutate (column-major)', function test( t ) { +tape( 'the function returns expected values for job = permute (column-major)', function test( t ) { var expectedScale; var expectedOut; var expectedA; @@ -755,7 +755,7 @@ tape( 'the function returns expected values for job = none (column-major) (negat t.end(); }); -tape( 'the function returns expected values for job = permutate (row-major) (negative strides)', function test( t ) { +tape( 'the function returns expected values for job = permute (row-major) (negative strides)', function test( t ) { var expectedScale; var expectedOut; var expectedA; @@ -781,7 +781,7 @@ tape( 'the function returns expected values for job = permutate (row-major) (neg 0.0, 2.0, 1.0 ]); - info = dgebal( 'permutate', 3, A, -3, -1, 8, out, -1, 1, scale, -1, 2 ); + info = dgebal( 'permute', 3, A, -3, -1, 8, out, -1, 1, scale, -1, 2 ); t.strictEqual( info, 0, 'returns expected value' ); t.deepEqual( out, expectedOut, 'returns expected value' ); t.deepEqual( A, expectedA, 'returns expected value' ); @@ -789,7 +789,7 @@ tape( 'the function returns expected values for job = permutate (row-major) (neg t.end(); }); -tape( 'the function returns expected values for job = permutate (column-major) (negative strides)', function test( t ) { +tape( 'the function returns expected values for job = permute (column-major) (negative strides)', function test( t ) { var expectedScale; var expectedOut; var expectedA; @@ -814,7 +814,7 @@ tape( 'the function returns expected values for job = permutate (column-major) ( 0.0, 3.0, 1.0 ]); - info = dgebal( 'permutate', 3, A, -1, -3, 8, out, -1, 1, scale, -1, 2 ); + info = dgebal( 'permute', 3, A, -1, -3, 8, out, -1, 1, scale, -1, 2 ); t.strictEqual( info, 0, 'returns expected value' ); t.deepEqual( out, expectedOut, 'returns expected value' ); t.deepEqual( A, expectedA, 'returns expected value' ); @@ -1320,7 +1320,7 @@ tape( 'the function returns expected values for job = none (column-major) (offse t.end(); }); -tape( 'the function returns expected values for job = permutate (row-major) (offsets)', function test( t ) { +tape( 'the function returns expected values for job = permute (row-major) (offsets)', function test( t ) { var expectedScale; var expectedOut; var expectedA; @@ -1347,7 +1347,7 @@ tape( 'the function returns expected values for job = permutate (row-major) (off 0.0, 0.0, 5.0 ]); - info = dgebal( 'permutate', 3, A, 3, 1, 2, out, 1, 1, scale, 1, 3 ); + info = dgebal( 'permute', 3, A, 3, 1, 2, out, 1, 1, scale, 1, 3 ); t.strictEqual( info, 0, 'returns expected value' ); t.deepEqual( out, expectedOut, 'returns expected value' ); t.deepEqual( A, expectedA, 'returns expected value' ); @@ -1355,7 +1355,7 @@ tape( 'the function returns expected values for job = permutate (row-major) (off t.end(); }); -tape( 'the function returns expected values for job = permutate (column-major) (offsets)', function test( t ) { +tape( 'the function returns expected values for job = permute (column-major) (offsets)', function test( t ) { var expectedScale; var expectedOut; var expectedA; @@ -1886,7 +1886,7 @@ tape( 'the function returns expected values for job = none (column-major) (mixed t.end(); }); -tape( 'the function returns expected values for job = permutate (row-major) (mixed strides)', function test( t ) { +tape( 'the function returns expected values for job = permute (row-major) (mixed strides)', function test( t ) { var expectedScale; var expectedOut; var expectedA; @@ -1911,7 +1911,7 @@ tape( 'the function returns expected values for job = permutate (row-major) (mix 5.0, 0.0, 0.0 ]); - info = dgebal( 'permutate', 3, A, 3, -1, 2, out, 1, 0, scale, 1, 0 ); + info = dgebal( 'permute', 3, A, 3, -1, 2, out, 1, 0, scale, 1, 0 ); t.strictEqual( info, 0, 'returns expected value' ); t.deepEqual( out, expectedOut, 'returns expected value' ); t.deepEqual( A, expectedA, 'returns expected value' ); @@ -1919,7 +1919,7 @@ tape( 'the function returns expected values for job = permutate (row-major) (mix t.end(); }); -tape( 'the function returns expected values for job = permutate (column-major) (mixed strides)', function test( t ) { +tape( 'the function returns expected values for job = permute (column-major) (mixed strides)', function test( t ) { var expectedScale; var expectedOut; var expectedA; @@ -2349,7 +2349,7 @@ tape( 'the function returns expected values for job = none (column-major) (large t.end(); }); -tape( 'the function returns expected values for job = permutate (row-major) (large strides)', function test( t ) { +tape( 'the function returns expected values for job = permute (row-major) (large strides)', function test( t ) { var expectedScale; var expectedOut; var expectedA; @@ -2374,7 +2374,7 @@ tape( 'the function returns expected values for job = permutate (row-major) (lar 0.0, 9999.0, 0.0, 9999.0, 5.0, 9999.0 ]); - info = dgebal( 'permutate', 3, A, 6, 2, 0, out, 2, 0, scale, 2, 0 ); + info = dgebal( 'permute', 3, A, 6, 2, 0, out, 2, 0, scale, 2, 0 ); t.strictEqual( info, 0, 'returns expected value' ); t.deepEqual( out, expectedOut, 'returns expected value' ); t.deepEqual( A, expectedA, 'returns expected value' ); @@ -2382,7 +2382,7 @@ tape( 'the function returns expected values for job = permutate (row-major) (lar t.end(); }); -tape( 'the function returns expected values for job = permutate (column-major) (large strides)', function test( t ) { +tape( 'the function returns expected values for job = permute (column-major) (large strides)', function test( t ) { var expectedScale; var expectedOut; var expectedA; @@ -2407,7 +2407,7 @@ tape( 'the function returns expected values for job = permutate (column-major) ( 0.0, 9999.0, 0.0, 9999.0, 5.0, 9999.0 ]); - info = dgebal( 'permutate', 3, A, 6, 2, 0, out, 2, 0, scale, 2, 0 ); + info = dgebal( 'permute', 3, A, 6, 2, 0, out, 2, 0, scale, 2, 0 ); t.strictEqual( info, 0, 'returns expected value' ); t.deepEqual( out, expectedOut, 'returns expected value' ); t.deepEqual( A, expectedA, 'returns expected value' ); From a69fa0bc9195aa361a6e587216d4d65b2edec29d Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Fri, 16 May 2025 08:24:40 +0000 Subject: [PATCH 25/43] fix: out should be an int32array because it contains indices --- 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: 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/dgebal/benchmark/benchmark.js | 5 +- .../dgebal/benchmark/benchmark.ndarray.js | 5 +- .../lapack/base/dgebal/examples/index.js | 3 +- .../@stdlib/lapack/base/dgebal/lib/base.js | 5 +- .../@stdlib/lapack/base/dgebal/lib/dgebal.js | 5 +- .../@stdlib/lapack/base/dgebal/lib/index.js | 6 +- .../@stdlib/lapack/base/dgebal/lib/ndarray.js | 5 +- .../lapack/base/dgebal/test/test.dgebal.js | 45 ++--- .../lapack/base/dgebal/test/test.ndarray.js | 161 +++++++++--------- 9 files changed, 125 insertions(+), 115 deletions(-) diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/benchmark/benchmark.js b/lib/node_modules/@stdlib/lapack/base/dgebal/benchmark/benchmark.js index 0b2a5517ef73..914cfa68602b 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/benchmark/benchmark.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* 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. @@ -26,6 +26,7 @@ var Float64Array = require( '@stdlib/array/float64' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var pow = require( '@stdlib/math/base/special/pow' ); var floor = require( '@stdlib/math/base/special/floor' ); +var Int32Array = require( '@stdlib/array/int32' ); var pkg = require( './../package.json' ).name; var dgebal = require( './../lib/dgebal.js' ); @@ -61,7 +62,7 @@ function createBenchmark( order, N, job ) { var A; scale = new Float64Array( N ); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); A = uniform( N*N, -10.0, 10.0, { 'dtype': 'float64' diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dgebal/benchmark/benchmark.ndarray.js index f3443d4126f9..da36207604c9 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/benchmark/benchmark.ndarray.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/benchmark/benchmark.ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 The Stdlib Authors. +* 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. @@ -27,6 +27,7 @@ var isColumnMajor = require( '@stdlib/ndarray/base/assert/is-column-major-string var isnan = require( '@stdlib/math/base/assert/is-nan' ); var pow = require( '@stdlib/math/base/special/pow' ); var floor = require( '@stdlib/math/base/special/floor' ); +var Int32Array = require( '@stdlib/array/int32' ); var pkg = require( './../package.json' ).name; var dgebal = require( './../lib/ndarray.js' ); @@ -64,7 +65,7 @@ function createBenchmark( order, N, job ) { var A; scale = new Float64Array( N ); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); A = uniform( N*N, -10.0, 10.0, { 'dtype': 'float64' diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/examples/index.js b/lib/node_modules/@stdlib/lapack/base/dgebal/examples/index.js index 185d84d0aedc..a542416832cb 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/examples/index.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/examples/index.js @@ -19,6 +19,7 @@ 'use strict'; var Float64Array = require( '@stdlib/array/float64' ); +var Int32Array = require( '@stdlib/array/int32' ); var ndarray2array = require( '@stdlib/ndarray/base/to-array' ); var dgebal = require( './../lib' ); @@ -33,7 +34,7 @@ var A = new Float64Array( [ 1.0, 100.0, 0.0, 2.0, 200.0, 0.0, 0.0, 0.0, 3.0 ] ); console.log( ndarray2array( A, shape, strides, offset, order ) ); // Define arrays to store the scaling factors -var out = new Float64Array( 2 ); +var out = new Int32Array( 2 ); var scale = new Float64Array( 3 ); // Permute and scale the matrix: diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js index dc17e37bb71d..3cc2e0d9cc54 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js @@ -56,7 +56,7 @@ var dscal = require( '@stdlib/blas/base/dscal' ).ndarray; * @param {integer} strideA1 - stride of the first dimension of `A` * @param {integer} strideA2 - stride of the second dimension of `A` * @param {NonNegativeInteger} offsetA - starting index for `A` -* @param {Float64Array} out - stores the first and last row/column of the balanced submatrix +* @param {Int32Array} out - stores the first and last row/column of the balanced submatrix * @param {integer} strideOut - stride of `out` * @param {NonNegativeInteger} offsetOut - starting index for `out` * @param {Float64Array} scale - array containing permutation and scaling information @@ -66,9 +66,10 @@ var dscal = require( '@stdlib/blas/base/dscal' ).ndarray; * * @example * var Float64Array = require( '@stdlib/array/float64' ); +* var Int32Array = require( '@stdlib/array/int32' ); * * var A = new Float64Array( [ 1.0, 100.0, 0.0, 2.0, 200.0, 0.0, 0.0, 0.0, 3.0 ] ); -* var out = new Float64Array( 2 ); +* var out = new Int32Array( 2 ); * var scale = new Float64Array( 3 ); * * dgebal( 'both', 3, A, 3, 1, 0, out, 1, 0, scale, 1, 0 ); diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/dgebal.js b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/dgebal.js index be457fc8337b..fc6407aea67f 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/dgebal.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/dgebal.js @@ -47,7 +47,7 @@ var base = require( './base.js' ); * @param {NonNegativeInteger} N - number of rows/columns in matrix `A` * @param {Float64Array} A - input matrix to be balanced * @param {NonNegativeInteger} LDA - leading dimension of `A` -* @param {Float64Array} out - stores the first and last row/column of the balanced submatrix +* @param {Int32Array} out - stores the first and last row/column of the balanced submatrix * @param {Float64Array} scale - array containing permutation and scaling information * @throws {TypeError} first argument must be a valid order * @throws {TypeError} second argument must be a valid job @@ -56,9 +56,10 @@ var base = require( './base.js' ); * * @example * var Float64Array = require( '@stdlib/array/float64' ); +* var Int32Array = require( '@stdlib/array/int32' ); * * var A = new Float64Array( [ 1.0, 100.0, 0.0, 2.0, 200.0, 0.0, 0.0, 0.0, 3.0 ] ); -* var out = new Float64Array( 2 ); +* var out = new Int32Array( 2 ); * var scale = new Float64Array( 3 ); * * dgebal( 'row-major', 'both', 3, A, 3, out, scale ); diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/index.js b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/index.js index 75b2826b6ba8..3e34377a28dc 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/index.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/index.js @@ -25,10 +25,11 @@ * * @example * var Float64Array = require( '@stdlib/array/float64' ); +* var Int32Array = require( '@stdlib/array/int32' ); * var dgebal = require( '@stdlib/lapack/base/dgebal' ); * * var A = new Float64Array( [ 1.0, 100.0, 0.0, 2.0, 200.0, 0.0, 0.0, 0.0, 3.0 ] ); -* var out = new Float64Array( 2 ); +* var out = new Int32Array( 2 ); * var scale = new Float64Array( 3 ); * * dgebal( 'row-major', 'both', 3, A, 3, out, scale ); @@ -38,10 +39,11 @@ * * @example * var Float64Array = require( '@stdlib/array/float64' ); +* var Int32Array = require( '@stdlib/array/int32' ); * var dgebal = require( '@stdlib/lapack/base/dgebal' ); * * var A = new Float64Array( [ 1.0, 100.0, 0.0, 2.0, 200.0, 0.0, 0.0, 0.0, 3.0 ] ); -* var out = new Float64Array( 2 ); +* var out = new Int32Array( 2 ); * var scale = new Float64Array( 3 ); * * dgebal.ndarray( 'both', 3, A, 3, 1, 0, out, 1, 0, scale, 1, 0 ); diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/ndarray.js b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/ndarray.js index e728fa87fce5..babaa6a7db62 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/ndarray.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/ndarray.js @@ -46,7 +46,7 @@ var base = require( './base.js' ); * @param {integer} strideA1 - stride of the first dimension of `A` * @param {integer} strideA2 - stride of the second dimension of `A` * @param {NonNegativeInteger} offsetA - starting index for `A` -* @param {Float64Array} out - stores the first and last row/column of the balanced submatrix +* @param {Int32Array} out - stores the first and last row/column of the balanced submatrix * @param {integer} strideOut - stride of `out` * @param {NonNegativeInteger} offsetOut - starting index for `out` * @param {Float64Array} scale - array containing permutation and scaling information @@ -57,9 +57,10 @@ var base = require( './base.js' ); * * @example * var Float64Array = require( '@stdlib/array/float64' ); +* var Int32Array = require( '@stdlib/array/int32' ); * * var A = new Float64Array( [ 1.0, 100.0, 0.0, 2.0, 200.0, 0.0, 0.0, 0.0, 3.0 ] ); -* var out = new Float64Array( 2 ); +* var out = new Int32Array( 2 ); * var scale = new Float64Array( 3 ); * * dgebal( 'both', 3, A, 3, 1, 0, out, 1, 0, scale, 1, 0 ); diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js index 9ed26ee38031..9713d5354e2c 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js @@ -24,6 +24,7 @@ var tape = require( 'tape' ); var Float64Array = require( '@stdlib/array/float64' ); +var Int32Array = require( '@stdlib/array/int32' ); var dgebal = require( './../lib/dgebal.js' ); @@ -55,7 +56,7 @@ tape( 'the function throws an error if provided an invalid first argument', func ]; A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 2 ); for ( i = 0; i < values.length; i++ ) { @@ -85,7 +86,7 @@ tape( 'the function throws an error if provided an invalid second argument', fun ]; A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 2 ); for ( i = 0; i < values.length; i++ ) { @@ -113,7 +114,7 @@ tape( 'the function throws an error if provided an invalid second argument', fun ]; A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 2 ); for ( i = 0; i < values.length; i++ ) { @@ -136,7 +137,7 @@ tape( 'the function returns invalid indices and leaves the input array unchanged var A; A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 2 ); info = dgebal( 'row-major', 'both', 0, A, 2, out, scale ); @@ -162,7 +163,7 @@ tape( 'the function returns expected values for job = none (row-major)', functio 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 0.0, 2.0 ] ); @@ -195,7 +196,7 @@ tape( 'the function returns expected values for job = none (column-major)', func 2.0, 5.0, 8.0, 3.0, 6.0, 9.0 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 0.0, 2.0 ] ); @@ -228,7 +229,7 @@ tape( 'the function returns expected values for job = permute (row-major)', func 0.0, 5.0, 0.0, 3.0, 0.0, 4.0 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 0.0, 1.0 ] ); @@ -261,7 +262,7 @@ tape( 'the function returns expected values for job = permute (column-major)', f 0.0, 5.0, 0.0, 2.0, 0.0, 4.0 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 0.0, 1.0 ] ); @@ -294,7 +295,7 @@ tape( 'the function returns expected values for job = scale (row-major)', functi 0.25, 0.25, 0.25, 0.25, 0.25, 0.25 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 0.0, 2.0 ] ); @@ -327,7 +328,7 @@ tape( 'the function returns expected values for job = scale (column-major)', fun 16.0, 0.25, 0.25, 16.0, 0.25, 0.25 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 0.0, 2.0 ] ); @@ -360,7 +361,7 @@ tape( 'the function returns expected values for job = both (row-major)', functio 0.0, 5.0, 0.0, 100.0, 0.0, 4.0 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 0.0, 1.0 ] ); @@ -393,7 +394,7 @@ tape( 'the function returns expected values for job = both (column-major)', func 0.0, 5.0, 0.0, 2.0, 0.0, 4.0 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 0.0, 1.0 ] ); @@ -426,7 +427,7 @@ tape( 'the function returns expected values for job = both with complex input (r 0.0, 2.0, 0.0, 0.0, 0.0, 3.0 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 0.0, 0.0 ] ); @@ -459,7 +460,7 @@ tape( 'the function returns expected values for job = both with complex input (c 1.0, 2.0, 0.0, 0.0, 0.0, 3.0 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 0.0, 0.0 ] ); @@ -492,7 +493,7 @@ tape( 'the function returns expected values for job = both with complex input (r 3.0, 4.0, 5.0, 6.0, 0.0, 7.0 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 1.0, 2.0 ] ); @@ -525,7 +526,7 @@ tape( 'the function returns expected values for job = both with complex input (c 0.0, 4.0, 0.0, 2.0, 5.0, 7.0 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 1.0, 2.0 ] ); @@ -558,7 +559,7 @@ tape( 'the function returns expected values for job = scale with zero norm (row- 2.0, 0.0, 5.0, 3.0, 0.0, 6.0 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 0.0, 2.0 ] ); @@ -591,7 +592,7 @@ tape( 'the function returns expected values for job = scale with zero norm (colu 0.0, 0.0, 0.0, 4.0, 5.0, 6.0 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 0.0, 2.0 ] ); @@ -625,7 +626,7 @@ tape( 'the function returns expected values for job = scale with small values (r 3.0e-4, 1.0, 2.0, 3.0e4, 4.0e-4, 1.0, 2.0, 4.0e4 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 4 ); expectedOut = new Float64Array( [ 0.0, 3.0 ] ); @@ -660,7 +661,7 @@ tape( 'the function returns expected values for job = scale with small values (c 2.0, 2.0, 2.0, 2.0, 1.0e4, 2.0e4, 3.0e4, 4.0e4 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 4 ); expectedOut = new Float64Array( [ 0.0, 3.0 ] ); @@ -694,7 +695,7 @@ tape( 'the function returns expected values for job = both with large values (ro 1.0e30, 1.0, 1.0e-30, 1.0e30, 1.0, 1.0e-30 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 0.0, 2.0 ] ); @@ -727,7 +728,7 @@ tape( 'the function returns expected values for job = both with large values (co 1.0, 1.0, 1.0, 1.0e-30, 1.0e-30, 1.0e-30 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 0.0, 2.0 ] ); diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.ndarray.js index e908bff3097b..246de4814084 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.ndarray.js @@ -24,6 +24,7 @@ var tape = require( 'tape' ); var Float64Array = require( '@stdlib/array/float64' ); +var Int32Array = require( '@stdlib/array/int32' ); var dgebal = require( './../lib/ndarray.js' ); @@ -55,7 +56,7 @@ tape( 'the function throws an error if provided an invalid first argument', func ]; A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 2 ); for ( i = 0; i < values.length; i++ ) { @@ -78,7 +79,7 @@ tape( 'the function returns invalid indices and leaves the input array unchanged var A; A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 2 ); info = dgebal( 'both', 0, A, 2, 1, 0, out, 1, 0, scale, 1, 0 ); @@ -104,7 +105,7 @@ tape( 'the function returns expected values for job = none (row-major)', functio 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 0.0, 2.0 ] ); @@ -137,7 +138,7 @@ tape( 'the function returns expected values for job = none (column-major)', func 2.0, 5.0, 8.0, 3.0, 6.0, 9.0 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 0.0, 2.0 ] ); @@ -170,7 +171,7 @@ tape( 'the function returns expected values for job = permute (row-major)', func 0.0, 5.0, 0.0, 3.0, 0.0, 4.0 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 0.0, 1.0 ] ); @@ -203,7 +204,7 @@ tape( 'the function returns expected values for job = permute (column-major)', f 0.0, 5.0, 0.0, 2.0, 0.0, 4.0 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 0.0, 1.0 ] ); @@ -236,7 +237,7 @@ tape( 'the function returns expected values for job = scale (row-major)', functi 0.25, 0.25, 0.25, 0.25, 0.25, 0.25 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 0.0, 2.0 ] ); @@ -269,7 +270,7 @@ tape( 'the function returns expected values for job = scale (column-major)', fun 16.0, 0.25, 0.25, 16.0, 0.25, 0.25 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 0.0, 2.0 ] ); @@ -302,7 +303,7 @@ tape( 'the function returns expected values for job = both (row-major)', functio 0.0, 5.0, 0.0, 100.0, 0.0, 4.0 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 0.0, 1.0 ] ); @@ -335,7 +336,7 @@ tape( 'the function returns expected values for job = both (column-major)', func 0.0, 5.0, 0.0, 2.0, 0.0, 4.0 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 0.0, 1.0 ] ); @@ -369,7 +370,7 @@ tape( 'the function returns expected values for job = both with complex input (r 0.0, 2.0, 0.0, 0.0, 0.0, 3.0 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 0.0, 0.0 ] ); @@ -402,7 +403,7 @@ tape( 'the function returns expected values for job = both with complex input (c 1.0, 2.0, 0.0, 0.0, 0.0, 3.0 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 0.0, 0.0 ] ); @@ -435,7 +436,7 @@ tape( 'the function returns expected values for job = both with complex input (r 3.0, 4.0, 5.0, 6.0, 0.0, 7.0 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 1.0, 2.0 ] ); @@ -468,7 +469,7 @@ tape( 'the function returns expected values for job = both with complex input (c 0.0, 4.0, 0.0, 2.0, 5.0, 7.0 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 1.0, 2.0 ] ); @@ -501,7 +502,7 @@ tape( 'the function returns expected values for job = scale with zero norm (row- 2.0, 0.0, 5.0, 3.0, 0.0, 6.0 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 0.0, 2.0 ] ); @@ -534,7 +535,7 @@ tape( 'the function returns expected values for job = scale with zero norm (colu 0.0, 0.0, 0.0, 4.0, 5.0, 6.0 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 0.0, 2.0 ] ); @@ -568,7 +569,7 @@ tape( 'the function returns expected values for job = scale with small values (r 3.0e-4, 1.0, 2.0, 3.0e4, 4.0e-4, 1.0, 2.0, 4.0e4 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 4 ); expectedOut = new Float64Array( [ 0.0, 3.0 ] ); @@ -603,7 +604,7 @@ tape( 'the function returns expected values for job = scale with small values (c 2.0, 2.0, 2.0, 2.0, 1.0e4, 2.0e4, 3.0e4, 4.0e4 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 4 ); expectedOut = new Float64Array( [ 0.0, 3.0 ] ); @@ -637,7 +638,7 @@ tape( 'the function returns expected values for job = both with large values (ro 1.0e30, 1.0, 1.0e-30, 1.0e30, 1.0, 1.0e-30 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 0.0, 2.0 ] ); @@ -670,7 +671,7 @@ tape( 'the function returns expected values for job = both with large values (co 1.0, 1.0, 1.0, 1.0e-30, 1.0e-30, 1.0e-30 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 0.0, 2.0 ] ); @@ -703,7 +704,7 @@ tape( 'the function returns expected values for job = none (row-major) (negative 6.0, 5.0, 4.0, 3.0, 2.0, 1.0 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 2.0, 0.0 ] ); @@ -736,7 +737,7 @@ tape( 'the function returns expected values for job = none (column-major) (negat 8.0, 5.0, 2.0, 7.0, 4.0, 1.0 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 2.0, 0.0 ] ); @@ -769,7 +770,7 @@ tape( 'the function returns expected values for job = permute (row-major) (negat 0.0, 5.0, 0.0, 2.0, 0.0, 1.0 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 1.0, 0.0 ] ); @@ -803,7 +804,7 @@ tape( 'the function returns expected values for job = permute (column-major) (ne 0.0, 5.0, 0.0, 3.0, 0.0, 1.0 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 1.0, 0.0 ] ); @@ -843,7 +844,7 @@ tape( 'the function returns expected values for job = scale (row-major) (negativ 16.0, 16.0, 16.0 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 2.0, 0.0 ] ); @@ -883,7 +884,7 @@ tape( 'the function returns expected values for job = scale (column-major) (nega 0.25, 0.25, 16.0 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 2.0, 0.0 ] ); @@ -916,7 +917,7 @@ tape( 'the function returns expected values for job = both (row-major) (negative 0.0, 5.0, 0.0, 2.0, 0.0, 1.0 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 1.0, 0.0 ] ); @@ -950,7 +951,7 @@ tape( 'the function returns expected values for job = both (column-major) (negat 0.0, 5.0, 0.0, 100.0, 0.0, 1.0 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 1.0, 0.0 ] ); @@ -985,7 +986,7 @@ tape( 'the function returns expected values for job = both with complex input (r 0.0, 1.0, 1.0 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 0.0, 0.0 ] ); @@ -1018,7 +1019,7 @@ tape( 'the function returns expected values for job = both with complex input (c 0.0, 2.0, 1.0, 0.0, 0.0, 1.0 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 0.0, 0.0 ] ); @@ -1052,7 +1053,7 @@ tape( 'the function returns expected values for job = both with complex input (r 5.0, 4.0, 3.0, 2.0, 0.0, 1.0 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 2.0, 1.0 ] ); @@ -1084,7 +1085,7 @@ tape( 'the function returns expected values for job = both with complex input (c 0.0, 4.0, 0.0, 6.0, 3.0, 1.0 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 2.0, 1.0 ] ); @@ -1118,7 +1119,7 @@ tape( 'the function returns expected values for job = scale with zero norm (row- 5.0, 0.0, 2.0, 4.0, 0.0, 1.0 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 2.0, 0.0 ] ); @@ -1156,7 +1157,7 @@ tape( 'the function returns expected values for job = scale with zero norm (colu 0.0, 0.0, 0.0, 3.0, 2.0, 1.0 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 2.0, 0.0 ] ); @@ -1196,7 +1197,7 @@ tape( 'the function returns expected values for job = scale with small values (r 2.0e4, 2.0, 1.0, 2.0e-4, 1.0e4, 2.0, 1.0, 1.0e-4 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 4 ); expectedOut = new Float64Array( [ 3.0, 0.0 ] ); @@ -1231,7 +1232,7 @@ tape( 'the function returns expected values for job = scale with small values (c 1.0, 1.0, 1.0, 1.0, 4.0e-4, 3.0e-4, 2.0e-4, 1.0e-4 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 4 ); expectedOut = new Float64Array( [ 3.0, 0.0 ] ); @@ -1265,7 +1266,7 @@ tape( 'the function returns expected values for job = none (row-major) (offsets) 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 ]); - out = new Float64Array( 3 ); + out = new Int32Array( 3 ); scale = new Float64Array( 6 ); expectedOut = new Float64Array( [ 0.0, 0.0, 2.0 ] ); @@ -1300,7 +1301,7 @@ tape( 'the function returns expected values for job = none (column-major) (offse 2.0, 5.0, 8.0, 3.0, 6.0, 9.0 ]); - out = new Float64Array( 3 ); + out = new Int32Array( 3 ); scale = new Float64Array( 6 ); expectedOut = new Float64Array( [ 0.0, 0.0, 2.0 ] ); @@ -1335,7 +1336,7 @@ tape( 'the function returns expected values for job = permute (row-major) (offse 0.0, 5.0, 0.0, 3.0, 0.0, 4.0 ]); - out = new Float64Array( 3 ); + out = new Int32Array( 3 ); scale = new Float64Array( 6 ); expectedOut = new Float64Array( [ 0.0, 0.0, 1.0 ] ); @@ -1370,7 +1371,7 @@ tape( 'the function returns expected values for job = permute (column-major) (of 0.0, 5.0, 0.0, 2.0, 0.0, 4.0 ]); - out = new Float64Array( 3 ); + out = new Int32Array( 3 ); scale = new Float64Array( 6 ); expectedOut = new Float64Array( [ 0.0, 0.0, 1.0 ] ); @@ -1405,7 +1406,7 @@ tape( 'the function returns expected values for job = scale (row-major) (offsets 0.25, 0.25, 0.25, 0.25, 0.25, 0.25 ]); - out = new Float64Array( 3 ); + out = new Int32Array( 3 ); scale = new Float64Array( 6 ); expectedOut = new Float64Array( [ 0.0, 0.0, 2.0 ] ); @@ -1440,7 +1441,7 @@ tape( 'the function returns expected values for job = scale (column-major) (offs 16.0, 0.25, 0.25, 16.0, 0.25, 0.25 ]); - out = new Float64Array( 3 ); + out = new Int32Array( 3 ); scale = new Float64Array( 6 ); expectedOut = new Float64Array( [ 0.0, 0.0, 2.0 ] ); @@ -1475,7 +1476,7 @@ tape( 'the function returns expected values for job = both (row-major) (offsets) 0.0, 5.0, 0.0, 100.0, 0.0, 4.0 ]); - out = new Float64Array( 3 ); + out = new Int32Array( 3 ); scale = new Float64Array( 6 ); expectedOut = new Float64Array( [ 0.0, 0.0, 1.0 ] ); @@ -1510,7 +1511,7 @@ tape( 'the function returns expected values for job = both (column-major) (offse 0.0, 5.0, 0.0, 2.0, 0.0, 4.0 ]); - out = new Float64Array( 3 ); + out = new Int32Array( 3 ); scale = new Float64Array( 6 ); expectedOut = new Float64Array( [ 0.0, 0.0, 1.0 ] ); @@ -1545,7 +1546,7 @@ tape( 'the function returns expected values for job = both with complex input (r 0.0, 2.0, 0.0, 0.0, 0.0, 3.0 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 0.0, 0.0 ] ); @@ -1579,7 +1580,7 @@ tape( 'the function returns expected values for job = both with complex input (c 1.0, 2.0, 0.0, 0.0, 0.0, 3.0 ]); - out = new Float64Array( 3 ); + out = new Int32Array( 3 ); scale = new Float64Array( 6 ); expectedOut = new Float64Array( [ 0.0, 0.0, 0.0 ] ); @@ -1614,7 +1615,7 @@ tape( 'the function returns expected values for job = both with complex input (r 3.0, 4.0, 5.0, 6.0, 0.0, 7.0 ]); - out = new Float64Array( 3 ); + out = new Int32Array( 3 ); scale = new Float64Array( 6 ); expectedOut = new Float64Array( [ 0.0, 1.0, 2.0 ] ); @@ -1649,7 +1650,7 @@ tape( 'the function returns expected values for job = both with complex input (c 0.0, 4.0, 0.0, 2.0, 5.0, 7.0 ]); - out = new Float64Array( 3 ); + out = new Int32Array( 3 ); scale = new Float64Array( 6 ); expectedOut = new Float64Array( [ 0.0, 1.0, 2.0 ] ); @@ -1684,7 +1685,7 @@ tape( 'the function returns expected values for job = scale with zero norm (row- 2.0, 0.0, 5.0, 3.0, 0.0, 6.0 ]); - out = new Float64Array( 3 ); + out = new Int32Array( 3 ); scale = new Float64Array( 6 ); expectedOut = new Float64Array( [ 0.0, 0.0, 2.0 ] ); @@ -1719,7 +1720,7 @@ tape( 'the function returns expected values for job = scale with zero norm (colu 0.0, 0.0, 0.0, 4.0, 5.0, 6.0 ]); - out = new Float64Array( 3 ); + out = new Int32Array( 3 ); scale = new Float64Array( 6 ); expectedOut = new Float64Array( [ 0.0, 0.0, 2.0 ] ); @@ -1755,7 +1756,7 @@ tape( 'the function returns expected values for job = scale with small values (r 3.0e-4, 1.0, 2.0, 3.0e4, 4.0e-4, 1.0, 2.0, 4.0e4 ]); - out = new Float64Array( 3 ); + out = new Int32Array( 3 ); scale = new Float64Array( 7 ); expectedOut = new Float64Array( [ 0.0, 0.0, 3.0 ] ); @@ -1792,7 +1793,7 @@ tape( 'the function returns expected values for job = scale with small values (c 2.0, 2.0, 2.0, 2.0, 1.0e4, 2.0e4, 3.0e4, 4.0e4 ]); - out = new Float64Array( 3 ); + out = new Int32Array( 3 ); scale = new Float64Array( 7 ); expectedOut = new Float64Array( [ 0.0, 0.0, 3.0 ] ); @@ -1827,7 +1828,7 @@ tape( 'the function returns expected values for job = none (row-major) (mixed st 6.0, 5.0, 4.0, 9.0, 8.0, 7.0 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 0.0, 2.0 ] ); @@ -1867,7 +1868,7 @@ tape( 'the function returns expected values for job = none (column-major) (mixed 8.0, 5.0, 2.0, 9.0, 6.0, 3.0 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 0.0, 2.0 ] ); @@ -1900,7 +1901,7 @@ tape( 'the function returns expected values for job = permute (row-major) (mixed 0.0, 5.0, 0.0, 4.0, 0.0, 3.0 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 0.0, 1.0 ] ); @@ -1933,7 +1934,7 @@ tape( 'the function returns expected values for job = permute (column-major) (mi 0.0, 5.0, 0.0, 4.0, 0.0, 2.0 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 0.0, 1.0 ] ); @@ -1966,7 +1967,7 @@ tape( 'the function returns expected values for job = scale (row-major) (mixed s 0.25, 0.25, 0.25 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 0.0, 2.0 ] ); @@ -2000,7 +2001,7 @@ tape( 'the function returns expected values for job = scale (column-major) (mixe 0.25, 0.25, 16.0 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 0.0, 2.0 ] ); @@ -2034,7 +2035,7 @@ tape( 'the function returns expected values for job = both (row-major) (mixed st 4.0, 0.0, 100.0 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 0.0, 1.0 ] ); @@ -2067,7 +2068,7 @@ tape( 'the function returns expected values for job = both (column-major) (mixed 0.0, 5.0, 0.0, 4.0, 0.0, 2.0 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 0.0, 1.0 ] ); @@ -2100,7 +2101,7 @@ tape( 'the function returns expected values for job = both with complex input (r 0.0, 2.0, 0.0, 3.0, 0.0, 0.0 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 0.0, 0.0 ] ); @@ -2133,7 +2134,7 @@ tape( 'the function returns expected values for job = both with complex input (c 0.0, 2.0, 1.0, 3.0, 0.0, 0.0 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 0.0, 0.0 ] ); @@ -2166,7 +2167,7 @@ tape( 'the function returns expected values for job = both with complex input (r 5.0, 4.0, 3.0, 7.0, 0.0, 6.0 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 1.0, 2.0 ] ); @@ -2199,7 +2200,7 @@ tape( 'the function returns expected values for job = both with complex input (c 0.0, 4.0, 0.0, 7.0, 5.0, 2.0 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 1.0, 2.0 ] ); @@ -2231,7 +2232,7 @@ tape( 'the function returns expected values for job = scale with zero norm (row- 5.0, 0.0, 2.0, 6.0, 0.0, 3.0 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 0.0, 2.0 ] ); @@ -2264,7 +2265,7 @@ tape( 'the function returns expected values for job = scale with zero norm (colu 0.0, 0.0, 0.0, 6.0, 5.0, 4.0 ]); - out = new Float64Array( 2 ); + out = new Int32Array( 2 ); scale = new Float64Array( 3 ); expectedOut = new Float64Array( [ 0.0, 2.0 ] ); @@ -2297,7 +2298,7 @@ tape( 'the function returns expected values for job = none (row-major) (large st 4.0, 9999.0, 5.0, 9999.0, 6.0, 9999.0, 7.0, 9999.0, 8.0, 9999.0, 9.0, 9999.0 ]); - out = new Float64Array( 4 ); + out = new Int32Array( 4 ); scale = new Float64Array( 6 ); expectedOut = new Float64Array( [ 0.0, 0.0, 2.0, 0.0 ] ); @@ -2330,7 +2331,7 @@ tape( 'the function returns expected values for job = none (column-major) (large 2.0, 9999.0, 5.0, 9999.0, 8.0, 9999.0, 3.0, 9999.0, 6.0, 9999.0, 9.0, 9999.0 ]); - out = new Float64Array( 4 ); + out = new Int32Array( 4 ); scale = new Float64Array( 6 ); expectedOut = new Float64Array( [ 0.0, 0.0, 2.0, 0.0 ] ); @@ -2363,7 +2364,7 @@ tape( 'the function returns expected values for job = permute (row-major) (large 0.0, 9999.0, 5.0, 9999.0, 0.0, 9999.0, 3.0, 9999.0, 0.0, 9999.0, 4.0, 9999.0 ]); - out = new Float64Array( 4 ); + out = new Int32Array( 4 ); scale = new Float64Array( 6 ); expectedOut = new Float64Array( [ 0.0, 0.0, 1.0, 0.0 ] ); @@ -2396,7 +2397,7 @@ tape( 'the function returns expected values for job = permute (column-major) (la 0.0, 9999.0, 5.0, 9999.0, 0.0, 9999.0, 2.0, 9999.0, 0.0, 9999.0, 4.0, 9999.0 ]); - out = new Float64Array( 4 ); + out = new Int32Array( 4 ); scale = new Float64Array( 6 ); expectedOut = new Float64Array( [ 0.0, 0.0, 1.0, 0.0 ] ); @@ -2429,7 +2430,7 @@ tape( 'the function returns expected values for job = scale (row-major) (large s 0.25, 9999.0, 0.25, 9999.0, 0.25, 9999.0, 0.25, 9999.0, 0.25, 9999.0, 0.25, 9999.0 ]); - out = new Float64Array( 4 ); + out = new Int32Array( 4 ); scale = new Float64Array( 6 ); expectedOut = new Float64Array( [ 0.0, 0.0, 2.0, 0.0 ] ); @@ -2462,7 +2463,7 @@ tape( 'the function returns expected values for job = scale (column-major) (larg 16.0, 9999.0, 0.25, 9999.0, 0.25, 9999.0, 16.0, 9999.0, 0.25, 9999.0, 0.25, 9999.0 ]); - out = new Float64Array( 4 ); + out = new Int32Array( 4 ); scale = new Float64Array( 6 ); expectedOut = new Float64Array( [ 0.0, 0.0, 2.0, 0.0 ] ); @@ -2495,7 +2496,7 @@ tape( 'the function returns expected values for job = both (row-major) (large st 0.0, 9999.0, 5.0, 9999.0, 0.0, 9999.0, 100.0, 9999.0, 0.0, 9999.0, 4.0, 9999.0 ]); - out = new Float64Array( 4 ); + out = new Int32Array( 4 ); scale = new Float64Array( 6 ); expectedOut = new Float64Array( [ 0.0, 0.0, 1.0, 0.0 ] ); @@ -2528,7 +2529,7 @@ tape( 'the function returns expected values for job = both (column-major) (large 0.0, 9999.0, 5.0, 9999.0, 0.0, 9999.0, 2.0, 9999.0, 0.0, 9999.0, 4.0, 9999.0 ]); - out = new Float64Array( 4 ); + out = new Int32Array( 4 ); scale = new Float64Array( 6 ); expectedOut = new Float64Array( [ 0.0, 0.0, 1.0, 0.0 ] ); @@ -2562,7 +2563,7 @@ tape( 'the function returns expected values for job = both with complex input (r 0.0, 9999.0, 2.0, 9999.0, 0.0, 9999.0, 0.0, 9999.0, 0.0, 9999.0, 3.0, 9999.0 ]); - out = new Float64Array( 4 ); + out = new Int32Array( 4 ); scale = new Float64Array( 6 ); expectedOut = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); @@ -2595,7 +2596,7 @@ tape( 'the function returns expected values for job = both with complex input (c 1.0, 9999.0, 2.0, 9999.0, 0.0, 9999.0, 0.0, 9999.0, 0.0, 9999.0, 3.0, 9999.0 ]); - out = new Float64Array( 4 ); + out = new Int32Array( 4 ); scale = new Float64Array( 6 ); expectedOut = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); @@ -2628,7 +2629,7 @@ tape( 'the function returns expected values for job = both with complex input (r 3.0, 9999.0, 4.0, 9999.0, 5.0, 9999.0, 6.0, 9999.0, 0.0, 9999.0, 7.0, 9999.0 ]); - out = new Float64Array( 4 ); + out = new Int32Array( 4 ); scale = new Float64Array( 6 ); expectedOut = new Float64Array( [ 1.0, 0.0, 2.0, 0.0 ] ); @@ -2661,7 +2662,7 @@ tape( 'the function returns expected values for job = both with complex input (c 0.0, 9999.0, 4.0, 9999.0, 0.0, 9999.0, 2.0, 9999.0, 5.0, 9999.0, 7.0, 9999.0 ]); - out = new Float64Array( 4 ); + out = new Int32Array( 4 ); scale = new Float64Array( 6 ); expectedOut = new Float64Array( [ 1.0, 0.0, 2.0, 0.0 ] ); @@ -2694,7 +2695,7 @@ tape( 'the function returns expected values for job = scale with zero norm (row- 2.0, 9999.0, 0.0, 9999.0, 5.0, 9999.0, 3.0, 9999.0, 0.0, 9999.0, 6.0, 9999.0 ]); - out = new Float64Array( 4 ); + out = new Int32Array( 4 ); scale = new Float64Array( 6 ); expectedOut = new Float64Array( [ 0.0, 0.0, 2.0, 0.0 ] ); @@ -2727,7 +2728,7 @@ tape( 'the function returns expected values for job = scale with zero norm (colu 0.0, 9999.0, 0.0, 9999.0, 0.0, 9999.0, 4.0, 9999.0, 5.0, 9999.0, 6.0, 9999.0 ]); - out = new Float64Array( 4 ); + out = new Int32Array( 4 ); scale = new Float64Array( 6 ); expectedOut = new Float64Array( [ 0.0, 0.0, 2.0, 0.0 ] ); From 2ac5b9ccb289495ff22dfbb96dba16a8f7edb9fa Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Fri, 16 May 2025 14:39:24 +0530 Subject: [PATCH 26/43] chore: remove decimals from int32arrays --- 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 --- --- .../lapack/base/dgebal/test/test.dgebal.js | 38 ++--- .../lapack/base/dgebal/test/test.ndarray.js | 158 +++++++++--------- 2 files changed, 98 insertions(+), 98 deletions(-) diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js index 9713d5354e2c..1da6a69f0938 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.dgebal.js @@ -142,7 +142,7 @@ tape( 'the function returns invalid indices and leaves the input array unchanged info = dgebal( 'row-major', 'both', 0, A, 2, out, scale ); - expectedOut = new Float64Array( [ 0.0, -1.0 ] ); + expectedOut = new Int32Array( [ 0, -1 ] ); t.strictEqual( info, 0, 'returns expected value' ); t.deepEqual( out, expectedOut, 'returns expected value' ); @@ -166,7 +166,7 @@ tape( 'the function returns expected values for job = none (row-major)', functio out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 0.0, 2.0 ] ); + expectedOut = new Int32Array( [ 0, 2 ] ); expectedScale = new Float64Array( [ 1.0, 1.0, 1.0 ] ); expectedA = new Float64Array([ 1.0, 2.0, 3.0, @@ -199,7 +199,7 @@ tape( 'the function returns expected values for job = none (column-major)', func out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 0.0, 2.0 ] ); + expectedOut = new Int32Array( [ 0, 2 ] ); expectedScale = new Float64Array( [ 1.0, 1.0, 1.0 ] ); expectedA = new Float64Array([ 1.0, 4.0, 7.0, @@ -232,7 +232,7 @@ tape( 'the function returns expected values for job = permute (row-major)', func out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 0.0, 1.0 ] ); + expectedOut = new Int32Array( [ 0, 1 ] ); expectedScale = new Float64Array( [ 1.0, 1.0, 1.0 ] ); expectedA = new Float64Array([ 1.0, 2.0, 0.0, @@ -265,7 +265,7 @@ tape( 'the function returns expected values for job = permute (column-major)', f out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 0.0, 1.0 ] ); + expectedOut = new Int32Array( [ 0, 1 ] ); expectedScale = new Float64Array( [ 1.0, 1.0, 1.0 ] ); expectedA = new Float64Array([ 1.0, 3.0, 0.0, @@ -298,7 +298,7 @@ tape( 'the function returns expected values for job = scale (row-major)', functi out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 0.0, 2.0 ] ); + expectedOut = new Int32Array( [ 0, 2 ] ); expectedScale = new Float64Array( [ 1.0, 0.125, 0.125 ] ); expectedA = new Float64Array([ 16.0, 2.0, 2.0, @@ -331,7 +331,7 @@ tape( 'the function returns expected values for job = scale (column-major)', fun out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 0.0, 2.0 ] ); + expectedOut = new Int32Array( [ 0, 2 ] ); expectedScale = new Float64Array( [ 1.0, 0.125, 0.125 ] ); expectedA = new Float64Array([ 16.0, 2.0, 2.0, @@ -364,7 +364,7 @@ tape( 'the function returns expected values for job = both (row-major)', functio out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 0.0, 1.0 ] ); + expectedOut = new Int32Array( [ 0, 1 ] ); expectedScale = new Float64Array( [ 0.125, 1.0, 1.0 ] ); expectedA = new Float64Array([ 1.0, 16.0, 0.0, @@ -397,7 +397,7 @@ tape( 'the function returns expected values for job = both (column-major)', func out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 0.0, 1.0 ] ); + expectedOut = new Int32Array( [ 0, 1 ] ); expectedScale = new Float64Array( [ 0.125, 1.0, 1.0 ] ); expectedA = new Float64Array([ 1.0, 12.5, 0.0, @@ -430,7 +430,7 @@ tape( 'the function returns expected values for job = both with complex input (r out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 0.0, 0.0 ] ); + expectedOut = new Int32Array( [ 0, 0 ] ); expectedScale = new Float64Array( [ 0.0, 1.0, 2.0 ] ); expectedA = new Float64Array([ 1.0, 1.0, 0.0, @@ -463,7 +463,7 @@ tape( 'the function returns expected values for job = both with complex input (c out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 0.0, 0.0 ] ); + expectedOut = new Int32Array( [ 0, 0 ] ); expectedScale = new Float64Array( [ 0.0, 1.0, 2.0 ] ); expectedA = new Float64Array([ 1.0, 0.0, 0.0, @@ -496,7 +496,7 @@ tape( 'the function returns expected values for job = both with complex input (r out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 1.0, 2.0 ] ); + expectedOut = new Int32Array( [ 1, 2 ] ); expectedScale = new Float64Array( [ 1.0, 0.5, 1.0 ] ); expectedA = new Float64Array([ 4.0, 1.5, 5.0, @@ -529,7 +529,7 @@ tape( 'the function returns expected values for job = both with complex input (c out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 1.0, 2.0 ] ); + expectedOut = new Int32Array( [ 1, 2 ] ); expectedScale = new Float64Array( [ 1.0, 0.5, 1.0 ] ); expectedA = new Float64Array([ 4.0, 0.0, 0.0, @@ -562,7 +562,7 @@ tape( 'the function returns expected values for job = scale with zero norm (row- out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 0.0, 2.0 ] ); + expectedOut = new Int32Array( [ 0, 2 ] ); expectedScale = new Float64Array( [ 1.0, 1.0, 1.0 ] ); expectedA = new Float64Array([ 1.0, 0.0, 4.0, @@ -595,7 +595,7 @@ tape( 'the function returns expected values for job = scale with zero norm (colu out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 0.0, 2.0 ] ); + expectedOut = new Int32Array( [ 0, 2 ] ); expectedScale = new Float64Array( [ 1.0, 1.0, 1.0 ] ); expectedA = new Float64Array([ 1.0, 2.0, 3.0, @@ -629,7 +629,7 @@ tape( 'the function returns expected values for job = scale with small values (r out = new Int32Array( 2 ); scale = new Float64Array( 4 ); - expectedOut = new Float64Array( [ 0.0, 3.0 ] ); + expectedOut = new Int32Array( [ 0.0, 3.0 ] ); expectedScale = new Float64Array( [ 4096.0, 128.0, 128.0, 1.0 ] ); expectedA = new Float64Array([ 1.0e-4, 3.125e-2, 6.25e-2, 2.44140625, @@ -664,7 +664,7 @@ tape( 'the function returns expected values for job = scale with small values (c out = new Int32Array( 2 ); scale = new Float64Array( 4 ); - expectedOut = new Float64Array( [ 0.0, 3.0 ] ); + expectedOut = new Int32Array( [ 0.0, 3.0 ] ); expectedScale = new Float64Array( [ 4096.0, 128.0, 128.0, 1.0 ] ); expectedA = new Float64Array([ 1.0e-4, 6.4e-3, 9.6e-3, 1.6384, @@ -698,7 +698,7 @@ tape( 'the function returns expected values for job = both with large values (ro out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 0.0, 2.0 ] ); + expectedOut = new Int32Array( [ 0, 2 ] ); expectedScale = new Float64Array( [ 1.0, 1125899906842624.0, 1.2676506002282294e30 ] ); // eslint-disable-line max-len expectedA = new Float64Array([ 1.0e30, 1.1258999068426240e15, 1.2676506002282295, @@ -731,7 +731,7 @@ tape( 'the function returns expected values for job = both with large values (co out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 0.0, 2.0 ] ); + expectedOut = new Int32Array( [ 0, 2 ] ); expectedScale = new Float64Array( [ 1.0, 1125899906842624.0, 1.2676506002282294e30 ] ); // eslint-disable-line max-len expectedA = new Float64Array([ 1.0e30, 8.8817841970012525e14, 7.8886090522101182e-1, diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.ndarray.js index 246de4814084..86e20a5b6ed9 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/test/test.ndarray.js @@ -84,7 +84,7 @@ tape( 'the function returns invalid indices and leaves the input array unchanged info = dgebal( 'both', 0, A, 2, 1, 0, out, 1, 0, scale, 1, 0 ); - expectedOut = new Float64Array( [ 0.0, -1.0 ] ); + expectedOut = new Int32Array( [ 0, -1 ] ); t.strictEqual( info, 0, 'returns expected value' ); t.deepEqual( out, expectedOut, 'returns expected value' ); @@ -108,7 +108,7 @@ tape( 'the function returns expected values for job = none (row-major)', functio out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 0.0, 2.0 ] ); + expectedOut = new Int32Array( [ 0, 2 ] ); expectedScale = new Float64Array( [ 1.0, 1.0, 1.0 ] ); expectedA = new Float64Array([ 1.0, 2.0, 3.0, @@ -141,7 +141,7 @@ tape( 'the function returns expected values for job = none (column-major)', func out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 0.0, 2.0 ] ); + expectedOut = new Int32Array( [ 0, 2 ] ); expectedScale = new Float64Array( [ 1.0, 1.0, 1.0 ] ); expectedA = new Float64Array([ 1.0, 4.0, 7.0, @@ -174,7 +174,7 @@ tape( 'the function returns expected values for job = permute (row-major)', func out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 0.0, 1.0 ] ); + expectedOut = new Int32Array( [ 0, 1 ] ); expectedScale = new Float64Array( [ 1.0, 1.0, 1.0 ] ); expectedA = new Float64Array([ 1.0, 2.0, 0.0, @@ -207,7 +207,7 @@ tape( 'the function returns expected values for job = permute (column-major)', f out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 0.0, 1.0 ] ); + expectedOut = new Int32Array( [ 0, 1 ] ); expectedScale = new Float64Array( [ 1.0, 1.0, 1.0 ] ); expectedA = new Float64Array([ 1.0, 3.0, 0.0, @@ -240,7 +240,7 @@ tape( 'the function returns expected values for job = scale (row-major)', functi out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 0.0, 2.0 ] ); + expectedOut = new Int32Array( [ 0, 2 ] ); expectedScale = new Float64Array( [ 1.0, 0.125, 0.125 ] ); expectedA = new Float64Array([ 16.0, 2.0, 2.0, @@ -273,7 +273,7 @@ tape( 'the function returns expected values for job = scale (column-major)', fun out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 0.0, 2.0 ] ); + expectedOut = new Int32Array( [ 0, 2 ] ); expectedScale = new Float64Array( [ 1.0, 0.125, 0.125 ] ); expectedA = new Float64Array([ 16.0, 2.0, 2.0, @@ -306,7 +306,7 @@ tape( 'the function returns expected values for job = both (row-major)', functio out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 0.0, 1.0 ] ); + expectedOut = new Int32Array( [ 0, 1 ] ); expectedScale = new Float64Array( [ 0.125, 1.0, 1.0 ] ); expectedA = new Float64Array([ 1.0, 16.0, 0.0, @@ -339,7 +339,7 @@ tape( 'the function returns expected values for job = both (column-major)', func out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 0.0, 1.0 ] ); + expectedOut = new Int32Array( [ 0, 1 ] ); expectedScale = new Float64Array( [ 0.125, 1.0, 1.0 ] ); expectedA = new Float64Array([ 1.0, 12.5, 0.0, @@ -373,7 +373,7 @@ tape( 'the function returns expected values for job = both with complex input (r out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 0.0, 0.0 ] ); + expectedOut = new Int32Array( [ 0, 0 ] ); expectedScale = new Float64Array( [ 0.0, 1.0, 2.0 ] ); expectedA = new Float64Array([ 1.0, 1.0, 0.0, @@ -406,7 +406,7 @@ tape( 'the function returns expected values for job = both with complex input (c out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 0.0, 0.0 ] ); + expectedOut = new Int32Array( [ 0, 0 ] ); expectedScale = new Float64Array( [ 0.0, 1.0, 2.0 ] ); expectedA = new Float64Array([ 1.0, 0.0, 0.0, @@ -439,7 +439,7 @@ tape( 'the function returns expected values for job = both with complex input (r out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 1.0, 2.0 ] ); + expectedOut = new Int32Array( [ 1, 2 ] ); expectedScale = new Float64Array( [ 1.0, 0.5, 1.0 ] ); expectedA = new Float64Array([ 4.0, 1.5, 5.0, @@ -472,7 +472,7 @@ tape( 'the function returns expected values for job = both with complex input (c out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 1.0, 2.0 ] ); + expectedOut = new Int32Array( [ 1, 2 ] ); expectedScale = new Float64Array( [ 1.0, 0.5, 1.0 ] ); expectedA = new Float64Array([ 4.0, 0.0, 0.0, @@ -505,7 +505,7 @@ tape( 'the function returns expected values for job = scale with zero norm (row- out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 0.0, 2.0 ] ); + expectedOut = new Int32Array( [ 0, 2 ] ); expectedScale = new Float64Array( [ 1.0, 1.0, 1.0 ] ); expectedA = new Float64Array([ 1.0, 0.0, 4.0, @@ -538,7 +538,7 @@ tape( 'the function returns expected values for job = scale with zero norm (colu out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 0.0, 2.0 ] ); + expectedOut = new Int32Array( [ 0, 2 ] ); expectedScale = new Float64Array( [ 1.0, 1.0, 1.0 ] ); expectedA = new Float64Array([ 1.0, 2.0, 3.0, @@ -572,7 +572,7 @@ tape( 'the function returns expected values for job = scale with small values (r out = new Int32Array( 2 ); scale = new Float64Array( 4 ); - expectedOut = new Float64Array( [ 0.0, 3.0 ] ); + expectedOut = new Int32Array( [ 0, 3 ] ); expectedScale = new Float64Array( [ 4096.0, 128.0, 128.0, 1.0 ] ); expectedA = new Float64Array([ 1.0e-4, 3.125e-2, 6.25e-2, 2.44140625, @@ -607,7 +607,7 @@ tape( 'the function returns expected values for job = scale with small values (c out = new Int32Array( 2 ); scale = new Float64Array( 4 ); - expectedOut = new Float64Array( [ 0.0, 3.0 ] ); + expectedOut = new Int32Array( [ 0, 3 ] ); expectedScale = new Float64Array( [ 4096.0, 128.0, 128.0, 1.0 ] ); expectedA = new Float64Array([ 1.0e-4, 6.4e-3, 9.6e-3, 1.6384, @@ -641,7 +641,7 @@ tape( 'the function returns expected values for job = both with large values (ro out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 0.0, 2.0 ] ); + expectedOut = new Int32Array( [ 0, 2 ] ); expectedScale = new Float64Array( [ 1.0, 1125899906842624.0, 1.2676506002282294e30 ] ); // eslint-disable-line max-len expectedA = new Float64Array([ 1.0e30, 1.1258999068426240e15, 1.2676506002282295, @@ -674,7 +674,7 @@ tape( 'the function returns expected values for job = both with large values (co out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 0.0, 2.0 ] ); + expectedOut = new Int32Array( [ 0, 2 ] ); expectedScale = new Float64Array( [ 1.0, 1125899906842624.0, 1.2676506002282294e30 ] ); // eslint-disable-line max-len expectedA = new Float64Array([ 1.0e30, 8.8817841970012525e14, 7.8886090522101182e-1, @@ -707,7 +707,7 @@ tape( 'the function returns expected values for job = none (row-major) (negative out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 2.0, 0.0 ] ); + expectedOut = new Int32Array( [ 2, 0 ] ); expectedScale = new Float64Array( [ 1.0, 1.0, 1.0 ] ); expectedA = new Float64Array([ 9.0, 8.0, 7.0, @@ -740,7 +740,7 @@ tape( 'the function returns expected values for job = none (column-major) (negat out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 2.0, 0.0 ] ); + expectedOut = new Int32Array( [ 2, 0 ] ); expectedScale = new Float64Array( [ 1.0, 1.0, 1.0 ] ); expectedA = new Float64Array([ 9.0, 6.0, 3.0, @@ -773,7 +773,7 @@ tape( 'the function returns expected values for job = permute (row-major) (negat out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 1.0, 0.0 ] ); + expectedOut = new Int32Array( [ 1.0, 0.0 ] ); expectedScale = new Float64Array( [ 1.0, 1.0, 1.0 ] ); expectedA = new Float64Array([ @@ -807,7 +807,7 @@ tape( 'the function returns expected values for job = permute (column-major) (ne out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 1.0, 0.0 ] ); + expectedOut = new Int32Array( [ 1.0, 0.0 ] ); expectedScale = new Float64Array( [ 1.0, 1.0, 1.0 ] ); expectedA = new Float64Array([ 5.0, 0.0, 0.0, @@ -847,7 +847,7 @@ tape( 'the function returns expected values for job = scale (row-major) (negativ out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 2.0, 0.0 ] ); + expectedOut = new Int32Array( [ 2, 0 ] ); expectedScale = new Float64Array( [ 0.125, 0.125, 1.0 ] ); expectedA = new Float64Array([ 16.0, 2.0, 2.0, @@ -887,7 +887,7 @@ tape( 'the function returns expected values for job = scale (column-major) (nega out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 2.0, 0.0 ] ); + expectedOut = new Int32Array( [ 2, 0 ] ); expectedScale = new Float64Array( [ 0.125, 0.125, 1.0 ] ); expectedA = new Float64Array([ 0.25, 0.25, 2.0, @@ -920,7 +920,7 @@ tape( 'the function returns expected values for job = both (row-major) (negative out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 1.0, 0.0 ] ); + expectedOut = new Int32Array( [ 1.0, 0.0 ] ); expectedScale = new Float64Array( [ 1.0, 1.0, 0.125 ] ); expectedA = new Float64Array([ @@ -954,7 +954,7 @@ tape( 'the function returns expected values for job = both (column-major) (negat out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 1.0, 0.0 ] ); + expectedOut = new Int32Array( [ 1.0, 0.0 ] ); expectedScale = new Float64Array( [ 1.0, 1.0, 0.125 ] ); expectedA = new Float64Array([ 5.0, 0.0, 0.0, @@ -989,7 +989,7 @@ tape( 'the function returns expected values for job = both with complex input (r out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 0.0, 0.0 ] ); + expectedOut = new Int32Array( [ 0, 0 ] ); expectedScale = new Float64Array( [ 2.0, 1.0, 0.0 ] ); expectedA = new Float64Array([ 3.0, 0.0, 0.0, @@ -1022,7 +1022,7 @@ tape( 'the function returns expected values for job = both with complex input (c out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 0.0, 0.0 ] ); + expectedOut = new Int32Array( [ 0, 0 ] ); expectedScale = new Float64Array( [ 2.0, 1.0, 0.0 ] ); expectedA = new Float64Array([ @@ -1056,7 +1056,7 @@ tape( 'the function returns expected values for job = both with complex input (r out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 2.0, 1.0 ] ); + expectedOut = new Int32Array( [ 2.0, 1.0 ] ); expectedScale = new Float64Array( [ 1.0, 0.5, 1.0 ] ); expectedA = new Float64Array([ 7.0, 3.0, 0.0, @@ -1088,7 +1088,7 @@ tape( 'the function returns expected values for job = both with complex input (c out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 2.0, 1.0 ] ); + expectedOut = new Int32Array( [ 2.0, 1.0 ] ); expectedScale = new Float64Array( [ 1.0, 0.5, 1.0 ] ); expectedA = new Float64Array([ @@ -1122,7 +1122,7 @@ tape( 'the function returns expected values for job = scale with zero norm (row- out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 2.0, 0.0 ] ); + expectedOut = new Int32Array( [ 2, 0 ] ); expectedScale = new Float64Array( [ 1.0, 1.0, 1.0 ] ); expectedA = new Float64Array([ 6.0, 0.0, 3.0, @@ -1160,7 +1160,7 @@ tape( 'the function returns expected values for job = scale with zero norm (colu out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 2.0, 0.0 ] ); + expectedOut = new Int32Array( [ 2, 0 ] ); expectedScale = new Float64Array( [ 1.0, 1.0, 1.0 ] ); expectedA = new Float64Array([ 1.0, 2.0, 3.0, @@ -1200,7 +1200,7 @@ tape( 'the function returns expected values for job = scale with small values (r out = new Int32Array( 2 ); scale = new Float64Array( 4 ); - expectedOut = new Float64Array( [ 3.0, 0.0 ] ); + expectedOut = new Int32Array( [ 3.0, 0.0 ] ); expectedScale = new Float64Array( [ 1.0, 128.0, 128.0, 4096.0 ] ); expectedA = new Float64Array([ 4.0e4, 2.56e2, 1.28e2, 1.6384, @@ -1235,7 +1235,7 @@ tape( 'the function returns expected values for job = scale with small values (c out = new Int32Array( 2 ); scale = new Float64Array( 4 ); - expectedOut = new Float64Array( [ 3.0, 0.0 ] ); + expectedOut = new Int32Array( [ 3.0, 0.0 ] ); expectedScale = new Float64Array( [ 1.0, 128.0, 128.0, 4096.0 ] ); expectedA = new Float64Array([ 4.0e4, 2.34375e2, 1.5625e2, 2.44140625, @@ -1269,7 +1269,7 @@ tape( 'the function returns expected values for job = none (row-major) (offsets) out = new Int32Array( 3 ); scale = new Float64Array( 6 ); - expectedOut = new Float64Array( [ 0.0, 0.0, 2.0 ] ); + expectedOut = new Int32Array( [ 0.0, 0.0, 2.0 ] ); expectedScale = new Float64Array( [ 0.0, 0.0, 0.0, 1.0, 1.0, 1.0 ] ); expectedA = new Float64Array([ 0.0, 0.0, @@ -1304,7 +1304,7 @@ tape( 'the function returns expected values for job = none (column-major) (offse out = new Int32Array( 3 ); scale = new Float64Array( 6 ); - expectedOut = new Float64Array( [ 0.0, 0.0, 2.0 ] ); + expectedOut = new Int32Array( [ 0.0, 0.0, 2.0 ] ); expectedScale = new Float64Array( [ 0.0, 0.0, 0.0, 1.0, 1.0, 1.0 ] ); expectedA = new Float64Array([ 0.0, 0.0, @@ -1339,7 +1339,7 @@ tape( 'the function returns expected values for job = permute (row-major) (offse out = new Int32Array( 3 ); scale = new Float64Array( 6 ); - expectedOut = new Float64Array( [ 0.0, 0.0, 1.0 ] ); + expectedOut = new Int32Array( [ 0.0, 0.0, 1.0 ] ); expectedScale = new Float64Array( [ 0.0, 0.0, 0.0, 1.0, 1.0, 1.0 ] ); expectedA = new Float64Array([ 0.0, 0.0, @@ -1374,7 +1374,7 @@ tape( 'the function returns expected values for job = permute (column-major) (of out = new Int32Array( 3 ); scale = new Float64Array( 6 ); - expectedOut = new Float64Array( [ 0.0, 0.0, 1.0 ] ); + expectedOut = new Int32Array( [ 0.0, 0.0, 1.0 ] ); expectedScale = new Float64Array( [ 0.0, 0.0, 0.0, 1.0, 1.0, 1.0 ] ); expectedA = new Float64Array([ 0.0, 0.0, @@ -1409,7 +1409,7 @@ tape( 'the function returns expected values for job = scale (row-major) (offsets out = new Int32Array( 3 ); scale = new Float64Array( 6 ); - expectedOut = new Float64Array( [ 0.0, 0.0, 2.0 ] ); + expectedOut = new Int32Array( [ 0.0, 0.0, 2.0 ] ); expectedScale = new Float64Array( [ 0.0, 0.0, 0.0, 1.0, 0.125, 0.125 ] ); expectedA = new Float64Array([ 0.0, 0.0, @@ -1444,7 +1444,7 @@ tape( 'the function returns expected values for job = scale (column-major) (offs out = new Int32Array( 3 ); scale = new Float64Array( 6 ); - expectedOut = new Float64Array( [ 0.0, 0.0, 2.0 ] ); + expectedOut = new Int32Array( [ 0.0, 0.0, 2.0 ] ); expectedScale = new Float64Array( [ 0.0, 0.0, 0.0, 1.0, 0.125, 0.125 ] ); expectedA = new Float64Array([ 0.0, 0.0, @@ -1479,7 +1479,7 @@ tape( 'the function returns expected values for job = both (row-major) (offsets) out = new Int32Array( 3 ); scale = new Float64Array( 6 ); - expectedOut = new Float64Array( [ 0.0, 0.0, 1.0 ] ); + expectedOut = new Int32Array( [ 0.0, 0.0, 1.0 ] ); expectedScale = new Float64Array( [ 0.0, 0.0, 0.0, 0.125, 1.0, 1.0 ] ); expectedA = new Float64Array([ 0.0, 0.0, @@ -1514,7 +1514,7 @@ tape( 'the function returns expected values for job = both (column-major) (offse out = new Int32Array( 3 ); scale = new Float64Array( 6 ); - expectedOut = new Float64Array( [ 0.0, 0.0, 1.0 ] ); + expectedOut = new Int32Array( [ 0.0, 0.0, 1.0 ] ); expectedScale = new Float64Array( [ 0.0, 0.0, 0.0, 0.125, 1.0, 1.0 ] ); expectedA = new Float64Array([ 0.0, 0.0, @@ -1549,7 +1549,7 @@ tape( 'the function returns expected values for job = both with complex input (r out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 0.0, 0.0 ] ); + expectedOut = new Int32Array( [ 0, 0 ] ); expectedScale = new Float64Array( [ 0.0, 1.0, 2.0 ] ); expectedA = new Float64Array([ 1.0, 1.0, 0.0, @@ -1583,7 +1583,7 @@ tape( 'the function returns expected values for job = both with complex input (c out = new Int32Array( 3 ); scale = new Float64Array( 6 ); - expectedOut = new Float64Array( [ 0.0, 0.0, 0.0 ] ); + expectedOut = new Int32Array( [ 0.0, 0.0, 0.0 ] ); expectedScale = new Float64Array( [ 0.0, 0.0, 0.0, 0.0, 1.0, 2.0 ] ); expectedA = new Float64Array([ 0.0, 0.0, @@ -1618,7 +1618,7 @@ tape( 'the function returns expected values for job = both with complex input (r out = new Int32Array( 3 ); scale = new Float64Array( 6 ); - expectedOut = new Float64Array( [ 0.0, 1.0, 2.0 ] ); + expectedOut = new Int32Array( [ 0.0, 1.0, 2.0 ] ); expectedScale = new Float64Array( [ 0.0, 0.0, 0.0, 1.0, 0.5, 1.0 ] ); expectedA = new Float64Array([ 0.0, 0.0, @@ -1653,7 +1653,7 @@ tape( 'the function returns expected values for job = both with complex input (c out = new Int32Array( 3 ); scale = new Float64Array( 6 ); - expectedOut = new Float64Array( [ 0.0, 1.0, 2.0 ] ); + expectedOut = new Int32Array( [ 0.0, 1.0, 2.0 ] ); expectedScale = new Float64Array( [ 0.0, 0.0, 0.0, 1.0, 0.5, 1.0 ] ); expectedA = new Float64Array([ 0.0, 0.0, @@ -1688,7 +1688,7 @@ tape( 'the function returns expected values for job = scale with zero norm (row- out = new Int32Array( 3 ); scale = new Float64Array( 6 ); - expectedOut = new Float64Array( [ 0.0, 0.0, 2.0 ] ); + expectedOut = new Int32Array( [ 0.0, 0.0, 2.0 ] ); expectedScale = new Float64Array( [ 0.0, 0.0, 0.0, 1.0, 1.0, 1.0 ] ); expectedA = new Float64Array([ 0.0, 0.0, @@ -1723,7 +1723,7 @@ tape( 'the function returns expected values for job = scale with zero norm (colu out = new Int32Array( 3 ); scale = new Float64Array( 6 ); - expectedOut = new Float64Array( [ 0.0, 0.0, 2.0 ] ); + expectedOut = new Int32Array( [ 0.0, 0.0, 2.0 ] ); expectedScale = new Float64Array( [ 0.0, 0.0, 0.0, 1.0, 1.0, 1.0 ] ); expectedA = new Float64Array([ 0.0, 0.0, @@ -1759,7 +1759,7 @@ tape( 'the function returns expected values for job = scale with small values (r out = new Int32Array( 3 ); scale = new Float64Array( 7 ); - expectedOut = new Float64Array( [ 0.0, 0.0, 3.0 ] ); + expectedOut = new Int32Array( [ 0.0, 0.0, 3.0 ] ); expectedScale = new Float64Array( [ 0.0, 0.0, 0.0, 4096.0, 128.0, 128.0, 1.0 ] ); // eslint-disable-line max-len expectedA = new Float64Array([ 0.0, 0.0, @@ -1796,7 +1796,7 @@ tape( 'the function returns expected values for job = scale with small values (c out = new Int32Array( 3 ); scale = new Float64Array( 7 ); - expectedOut = new Float64Array( [ 0.0, 0.0, 3.0 ] ); + expectedOut = new Int32Array( [ 0.0, 0.0, 3.0 ] ); expectedScale = new Float64Array( [ 0.0, 0.0, 0.0, 4096.0, 128.0, 128.0, 1.0 ] ); // eslint-disable-line max-len expectedA = new Float64Array([ 0.0, 0.0, @@ -1831,7 +1831,7 @@ tape( 'the function returns expected values for job = none (row-major) (mixed st out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 0.0, 2.0 ] ); + expectedOut = new Int32Array( [ 0, 2 ] ); expectedScale = new Float64Array( [ 1.0, 1.0, 1.0 ] ); expectedA = new Float64Array([ @@ -1871,7 +1871,7 @@ tape( 'the function returns expected values for job = none (column-major) (mixed out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 0.0, 2.0 ] ); + expectedOut = new Int32Array( [ 0, 2 ] ); expectedScale = new Float64Array( [ 1.0, 1.0, 1.0 ] ); expectedA = new Float64Array([ 7.0, 4.0, 1.0, @@ -1904,7 +1904,7 @@ tape( 'the function returns expected values for job = permute (row-major) (mixed out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 0.0, 1.0 ] ); + expectedOut = new Int32Array( [ 0, 1 ] ); expectedScale = new Float64Array( [ 1.0, 1.0, 1.0 ] ); expectedA = new Float64Array([ 0.0, 2.0, 1.0, @@ -1937,7 +1937,7 @@ tape( 'the function returns expected values for job = permute (column-major) (mi out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 0.0, 1.0 ] ); + expectedOut = new Int32Array( [ 0, 1 ] ); expectedScale = new Float64Array( [ 1.0, 1.0, 1.0 ] ); expectedA = new Float64Array([ 0.0, 3.0, 1.0, @@ -1970,7 +1970,7 @@ tape( 'the function returns expected values for job = scale (row-major) (mixed s out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 0.0, 2.0 ] ); + expectedOut = new Int32Array( [ 0, 2 ] ); expectedScale = new Float64Array( [ 1.0, 0.125, 0.125 ] ); expectedA = new Float64Array([ 2.0, 2.0, 16.0, @@ -2004,7 +2004,7 @@ tape( 'the function returns expected values for job = scale (column-major) (mixe out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 0.0, 2.0 ] ); + expectedOut = new Int32Array( [ 0, 2 ] ); expectedScale = new Float64Array( [ 1.0, 0.125, 0.125 ] ); expectedA = new Float64Array([ 2.0, 2.0, 16.0, @@ -2038,7 +2038,7 @@ tape( 'the function returns expected values for job = both (row-major) (mixed st out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 0.0, 1.0 ] ); + expectedOut = new Int32Array( [ 0, 1 ] ); expectedScale = new Float64Array( [ 0.125, 1.0, 1.0 ] ); expectedA = new Float64Array([ 0.0, 16.0, 1.0, @@ -2071,7 +2071,7 @@ tape( 'the function returns expected values for job = both (column-major) (mixed out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 0.0, 1.0 ] ); + expectedOut = new Int32Array( [ 0, 1 ] ); expectedScale = new Float64Array( [ 0.125, 1.0, 1.0 ] ); expectedA = new Float64Array([ 0.0, 12.5, 1.0, @@ -2104,7 +2104,7 @@ tape( 'the function returns expected values for job = both with complex input (r out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 0.0, 0.0 ] ); + expectedOut = new Int32Array( [ 0, 0 ] ); expectedScale = new Float64Array( [ 0.0, 1.0, 2.0 ] ); expectedA = new Float64Array([ 0.0, 1.0, 1.0, @@ -2137,7 +2137,7 @@ tape( 'the function returns expected values for job = both with complex input (c out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 0.0, 0.0 ] ); + expectedOut = new Int32Array( [ 0, 0 ] ); expectedScale = new Float64Array( [ 0.0, 1.0, 2.0 ] ); expectedA = new Float64Array([ 0.0, 0.0, 1.0, @@ -2170,7 +2170,7 @@ tape( 'the function returns expected values for job = both with complex input (r out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 1.0, 2.0 ] ); + expectedOut = new Int32Array( [ 1, 2 ] ); expectedScale = new Float64Array( [ 1.0, 0.5, 1.0 ] ); expectedA = new Float64Array([ 5.0, 1.5, 4.0, @@ -2203,7 +2203,7 @@ tape( 'the function returns expected values for job = both with complex input (c out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 1.0, 2.0 ] ); + expectedOut = new Int32Array( [ 1, 2 ] ); expectedScale = new Float64Array( [ 1.0, 0.5, 1.0 ] ); expectedA = new Float64Array([ 0.0, 0.0, 4.0, @@ -2235,7 +2235,7 @@ tape( 'the function returns expected values for job = scale with zero norm (row- out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 0.0, 2.0 ] ); + expectedOut = new Int32Array( [ 0, 2 ] ); expectedScale = new Float64Array( [ 1.0, 1.0, 1.0 ] ); expectedA = new Float64Array([ 4.0, 0.0, 1.0, @@ -2268,7 +2268,7 @@ tape( 'the function returns expected values for job = scale with zero norm (colu out = new Int32Array( 2 ); scale = new Float64Array( 3 ); - expectedOut = new Float64Array( [ 0.0, 2.0 ] ); + expectedOut = new Int32Array( [ 0, 2 ] ); expectedScale = new Float64Array( [ 1.0, 1.0, 1.0 ] ); expectedA = new Float64Array([ 3.0, 2.0, 1.0, @@ -2301,7 +2301,7 @@ tape( 'the function returns expected values for job = none (row-major) (large st out = new Int32Array( 4 ); scale = new Float64Array( 6 ); - expectedOut = new Float64Array( [ 0.0, 0.0, 2.0, 0.0 ] ); + expectedOut = new Int32Array( [ 0.0, 0.0, 2.0, 0.0 ] ); expectedScale = new Float64Array( [ 1.0, 0.0, 1.0, 0.0, 1.0, 0.0 ] ); expectedA = new Float64Array([ 1.0, 9999.0, 2.0, 9999.0, 3.0, 9999.0, @@ -2334,7 +2334,7 @@ tape( 'the function returns expected values for job = none (column-major) (large out = new Int32Array( 4 ); scale = new Float64Array( 6 ); - expectedOut = new Float64Array( [ 0.0, 0.0, 2.0, 0.0 ] ); + expectedOut = new Int32Array( [ 0.0, 0.0, 2.0, 0.0 ] ); expectedScale = new Float64Array( [ 1.0, 0.0, 1.0, 0.0, 1.0, 0.0 ] ); expectedA = new Float64Array([ 1.0, 9999.0, 4.0, 9999.0, 7.0, 9999.0, @@ -2367,7 +2367,7 @@ tape( 'the function returns expected values for job = permute (row-major) (large out = new Int32Array( 4 ); scale = new Float64Array( 6 ); - expectedOut = new Float64Array( [ 0.0, 0.0, 1.0, 0.0 ] ); + expectedOut = new Int32Array( [ 0.0, 0.0, 1.0, 0.0 ] ); expectedScale = new Float64Array( [ 1.0, 0.0, 1.0, 0.0, 1.0, 0.0 ] ); expectedA = new Float64Array([ 1.0, 9999.0, 2.0, 9999.0, 0.0, 9999.0, @@ -2400,7 +2400,7 @@ tape( 'the function returns expected values for job = permute (column-major) (la out = new Int32Array( 4 ); scale = new Float64Array( 6 ); - expectedOut = new Float64Array( [ 0.0, 0.0, 1.0, 0.0 ] ); + expectedOut = new Int32Array( [ 0.0, 0.0, 1.0, 0.0 ] ); expectedScale = new Float64Array( [ 1.0, 0.0, 1.0, 0.0, 1.0, 0.0 ] ); expectedA = new Float64Array([ 1.0, 9999.0, 3.0, 9999.0, 0.0, 9999.0, @@ -2433,7 +2433,7 @@ tape( 'the function returns expected values for job = scale (row-major) (large s out = new Int32Array( 4 ); scale = new Float64Array( 6 ); - expectedOut = new Float64Array( [ 0.0, 0.0, 2.0, 0.0 ] ); + expectedOut = new Int32Array( [ 0.0, 0.0, 2.0, 0.0 ] ); expectedScale = new Float64Array( [ 1.0, 0.0, 0.125, 0.0, 0.125, 0.0 ] ); expectedA = new Float64Array([ 16.0, 9999.0, 2.0, 9999.0, 2.0, 9999.0, @@ -2466,7 +2466,7 @@ tape( 'the function returns expected values for job = scale (column-major) (larg out = new Int32Array( 4 ); scale = new Float64Array( 6 ); - expectedOut = new Float64Array( [ 0.0, 0.0, 2.0, 0.0 ] ); + expectedOut = new Int32Array( [ 0.0, 0.0, 2.0, 0.0 ] ); expectedScale = new Float64Array( [ 1.0, 0.0, 0.125, 0.0, 0.125, 0.0 ] ); expectedA = new Float64Array([ 16.0, 9999.0, 2.0, 9999.0, 2.0, 9999.0, @@ -2499,7 +2499,7 @@ tape( 'the function returns expected values for job = both (row-major) (large st out = new Int32Array( 4 ); scale = new Float64Array( 6 ); - expectedOut = new Float64Array( [ 0.0, 0.0, 1.0, 0.0 ] ); + expectedOut = new Int32Array( [ 0.0, 0.0, 1.0, 0.0 ] ); expectedScale = new Float64Array( [ 0.125, 0.0, 1.0, 0.0, 1.0, 0.0 ] ); expectedA = new Float64Array([ 1.0, 9999.0, 16.0, 9999.0, 0.0, 9999.0, @@ -2532,7 +2532,7 @@ tape( 'the function returns expected values for job = both (column-major) (large out = new Int32Array( 4 ); scale = new Float64Array( 6 ); - expectedOut = new Float64Array( [ 0.0, 0.0, 1.0, 0.0 ] ); + expectedOut = new Int32Array( [ 0.0, 0.0, 1.0, 0.0 ] ); expectedScale = new Float64Array( [ 0.125, 0.0, 1.0, 0.0, 1.0, 0.0 ] ); expectedA = new Float64Array([ 1.0, 9999.0, 12.5, 9999.0, 0.0, 9999.0, @@ -2566,7 +2566,7 @@ tape( 'the function returns expected values for job = both with complex input (r out = new Int32Array( 4 ); scale = new Float64Array( 6 ); - expectedOut = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + expectedOut = new Int32Array( [ 0.0, 0.0, 0.0, 0.0 ] ); expectedScale = new Float64Array( [ 0.0, 0.0, 1.0, 0.0, 2.0, 0.0 ] ); expectedA = new Float64Array([ 1.0, 9999.0, 1.0, 9999.0, 0.0, 9999.0, @@ -2599,7 +2599,7 @@ tape( 'the function returns expected values for job = both with complex input (c out = new Int32Array( 4 ); scale = new Float64Array( 6 ); - expectedOut = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] ); + expectedOut = new Int32Array( [ 0.0, 0.0, 0.0, 0.0 ] ); expectedScale = new Float64Array( [ 0.0, 0.0, 1.0, 0.0, 2.0, 0.0 ] ); expectedA = new Float64Array([ 1.0, 9999.0, 0.0, 9999.0, 0.0, 9999.0, @@ -2632,7 +2632,7 @@ tape( 'the function returns expected values for job = both with complex input (r out = new Int32Array( 4 ); scale = new Float64Array( 6 ); - expectedOut = new Float64Array( [ 1.0, 0.0, 2.0, 0.0 ] ); + expectedOut = new Int32Array( [ 1.0, 0.0, 2.0, 0.0 ] ); expectedScale = new Float64Array( [ 1.0, 0.0, 0.5, 0.0, 1.0, 0.0 ] ); expectedA = new Float64Array([ 4.0, 9999.0, 1.5, 9999.0, 5.0, 9999.0, @@ -2665,7 +2665,7 @@ tape( 'the function returns expected values for job = both with complex input (c out = new Int32Array( 4 ); scale = new Float64Array( 6 ); - expectedOut = new Float64Array( [ 1.0, 0.0, 2.0, 0.0 ] ); + expectedOut = new Int32Array( [ 1.0, 0.0, 2.0, 0.0 ] ); expectedScale = new Float64Array( [ 1.0, 0.0, 0.5, 0.0, 1.0, 0.0 ] ); expectedA = new Float64Array([ 4.0, 9999.0, 0.0, 9999.0, 0.0, 9999.0, @@ -2698,7 +2698,7 @@ tape( 'the function returns expected values for job = scale with zero norm (row- out = new Int32Array( 4 ); scale = new Float64Array( 6 ); - expectedOut = new Float64Array( [ 0.0, 0.0, 2.0, 0.0 ] ); + expectedOut = new Int32Array( [ 0.0, 0.0, 2.0, 0.0 ] ); expectedScale = new Float64Array( [ 1.0, 0.0, 1.0, 0.0, 1.0, 0.0 ] ); expectedA = new Float64Array([ 1.0, 9999.0, 0.0, 9999.0, 4.0, 9999.0, @@ -2731,7 +2731,7 @@ tape( 'the function returns expected values for job = scale with zero norm (colu out = new Int32Array( 4 ); scale = new Float64Array( 6 ); - expectedOut = new Float64Array( [ 0.0, 0.0, 2.0, 0.0 ] ); + expectedOut = new Int32Array( [ 0.0, 0.0, 2.0, 0.0 ] ); expectedScale = new Float64Array( [ 1.0, 0.0, 1.0, 0.0, 1.0, 0.0 ] ); expectedA = new Float64Array([ 1.0, 9999.0, 2.0, 9999.0, 3.0, 9999.0, From ee1d3a16ed39890bfc6499e07d3c50d4bec98f52 Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Fri, 16 May 2025 09:15:48 +0000 Subject: [PATCH 27/43] chore: cleanupp --- 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 --- --- lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js | 2 +- lib/node_modules/@stdlib/lapack/base/dgebal/lib/dgebal.js | 2 +- lib/node_modules/@stdlib/lapack/base/dgebal/lib/index.js | 4 ++-- lib/node_modules/@stdlib/lapack/base/dgebal/lib/ndarray.js | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js index 3cc2e0d9cc54..ef2c1f533e33 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js @@ -74,7 +74,7 @@ var dscal = require( '@stdlib/blas/base/dscal' ).ndarray; * * dgebal( 'both', 3, A, 3, 1, 0, out, 1, 0, scale, 1, 0 ); * // A => [ 1, 12.5, 0, 16, 200, 0, 0, 0, 3 ] -* // out => [ 0, 1 ] +* // out => [ 0, 1 ] * // scale => [ 8, 1, 2 ] */ function dgebal( job, N, A, strideA1, strideA2, offsetA, out, strideOut, offsetOut, scale, strideScale, offsetScale ) { diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/dgebal.js b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/dgebal.js index fc6407aea67f..e1f085f37c60 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/dgebal.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/dgebal.js @@ -64,7 +64,7 @@ var base = require( './base.js' ); * * dgebal( 'row-major', 'both', 3, A, 3, out, scale ); * // A => [ 1, 12.5, 0, 16, 200, 0, 0, 0, 3 ] -* // out => [ 0, 1 ] +* // out => [ 0, 1 ] * // scale => [ 8, 1, 2 ] */ function dgebal( order, job, N, A, LDA, out, scale ) { diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/index.js b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/index.js index 3e34377a28dc..313d8d886867 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/index.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/index.js @@ -34,7 +34,7 @@ * * dgebal( 'row-major', 'both', 3, A, 3, out, scale ); * // A => [ 1, 12.5, 0, 16, 200, 0, 0, 0, 3 ] -* // out => [ 0, 1 ] +* // out => [ 0, 1 ] * // scale => [ 8, 1, 2 ] * * @example @@ -48,7 +48,7 @@ * * dgebal.ndarray( 'both', 3, A, 3, 1, 0, out, 1, 0, scale, 1, 0 ); * // A => [ 1, 12.5, 0, 16, 200, 0, 0, 0, 3 ] -* // out => [ 0, 1 ] +* // out => [ 0, 1 ] * // scale => [ 8, 1, 2 ] */ diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/ndarray.js b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/ndarray.js index babaa6a7db62..7fda7ff8ce61 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/ndarray.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/ndarray.js @@ -65,7 +65,7 @@ var base = require( './base.js' ); * * dgebal( 'both', 3, A, 3, 1, 0, out, 1, 0, scale, 1, 0 ); * // A => [ 1, 12.5, 0, 16, 200, 0, 0, 0, 3 ] -* // out => [ 0, 1 ] +* // out => [ 0, 1 ] * // scale => [ 8, 1, 2 ] */ function dgebal( job, N, A, strideA1, strideA2, offsetA, out, strideOut, offsetOut, scale, strideScale, offsetScale ) { // eslint-disable-line max-len, max-params From eb38b48adbff78f30bb993f403eb2ab347502a9a Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Fri, 16 May 2025 10:10:28 +0000 Subject: [PATCH 28/43] docs: update docs --- 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 --- --- lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js | 8 +++++++- .../@stdlib/lapack/base/dgebal/lib/dgebal.js | 9 ++++++++- .../@stdlib/lapack/base/dgebal/lib/ndarray.js | 9 ++++++++- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js index ef2c1f533e33..c9f137a942ed 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js @@ -47,7 +47,13 @@ var dscal = require( '@stdlib/blas/base/dscal' ).ndarray; * - 'scale': scale only * - 'both': both permute and scale * -* The matrix `A` is overwritten by the balanced matrix. Scale factors are stored in the `scale` array. +* The matrix `A` is overwritten by the balanced matrix. Scale factors are stored in the `scale` array. If `P[ j ]` is the index of the row and column interchanged with row and column j (zero-based) and `D[ j ]` is the scaling factor applied to row and column j, then: +* +* - `scale[ j ]` = `P[ j ]` for j = `0`,...,`out[ 0 ]-1` +* - `scale[ j ]` = `D[ j ]` for j = `out[ 0 ]`,...,`out[ 1 ]` +* - `scale[ j ]` = `P[ j ]` for j = `out[ 1 ]+1`,...,`N-1`. +* +* The order in which the interchanges are made is `N-1` to `out[ 1 ]+1`, then `0` to `out[ 0 ]-1`. * * @private * @param {string} job - indicates the operations to be performed diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/dgebal.js b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/dgebal.js index e1f085f37c60..08d21c369f6a 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/dgebal.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/dgebal.js @@ -39,7 +39,14 @@ var base = require( './base.js' ); * - 'permute': permute only * - 'scale': scale only * - 'both': both permute and scale -* - The matrix `A` is overwritten by the balanced matrix. +* +* The matrix `A` is overwritten by the balanced matrix. Scale factors are stored in the `scale` array. If `P[ j ]` is the index of the row and column interchanged with row and column j (zero-based) and `D[ j ]` is the scaling factor applied to row and column j, then: +* +* - `scale[ j ]` = `P[ j ]` for j = `0`,...,`out[ 0 ]-1` +* - `scale[ j ]` = `D[ j ]` for j = `out[ 0 ]`,...,`out[ 1 ]` +* - `scale[ j ]` = `P[ j ]` for j = `out[ 1 ]+1`,...,`N-1`. +* +* The order in which the interchanges are made is `N-1` to `out[ 1 ]+1`, then `0` to `out[ 0 ]-1`. * * @private * @param {string} order - storage layout of `A` diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/ndarray.js b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/ndarray.js index 7fda7ff8ce61..b1023b994589 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/ndarray.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/ndarray.js @@ -37,7 +37,14 @@ var base = require( './base.js' ); * - 'permute': permute only * - 'scale': scale only * - 'both': both permute and scale -* - The matrix `A` is overwritten by the balanced matrix. +* +* The matrix `A` is overwritten by the balanced matrix. Scale factors are stored in the `scale` array. If `P[ j ]` is the index of the row and column interchanged with row and column j (zero-based) and `D[ j ]` is the scaling factor applied to row and column j, then: +* +* - `scale[ j ]` = `P[ j ]` for j = `0`,...,`out[ 0 ]-1` +* - `scale[ j ]` = `D[ j ]` for j = `out[ 0 ]`,...,`out[ 1 ]` +* - `scale[ j ]` = `P[ j ]` for j = `out[ 1 ]+1`,...,`N-1`. +* +* The order in which the interchanges are made is `N-1` to `out[ 1 ]+1`, then `0` to `out[ 0 ]-1`. * * @private * @param {string} job - indicates the operations to be performed From b516efdd163381bbf30715e99a39c90f3c0aa83e Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Fri, 16 May 2025 11:00:04 +0000 Subject: [PATCH 29/43] docs: add ts declaration file --- 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: 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 --- --- .../lapack/base/dgebal/docs/types/index.d.ts | 208 ++++++++++++++++++ 1 file changed, 208 insertions(+) create mode 100644 lib/node_modules/@stdlib/lapack/base/dgebal/docs/types/index.d.ts diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/docs/types/index.d.ts b/lib/node_modules/@stdlib/lapack/base/dgebal/docs/types/index.d.ts new file mode 100644 index 000000000000..2857c648f422 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/docs/types/index.d.ts @@ -0,0 +1,208 @@ +/** +* @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 } from '@stdlib/types/blas'; + +/** +* Status code. +* +* ## Notes +* +* The status code indicates the following conditions: +* +* - if equal to zero, then the factorization was successful. +*/ +type StatusCode = number; + +/** +* Job parameter. +* +* ## Notes +* +* The job parameter can be one of the following: +* +* - 'none': none, return immediately +* - 'permute': permute only +* - 'scale': scale only +* - 'both': both permute and scale +*/ +type Job = 'none' | 'permute' | 'scale' | 'both'; + +/** +* Interface describing `dgebal`. +*/ +interface Routine { + /** + * Balances a general real matrix `A`. + * + * ## Notes + * + * The job parameter can be one of the following: + * + * - 'none': none, return immediately + * - 'permute': permute only + * - 'scale': scale only + * - 'both': both permute and scale + * + * The matrix `A` is overwritten by the balanced matrix. Scale factors are stored in the `scale` array. If `P[ j ]` is the index of the row and column interchanged with row and column j (zero-based) and `D[ j ]` is the scaling factor applied to row and column j, then: + * + * - `scale[ j ]` = `P[ j ]` for j = `0`,...,`out[ 0 ]-1` + * - `scale[ j ]` = `D[ j ]` for j = `out[ 0 ]`,...,`out[ 1 ]` + * - `scale[ j ]` = `P[ j ]` for j = `out[ 1 ]+1`,...,`N-1`. + * + * The order in which the interchanges are made is `N-1` to `out[ 1 ]+1`, then `0` to `out[ 0 ]-1`. + * + * @param order - storage layout of `A` + * @param job - indicates the operations to be performed + * @param N - number of rows/columns in matrix `A` + * @param A - input matrix to be balanced + * @param LDA - leading dimension of `A` + * @param out - stores the first and last row/column of the balanced submatrix + * @param scale - array containing permutation and scaling information + * @returns status code + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * var Int32Array = require( '@stdlib/array/int32' ); + * + * var A = new Float64Array( [ 1.0, 100.0, 0.0, 2.0, 200.0, 0.0, 0.0, 0.0, 3.0 ] ); + * var out = new Int32Array( 2 ); + * var scale = new Float64Array( 3 ); + * + * dgebal( 'row-major', 'both', 3, A, 3, out, scale ); + * // A => [ 1, 12.5, 0, 16, 200, 0, 0, 0, 3 ] + * // out => [ 0, 1 ] + * // scale => [ 8, 1, 2 ] + */ + ( order: Layout, job: Job, N: number, A: Float64Array, LDA: number, out: Int32Array, scale: Float64Array ): StatusCode; + + /** + * Balances a general real matrix `A` using alternative indexing semantics. + * + * ## Notes + * + * The job parameter can be one of the following: + * + * - 'none': none, return immediately + * - 'permute': permute only + * - 'scale': scale only + * - 'both': both permute and scale + * + * The matrix `A` is overwritten by the balanced matrix. Scale factors are stored in the `scale` array. If `P[ j ]` is the index of the row and column interchanged with row and column j (zero-based) and `D[ j ]` is the scaling factor applied to row and column j, then: + * + * - `scale[ j ]` = `P[ j ]` for j = `0`,...,`out[ 0 ]-1` + * - `scale[ j ]` = `D[ j ]` for j = `out[ 0 ]`,...,`out[ 1 ]` + * - `scale[ j ]` = `P[ j ]` for j = `out[ 1 ]+1`,...,`N-1`. + * + * The order in which the interchanges are made is `N-1` to `out[ 1 ]+1`, then `0` to `out[ 0 ]-1`. + * + * @param job - indicates the operations to be performed + * @param N - number of rows/columns in matrix `A` + * @param A - input matrix to be balanced + * @param strideA1 - stride of the first dimension of `A` + * @param strideA2 - stride of the second dimension of `A` + * @param offsetA - starting index for `A` + * @param out - stores the first and last row/column of the balanced submatrix + * @param strideOut - stride of `out` + * @param offsetOut - starting index for `out` + * @param scale - array containing permutation and scaling information + * @param strideScale - stride of `scale` + * @param offsetScale - starting index for `scale` + * @returns status code + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * var Int32Array = require( '@stdlib/array/int32' ); + * + * var A = new Float64Array( [ 1.0, 100.0, 0.0, 2.0, 200.0, 0.0, 0.0, 0.0, 3.0 ] ); + * var out = new Int32Array( 2 ); + * var scale = new Float64Array( 3 ); + * + * dgebal.ndarray( 'both', 3, A, 3, 1, 0, out, 1, 0, scale, 1, 0 ); + * // A => [ 1, 12.5, 0, 16, 200, 0, 0, 0, 3 ] + * // out => [ 0, 1 ] + * // scale => [ 8, 1, 2 ] + */ + ndarray( job: Job, N: number, A: Float64Array, strideA1: number, strideA2: number, offsetA: number, out: Int32Array, strideOut: number, offsetOut: number, scale: Float64Array, strideScale: number, offsetScale: number ): StatusCode; +} + +/** +* Balances a general real matrix `A`. +* +* ## Notes +* +* The job parameter can be one of the following: +* +* - 'none': none, return immediately +* - 'permute': permute only +* - 'scale': scale only +* - 'both': both permute and scale +* +* The matrix `A` is overwritten by the balanced matrix. Scale factors are stored in the `scale` array. If `P[ j ]` is the index of the row and column interchanged with row and column j (zero-based) and `D[ j ]` is the scaling factor applied to row and column j, then: +* +* - `scale[ j ]` = `P[ j ]` for j = `0`,...,`out[ 0 ]-1` +* - `scale[ j ]` = `D[ j ]` for j = `out[ 0 ]`,...,`out[ 1 ]` +* - `scale[ j ]` = `P[ j ]` for j = `out[ 1 ]+1`,...,`N-1`. +* +* The order in which the interchanges are made is `N-1` to `out[ 1 ]+1`, then `0` to `out[ 0 ]-1`. +* +* @param order - storage layout of `A` +* @param job - indicates the operations to be performed +* @param N - number of rows/columns in matrix `A` +* @param A - input matrix to be balanced +* @param LDA - leading dimension of `A` +* @param out - stores the first and last row/column of the balanced submatrix +* @param scale - array containing permutation and scaling information +* @returns status code +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var Int32Array = require( '@stdlib/array/int32' ); +* +* var A = new Float64Array( [ 1.0, 100.0, 0.0, 2.0, 200.0, 0.0, 0.0, 0.0, 3.0 ] ); +* var out = new Int32Array( 2 ); +* var scale = new Float64Array( 3 ); +* +* dgebal( 'row-major', 'both', 3, A, 3, out, scale ); +* // A => [ 1, 12.5, 0, 16, 200, 0, 0, 0, 3 ] +* // out => [ 0, 1 ] +* // scale => [ 8, 1, 2 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var Int32Array = require( '@stdlib/array/int32' ); +* +* var A = new Float64Array( [ 1.0, 100.0, 0.0, 2.0, 200.0, 0.0, 0.0, 0.0, 3.0 ] ); +* var out = new Int32Array( 2 ); +* var scale = new Float64Array( 3 ); +* +* dgebal.ndarray( 'both', 3, A, 3, 1, 0, out, 1, 0, scale, 1, 0 ); +* // A => [ 1, 12.5, 0, 16, 200, 0, 0, 0, 3 ] +* // out => [ 0, 1 ] +* // scale => [ 8, 1, 2 ] +*/ +declare var dgebal: Routine; + + +// EXPORTS // + +export = dgebal; From 3f05266721ff06c9db64bbe63df1584775d14bdc Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Fri, 16 May 2025 14:17:29 +0000 Subject: [PATCH 30/43] test: add ts test file --- 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: 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: passed - task: lint_license_headers status: passed --- --- .../lapack/base/dgebal/docs/types/test.ts | 379 ++++++++++++++++++ 1 file changed, 379 insertions(+) create mode 100644 lib/node_modules/@stdlib/lapack/base/dgebal/docs/types/test.ts diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/docs/types/test.ts b/lib/node_modules/@stdlib/lapack/base/dgebal/docs/types/test.ts new file mode 100644 index 000000000000..2acfedbd413e --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/docs/types/test.ts @@ -0,0 +1,379 @@ +/* +* @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 dgebal = require( './index' ); + + +// TESTS // + +// The function returns a number... +{ + const A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + const out = new Int32Array( 2 ); + const scale = new Float64Array( 2 ); + + dgebal( 'row-major', 'both', 2, A, 2, out, scale ); // $ExpectType number +} + +// The compiler throws an error if the function is provided a first argument which is not a string... +{ + const A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + const out = new Int32Array( 2 ); + const scale = new Float64Array( 2 ); + + dgebal( 5, 'both', 2, A, 2, out, scale ); // $ExpectError + dgebal( true, 'both', 2, A, 2, out, scale ); // $ExpectError + dgebal( false, 'both', 2, A, 2, out, scale ); // $ExpectError + dgebal( null, 'both', 2, A, 2, out, scale ); // $ExpectError + dgebal( void 0, 'both', 2, A, 2, out, scale ); // $ExpectError + dgebal( [], 'both', 2, A, 2, out, scale ); // $ExpectError + dgebal( {}, 'both', 2, A, 2, out, scale ); // $ExpectError + dgebal( ( x: number ): number => x, 'both', 2, A, 2, out, scale ); // $ExpectError +} + +// The compiler throws an error if the function is provided a second argument which is not a string... +{ + const A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + const out = new Int32Array( 2 ); + const scale = new Float64Array( 2 ); + + dgebal( 'row-major', 5, 2, A, 2, out, scale ); // $ExpectError + dgebal( 'row-major', true, 2, A, 2, out, scale ); // $ExpectError + dgebal( 'row-major', false, 2, A, 2, out, scale ); // $ExpectError + dgebal( 'row-major', null, 2, A, 2, out, scale ); // $ExpectError + dgebal( 'row-major', void 0, 2, A, 2, out, scale ); // $ExpectError + dgebal( 'row-major', [], 2, A, 2, out, scale ); // $ExpectError + dgebal( 'row-major', {}, 2, A, 2, out, scale ); // $ExpectError + dgebal( 'row-major', ( x: number ): number => x, 2, A, 2, out, scale ); // $ExpectError +} + + +// The compiler throws an error if the function is provided a third argument which is not a number... +{ + const A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + const out = new Int32Array( 2 ); + const scale = new Float64Array( 2 ); + + dgebal( 'row-major', 'both', '5', A, 2, out, scale ); // $ExpectError + dgebal( 'row-major', 'both', true, A, 2, out, scale ); // $ExpectError + dgebal( 'row-major', 'both', false, A, 2, out, scale ); // $ExpectError + dgebal( 'row-major', 'both', null, A, 2, out, scale ); // $ExpectError + dgebal( 'row-major', 'both', void 0, A, 2, out, scale ); // $ExpectError + dgebal( 'row-major', 'both', [], A, 2, out, scale ); // $ExpectError + dgebal( 'row-major', 'both', {}, A, 2, out, scale ); // $ExpectError + dgebal( 'row-major', 'both', ( x: number ): number => x, A, 2, out, scale ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fourth argument which is not a Float64Array... +{ + const out = new Int32Array( 2 ); + const scale = new Float64Array( 2 ); + + dgebal( 'row-major', 'both', 2, '5', 2, out, scale ); // $ExpectError + dgebal( 'row-major', 'both', 2, 5, 2, out, scale ); // $ExpectError + dgebal( 'row-major', 'both', 2, true, 2, out, scale ); // $ExpectError + dgebal( 'row-major', 'both', 2, false, 2, out, scale ); // $ExpectError + dgebal( 'row-major', 'both', 2, null, 2, out, scale ); // $ExpectError + dgebal( 'row-major', 'both', 2, void 0, 2, out, scale ); // $ExpectError + dgebal( 'row-major', 'both', 2, [], 2, out, scale ); // $ExpectError + dgebal( 'row-major', 'both', 2, {}, 2, out, scale ); // $ExpectError + dgebal( 'row-major', 'both', 2, ( x: number ): number => x, 2, out, scale ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fifth argument which is not a number... +{ + const out = new Int32Array( 2 ); + const scale = new Float64Array( 2 ); + const A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + + dgebal( 'row-major', 'both', 2, A, '5', out, scale ); // $ExpectError + dgebal( 'row-major', 'both', 2, A, true, out, scale ); // $ExpectError + dgebal( 'row-major', 'both', 2, A, false, out, scale ); // $ExpectError + dgebal( 'row-major', 'both', 2, A, null, out, scale ); // $ExpectError + dgebal( 'row-major', 'both', 2, A, void 0, out, scale ); // $ExpectError + dgebal( 'row-major', 'both', 2, A, [], out, scale ); // $ExpectError + dgebal( 'row-major', 'both', 2, A, {}, out, scale ); // $ExpectError + dgebal( 'row-major', 'both', 2, A, ( x: number ): number => x, out, scale ); // $ExpectError +} + +// The compiler throws an error if the function is provided a sixth argument which is not a Int32Array... +{ + const A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + const scale = new Float64Array( 2 ); + + dgebal( 'row-major', 'both', 2, A, 2, '5', scale ); // $ExpectError + dgebal( 'row-major', 'both', 2, A, 2, true, scale ); // $ExpectError + dgebal( 'row-major', 'both', 2, A, 2, false, scale ); // $ExpectError + dgebal( 'row-major', 'both', 2, A, 2, null, scale ); // $ExpectError + dgebal( 'row-major', 'both', 2, A, 2, void 0, scale ); // $ExpectError + dgebal( 'row-major', 'both', 2, A, 2, [], scale ); // $ExpectError + dgebal( 'row-major', 'both', 2, A, 2, {}, scale ); // $ExpectError + dgebal( 'row-major', 'both', 2, A, 2, ( x: number ): number => x, scale ); // $ExpectError +} + +// The compiler throws an error if the function is provided a seventh argument which is not a Float64Array... +{ + const A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + const out = new Int32Array( 2 ); + + dgebal( 'row-major', 'both', 2, A, 2, out, '5' ); // $ExpectError + dgebal( 'row-major', 'both', 2, A, 2, out, true ); // $ExpectError + dgebal( 'row-major', 'both', 2, A, 2, out, false ); // $ExpectError + dgebal( 'row-major', 'both', 2, A, 2, out, null ); // $ExpectError + dgebal( 'row-major', 'both', 2, A, 2, out, void 0 ); // $ExpectError + dgebal( 'row-major', 'both', 2, A, 2, out, [] ); // $ExpectError + dgebal( 'row-major', 'both', 2, A, 2, out, {} ); // $ExpectError + dgebal( 'row-major', 'both', 2, A, 2, out, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + const A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + const out = new Int32Array( 2 ); + const scale = new Float64Array( 2 ); + + dgebal(); // $ExpectError + dgebal( 'row-major' ); // $ExpectError + dgebal( 'row-major', 'both' ); // $ExpectError + dgebal( 'row-major', 'both', 2 ); // $ExpectError + dgebal( 'row-major', 'both', 2, A ); // $ExpectError + dgebal( 'row-major', 'both', 2, A, 2 ); // $ExpectError + dgebal( 'row-major', 'both', 2, A, 2, out ); // $ExpectError + dgebal( 'row-major', 'both', 2, A, 2, out, scale, 10 ); // $ExpectError +} + +// Attached to main export is an `ndarray` method which returns a number... +{ + const A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + const out = new Int32Array( 2 ); + const scale = new Float64Array( 2 ); + + dgebal.ndarray( 'both', 2, A, 2, 1, 0, out, 1, 0, scale, 1, 0 ); // $ExpectType number +} + +// The compiler throws an error if the function is provided a first argument which is not a string... +{ + const A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + const out = new Int32Array( 2 ); + const scale = new Float64Array( 2 ); + + dgebal.ndarray( 5, 2, A, 2, 1, 0, out, 1, 0, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( true, 2, A, 2, 1, 0, out, 1, 0, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( false, 2, A, 2, 1, 0, out, 1, 0, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( null, 2, A, 2, 1, 0, out, 1, 0, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( void 0, 2, A, 2, 1, 0, out, 1, 0, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( [], 2, A, 2, 1, 0, out, 1, 0, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( {}, 2, A, 2, 1, 0, out, 1, 0, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( ( x: number ): number => x, 2, A, 2, 1, 0, out, 1, 0, scale, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a second argument which is not a number... +{ + const A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + const out = new Int32Array( 2 ); + const scale = new Float64Array( 2 ); + + dgebal.ndarray( 'both', '5', A, 2, 1, 0, out, 1, 0, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', true, A, 2, 1, 0, out, 1, 0, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', false, A, 2, 1, 0, out, 1, 0, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', null, A, 2, 1, 0, out, 1, 0, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', void 0, A, 2, 1, 0, out, 1, 0, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', [], A, 2, 1, 0, out, 1, 0, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', {}, A, 2, 1, 0, out, 1, 0, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', ( x: number ): number => x, A, 2, 1, 0, out, 1, 0, scale, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a third argument which is not a Float64Array... +{ + const out = new Int32Array( 2 ); + const scale = new Float64Array( 2 ); + + dgebal.ndarray( 'both', 2, '5', 2, 1, 0, out, 1, 0, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, true, 2, 1, 0, out, 1, 0, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, false, 2, 1, 0, out, 1, 0, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, null, 2, 1, 0, out, 1, 0, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, void 0, 2, 1, 0, out, 1, 0, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, [], 2, 1, 0, out, 1, 0, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, {}, 2, 1, 0, out, 1, 0, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, ( x: number ): number => x, 2, 1, 0, out, 1, 0, scale, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fourth argument which is not a number... +{ + const A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + const out = new Int32Array( 2 ); + const scale = new Float64Array( 2 ); + + dgebal.ndarray( 'both', 2, A, '5', 1, 0, out, 1, 0, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, true, 1, 0, out, 1, 0, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, false, 1, 0, out, 1, 0, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, null, 1, 0, out, 1, 0, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, void 0, 1, 0, out, 1, 0, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, [], 1, 0, out, 1, 0, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, {}, 1, 0, out, 1, 0, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, ( x: number ): number => x, 1, 0, out, 1, 0, scale, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fifth argument which is not a number... +{ + const A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + const out = new Int32Array( 2 ); + const scale = new Float64Array( 2 ); + + dgebal.ndarray( 'both', 2, A, 2, '5', 0, out, 1, 0, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, true, 0, out, 1, 0, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, false, 0, out, 1, 0, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, null, 0, out, 1, 0, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, void 0, 0, out, 1, 0, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, [], 0, out, 1, 0, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, {}, 0, out, 1, 0, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, ( x: number ): number => x, 0, out, 1, 0, scale, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a sixth argument which is not a number... +{ + const A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + const out = new Int32Array( 2 ); + const scale = new Float64Array( 2 ); + + dgebal.ndarray( 'both', 2, A, 2, 1, '5', out, 1, 0, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, 1, true, out, 1, 0, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, 1, false, out, 1, 0, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, 1, null, out, 1, 0, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, 1, void 0, out, 1, 0, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, 1, [], out, 1, 0, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, 1, {}, out, 1, 0, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, 1, ( x: number ): number => x, out, 1, 0, scale, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a seventh argument which is not a Int32Array... +{ + const A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + const scale = new Float64Array( 2 ); + + dgebal.ndarray( 'both', 2, A, 2, 1, 0, '5', 1, 0, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, 1, 0, 5, 1, 0, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, 1, 0, true, 1, 0, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, 1, 0, false, 1, 0, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, 1, 0, null, 1, 0, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, 1, 0, void 0, 1, 0, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, 1, 0, [], 1, 0, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, 1, 0, {}, 1, 0, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, 1, 0, ( x: number ): number => x, 1, 0, scale, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided an eighth argument which is not a Int32Array... +{ + const A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + const scale = new Float64Array( 2 ); + + dgebal.ndarray( 'both', 2, A, 2, 1, 0, '5', 1, 0, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, 1, 0, 5, 1, 0, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, 1, 0, true, 1, 0, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, 1, 0, false, 1, 0, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, 1, 0, null, 1, 0, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, 1, 0, void 0, 1, 0, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, 1, 0, [], 1, 0, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, 1, 0, {}, 1, 0, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, 1, 0, ( x: number ): number => x, 1, 0, scale, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a ninth argument which is not a number... +{ + const A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + const out = new Int32Array( 2 ); + const scale = new Float64Array( 2 ); + + dgebal.ndarray( 'both', 2, A, 2, 1, 0, out, 1, '5', scale, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, 1, 0, out, 1, true, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, 1, 0, out, 1, false, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, 1, 0, out, 1, null, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, 1, 0, out, 1, void 0, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, 1, 0, out, 1, [], scale, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, 1, 0, out, 1, {}, scale, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, 1, 0, out, 1, ( x: number ): number => x, scale, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a tenth argument which is not a Float64Array... +{ + const A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + const out = new Int32Array( 2 ); + + dgebal.ndarray( 'both', 2, A, 2, 1, 0, out, 1, 0, '5', 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, 1, 0, out, 1, 0, 5, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, 1, 0, out, 1, 0, true, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, 1, 0, out, 1, 0, false, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, 1, 0, out, 1, 0, null, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, 1, 0, out, 1, 0, void 0, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, 1, 0, out, 1, 0, [], 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, 1, 0, out, 1, 0, {}, 1, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, 1, 0, out, 1, 0, ( x: number ): number => x, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided an eleventh argument which is not a number... +{ + const A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + const out = new Int32Array( 2 ); + const scale = new Float64Array( 2 ); + + dgebal.ndarray( 'both', 2, A, 2, 1, 0, out, 1, 0, scale, '5', 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, 1, 0, out, 1, 0, scale, true, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, 1, 0, out, 1, 0, scale, false, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, 1, 0, out, 1, 0, scale, null, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, 1, 0, out, 1, 0, scale, void 0, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, 1, 0, out, 1, 0, scale, [], 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, 1, 0, out, 1, 0, scale, {}, 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, 1, 0, out, 1, 0, scale, ( x: number ): number => x, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a twelfth argument which is not a number... +{ + const A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + const out = new Int32Array( 2 ); + const scale = new Float64Array( 2 ); + + dgebal.ndarray( 'both', 2, A, 2, 1, 0, out, 1, 0, scale, 1, '5' ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, 1, 0, out, 1, 0, scale, 1, true ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, 1, 0, out, 1, 0, scale, 1, false ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, 1, 0, out, 1, 0, scale, 1, null ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, 1, 0, out, 1, 0, scale, 1, void 0 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, 1, 0, out, 1, 0, scale, 1, [] ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, 1, 0, out, 1, 0, scale, 1, {} ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, 1, 0, out, 1, 0, scale, 1, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + const A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + const out = new Int32Array( 2 ); + const scale = new Float64Array( 2 ); + + dgebal.ndarray(); // $ExpectError + dgebal.ndarray( 'none' ); // $ExpectError + dgebal.ndarray( 'permute', 2 ); // $ExpectError + dgebal.ndarray( 'scale', 2, A ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2 ); // $ExpectError + dgebal.ndarray( 'none', 2, A, 2, 1 ); // $ExpectError + dgebal.ndarray( 'permute', 2, A, 2, 1, 0 ); // $ExpectError + dgebal.ndarray( 'scale', 2, A, 2, 1, 0, out ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, 1, 0, out, 1 ); // $ExpectError + dgebal.ndarray( 'none', 2, A, 2, 1, 0, out, 1, 0 ); // $ExpectError + dgebal.ndarray( 'permute', 2, A, 2, 1, 0, out, 1, 0, scale ); // $ExpectError + dgebal.ndarray( 'scale', 2, A, 2, 1, 0, out, 1, 0, scale, 1 ); // $ExpectError + dgebal.ndarray( 'both', 2, A, 2, 1, 0, out, 1, 0, scale, 1, 0, 10 ); // $ExpectError +} From c86cd7605896e5c5b7aeedf5844e2eb748bbad2a Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Fri, 16 May 2025 17:35:55 +0000 Subject: [PATCH 31/43] docs: add repl.txt --- 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: passed - 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: 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/dgebal/docs/repl.txt | 134 ++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 lib/node_modules/@stdlib/lapack/base/dgebal/docs/repl.txt diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/docs/repl.txt b/lib/node_modules/@stdlib/lapack/base/dgebal/docs/repl.txt new file mode 100644 index 000000000000..6490b737772e --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/docs/repl.txt @@ -0,0 +1,134 @@ + +{{alias}}( order, job, N, A, LDA, out, scale ) + Balances a general real matrix `A`. + + The matrix `A` is overwritten by the balanced matrix. Scale factors are + stored in the `scale` array. Where the indices `0` to `out[ 0 ] - 1` and + `out[ 1 ] + 1` to `N-1` contain the index of the interchanged row/column + (zero based), and the indices `out[ 0 ]` to `out[ 1 ]` contains the + scaling factor applied. + + Indexing is relative to the first index. To introduce an offset, use typed + array views. + + Parameters + ---------- + order: string + Row-major (C-style) or column-major (Fortran-style) order. Must be + either 'row-major' or 'column-major'. + + job: string + Indicates the operations to be performed. The `job` parameter can be + one of the following. 'none' (do nothing), 'permute' (permute only), + 'scale' (scale only) and 'both' (both permute and scale). + + N: integer + Number of row/columns in `A`. + + A: Float64Array + Input matrix `A`. + + LDA: integer + Stride of the first dimension of `A` (a.k.a., leading dimension of the + matrix `A`). + + out: Int32Array + Output matrix `out`. + + scale: Float64Array + Array containing permutation and scaling information. + + Returns + ------- + info: integer + Status code. + + Examples + -------- + > var A = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0, 4.0 ] ); + > var out = new {{alias:@stdlib/array/int32}}( 2 ); + > var scale = new {{alias:@stdlib/array/float64}}( 2 ); + > {{alias}}( 'row-major', 'both', 2, A, 2, out, scale ) + 0 + > A + [ 1.0, 2.0, 3.0, 4.0 ] + > out + [ 0, 1 ] + > scale + [ 1.0, 1.0 ] + + +{{alias}}.ndarray( job, N, A, sa1, sa2, oa, out, so, oo, scale, ss, os ) + Balances a general real matrix `A` using alternative indexing semantics. + + The matrix `A` is overwritten by the balanced matrix. Scale factors are + stored in the `scale` array. Where the indices `0` to `out[ 0 ] - 1` and + `out[ 1 ] + 1` to `N-1` contain the index of the interchanged row/column + (zero based), and the indices `out[ 0 ]` to `out[ 1 ]` contains the + scaling factor applied. + + While typed array views mandate a view offset based on the underlying + buffer, the offset parameters support indexing semantics based on starting + indices. + + Parameters + ---------- + job: string + Indicates the operations to be performed. The `job` parameter can be + one of the following. 'none' (do nothing), 'permute' (permute only), + 'scale' (scale only) and 'both' (both permute and scale). + + N: integer + Number of row/columns in `A`. + + A: Float64Array + Input matrix `A`. + + sa1: integer + Stride of the first dimension of `A`. + + sa2: integer + Stride of the second dimension of `A`. + + oa: integer + Starting index for `A`. + + out: Int32Array + Output matrix `out`. + + so: integer + Stride length of `out`. + + oo: integer + Starting index of `out`. + + scale: Float64Array + Array containing permutation and scaling information. + + ss: integer + Stride length for `scale`. + + os: integer + Starting index for `scale`. + + Returns + ------- + info: integer + Status code. + + Examples + -------- + > var A = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0, 4.0 ] ); + > var out = new {{alias:@stdlib/array/int32}}( 2 ); + > var scale = new {{alias:@stdlib/array/float64}}( 2 ); + > {{alias}}.ndarray( 'both', 2, A, 2, 1, 0, out, 1, 0, scale, 1, 0 ) + 0 + > A + [ 1.0, 2.0, 3.0, 4.0 ] + > out + [ 0, 1 ] + > scale + [ 1.0, 1.0 ] + + See Also + -------- From 51b8662a024f6e064153a59ba4b5406a7c2b5219 Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Sat, 17 May 2025 05:58:44 +0000 Subject: [PATCH 32/43] docs: add readme --- 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: passed - task: lint_package_json status: na - task: lint_repl_help status: passed - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - 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/dgebal/README.md | 314 ++++++++++++++++++ .../@stdlib/lapack/base/dgebal/docs/repl.txt | 3 +- .../lapack/base/dgebal/examples/index.js | 3 + 3 files changed, 319 insertions(+), 1 deletion(-) create mode 100644 lib/node_modules/@stdlib/lapack/base/dgebal/README.md diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/README.md b/lib/node_modules/@stdlib/lapack/base/dgebal/README.md new file mode 100644 index 000000000000..16880a86324b --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/README.md @@ -0,0 +1,314 @@ + + +# dgebal + +> Balances a general real matrix `A`. + +
+ +## Usage + +```javascript +var dgebal = require( '@stdlib/lapack/base/dgebal' ); +``` + +#### dgebal( order, job, N, A, LDA, out, scale ) + +Balances a general real matrix `A`. + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); +var Int32Array = require( '@stdlib/array/int32' ); + +var A = new Float64Array( [ 1.0, 100.0, 0.0, 2.0, 200.0, 0.0, 0.0, 0.0, 3.0 ] ); +var out = new Int32Array( 2 ); +var scale = new Float64Array( 3 ); + +/* + A = [ + [ 1.0, 100.0, 0.0 ], + [ 2.0, 200.0, 0.0 ], + [ 0.0, 0.0, 3.0 ], + ] +*/ + +dgebal( 'row-major', 'both', 3, A, 3, out, scale ); +// A => [ 1.0, 12.5, 0.0, 16.0, 200.0, 0.0, 0.0, 0.0, 3.0 ] +// out => [ 0, 1 ] +// scale => [ 8.0, 1.0, 2.0 ] +``` + +The function has the following parameters: + +- **order**: storage layout. +- **job**: indicates the operations to be performed. The `job` parameter can be one of the following. `none` (do nothing), `permute` (permute only), `scale` (scale only) and `both` (both permute and scale). +- **N**: number of row/columns in `A`. +- **A**: input [`Float64Array`][mdn-float64array]. +- **LDA**: stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`). +- **out**: stores the first and last row/column of the balanced submatrix as a [`Int32Array`][mdn-int32array]. +- **scale**: scale factors are stored in the `scale` array as a [`Float64Array`][mdn-float64array]. Where the indices `0` to `out[ 0 ] - 1` and `out[ 1 ] + 1` to `N-1` contain the index of the interchanged row/column (zero based), and the indices `out[ 0 ]` to `out[ 1 ]` contains the scaling factor applied. + +Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views. + + + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); +var Int32Array = require( '@stdlib/array/int32' ); + +// Initial arrays... +var A0 = new Float64Array( [ 0.0, 1.0, 100.0, 0.0, 2.0, 200.0, 0.0, 0.0, 0.0, 3.0 ] ); +var out0 = new Int32Array( 3 ); +var scale0 = new Float64Array( 4 ); + +// Create offset views... +var A1 = new Float64Array( A0.buffer, A0.BYTES_PER_ELEMENT*1 ); // start at 2nd element +var out1 = new Int32Array( out0.buffer, out0.BYTES_PER_ELEMENT*1 ); // start at 2nd element +var scale1 = new Float64Array( scale0.buffer, scale0.BYTES_PER_ELEMENT*1 ); // start at 2nd element + +/* + A = [ + [ 1.0, 100.0, 0.0 ], + [ 2.0, 200.0, 0.0 ], + [ 0.0, 0.0, 3.0 ], + ] +*/ + +dgebal( 'row-major', 'both', 3, A1, 3, out1, scale1 ); +// A0 => [ 0.0, 1.0, 12.5, 0.0, 16.0, 200.0, 0.0, 0.0, 0.0, 3.0 ] +// out0 => [ 0, 0, 1 ] +// scale0 => [ 0.0, 8.0, 1.0, 2.0 ] +``` + +#### dgebal.ndarray( uplo, M, N, A, sa1, sa2, oa, B, sb1, sb2, ob ) + +Balances a general real matrix `A` using alternative indexing semantics. + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); +var Int32Array = require( '@stdlib/array/int32' ); + +var A = new Float64Array( [ 1.0, 100.0, 0.0, 2.0, 200.0, 0.0, 0.0, 0.0, 3.0 ] ); +var out = new Int32Array( 2 ); +var scale = new Float64Array( 3 ); + +/* + A = [ + [ 1.0, 100.0, 0.0 ], + [ 2.0, 200.0, 0.0 ], + [ 0.0, 0.0, 3.0 ], + ] +*/ + +dgebal.ndarray( 'both', 3, A, 3, 1, 0, out, 1, 0, scale, 1, 0 ); +// A => [ 1.0, 12.5, 0.0, 16.0, 200.0, 0.0, 0.0, 0.0, 3.0 ] +// out => [ 0, 1 ] +// scale => [ 8.0, 1.0, 2.0 ] +``` + +The function has the following parameters: + +- **job**: indicates the operations to be performed. The `job` parameter can be one of the following. `none` (do nothing), `permute` (permute only), `scale` (scale only) and `both` (both permute and scale). +- **N**: number of row/columns in `A`. +- **A**: input [`Float64Array`][mdn-float64array]. +- **strideA1**: stride of the first dimension of `A`. +- **strideA2**: stride of the second dimension of `A`. +- **offsetA**: starting index for `A`. +- **out**: stores the first and last row/column of the balanced submatrix as a [`Int32Array`][mdn-int32array]. +- **strideOut**: stride length of `out`. +- **offsetOut**: starting index for `out`. +- **scale**: scale factors are stored in the `scale` array as a [`Float64Array`][mdn-float64array]. Where the indices `0` to `out[ 0 ] - 1` and `out[ 1 ] + 1` to `N-1` contain the index of the interchanged row/column (zero based), and the indices `out[ 0 ]` to `out[ 1 ]` contains the scaling factor applied. +- **strideScale**: stride length for `scale`. +- **offsetScale**: starting index for `scale`. + +While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameters support indexing semantics based on starting indices. For example, + + + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); +var Int32Array = require( '@stdlib/array/int32' ); + +var A = new Float64Array( [ 0.0, 1.0, 100.0, 0.0, 2.0, 200.0, 0.0, 0.0, 0.0, 3.0 ] ); +var out = new Int32Array( 3 ); +var scale = new Float64Array( 4 ); + +/* + A = [ + [ 1.0, 100.0, 0.0 ], + [ 2.0, 200.0, 0.0 ], + [ 0.0, 0.0, 3.0 ], + ] +*/ + +dgebal.ndarray( 'both', 3, A, 3, 1, 1, out, 1, 1, scale, 1, 1 ); +// A => [ 0.0, 1.0, 12.5, 0.0, 16.0, 200.0, 0.0, 0.0, 0.0, 3.0 ] +// out => [ 0, 0, 1 ] +// scale => [ 0.0, 8.0, 1.0, 2.0 ] +``` + +
+ + + +
+ +## Notes + +- `dgebal()` corresponds to the [LAPACK][lapack] routine [`dgebal`][lapack-dgebal]. + +
+ + + +
+ +## Examples + + + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); +var Int32Array = require( '@stdlib/array/int32' ); +var ndarray2array = require( '@stdlib/ndarray/base/to-array' ); +var dgebal = require( '@stdlib/lapack/base/dgebal' ); + +// Specify matrix meta data: +var shape = [ 3, 3 ]; +var strides = [ 3, 1 ]; +var offset = 0; +var order = 'row-major'; + +// Create a matrix stored in linear memory: +var A = new Float64Array( [ 1.0, 100.0, 0.0, 2.0, 200.0, 0.0, 0.0, 0.0, 3.0 ] ); +console.log( ndarray2array( A, shape, strides, offset, order ) ); + +// Define arrays to store the scaling factors +var out = new Int32Array( 2 ); +var scale = new Float64Array( 3 ); + +// Permute and scale the matrix: +dgebal( order, 'both', shape[ 0 ], A, strides[ 0 ], out, scale ); + +console.log( ndarray2array( A, shape, strides, offset, order ) ); +console.log( out ); +console.log( scale ); +``` + +
+ + + + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +TODO +``` + +#### TODO + +TODO. + +```c +TODO +``` + +TODO + +```c +TODO +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +TODO +``` + +
+ + + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/docs/repl.txt b/lib/node_modules/@stdlib/lapack/base/dgebal/docs/repl.txt index 6490b737772e..13eca4ba865a 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/docs/repl.txt +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/docs/repl.txt @@ -33,7 +33,8 @@ matrix `A`). out: Int32Array - Output matrix `out`. + Output matrix `out`. Stores the first and last row/column of the + balanced submatrix. scale: Float64Array Array containing permutation and scaling information. diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/examples/index.js b/lib/node_modules/@stdlib/lapack/base/dgebal/examples/index.js index a542416832cb..30eeefb8a3c6 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/examples/index.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/examples/index.js @@ -39,4 +39,7 @@ var scale = new Float64Array( 3 ); // Permute and scale the matrix: dgebal( order, 'both', shape[ 0 ], A, strides[ 0 ], out, scale ); + console.log( ndarray2array( A, shape, strides, offset, order ) ); +console.log( out ); +console.log( scale ); From 115d1857008edf1740ab3cbdb09227f3c695a551 Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Sat, 17 May 2025 06:02:03 +0000 Subject: [PATCH 33/43] chore: linting error --- 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: passed - 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: 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 --- --- lib/node_modules/@stdlib/lapack/base/dgebal/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/README.md b/lib/node_modules/@stdlib/lapack/base/dgebal/README.md index 16880a86324b..1fef3ab203d8 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/README.md +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/README.md @@ -2,7 +2,7 @@ @license Apache-2.0 -Copyright (c) 2024 The Stdlib Authors. +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. From 944cc60b48586bfbf062ef0a3bbcbf99a22fa657 Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Sat, 17 May 2025 06:03:50 +0000 Subject: [PATCH 34/43] chore: linting error --- 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 --- --- lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js index c9f137a942ed..d7269c10bba7 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js @@ -68,6 +68,7 @@ var dscal = require( '@stdlib/blas/base/dscal' ).ndarray; * @param {Float64Array} scale - array containing permutation and scaling information * @param {integer} strideScale - stride of `scale` * @param {NonNegativeInteger} offsetScale - starting index for `scale` +* @throws {RangeError} should not return NaN * @returns {integer} status code * * @example @@ -228,7 +229,7 @@ function dgebal( job, N, A, strideA1, strideA2, offsetA, out, strideOut, offsetO } if ( isnan( c ) || isnan( r ) || isnan( ca ) || isnan( ra ) ) { - return -3; + throw new RangeError( 'should not return NaN' ); } g = r / sclfac; From bd0084f724135efbaf09b2444d00f66f60aa3e57 Mon Sep 17 00:00:00 2001 From: Aayush Khanna <96649223+aayush0325@users.noreply.github.com> Date: Sun, 18 May 2025 13:20:49 +0530 Subject: [PATCH 35/43] chore: move variables to a separate section --- .../@stdlib/lapack/base/dgebal/lib/base.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js index d7269c10bba7..a85e63dd616b 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js @@ -33,6 +33,12 @@ var min = require( '@stdlib/math/base/special/minn' ); var dscal = require( '@stdlib/blas/base/dscal' ).ndarray; +// VARIABLES // + +var sclfac = 2.0; +var factor = 0.95; + + // MAIN // /** @@ -91,8 +97,6 @@ function dgebal( job, N, A, strideA1, strideA2, offsetA, out, strideOut, offsetO var sfmin2; var sfmax1; var sfmax2; - var sclfac; - var factor; var ica; var ira; var ca; @@ -108,9 +112,6 @@ function dgebal( job, N, A, strideA1, strideA2, offsetA, out, strideOut, offsetO var f; var s; - sclfac = 2.0; - factor = 0.95; - // Quick return if possible if ( N === 0 ) { out[ offsetOut ] = 0.0; // ilo From 09f01cad2131d04bec0774981200d256dd59f46a Mon Sep 17 00:00:00 2001 From: Aayush Khanna <96649223+aayush0325@users.noreply.github.com> Date: Wed, 21 May 2025 15:20:03 +0530 Subject: [PATCH 36/43] chore: update error message --- lib/node_modules/@stdlib/lapack/base/dgebal/lib/dgebal.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/dgebal.js b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/dgebal.js index 08d21c369f6a..23f4615b92b9 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/dgebal.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/dgebal.js @@ -89,7 +89,7 @@ function dgebal( order, job, N, A, LDA, out, scale ) { sa2 = LDA; } else { // order === 'row-major' if ( LDA < N ) { - throw new RangeError( format( 'invalid argument. Eighth argument must be greater than or equal to %d. Value: `%d`.', N, LDA ) ); + throw new RangeError( format( 'invalid argument. Fifth argument must be greater than or equal to %d. Value: `%d`.', N, LDA ) ); } sa1 = LDA; sa2 = 1; From 50a4de17a5ebfde8f6bccc21064d95c0b9b9b5ff Mon Sep 17 00:00:00 2001 From: Aayush Khanna <96649223+aayush0325@users.noreply.github.com> Date: Wed, 21 May 2025 15:22:54 +0530 Subject: [PATCH 37/43] chore: update error mesages --- lib/node_modules/@stdlib/lapack/base/dgebal/lib/ndarray.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/ndarray.js b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/ndarray.js index b1023b994589..62a10905931e 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/ndarray.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/ndarray.js @@ -77,7 +77,7 @@ var base = require( './base.js' ); */ function dgebal( job, N, A, strideA1, strideA2, offsetA, out, strideOut, offsetOut, scale, strideScale, offsetScale ) { // eslint-disable-line max-len, max-params if ( job !== 'both' && job !== 'scale' && job !== 'permute' && job !== 'none' ) { - throw new TypeError( format( 'invalid argument. Second argument must be one of the following: `both`, `scale`, `permute`, or `none`. Value: `%s`.', job ) ); + throw new TypeError( format( 'invalid argument. First argument must be one of the following: `both`, `scale`, `permute`, or `none`. Value: `%s`.', job ) ); } return base( job, N, A, strideA1, strideA2, offsetA, out, strideOut, offsetOut, scale, strideScale, offsetScale ); // eslint-disable-line max-len } From 0c607b9743c46d293e999ff953059c3cfdd9b58e Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Thu, 22 May 2025 12:15:39 +0000 Subject: [PATCH 38/43] chore: resolve conflicts --- 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/dgebal/lib/dgebal.js | 3 +- .../@stdlib/lapack/base/dgebal/lib/isjob.js | 62 +++++++++++++++++++ .../@stdlib/lapack/base/dgebal/lib/ndarray.js | 3 +- 3 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 lib/node_modules/@stdlib/lapack/base/dgebal/lib/isjob.js diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/dgebal.js b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/dgebal.js index 23f4615b92b9..db716fd51dc2 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/dgebal.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/dgebal.js @@ -23,6 +23,7 @@ var isLayout = require( '@stdlib/blas/base/assert/is-layout' ); var isColumnMajor = require( '@stdlib/ndarray/base/assert/is-column-major-string' ); var format = require( '@stdlib/string/format' ); +var isJob = require( './isjob.js' ); var base = require( './base.js' ); @@ -81,7 +82,7 @@ function dgebal( order, job, N, A, LDA, out, scale ) { if ( !isLayout( order ) ) { throw new TypeError( format( 'invalid argument. First argument must be a valid order. Value: `%s`.', order ) ); } - if ( job !== 'both' && job !== 'scale' && job !== 'permute' && job !== 'none' ) { + if ( !isJob( job ) ) { throw new TypeError( format( 'invalid argument. Second argument must be one of the following: `both`, `scale`, `permute`, or `none`. Value: `%s`.', job ) ); } if ( isColumnMajor( order ) ) { diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/isjob.js b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/isjob.js new file mode 100644 index 000000000000..fd4ffa0500d3 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/isjob.js @@ -0,0 +1,62 @@ +/** +* @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 contains = require( '@stdlib/array/base/assert/contains' ).factory; + + +// VARIABLES // + +var JOBS = [ 'none', 'permute', 'scale', 'both' ]; + + +// MAIN // + +/** +* Tests whether an input value is a supported job. +* +* @name isJob +* @type {Function} +* @param {*} v - value to test +* @returns {boolean} boolean indicating whether an input value is a supported job +* +* @example +* var bool = isJob( 'both' ); +* // returns true +* +* bool = isJob( 'none' ); +* // returns true +* +* bool = isJob( 'permute' ); +* // returns true +* +* bool = isJob( 'scale' ); +* // returns true +* +* bool = isJob( 'foo' ); +* // returns false +*/ +var isJob = contains( JOBS ); + + +// EXPORTS // + +module.exports = isJob; diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/ndarray.js b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/ndarray.js index 62a10905931e..b6916760c151 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/ndarray.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/ndarray.js @@ -21,6 +21,7 @@ // MODULES // var format = require( '@stdlib/string/format' ); +var isJob = require( './isjob.js' ); var base = require( './base.js' ); @@ -76,7 +77,7 @@ var base = require( './base.js' ); * // scale => [ 8, 1, 2 ] */ function dgebal( job, N, A, strideA1, strideA2, offsetA, out, strideOut, offsetOut, scale, strideScale, offsetScale ) { // eslint-disable-line max-len, max-params - if ( job !== 'both' && job !== 'scale' && job !== 'permute' && job !== 'none' ) { + if ( !isJob( job ) ) { throw new TypeError( format( 'invalid argument. First argument must be one of the following: `both`, `scale`, `permute`, or `none`. Value: `%s`.', job ) ); } return base( job, N, A, strideA1, strideA2, offsetA, out, strideOut, offsetOut, scale, strideScale, offsetScale ); // eslint-disable-line max-len From 021712f5315c195bdd7585493fa8066eb7c919fc Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Thu, 22 May 2025 12:31:42 +0000 Subject: [PATCH 39/43] refactor: pointer arithmetics --- 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 --- --- lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js index a85e63dd616b..bd6796fac55a 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js @@ -141,6 +141,7 @@ function dgebal( job, N, A, strideA1, strideA2, offsetA, out, strideOut, offsetO while ( noconv ) { // Search for rows isolating an eigenvalue and push them down noconv = false; + is = offsetScale + ( l * strideScale ); for ( i = l; i >= 0; i-- ) { canSwap = true; for ( j = 0; j <= l; j++ ) { @@ -151,7 +152,7 @@ function dgebal( job, N, A, strideA1, strideA2, offsetA, out, strideOut, offsetO } if ( canSwap ) { - scale[ offsetScale + (l*strideScale) ] = i; + scale[ is ] = i; if ( i !== l ) { dswap( l+1, A, strideA1, offsetA + (i*strideA2), A, strideA1, offsetA + (l*strideA2) ); dswap( N - k, A, strideA2, offsetA + (i*strideA1) + (k*strideA2), A, strideA2, offsetA + (l*strideA1) + (k*strideA2) ); @@ -165,6 +166,7 @@ function dgebal( job, N, A, strideA1, strideA2, offsetA, out, strideOut, offsetO return 0; } l -= 1; + is -= strideScale; } } } @@ -173,6 +175,7 @@ function dgebal( job, N, A, strideA1, strideA2, offsetA, out, strideOut, offsetO while ( noconv ) { // Search for columns isolating an eigenvalue and push them left noconv = false; + is = offsetScale + ( k * strideScale ); for ( j = k; j <= l; j++ ) { canSwap = true; for ( i = k; i <= l; i++ ) { @@ -183,13 +186,14 @@ function dgebal( job, N, A, strideA1, strideA2, offsetA, out, strideOut, offsetO } if ( canSwap ) { - scale[ offsetScale + (k*strideScale) ] = j; + scale[ is ] = j; if ( j !== k ) { dswap( l+1, A, strideA1, offsetA + (j*strideA2), A, strideA1, offsetA + (k*strideA2) ); dswap( N-k, A, strideA2, offsetA + (j*strideA1), A, strideA2, offsetA + (k*strideA1) ); } noconv = true; k += 1; + is += strideScale; } } } From 89c3b1ccb1f4f214dffff098c8ae99b753ce076b Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Thu, 22 May 2025 12:45:04 +0000 Subject: [PATCH 40/43] refactor: pointer arithmetic --- 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/dgebal/lib/base.js | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js index bd6796fac55a..f65add2cb3ef 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js @@ -99,6 +99,10 @@ function dgebal( job, N, A, strideA1, strideA2, offsetA, out, strideOut, offsetO var sfmax2; var ica; var ira; + var ia1; + var ia2; + var ia3; + var ia4; var ca; var ra; var is; @@ -141,7 +145,13 @@ function dgebal( job, N, A, strideA1, strideA2, offsetA, out, strideOut, offsetO while ( noconv ) { // Search for rows isolating an eigenvalue and push them down noconv = false; - is = offsetScale + ( l * strideScale ); + + is = offsetScale + ( l * strideScale ); // Follows `scale` + ia1 = offsetA + ( l * strideA2 ); // Follows `i`th column + ia2 = offsetA + ( l * strideA2 ); // Follows `l`th column + ia3 = offsetA + (l*strideA1) + (k*strideA2); // Follows `i`th row + ia4 = offsetA + (l*strideA1) + (k*strideA2); // Follows `l`th row + for ( i = l; i >= 0; i-- ) { canSwap = true; for ( j = 0; j <= l; j++ ) { @@ -154,8 +164,8 @@ function dgebal( job, N, A, strideA1, strideA2, offsetA, out, strideOut, offsetO if ( canSwap ) { scale[ is ] = i; if ( i !== l ) { - dswap( l+1, A, strideA1, offsetA + (i*strideA2), A, strideA1, offsetA + (l*strideA2) ); - dswap( N - k, A, strideA2, offsetA + (i*strideA1) + (k*strideA2), A, strideA2, offsetA + (l*strideA1) + (k*strideA2) ); + dswap( l+1, A, strideA1, ia1, A, strideA1, ia2 ); + dswap( N - k, A, strideA2, ia3, A, strideA2, ia4 ); } noconv = true; @@ -167,7 +177,11 @@ function dgebal( job, N, A, strideA1, strideA2, offsetA, out, strideOut, offsetO } l -= 1; is -= strideScale; + ia2 -= strideA2; + ia4 -= strideA1; } + ia1 -= strideA2; + ia3 -= strideA1; } } From 5f0fdaab7b90eca1416f821d6d54f20d99a1258e Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Thu, 22 May 2025 12:54:19 +0000 Subject: [PATCH 41/43] refactor: pointer arithmetic --- 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/dgebal/lib/base.js | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js index f65add2cb3ef..6c2585e58863 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js @@ -146,11 +146,11 @@ function dgebal( job, N, A, strideA1, strideA2, offsetA, out, strideOut, offsetO // Search for rows isolating an eigenvalue and push them down noconv = false; - is = offsetScale + ( l * strideScale ); // Follows `scale` - ia1 = offsetA + ( l * strideA2 ); // Follows `i`th column - ia2 = offsetA + ( l * strideA2 ); // Follows `l`th column - ia3 = offsetA + (l*strideA1) + (k*strideA2); // Follows `i`th row - ia4 = offsetA + (l*strideA1) + (k*strideA2); // Follows `l`th row + is = offsetScale + ( l * strideScale ); // Follows scale + ia1 = offsetA + ( l * strideA2 ); // Follows `i`th column of A + ia2 = offsetA + ( l * strideA2 ); // Follows `l`th column of A + ia3 = offsetA + (l*strideA1) + (k*strideA2); // Follows `i`th row of A + ia4 = offsetA + (l*strideA1) + (k*strideA2); // Follows `l`th row of A for ( i = l; i >= 0; i-- ) { canSwap = true; @@ -176,10 +176,12 @@ function dgebal( job, N, A, strideA1, strideA2, offsetA, out, strideOut, offsetO return 0; } l -= 1; + is -= strideScale; ia2 -= strideA2; ia4 -= strideA1; } + ia1 -= strideA2; ia3 -= strideA1; } @@ -189,7 +191,9 @@ function dgebal( job, N, A, strideA1, strideA2, offsetA, out, strideOut, offsetO while ( noconv ) { // Search for columns isolating an eigenvalue and push them left noconv = false; - is = offsetScale + ( k * strideScale ); + is = offsetScale + ( k * strideScale ); // Follows scale + ia1 = offsetA + ( k * strideA2 ); // Follows `j`th column of A + ia2 = offsetA + ( k * strideA2 ); // Follows `k`th column of A for ( j = k; j <= l; j++ ) { canSwap = true; for ( i = k; i <= l; i++ ) { @@ -202,13 +206,17 @@ function dgebal( job, N, A, strideA1, strideA2, offsetA, out, strideOut, offsetO if ( canSwap ) { scale[ is ] = j; if ( j !== k ) { - dswap( l+1, A, strideA1, offsetA + (j*strideA2), A, strideA1, offsetA + (k*strideA2) ); + dswap( l+1, A, strideA1, ia1, A, strideA1, ia2 ); dswap( N-k, A, strideA2, offsetA + (j*strideA1), A, strideA2, offsetA + (k*strideA1) ); } noconv = true; k += 1; + is += strideScale; + ia2 += strideA2; } + + ia1 += strideA2; } } } From d50308b4fa765f11817ab37707202d8e15532173 Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Thu, 22 May 2025 12:55:57 +0000 Subject: [PATCH 42/43] refactor: pointer arithmetic --- 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 --- --- lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js index 6c2585e58863..47777753971c 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js @@ -194,6 +194,9 @@ function dgebal( job, N, A, strideA1, strideA2, offsetA, out, strideOut, offsetO is = offsetScale + ( k * strideScale ); // Follows scale ia1 = offsetA + ( k * strideA2 ); // Follows `j`th column of A ia2 = offsetA + ( k * strideA2 ); // Follows `k`th column of A + ia3 = offsetA + ( k * strideA1 ); // Follows `j`th row of A + ia4 = offsetA + ( k * strideA1 ); // Follows `k`th row of A + for ( j = k; j <= l; j++ ) { canSwap = true; for ( i = k; i <= l; i++ ) { @@ -207,16 +210,18 @@ function dgebal( job, N, A, strideA1, strideA2, offsetA, out, strideOut, offsetO scale[ is ] = j; if ( j !== k ) { dswap( l+1, A, strideA1, ia1, A, strideA1, ia2 ); - dswap( N-k, A, strideA2, offsetA + (j*strideA1), A, strideA2, offsetA + (k*strideA1) ); + dswap( N-k, A, strideA2, ia3, A, strideA2, ia4 ); } noconv = true; k += 1; is += strideScale; ia2 += strideA2; + ia4 += strideA1; } ia1 += strideA2; + ia3 += strideA1; } } } From ff55902e34327fdd5f2ad5e8b88d4e1252836541 Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Thu, 22 May 2025 13:35:42 +0000 Subject: [PATCH 43/43] refactor: pointer arithmetic --- 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/dgebal/lib/base.js | 54 ++++++++++++++----- 1 file changed, 40 insertions(+), 14 deletions(-) diff --git a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js index 47777753971c..b213282f54d4 100644 --- a/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js +++ b/lib/node_modules/@stdlib/lapack/base/dgebal/lib/base.js @@ -16,7 +16,7 @@ * limitations under the License. */ -/* eslint-disable max-len, max-params, max-statements */ +/* eslint-disable max-len, max-params, max-statements, max-lines-per-function */ 'use strict'; @@ -226,8 +226,8 @@ function dgebal( job, N, A, strideA1, strideA2, offsetA, out, strideOut, offsetO } } - // Initialize `scale` for non-permuted submatrix - is = offsetScale + (k*strideScale); + // Initialize scale for non-permuted submatrix + is = offsetScale + ( k * strideScale ); for ( i = k; i <= l; i++ ) { scale[ is ] = 1.0; is += strideScale; @@ -247,16 +247,25 @@ function dgebal( job, N, A, strideA1, strideA2, offsetA, out, strideOut, offsetO noconv = true; while ( noconv ) { + is = offsetScale + ( k * strideScale ); // Follows scale + ia1 = offsetA + ( k * strideA1 ) + ( k * strideA2 ); // Follows A[ k, i ] + ia2 = offsetA + ( k * strideA1 ) + ( k * strideA2 ); // Follows A[ i, k ] + ia3 = offsetA + ( k * strideA2 ); // follows `i`th column of A + noconv = false; for ( i = k; i <= l; i++ ) { - c = dnrm2( l-k+1, A, strideA1, offsetA + (k*strideA1) + (i*strideA2) ); - r = dnrm2( l-k+1, A, strideA2, offsetA + (i*strideA1) + (k*strideA2) ); - ica = idamax( l+1, A, strideA1, offsetA + (i*strideA2) ); + c = dnrm2( l-k+1, A, strideA1, ia1 ); + r = dnrm2( l-k+1, A, strideA2, ia2 ); + ica = idamax( l+1, A, strideA1, ia3 ); ca = abs( A[ offsetA + (ica*strideA1) + (i*strideA2) ] ); - ira = idamax( N-k+1, A, strideA2, offsetA + (i*strideA1) + (k*strideA2) ); + ira = idamax( N-k+1, A, strideA2, ia2 ); ra = abs( A[ offsetA + (i*strideA1) + ((ira+k)*strideA2) ] ); if ( c === 0.0 || r === 0.0 ) { + ia1 += strideA2; + ia2 += strideA1; + is += strideScale; + ia3 += strideA2; continue; } @@ -290,27 +299,44 @@ function dgebal( job, N, A, strideA1, strideA2, offsetA, out, strideOut, offsetO // Now balance if ( ( c + r ) >= factor * s ) { + ia1 += strideA2; + ia2 += strideA1; + is += strideScale; + ia3 += strideA2; continue; } - if ( f < 1.0 && scale[ offsetScale + (i*strideScale) ] < 1.0 ) { - if ( f * scale[ offsetScale + (i*strideScale) ] <= sfmin1 ) { + if ( f < 1.0 && scale[ is ] < 1.0 ) { + if ( f * scale[ is ] <= sfmin1 ) { + ia1 += strideA2; + ia2 += strideA1; + is += strideScale; + ia3 += strideA2; continue; } } - if ( f > 1.0 && scale[ offsetScale + (i*strideScale) ] > 1.0 ) { - if ( scale[ offsetScale + (i*strideScale) ] >= sfmax1 / f ) { + if ( f > 1.0 && scale[ is ] > 1.0 ) { + if ( scale[ is ] >= sfmax1 / f ) { + ia1 += strideA2; + ia2 += strideA1; + is += strideScale; + ia3 += strideA2; continue; } } g = 1.0 / f; - scale[ offsetScale + (i*strideScale) ] *= f; + scale[ is ] *= f; noconv = true; - dscal( N-k, g, A, strideA2, offsetA + (i*strideA1) + (k*strideA2) ); - dscal( l+1, f, A, strideA1, offsetA + (i*strideA2) ); + dscal( N-k, g, A, strideA2, ia2 ); + dscal( l+1, f, A, strideA1, ia3 ); + + ia1 += strideA2; + ia2 += strideA1; + is += strideScale; + ia3 += strideA2; } }