From 8104aedb45fc4681114b4e448a911c3673d572d9 Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Mon, 7 Apr 2025 08:25:21 +0000 Subject: [PATCH 01/28] feat: add base algorithm --- .../@stdlib/lapack/base/dppequ/lib/base.js | 126 ++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 lib/node_modules/@stdlib/lapack/base/dppequ/lib/base.js diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/base.js b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/base.js new file mode 100644 index 000000000000..acacba60715b --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/base.js @@ -0,0 +1,126 @@ +/** +* @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 sqrt = require( '@stdlib/math/base/special/sqrt' ); +var max = require( '@stdlib/math/base/special/max' ); +var min = require( '@stdlib/math/base/special/min' ); + + +// MAIN // + +/** +* Computes the row and column scalings intended to equilibrate a symmetric positive definite matrix `A` in packed storage and reduce it's condition number (with respect to the two-norm). +* +* @param {string} order - specifies whether `AP` is packed in row-major or column-major order +* @param {string} uplo - 'Upper' or 'Lower' triangle of `A` is stored +* @param {NonNegativeInteger} N - order of the matrix `A` +* @param {Float64Array} AP - array containing the upper or lower triangle of `A` in packed form +* @param {integer} strideAP - stride length for `AP` +* @param {integer} offsetAP - starting index for `AP` +* @param {Float64Array} S - array to store the scale factors of `A` +* @param {integer} strideS - stride length for `S` +* @param {integer} offsetS - starting index for `S` +* @param {Float64Array} out - array to store the output +* @param {integer} strideOut - stride length for `out` +* @param {integer} offsetOut - starting index for `out` +* @returns {integer} status code +*/ +function dppequ( order, uplo, N, AP, strideAP, offsetAP, S, strideS, offsetS, out, strideOut, offsetOut ) { // eslint-disable-line max-len, max-params + var info; + var smin; + var amax; + var jj; + var i; + + if ( N === 0 ) { + out[ offsetOut ] = 1.0; // scond + out[ offsetOut + strideOut ] = 0.0; // amax + return 0; // info + } + + S[ offsetAP ] = AP[ offsetAP ]; + smin = S[ offsetAP ]; + amax = S[ offsetAP ]; + + if ( order === 'row-major' ) { + if ( uplo === 'U' ) { // uplo === 'U' + jj = 0; + for ( i = 1; i < N; i++ ) { + jj += N - i + 1; + S[ offsetS + (i * strideS) ] = AP[ offsetAP + (jj * strideAP) ]; + smin = min( smin, S[ offsetS + (i * strideS) ] ); + amax = max( amax, S[ offsetS + (i * strideS) ] ); + } + } else { // uplo === 'L' + jj = 0; + for ( i = 1; i < N; i++ ) { + jj += i + 1; + S[ offsetS + (i * strideS) ] = AP[ offsetAP + (jj * strideAP) ]; + smin = min( smin, S[ offsetS + (i * strideS) ] ); + amax = max( amax, S[ offsetS + (i * strideS) ] ); + } + } + } else { // order === 'col-major' + if ( uplo === 'U' ) { // uplo === 'U' + jj = 0; + for ( i = 1; i < N; i++ ) { + jj += i + 1; + S[ offsetS + (i * strideS) ] = AP[ offsetAP + (jj * strideAP) ]; + smin = min( smin, S[ offsetS + (i * strideS) ] ); + amax = max( amax, S[ offsetS + (i * strideS) ] ); + } + } else { // uplo === 'L' + jj = 0; + for ( i = 1; i < N; i++ ) { + jj += N - i + 1; + S[ offsetS + (i * strideS) ] = AP[ offsetAP + (jj * strideAP) ]; + smin = min( smin, S[ offsetS + (i * strideS) ] ); + amax = max( amax, S[ offsetS + (i * strideS) ] ); + } + } + } + + if ( smin <= 0.0 ) { + for ( i = 0; i < N; i++ ) { + if ( S[ offsetS + (i * strideS) ] <= 0.0 ) { + out[ offsetOut ] = 0.0; // scond + out[ offsetOut + strideOut ] = amax; // amax + info = i; + return info; + } + } + } else { + for ( i = 0; i < N; i++ ) { + S[ offsetS + (i * strideS) ] = 1.0 / sqrt( S[ offsetS + (i * strideS) ] ); // eslint-disable-line max-len + } + } + + out[ offsetOut ] = sqrt( smin ) / sqrt( amax ); // scond + out[ offsetOut + strideOut ] = amax; // amax + info = 0; + return info; +} + + +// EXPORTS // + +module.exports = dppequ; From b5618f14d4ee1e4d69a1757f259a763f480d5e9b Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Mon, 7 Apr 2025 09:39:01 +0000 Subject: [PATCH 02/28] feat: add exports --- 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/dppequ/lib/base.js | 43 +++++++----- .../@stdlib/lapack/base/dppequ/lib/dppequ.js | 63 +++++++++++++++++ .../@stdlib/lapack/base/dppequ/lib/main.js | 35 ++++++++++ .../@stdlib/lapack/base/dppequ/lib/ndarray.js | 69 +++++++++++++++++++ 4 files changed, 193 insertions(+), 17 deletions(-) create mode 100644 lib/node_modules/@stdlib/lapack/base/dppequ/lib/dppequ.js create mode 100644 lib/node_modules/@stdlib/lapack/base/dppequ/lib/main.js create mode 100644 lib/node_modules/@stdlib/lapack/base/dppequ/lib/ndarray.js diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/base.js b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/base.js index acacba60715b..1959f700cb4a 100644 --- a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/base.js +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/base.js @@ -43,6 +43,17 @@ var min = require( '@stdlib/math/base/special/min' ); * @param {integer} strideOut - stride length for `out` * @param {integer} offsetOut - starting index for `out` * @returns {integer} status code +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var AP = new Float64Array( [ 1.0, 2.0, 3.0, 5.0, 6.0, 9.0 ] ); +* var S = new Float64Array( 3 ); +* var out = new Float64Array( 2 ); +* +* dppequ( 'row-major', 'L', 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); +* // S => [ 1, ~0.58, ~0.33 ] +* // out => [ ~0.33, 9 ] */ function dppequ( order, uplo, N, AP, strideAP, offsetAP, S, strideS, offsetS, out, strideOut, offsetOut ) { // eslint-disable-line max-len, max-params var info; @@ -79,23 +90,21 @@ function dppequ( order, uplo, N, AP, strideAP, offsetAP, S, strideS, offsetS, ou amax = max( amax, S[ offsetS + (i * strideS) ] ); } } - } else { // order === 'col-major' - if ( uplo === 'U' ) { // uplo === 'U' - jj = 0; - for ( i = 1; i < N; i++ ) { - jj += i + 1; - S[ offsetS + (i * strideS) ] = AP[ offsetAP + (jj * strideAP) ]; - smin = min( smin, S[ offsetS + (i * strideS) ] ); - amax = max( amax, S[ offsetS + (i * strideS) ] ); - } - } else { // uplo === 'L' - jj = 0; - for ( i = 1; i < N; i++ ) { - jj += N - i + 1; - S[ offsetS + (i * strideS) ] = AP[ offsetAP + (jj * strideAP) ]; - smin = min( smin, S[ offsetS + (i * strideS) ] ); - amax = max( amax, S[ offsetS + (i * strideS) ] ); - } + } else if ( uplo === 'U' ) { // order === 'col-major' + jj = 0; + for ( i = 1; i < N; i++ ) { + jj += i + 1; + S[ offsetS + (i * strideS) ] = AP[ offsetAP + (jj * strideAP) ]; + smin = min( smin, S[ offsetS + (i * strideS) ] ); + amax = max( amax, S[ offsetS + (i * strideS) ] ); + } + } else { // uplo === 'L', order === 'col-major' + jj = 0; + for ( i = 1; i < N; i++ ) { + jj += N - i + 1; + S[ offsetS + (i * strideS) ] = AP[ offsetAP + (jj * strideAP) ]; + smin = min( smin, S[ offsetS + (i * strideS) ] ); + amax = max( amax, S[ offsetS + (i * strideS) ] ); } } diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/dppequ.js b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/dppequ.js new file mode 100644 index 000000000000..6cf26fb0f45e --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/dppequ.js @@ -0,0 +1,63 @@ +/** +* @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 isLayout = require( '@stdlib/blas/base/assert/is-layout' ); +var format = require( '@stdlib/string/format' ); +var base = require( './base.js' ); + + +// MAIN // + +/** +* Computes the row and column scaling factors intended to equilibrate a symmetric positive definite matrix `A` in packed storage and reduce it's condition number (with respect to the two-norm). +* +* @param {string} order - specifies whether `AP` is packed in row-major or column-major order +* @param {string} uplo - 'Upper' or 'Lower' triangle of `A` is stored +* @param {NonNegativeInteger} N - order of the matrix `A` +* @param {Float64Array} AP - array containing the upper or lower triangle of `A` in packed form +* @param {Float64Array} S - array to store the scale factors of `A` +* @param {Float64Array} out - array to store the output +* @throws {TypeError} first argument must be a valid order +* @returns {integer} status code +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var AP = new Float64Array( [ 1.0, 2.0, 3.0, 5.0, 6.0, 9.0 ] ); +* var S = new Float64Array( 3 ); +* var out = new Float64Array( 2 ); +* +* dppequ( 'row-major', 'L', 3, AP, S, out ); +* // S => [ 1, ~0.58, ~0.33 ] +* // out => [ ~0.33, 9 ] +*/ +function dppequ( order, uplo, N, AP, S, out ) { + if ( !isLayout( order ) ) { + throw new TypeError( format( 'invalid argument. First argument must be a valid order. Value: `%s`.', order ) ); + } + return base( order, uplo, N, AP, 1, 0, S, 1, 0, out, 1, 0 ); +} + + +// EXPORTS // + +module.exports = dppequ; diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/main.js b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/main.js new file mode 100644 index 000000000000..d40caa8fc3f4 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/main.js @@ -0,0 +1,35 @@ +/** +* @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 setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var dppequ = require( './dppequ.js' ); +var ndarray = require( './ndarray.js' ); + + +// MAIN // + +setReadOnly( dppequ, 'ndarray', ndarray ); + + +// EXPORTS // + +module.exports = dppequ; diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/ndarray.js b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/ndarray.js new file mode 100644 index 000000000000..f8f6486b3470 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/ndarray.js @@ -0,0 +1,69 @@ +/** +* @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 isLayout = require( '@stdlib/blas/base/assert/is-layout' ); +var format = require( '@stdlib/string/format' ); +var base = require( './base.js' ); + + +// MAIN // + +/** +* Computes the row and column scaling factors intended to equilibrate a symmetric positive definite matrix `A` in packed storage and reduce it's condition number (with respect to the two-norm). +* +* @param {string} order - specifies whether `AP` is packed in row-major or column-major order +* @param {string} uplo - 'Upper' or 'Lower' triangle of `A` is stored +* @param {NonNegativeInteger} N - order of the matrix `A` +* @param {Float64Array} AP - array containing the upper or lower triangle of `A` in packed form +* @param {integer} strideAP - stride length for `AP` +* @param {integer} offsetAP - starting index for `AP` +* @param {Float64Array} S - array to store the scale factors of `A` +* @param {integer} strideS - stride length for `S` +* @param {integer} offsetS - starting index for `S` +* @param {Float64Array} out - array to store the output +* @param {integer} strideOut - stride length for `out` +* @param {integer} offsetOut - starting index for `out` +* @throws {TypeError} first argument must be a valid order +* @returns {integer} status code +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var AP = new Float64Array( [ 1.0, 2.0, 3.0, 5.0, 6.0, 9.0 ] ); +* var S = new Float64Array( 3 ); +* var out = new Float64Array( 2 ); +* +* dppequ( 'row-major', 'L', 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); +* // S => [ 1, ~0.58, ~0.33 ] +* // out => [ ~0.33, 9 ] +*/ +function dppequ( order, uplo, N, AP, strideAP, offsetAP, S, strideS, offsetS, out, strideOut, offsetOut ) { // eslint-disable-line max-len, max-params + if ( !isLayout( order ) ) { + throw new TypeError( format( 'invalid argument. First argument must be a valid order. Value: `%s`.', order ) ); + } + return base( order, uplo, N, AP, strideAP, offsetAP, S, strideS, offsetS, out, strideOut, offsetOut ); // eslint-disable-line max-len +} + + +// EXPORTS // + +module.exports = dppequ; From b7e80ebf8668773d0f820d8c8af4171dda632a95 Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Mon, 7 Apr 2025 09:46:14 +0000 Subject: [PATCH 03/28] feat: merge loops --- 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/dppequ/lib/base.js | 34 +++++++------------ 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/base.js b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/base.js index 1959f700cb4a..63a8e19ec4d7 100644 --- a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/base.js +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/base.js @@ -28,7 +28,7 @@ var min = require( '@stdlib/math/base/special/min' ); // MAIN // /** -* Computes the row and column scalings intended to equilibrate a symmetric positive definite matrix `A` in packed storage and reduce it's condition number (with respect to the two-norm). +* Computes the row and column scaling factors intended to equilibrate a symmetric positive definite matrix `A` in packed storage and reduce it's condition number (with respect to the two-norm). * * @param {string} order - specifies whether `AP` is packed in row-major or column-major order * @param {string} uplo - 'Upper' or 'Lower' triangle of `A` is stored @@ -72,36 +72,26 @@ function dppequ( order, uplo, N, AP, strideAP, offsetAP, S, strideS, offsetS, ou smin = S[ offsetAP ]; amax = S[ offsetAP ]; - if ( order === 'row-major' ) { - if ( uplo === 'U' ) { // uplo === 'U' - jj = 0; - for ( i = 1; i < N; i++ ) { + if ( uplo === 'U' ) { // uplo === 'U' + jj = 0; + for ( i = 1; i < N; i++ ) { + if ( order === 'row-major' ) { jj += N - i + 1; - S[ offsetS + (i * strideS) ] = AP[ offsetAP + (jj * strideAP) ]; - smin = min( smin, S[ offsetS + (i * strideS) ] ); - amax = max( amax, S[ offsetS + (i * strideS) ] ); - } - } else { // uplo === 'L' - jj = 0; - for ( i = 1; i < N; i++ ) { + } else { // order === 'column-major' jj += i + 1; - S[ offsetS + (i * strideS) ] = AP[ offsetAP + (jj * strideAP) ]; - smin = min( smin, S[ offsetS + (i * strideS) ] ); - amax = max( amax, S[ offsetS + (i * strideS) ] ); } - } - } else if ( uplo === 'U' ) { // order === 'col-major' - jj = 0; - for ( i = 1; i < N; i++ ) { - jj += i + 1; S[ offsetS + (i * strideS) ] = AP[ offsetAP + (jj * strideAP) ]; smin = min( smin, S[ offsetS + (i * strideS) ] ); amax = max( amax, S[ offsetS + (i * strideS) ] ); } - } else { // uplo === 'L', order === 'col-major' + } else { // uplo === 'L' jj = 0; for ( i = 1; i < N; i++ ) { - jj += N - i + 1; + if ( order === 'row-major' ) { + jj += i + 1; + } else { // order === 'column-major' + jj += N - i + 1; + } S[ offsetS + (i * strideS) ] = AP[ offsetAP + (jj * strideAP) ]; smin = min( smin, S[ offsetS + (i * strideS) ] ); amax = max( amax, S[ offsetS + (i * strideS) ] ); From 9bb5c3897a7135c15581792eaf218f8a6cdec575 Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Mon, 7 Apr 2025 09:50:37 +0000 Subject: [PATCH 04/28] 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/dppequ/lib/base.js | 2 +- .../@stdlib/lapack/base/dppequ/lib/dppequ.js | 2 +- .../@stdlib/lapack/base/dppequ/lib/index.js | 72 +++++++++++++++++++ .../@stdlib/lapack/base/dppequ/lib/main.js | 2 +- .../@stdlib/lapack/base/dppequ/lib/ndarray.js | 4 +- 5 files changed, 77 insertions(+), 5 deletions(-) create mode 100644 lib/node_modules/@stdlib/lapack/base/dppequ/lib/index.js diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/base.js b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/base.js index 63a8e19ec4d7..ff622f664b59 100644 --- a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/base.js +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/base.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/dppequ/lib/dppequ.js b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/dppequ.js index 6cf26fb0f45e..6859e71eaa25 100644 --- a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/dppequ.js +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/dppequ.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/dppequ/lib/index.js b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/index.js new file mode 100644 index 000000000000..40790ac7c266 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/index.js @@ -0,0 +1,72 @@ +/** +* @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 compute the row and column scaling factors intended to equilibrate a symmetric positive definite matrix `A` in packed storage and reduce it's condition number (with respect to the two-norm). +* +* @module @stdlib/lapack/base/dppequ +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var dppequ = require( '@stdlib/lapack/base/dppequ' ); +* +* var AP = new Float64Array( [ 1.0, 2.0, 3.0, 5.0, 6.0, 9.0 ] ); +* var S = new Float64Array( 3 ); +* var out = new Float64Array( 2 ); +* +* dppequ( 'row-major', 'L', 3, AP, S, out ); +* // S => [ 1, ~0.58, ~0.33 ] +* // out => [ ~0.33, 9 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var dppequ = require( '@stdlib/lapack/base/dppequ' ); +* +* var AP = new Float64Array( [ 1.0, 2.0, 3.0, 5.0, 6.0, 9.0 ] ); +* var S = new Float64Array( 3 ); +* var out = new Float64Array( 2 ); +* +* dppequ.ndarray( 'row-major', 'L', 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); +* // S => [ 1, ~0.58, ~0.33 ] +* // out => [ ~0.33, 9 ] +*/ + +// 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 dppequ; +var tmp = tryRequire( join( __dirname, './native.js' ) ); +if ( isError( tmp ) ) { + dppequ = main; +} else { + dppequ = tmp; +} + + +// EXPORTS // + +module.exports = dppequ; diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/main.js b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/main.js index d40caa8fc3f4..7b6ee1e50424 100644 --- a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/main.js +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/main.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/dppequ/lib/ndarray.js b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/ndarray.js index f8f6486b3470..44f98b80b569 100644 --- a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/ndarray.js +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/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. @@ -28,7 +28,7 @@ var base = require( './base.js' ); // MAIN // /** -* Computes the row and column scaling factors intended to equilibrate a symmetric positive definite matrix `A` in packed storage and reduce it's condition number (with respect to the two-norm). +* Computes the row and column scaling factors intended to equilibrate a symmetric positive definite matrix `A` in packed storage and reduce it's condition number (with respect to the two-norm) using alternative indexing semantics. * * @param {string} order - specifies whether `AP` is packed in row-major or column-major order * @param {string} uplo - 'Upper' or 'Lower' triangle of `A` is stored From fab8873dea994afefe5a08b27595bbf6702c32f3 Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Wed, 16 Apr 2025 18:15:54 +0000 Subject: [PATCH 05/28] 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/dppequ/lib/dppequ.js | 4 + .../lapack/base/dppequ/test/test.dppequ.js | 109 ++++++++++++++++++ .../@stdlib/lapack/base/dppequ/test/test.js | 82 +++++++++++++ 3 files changed, 195 insertions(+) create mode 100644 lib/node_modules/@stdlib/lapack/base/dppequ/test/test.dppequ.js create mode 100644 lib/node_modules/@stdlib/lapack/base/dppequ/test/test.js diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/dppequ.js b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/dppequ.js index 6859e71eaa25..947507c94276 100644 --- a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/dppequ.js +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/dppequ.js @@ -37,6 +37,7 @@ var base = require( './base.js' ); * @param {Float64Array} S - array to store the scale factors of `A` * @param {Float64Array} out - array to store the output * @throws {TypeError} first argument must be a valid order +* @throws {RangeError} third argument must be a nonnegative integer * @returns {integer} status code * * @example @@ -54,6 +55,9 @@ function dppequ( order, uplo, N, AP, S, out ) { if ( !isLayout( order ) ) { throw new TypeError( format( 'invalid argument. First argument must be a valid order. Value: `%s`.', order ) ); } + if ( N < 0 ) { + throw new RangeError( format( 'invalid argument. First argument must be a nonnegative integer. Value: `%d`.', N ) ); + } return base( order, uplo, N, AP, 1, 0, S, 1, 0, out, 1, 0 ); } diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.dppequ.js b/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.dppequ.js new file mode 100644 index 000000000000..61737e4d2de4 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.dppequ.js @@ -0,0 +1,109 @@ +/** +* @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 Float64Array = require( '@stdlib/array/float64' ); +var dppequ = require( './../lib/dppequ.js' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof dppequ, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 6', function test( t ) { + t.strictEqual( dppequ.length, 6, 'returns expected value' ); + t.end(); +}); + +tape( 'the function throws an error if provided an invalid third argument', function test( t ) { + var values; + var out; + var AP; + var S; + var i; + + values = [ + -1, + -2, + -3, + -4, + -5 + ]; + + AP = new Float64Array( [ 1.0, 2.0, 3.0, 5.0, 6.0, 9.0 ] ); + S = new Float64Array( 3 ); + out = 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() { + dppequ( 'row-major', 'L', value, AP, S, out ); + }; + } +}); + +tape( 'the function throws an error if provided a first argument which is not a valid order', function test( t ) { + var values; + var out; + var AP; + var S; + var i; + + values = [ + 'foo', + 'bar', + 'beep', + 'boop', + -5, + NaN, + true, + false, + null, + void 0, + [], + {}, + function noop() {} + ]; + + AP = new Float64Array( [ 1.0, 2.0, 3.0, 5.0, 6.0, 9.0 ] ); + S = new Float64Array( 3 ); + out = 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() { + dppequ( value, 'L', 3, AP, S, out ); + }; + } +}); diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.js b/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.js new file mode 100644 index 000000000000..96853273fab0 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.js @@ -0,0 +1,82 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var proxyquire = require( 'proxyquire' ); +var IS_BROWSER = require( '@stdlib/assert/is-browser' ); +var dppequ = 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 dppequ, '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 dppequ.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 dppequ = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( dppequ, 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 dppequ; + var main; + + main = require( './../lib/dppequ.js' ); + + dppequ = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( dppequ, main, 'returns expected value' ); + t.end(); + + function tryRequire() { + return new Error( 'Cannot find module' ); + } +}); From 51ad33f0297c29ecc236750e33127d68c0922b03 Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Wed, 16 Apr 2025 18:23:51 +0000 Subject: [PATCH 06/28] test: add initial 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: 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/dppequ/lib/ndarray.js | 4 + .../lapack/base/dppequ/test/test.ndarray.js | 109 ++++++++++++++++++ 2 files changed, 113 insertions(+) create mode 100644 lib/node_modules/@stdlib/lapack/base/dppequ/test/test.ndarray.js diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/ndarray.js b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/ndarray.js index 44f98b80b569..8c264abd01f4 100644 --- a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/ndarray.js +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/ndarray.js @@ -43,6 +43,7 @@ var base = require( './base.js' ); * @param {integer} strideOut - stride length for `out` * @param {integer} offsetOut - starting index for `out` * @throws {TypeError} first argument must be a valid order +* @throws {RangeError} third argument must be a nonnegative integer * @returns {integer} status code * * @example @@ -60,6 +61,9 @@ function dppequ( order, uplo, N, AP, strideAP, offsetAP, S, strideS, offsetS, ou if ( !isLayout( order ) ) { throw new TypeError( format( 'invalid argument. First argument must be a valid order. Value: `%s`.', order ) ); } + if ( N < 0 ) { + throw new RangeError( format( 'invalid argument. First argument must be a nonnegative integer. Value: `%d`.', N ) ); + } return base( order, uplo, N, AP, strideAP, offsetAP, S, strideS, offsetS, out, strideOut, offsetOut ); // eslint-disable-line max-len } diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.ndarray.js new file mode 100644 index 000000000000..acdac90d5b17 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.ndarray.js @@ -0,0 +1,109 @@ +/** +* @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 Float64Array = require( '@stdlib/array/float64' ); +var dppequ = require( './../lib/ndarray.js' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof dppequ, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 12', function test( t ) { + t.strictEqual( dppequ.length, 12, 'returns expected value' ); + t.end(); +}); + +tape( 'the function throws an error if provided an invalid third argument', function test( t ) { + var values; + var out; + var AP; + var S; + var i; + + values = [ + -1, + -2, + -3, + -4, + -5 + ]; + + AP = new Float64Array( [ 1.0, 2.0, 3.0, 5.0, 6.0, 9.0 ] ); + S = new Float64Array( 3 ); + out = 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() { + dppequ( 'row-major', 'L', value, AP, 1, 0, S, 1, 0, out, 1, 0 ); + }; + } +}); + +tape( 'the function throws an error if provided a first argument which is not a valid order', function test( t ) { + var values; + var out; + var AP; + var S; + var i; + + values = [ + 'foo', + 'bar', + 'beep', + 'boop', + -5, + NaN, + true, + false, + null, + void 0, + [], + {}, + function noop() {} + ]; + + AP = new Float64Array( [ 1.0, 2.0, 3.0, 5.0, 6.0, 9.0 ] ); + S = new Float64Array( 3 ); + out = 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() { + dppequ( value, 'L', 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); + }; + } +}); From ccda72f9235a6bada4603ab69136db4d66546723 Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Wed, 16 Apr 2025 18:24:44 +0000 Subject: [PATCH 07/28] test: add initial 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 --- --- lib/node_modules/@stdlib/lapack/base/dppequ/test/test.dppequ.js | 2 +- .../@stdlib/lapack/base/dppequ/test/test.ndarray.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.dppequ.js b/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.dppequ.js index 61737e4d2de4..7cfe9d30c9e9 100644 --- a/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.dppequ.js +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.dppequ.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/dppequ/test/test.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.ndarray.js index acdac90d5b17..3bce838fa53d 100644 --- a/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.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. From dc0dfd0793a65bc3708fcdc8ee1676fa184da600 Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Fri, 18 Apr 2025 13:08:17 +0000 Subject: [PATCH 08/28] test: add tests --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../lapack/base/dppequ/test/test.dppequ.js | 86 +++++++++++++++++++ 1 file changed, 86 insertions(+) diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.dppequ.js b/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.dppequ.js index 7cfe9d30c9e9..83f3b97d6447 100644 --- a/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.dppequ.js +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.dppequ.js @@ -18,6 +18,8 @@ 'use strict'; +/* eslint-disable max-len */ + // MODULES // var tape = require( 'tape' ); @@ -107,3 +109,87 @@ tape( 'the function throws an error if provided a first argument which is not a }; } }); + +tape( 'the function calculates the row and column scaling factors intended to equilibrate a symmetric positive definite matrix `A` in packed storage (lower-triangular) (row-major)', function test( t ) { + var expectedOut; + var expectedS; + var out; + var AP; + var S; + + AP = new Float64Array( [ 1.0, 2.0, 3.0, 5.0, 6.0, 9.0 ] ); + S = new Float64Array( 3 ); + out = new Float64Array( 2 ); + + dppequ( 'row-major', 'L', 3, AP, S, out ); + + expectedOut = new Float64Array( [ 0.33333333333333331, 9.0 ] ); + expectedS = new Float64Array( [ 1.0, 0.57735026918962584, 0.33333333333333331 ] ); + t.deepEqual( S, expectedS, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function calculates the row and column scaling factors intended to equilibrate a symmetric positive definite matrix `A` in packed storage (lower-triangular) (column-major)', function test( t ) { + var expectedOut; + var expectedS; + var out; + var AP; + var S; + + AP = new Float64Array( [ 1.0, 2.0, 5.0, 3.0, 6.0, 9.0 ] ); + S = new Float64Array( 3 ); + out = new Float64Array( 2 ); + + dppequ( 'column-major', 'L', 3, AP, S, out ); + + expectedOut = new Float64Array( [ 0.33333333333333331, 9.0 ] ); + expectedS = new Float64Array( [ 1.0, 0.57735026918962584, 0.33333333333333331 ] ); + t.deepEqual( S, expectedS, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function calculates the row and column scaling factors intended to equilibrate a symmetric positive definite matrix `A` in packed storage (upper-triangular) (row-major)', function test( t ) { + var expectedOut; + var expectedS; + var out; + var AP; + var S; + + AP = new Float64Array( [ 1.0, 2.0, 3.0, 5.0, 6.0, 9.0 ] ); + S = new Float64Array( 3 ); + out = new Float64Array( 2 ); + + dppequ( 'row-major', 'U', 3, AP, S, out ); + + expectedOut = new Float64Array( [ 0.33333333333333331, 9.0 ] ); + expectedS = new Float64Array( [ 1.0, 0.44721359549995793, 0.33333333333333331 ] ); + t.deepEqual( S, expectedS, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function calculates the row and column scaling factors intended to equilibrate a symmetric positive definite matrix `A` in packed storage (upper-triangular) (column-major)', function test( t ) { + var expectedOut; + var expectedS; + var out; + var AP; + var S; + + AP = new Float64Array( [ 1.0, 2.0, 5.0, 3.0, 6.0, 9.0 ] ); + S = new Float64Array( 3 ); + out = new Float64Array( 2 ); + + dppequ( 'column-major', 'U', 3, AP, S, out ); + + expectedOut = new Float64Array( [ 0.33333333333333331, 9.0 ] ); + expectedS = new Float64Array( [ 1.0, 0.44721359549995793, 0.33333333333333331 ] ); + t.deepEqual( S, expectedS, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + + t.end(); +}); From 7ac07fd5f14ff7c20e50b13974db31860680d945 Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Fri, 18 Apr 2025 13:37:09 +0000 Subject: [PATCH 09/28] test: add N=0 case --- 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/dppequ/test/test.dppequ.js | 39 +++++++++++++++++-- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.dppequ.js b/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.dppequ.js index 83f3b97d6447..70231f398d9d 100644 --- a/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.dppequ.js +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.dppequ.js @@ -110,9 +110,33 @@ tape( 'the function throws an error if provided a first argument which is not a } }); +tape( 'the function leaves the row and column scaling factors intended to equilibrate a symmetric positive definite matrix `A` in packed storage unchanged if N is equal to 0', function test( t ) { + var expectedOut; + var expectedS; + var info; + var out; + var AP; + var S; + + AP = new Float64Array( [ 1.0, 2.0, 3.0, 5.0, 6.0, 9.0 ] ); + S = new Float64Array( 3 ); + out = new Float64Array( 2 ); + + info = dppequ( 'row-major', 'L', 0, AP, S, out ); + + expectedOut = new Float64Array( [ 1.0, 0.0 ] ); + expectedS = new Float64Array( 3 ); + t.deepEqual( S, expectedS, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( info, 0, 'returns expected value' ); + + t.end(); +}); + tape( 'the function calculates the row and column scaling factors intended to equilibrate a symmetric positive definite matrix `A` in packed storage (lower-triangular) (row-major)', function test( t ) { var expectedOut; var expectedS; + var info; var out; var AP; var S; @@ -121,12 +145,13 @@ tape( 'the function calculates the row and column scaling factors intended to eq S = new Float64Array( 3 ); out = new Float64Array( 2 ); - dppequ( 'row-major', 'L', 3, AP, S, out ); + info = dppequ( 'row-major', 'L', 3, AP, S, out ); expectedOut = new Float64Array( [ 0.33333333333333331, 9.0 ] ); expectedS = new Float64Array( [ 1.0, 0.57735026918962584, 0.33333333333333331 ] ); t.deepEqual( S, expectedS, 'returns expected value' ); t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( info, 0, 'returns expected value' ); t.end(); }); @@ -134,6 +159,7 @@ tape( 'the function calculates the row and column scaling factors intended to eq tape( 'the function calculates the row and column scaling factors intended to equilibrate a symmetric positive definite matrix `A` in packed storage (lower-triangular) (column-major)', function test( t ) { var expectedOut; var expectedS; + var info; var out; var AP; var S; @@ -142,12 +168,13 @@ tape( 'the function calculates the row and column scaling factors intended to eq S = new Float64Array( 3 ); out = new Float64Array( 2 ); - dppequ( 'column-major', 'L', 3, AP, S, out ); + info = dppequ( 'column-major', 'L', 3, AP, S, out ); expectedOut = new Float64Array( [ 0.33333333333333331, 9.0 ] ); expectedS = new Float64Array( [ 1.0, 0.57735026918962584, 0.33333333333333331 ] ); t.deepEqual( S, expectedS, 'returns expected value' ); t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( info, 0, 'returns expected value' ); t.end(); }); @@ -155,6 +182,7 @@ tape( 'the function calculates the row and column scaling factors intended to eq tape( 'the function calculates the row and column scaling factors intended to equilibrate a symmetric positive definite matrix `A` in packed storage (upper-triangular) (row-major)', function test( t ) { var expectedOut; var expectedS; + var info; var out; var AP; var S; @@ -163,12 +191,13 @@ tape( 'the function calculates the row and column scaling factors intended to eq S = new Float64Array( 3 ); out = new Float64Array( 2 ); - dppequ( 'row-major', 'U', 3, AP, S, out ); + info = dppequ( 'row-major', 'U', 3, AP, S, out ); expectedOut = new Float64Array( [ 0.33333333333333331, 9.0 ] ); expectedS = new Float64Array( [ 1.0, 0.44721359549995793, 0.33333333333333331 ] ); t.deepEqual( S, expectedS, 'returns expected value' ); t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( info, 0, 'returns expected value' ); t.end(); }); @@ -176,6 +205,7 @@ tape( 'the function calculates the row and column scaling factors intended to eq tape( 'the function calculates the row and column scaling factors intended to equilibrate a symmetric positive definite matrix `A` in packed storage (upper-triangular) (column-major)', function test( t ) { var expectedOut; var expectedS; + var info; var out; var AP; var S; @@ -184,12 +214,13 @@ tape( 'the function calculates the row and column scaling factors intended to eq S = new Float64Array( 3 ); out = new Float64Array( 2 ); - dppequ( 'column-major', 'U', 3, AP, S, out ); + info = dppequ( 'column-major', 'U', 3, AP, S, out ); expectedOut = new Float64Array( [ 0.33333333333333331, 9.0 ] ); expectedS = new Float64Array( [ 1.0, 0.44721359549995793, 0.33333333333333331 ] ); t.deepEqual( S, expectedS, 'returns expected value' ); t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( info, 0, 'returns expected value' ); t.end(); }); From 7ff79c80c46ba27deaeb696daa79aa74f849b4a1 Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Sat, 19 Apr 2025 08:10:30 +0000 Subject: [PATCH 10/28] test: add non positive diagonal element 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/dppequ/lib/base.js | 4 +- .../lapack/base/dppequ/test/test.dppequ.js | 92 +++++++++++++++++++ 2 files changed, 94 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/base.js b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/base.js index ff622f664b59..3eb0daec7511 100644 --- a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/base.js +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/base.js @@ -72,7 +72,7 @@ function dppequ( order, uplo, N, AP, strideAP, offsetAP, S, strideS, offsetS, ou smin = S[ offsetAP ]; amax = S[ offsetAP ]; - if ( uplo === 'U' ) { // uplo === 'U' + if ( uplo === 'U' ) { jj = 0; for ( i = 1; i < N; i++ ) { if ( order === 'row-major' ) { @@ -101,7 +101,7 @@ function dppequ( order, uplo, N, AP, strideAP, offsetAP, S, strideS, offsetS, ou if ( smin <= 0.0 ) { for ( i = 0; i < N; i++ ) { if ( S[ offsetS + (i * strideS) ] <= 0.0 ) { - out[ offsetOut ] = 0.0; // scond + // Leave first element of `out` unchanged out[ offsetOut + strideOut ] = amax; // amax info = i; return info; diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.dppequ.js b/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.dppequ.js index 70231f398d9d..8476e0085adc 100644 --- a/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.dppequ.js +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.dppequ.js @@ -224,3 +224,95 @@ tape( 'the function calculates the row and column scaling factors intended to eq t.end(); }); + +tape( 'the function finds the first non-positive diagonal element and returns (upper-triangular) (column-major)', function test( t ) { + var expectedOut; + var expectedS; + var info; + var out; + var AP; + var S; + + AP = new Float64Array( [ 1.0, 0.0, -1.0, 0.0, 0.0, 1.0 ] ); + S = new Float64Array( 3 ); + out = new Float64Array( 2 ); + + info = dppequ( 'column-major', 'U', 3, AP, S, out ); + + expectedOut = new Float64Array( [ 0.0, 1.0 ] ); + expectedS = new Float64Array( [ 1.0, -1.0, 1.0 ] ); + t.deepEqual( S, expectedS, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( info, 1, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function finds the first non-positive diagonal element and returns (upper-triangular) (row-major)', function test( t ) { + var expectedOut; + var expectedS; + var info; + var out; + var AP; + var S; + + AP = new Float64Array( [ 1.0, 0.0, 0.0, -1.0, 0.0, 1.0 ] ); + S = new Float64Array( 3 ); + out = new Float64Array( 2 ); + + info = dppequ( 'row-major', 'U', 3, AP, S, out ); + + expectedOut = new Float64Array( [ 0.0, 1.0 ] ); + expectedS = new Float64Array( [ 1.0, -1.0, 1.0 ] ); + t.deepEqual( S, expectedS, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( info, 1, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function finds the first non-positive diagonal element and returns (lower-triangular) (column-major)', function test( t ) { + var expectedOut; + var expectedS; + var info; + var out; + var AP; + var S; + + AP = new Float64Array( [ 1.0, 0.0, -1.0, 0.0, 0.0, 1.0 ] ); + S = new Float64Array( 3 ); + out = new Float64Array( 2 ); + + info = dppequ( 'column-major', 'L', 3, AP, S, out ); + + expectedOut = new Float64Array( [ 0.0, 1.0 ] ); + expectedS = new Float64Array( [ 1.0, 0.0, 1.0 ] ); + t.deepEqual( S, expectedS, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( info, 1, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function finds the first non-positive diagonal element and returns (lower-triangular) (row-major)', function test( t ) { + var expectedOut; + var expectedS; + var info; + var out; + var AP; + var S; + + AP = new Float64Array( [ 1.0, 0.0, 0.0, -1.0, 0.0, 1.0 ] ); + S = new Float64Array( 3 ); + out = new Float64Array( 2 ); + + info = dppequ( 'row-major', 'L', 3, AP, S, out ); + + expectedOut = new Float64Array( [ 0.0, 1.0 ] ); + expectedS = new Float64Array( [ 1.0, 0.0, 1.0 ] ); + t.deepEqual( S, expectedS, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( info, 1, 'returns expected value' ); + + t.end(); +}); From 9de21b0cced56231c785c0a9bbd997624ba0d026 Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Sat, 19 Apr 2025 08:16:26 +0000 Subject: [PATCH 11/28] 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/dppequ/test/test.ndarray.js | 209 ++++++++++++++++++ 1 file changed, 209 insertions(+) diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.ndarray.js index 3bce838fa53d..9baeb9f25394 100644 --- a/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.ndarray.js @@ -18,6 +18,8 @@ 'use strict'; +/* eslint-disable max-len */ + // MODULES // var tape = require( 'tape' ); @@ -107,3 +109,210 @@ tape( 'the function throws an error if provided a first argument which is not a }; } }); + +tape( 'the function leaves the row and column scaling factors intended to equilibrate a symmetric positive definite matrix `A` in packed storage unchanged if N is equal to 0', function test( t ) { + var expectedOut; + var expectedS; + var info; + var out; + var AP; + var S; + + AP = new Float64Array( [ 1.0, 2.0, 3.0, 5.0, 6.0, 9.0 ] ); + S = new Float64Array( 3 ); + out = new Float64Array( 2 ); + + info = dppequ( 'row-major', 'L', 0, AP, 1, 0, S, 1, 0, out, 1, 0 ); + + expectedOut = new Float64Array( [ 1.0, 0.0 ] ); + expectedS = new Float64Array( 3 ); + t.deepEqual( S, expectedS, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( info, 0, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function calculates the row and column scaling factors intended to equilibrate a symmetric positive definite matrix `A` in packed storage (lower-triangular) (row-major)', function test( t ) { + var expectedOut; + var expectedS; + var info; + var out; + var AP; + var S; + + AP = new Float64Array( [ 1.0, 2.0, 3.0, 5.0, 6.0, 9.0 ] ); + S = new Float64Array( 3 ); + out = new Float64Array( 2 ); + + info = dppequ( 'row-major', 'L', 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); + + expectedOut = new Float64Array( [ 0.33333333333333331, 9.0 ] ); + expectedS = new Float64Array( [ 1.0, 0.57735026918962584, 0.33333333333333331 ] ); + t.deepEqual( S, expectedS, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( info, 0, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function calculates the row and column scaling factors intended to equilibrate a symmetric positive definite matrix `A` in packed storage (lower-triangular) (column-major)', function test( t ) { + var expectedOut; + var expectedS; + var info; + var out; + var AP; + var S; + + AP = new Float64Array( [ 1.0, 2.0, 5.0, 3.0, 6.0, 9.0 ] ); + S = new Float64Array( 3 ); + out = new Float64Array( 2 ); + + info = dppequ( 'column-major', 'L', 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); + + expectedOut = new Float64Array( [ 0.33333333333333331, 9.0 ] ); + expectedS = new Float64Array( [ 1.0, 0.57735026918962584, 0.33333333333333331 ] ); + t.deepEqual( S, expectedS, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( info, 0, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function calculates the row and column scaling factors intended to equilibrate a symmetric positive definite matrix `A` in packed storage (upper-triangular) (row-major)', function test( t ) { + var expectedOut; + var expectedS; + var info; + var out; + var AP; + var S; + + AP = new Float64Array( [ 1.0, 2.0, 3.0, 5.0, 6.0, 9.0 ] ); + S = new Float64Array( 3 ); + out = new Float64Array( 2 ); + + info = dppequ( 'row-major', 'U', 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); + + expectedOut = new Float64Array( [ 0.33333333333333331, 9.0 ] ); + expectedS = new Float64Array( [ 1.0, 0.44721359549995793, 0.33333333333333331 ] ); + t.deepEqual( S, expectedS, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( info, 0, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function calculates the row and column scaling factors intended to equilibrate a symmetric positive definite matrix `A` in packed storage (upper-triangular) (column-major)', function test( t ) { + var expectedOut; + var expectedS; + var info; + var out; + var AP; + var S; + + AP = new Float64Array( [ 1.0, 2.0, 5.0, 3.0, 6.0, 9.0 ] ); + S = new Float64Array( 3 ); + out = new Float64Array( 2 ); + + info = dppequ( 'column-major', 'U', 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); + + expectedOut = new Float64Array( [ 0.33333333333333331, 9.0 ] ); + expectedS = new Float64Array( [ 1.0, 0.44721359549995793, 0.33333333333333331 ] ); + t.deepEqual( S, expectedS, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( info, 0, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function finds the first non-positive diagonal element and returns (upper-triangular) (column-major)', function test( t ) { + var expectedOut; + var expectedS; + var info; + var out; + var AP; + var S; + + AP = new Float64Array( [ 1.0, 0.0, -1.0, 0.0, 0.0, 1.0 ] ); + S = new Float64Array( 3 ); + out = new Float64Array( 2 ); + + info = dppequ( 'column-major', 'U', 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); + + expectedOut = new Float64Array( [ 0.0, 1.0 ] ); + expectedS = new Float64Array( [ 1.0, -1.0, 1.0 ] ); + t.deepEqual( S, expectedS, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( info, 1, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function finds the first non-positive diagonal element and returns (upper-triangular) (row-major)', function test( t ) { + var expectedOut; + var expectedS; + var info; + var out; + var AP; + var S; + + AP = new Float64Array( [ 1.0, 0.0, 0.0, -1.0, 0.0, 1.0 ] ); + S = new Float64Array( 3 ); + out = new Float64Array( 2 ); + + info = dppequ( 'row-major', 'U', 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); + + expectedOut = new Float64Array( [ 0.0, 1.0 ] ); + expectedS = new Float64Array( [ 1.0, -1.0, 1.0 ] ); + t.deepEqual( S, expectedS, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( info, 1, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function finds the first non-positive diagonal element and returns (lower-triangular) (column-major)', function test( t ) { + var expectedOut; + var expectedS; + var info; + var out; + var AP; + var S; + + AP = new Float64Array( [ 1.0, 0.0, -1.0, 0.0, 0.0, 1.0 ] ); + S = new Float64Array( 3 ); + out = new Float64Array( 2 ); + + info = dppequ( 'column-major', 'L', 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); + + expectedOut = new Float64Array( [ 0.0, 1.0 ] ); + expectedS = new Float64Array( [ 1.0, 0.0, 1.0 ] ); + t.deepEqual( S, expectedS, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( info, 1, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function finds the first non-positive diagonal element and returns (lower-triangular) (row-major)', function test( t ) { + var expectedOut; + var expectedS; + var info; + var out; + var AP; + var S; + + AP = new Float64Array( [ 1.0, 0.0, 0.0, -1.0, 0.0, 1.0 ] ); + S = new Float64Array( 3 ); + out = new Float64Array( 2 ); + + info = dppequ( 'row-major', 'L', 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); + + expectedOut = new Float64Array( [ 0.0, 1.0 ] ); + expectedS = new Float64Array( [ 1.0, 0.0, 1.0 ] ); + t.deepEqual( S, expectedS, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( info, 1, 'returns expected value' ); + + t.end(); +}); From b2d8e26e7901c751eb548655b0727a33e4c4ef0f Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Sat, 26 Apr 2025 12:53:59 +0000 Subject: [PATCH 12/28] 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: 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/dppequ/lib/base.js | 6 +- .../lapack/base/dppequ/test/test.ndarray.js | 93 +++++++++++++++++++ 2 files changed, 96 insertions(+), 3 deletions(-) diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/base.js b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/base.js index 3eb0daec7511..50d34feb21dd 100644 --- a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/base.js +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/base.js @@ -68,9 +68,9 @@ function dppequ( order, uplo, N, AP, strideAP, offsetAP, S, strideS, offsetS, ou return 0; // info } - S[ offsetAP ] = AP[ offsetAP ]; - smin = S[ offsetAP ]; - amax = S[ offsetAP ]; + S[ offsetS ] = AP[ offsetAP ]; + smin = S[ offsetS ]; + amax = S[ offsetS ]; if ( uplo === 'U' ) { jj = 0; diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.ndarray.js index 9baeb9f25394..53d81af013be 100644 --- a/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.ndarray.js @@ -316,3 +316,96 @@ tape( 'the function finds the first non-positive diagonal element and returns (l t.end(); }); + +tape( 'the function calculates the row and column scaling factors intended to equilibrate a symmetric positive definite matrix `A` in packed storage with negative strides (lower-triangular) (row-major)', function test( t ) { + var expectedOut; + var expectedS; + var info; + var out; + var AP; + var S; + + AP = new Float64Array( [ 9.0, 6.0, 5.0, 3.0, 2.0, 1.0 ] ); + S = new Float64Array( 3 ); + out = new Float64Array( 2 ); + + info = dppequ( 'row-major', 'L', 3, AP, -1, 5, S, -1, 2, out, -1, 1 ); + + expectedOut = new Float64Array( [ 9.0, 0.33333333333333331 ] ); + expectedS = new Float64Array( [ 0.33333333333333331, 0.57735026918962584, 1.0 ] ); + t.deepEqual( S, expectedS, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( info, 0, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function calculates the row and column scaling factors intended to equilibrate a symmetric positive definite matrix `A` in packed storage with negative strides (lower-triangular) (column-major)', function test( t ) { + var expectedOut; + var expectedS; + var info; + var out; + var AP; + var S; + + AP = new Float64Array( [ 9.0, 6.0, 3.0, 5.0, 2.0, 1.0 ] ); + S = new Float64Array( 3 ); + out = new Float64Array( 2 ); + + info = dppequ( 'column-major', 'L', 3, AP, -1, 5, S, -1, 2, out, -1, 1 ); + + expectedOut = new Float64Array( [ 9.0, 0.33333333333333331 ] ); + expectedS = new Float64Array( [ 0.33333333333333331, 0.57735026918962584, 1.0 ] ); + t.deepEqual( S, expectedS, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( info, 0, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function calculates the row and column scaling factors intended to equilibrate a symmetric positive definite matrix `A` in packed storage with negative strides (upper-triangular) (row-major)', function test( t ) { + var expectedOut; + var expectedS; + var info; + var out; + var AP; + var S; + + AP = new Float64Array( [ 9.0, 6.0, 5.0, 3.0, 2.0, 1.0 ] ); + S = new Float64Array( 3 ); + out = new Float64Array( 2 ); + + info = dppequ( 'row-major', 'U', 3, AP, -1, 5, S, -1, 2, out, -1, 1 ); + + expectedOut = new Float64Array( [ 9.0, 0.33333333333333331 ] ); + expectedS = new Float64Array( [ 0.33333333333333331, 0.44721359549995793, 1.0 ] ); + + t.deepEqual( S, expectedS, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( info, 0, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function calculates the row and column scaling factors intended to equilibrate a symmetric positive definite matrix `A` in packed storage with negative strides (upper-triangular) (column-major)', function test( t ) { + var expectedOut; + var expectedS; + var info; + var out; + var AP; + var S; + + AP = new Float64Array( [ 9.0, 6.0, 3.0, 5.0, 2.0, 1.0 ] ); + S = new Float64Array( 3 ); + out = new Float64Array( 2 ); + + info = dppequ( 'column-major', 'U', 3, AP, -1, 5, S, -1, 2, out, -1, 1 ); + + expectedOut = new Float64Array( [ 9.0, 0.33333333333333331 ] ); + expectedS = new Float64Array( [ 0.33333333333333331, 0.44721359549995793, 1.0 ] ); + t.deepEqual( S, expectedS, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( info, 0, 'returns expected value' ); + + t.end(); +}); From b896286d84d2e4a1b7a1ed7b8956a5e42a83039a Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Sat, 26 Apr 2025 13:07:31 +0000 Subject: [PATCH 13/28] test: add tests --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../lapack/base/dppequ/test/test.ndarray.js | 92 +++++++++++++++++++ 1 file changed, 92 insertions(+) diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.ndarray.js index 53d81af013be..1d01fc1e58f9 100644 --- a/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.ndarray.js @@ -409,3 +409,95 @@ tape( 'the function calculates the row and column scaling factors intended to eq t.end(); }); + +tape( 'the function finds the first non-positive diagonal element with negative strides and returns (upper-triangular) (column-major)', function test( t ) { + var expectedOut; + var expectedS; + var info; + var out; + var AP; + var S; + + AP = new Float64Array( [ 1.0, 0.0, -1.0, 0.0, 0.0, 1.0 ] ); + S = new Float64Array( 3 ); + out = new Float64Array( 2 ); + + info = dppequ( 'column-major', 'U', 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); + + expectedOut = new Float64Array( [ 0.0, 1.0 ] ); + expectedS = new Float64Array( [ 1.0, -1.0, 1.0 ] ); + t.deepEqual( S, expectedS, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( info, 1, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function finds the first non-positive diagonal element with negative strides and returns (upper-triangular) (row-major)', function test( t ) { + var expectedOut; + var expectedS; + var info; + var out; + var AP; + var S; + + AP = new Float64Array( [ 1.0, 0.0, -1.0, 0.0, 0.0, 1.0 ] ); + S = new Float64Array( 3 ); + out = new Float64Array( 2 ); + + info = dppequ( 'row-major', 'U', 3, AP, -1, 5, S, -1, 2, out, -1, 1 ); + + expectedOut = new Float64Array( [ 1.0, 0.0 ] ); + expectedS = new Float64Array( [ 1.0, -1.0, 1.0 ] ); + t.deepEqual( S, expectedS, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( info, 1, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function finds the first non-positive diagonal element with negative strides and returns (lower-triangular) (column-major)', function test( t ) { + var expectedOut; + var expectedS; + var info; + var out; + var AP; + var S; + + AP = new Float64Array( [ 1.0, 0.0, 0.0, -1.0, 0.0, 1.0 ] ); + S = new Float64Array( 3 ); + out = new Float64Array( 2 ); + + info = dppequ( 'column-major', 'L', 3, AP, -1, 5, S, -1, 2, out, -1, 1 ); + + expectedOut = new Float64Array( [ 1.0, 0.0 ] ); + expectedS = new Float64Array( [ 1.0, 0.0, 1.0 ] ); + t.deepEqual( S, expectedS, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( info, 1, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function finds the first non-positive diagonal element with negative strides and returns (lower-triangular) (row-major)', function test( t ) { + var expectedOut; + var expectedS; + var info; + var out; + var AP; + var S; + + AP = new Float64Array( [ 1.0, 0.0, -1.0, 0.0, 0.0, 1.0 ] ); + S = new Float64Array( 3 ); + out = new Float64Array( 2 ); + + info = dppequ( 'row-major', 'L', 3, AP, -1, 5, S, -1, 2, out, -1, 1 ); + + expectedOut = new Float64Array( [ 1.0, 0.0 ] ); + expectedS = new Float64Array( [ 1.0, 0.0, 1.0 ] ); + t.deepEqual( S, expectedS, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( info, 1, 'returns expected value' ); + + t.end(); +}); From d978c698f4fc18013499f55172cf6ea2f28ffa8b Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Tue, 29 Apr 2025 04:01:34 +0000 Subject: [PATCH 14/28] 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/dppequ/test/test.ndarray.js | 184 ++++++++++++++++++ 1 file changed, 184 insertions(+) diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.ndarray.js index 1d01fc1e58f9..d75affbbd4b8 100644 --- a/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.ndarray.js @@ -501,3 +501,187 @@ tape( 'the function finds the first non-positive diagonal element with negative t.end(); }); + +tape( 'the function calculates the row and column scaling factors intended to equilibrate a symmetric positive definite matrix `A` in packed storage with offsets (lower-triangular) (row-major)', function test( t ) { + var expectedOut; + var expectedS; + var info; + var out; + var AP; + var S; + + AP = new Float64Array( [ 0.0, 1.0, 2.0, 3.0, 5.0, 6.0, 9.0 ] ); + S = new Float64Array( 4 ); + out = new Float64Array( 3 ); + + info = dppequ( 'row-major', 'L', 3, AP, 1, 1, S, 1, 1, out, 1, 1 ); + + expectedOut = new Float64Array( [ 0.0, 0.33333333333333331, 9.0 ] ); + expectedS = new Float64Array( [ 0.0, 1.0, 0.57735026918962584, 0.33333333333333331 ] ); + t.deepEqual( S, expectedS, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( info, 0, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function calculates the row and column scaling factors intended to equilibrate a symmetric positive definite matrix `A` in packed storage with offsets (lower-triangular) (column-major)', function test( t ) { + var expectedOut; + var expectedS; + var info; + var out; + var AP; + var S; + + AP = new Float64Array( [ 0.0, 1.0, 2.0, 5.0, 3.0, 6.0, 9.0 ] ); + S = new Float64Array( 4 ); + out = new Float64Array( 3 ); + + info = dppequ( 'column-major', 'L', 3, AP, 1, 1, S, 1, 1, out, 1, 1 ); + + expectedOut = new Float64Array( [ 0.0, 0.33333333333333331, 9.0 ] ); + expectedS = new Float64Array( [ 0.0, 1.0, 0.57735026918962584, 0.33333333333333331 ] ); + t.deepEqual( S, expectedS, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( info, 0, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function calculates the row and column scaling factors intended to equilibrate a symmetric positive definite matrix `A` in packed storage with offsets (upper-triangular) (row-major)', function test( t ) { + var expectedOut; + var expectedS; + var info; + var out; + var AP; + var S; + + AP = new Float64Array( [ 0.0, 1.0, 2.0, 3.0, 5.0, 6.0, 9.0 ] ); + S = new Float64Array( 4 ); + out = new Float64Array( 3 ); + + info = dppequ( 'row-major', 'U', 3, AP, 1, 1, S, 1, 1, out, 1, 1 ); + + expectedOut = new Float64Array( [ 0.0, 0.33333333333333331, 9.0 ] ); + expectedS = new Float64Array( [ 0.0, 1.0, 0.44721359549995793, 0.33333333333333331 ] ); + t.deepEqual( S, expectedS, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( info, 0, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function calculates the row and column scaling factors intended to equilibrate a symmetric positive definite matrix `A` in packed storage with offsets (upper-triangular) (column-major)', function test( t ) { + var expectedOut; + var expectedS; + var info; + var out; + var AP; + var S; + + AP = new Float64Array( [ 0.0, 1.0, 2.0, 5.0, 3.0, 6.0, 9.0 ] ); + S = new Float64Array( 4 ); + out = new Float64Array( 3 ); + + info = dppequ( 'column-major', 'U', 3, AP, 1, 1, S, 1, 1, out, 1, 1 ); + + expectedOut = new Float64Array( [ 0.0, 0.33333333333333331, 9.0 ] ); + expectedS = new Float64Array( [ 0.0, 1.0, 0.44721359549995793, 0.33333333333333331 ] ); + t.deepEqual( S, expectedS, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( info, 0, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function finds the first non-positive diagonal element with offsets and returns (upper-triangular) (column-major)', function test( t ) { + var expectedOut; + var expectedS; + var info; + var out; + var AP; + var S; + + AP = new Float64Array( [ 0.0, 1.0, 0.0, -1.0, 0.0, 0.0, 1.0 ] ); + S = new Float64Array( 4 ); + out = new Float64Array( 3 ); + + info = dppequ( 'column-major', 'U', 3, AP, 1, 1, S, 1, 1, out, 1, 1 ); + + expectedOut = new Float64Array( [ 0.0, 0.0, 1.0 ] ); + expectedS = new Float64Array( [ 0.0, 1.0, -1.0, 1.0 ] ); + t.deepEqual( S, expectedS, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( info, 1, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function finds the first non-positive diagonal element with offsets and returns (upper-triangular) (row-major)', function test( t ) { + var expectedOut; + var expectedS; + var info; + var out; + var AP; + var S; + + AP = new Float64Array( [ 0.0, 1.0, 0.0, 0.0, -1.0, 0.0, 1.0 ] ); + S = new Float64Array( 4 ); + out = new Float64Array( 3 ); + + info = dppequ( 'row-major', 'U', 3, AP, 1, 1, S, 1, 1, out, 1, 1 ); + + expectedOut = new Float64Array( [ 0.0, 0.0, 1.0 ] ); + expectedS = new Float64Array( [ 0.0, 1.0, -1.0, 1.0 ] ); + t.deepEqual( S, expectedS, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( info, 1, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function finds the first non-positive diagonal element with offsets and returns (lower-triangular) (column-major)', function test( t ) { + var expectedOut; + var expectedS; + var info; + var out; + var AP; + var S; + + AP = new Float64Array( [ 0.0, 1.0, 0.0, -1.0, 0.0, 0.0, 1.0 ] ); + S = new Float64Array( 4 ); + out = new Float64Array( 3 ); + + info = dppequ( 'column-major', 'L', 3, AP, 1, 1, S, 1, 1, out, 1, 1 ); + + expectedOut = new Float64Array( [ 0.0, 0.0, 1.0 ] ); + expectedS = new Float64Array( [ 0.0, 1.0, 0.0, 1.0 ] ); + t.deepEqual( S, expectedS, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( info, 1, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function finds the first non-positive diagonal element with offsets and returns (lower-triangular) (row-major)', function test( t ) { + var expectedOut; + var expectedS; + var info; + var out; + var AP; + var S; + + AP = new Float64Array( [ 0.0, 1.0, 0.0, 0.0, -1.0, 0.0, 1.0 ] ); + S = new Float64Array( 4 ); + out = new Float64Array( 3 ); + + info = dppequ( 'row-major', 'L', 3, AP, 1, 1, S, 1, 1, out, 1, 1 ); + + expectedOut = new Float64Array( [ 0.0, 0.0, 1.0 ] ); + expectedS = new Float64Array( [ 0.0, 1.0, 0.0, 1.0 ] ); + t.deepEqual( S, expectedS, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( info, 1, 'returns expected value' ); + + t.end(); +}); From 9fd55a0a4eeed2273ce180032835f9205514921f Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Mon, 26 May 2025 17:35:00 +0000 Subject: [PATCH 15/28] refactor: pointer arithmmetic --- 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/dppequ/lib/base.js | 30 ++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/base.js b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/base.js index 50d34feb21dd..120ef84ad5df 100644 --- a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/base.js +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/base.js @@ -60,6 +60,7 @@ function dppequ( order, uplo, N, AP, strideAP, offsetAP, S, strideS, offsetS, ou var smin; var amax; var jj; + var is; var i; if ( N === 0 ) { @@ -68,10 +69,12 @@ function dppequ( order, uplo, N, AP, strideAP, offsetAP, S, strideS, offsetS, ou return 0; // info } - S[ offsetS ] = AP[ offsetAP ]; - smin = S[ offsetS ]; - amax = S[ offsetS ]; + is = offsetS; + S[ is ] = AP[ offsetAP ]; + smin = S[ is ]; + amax = S[ is ]; + is = offsetS + strideS; if ( uplo === 'U' ) { jj = 0; for ( i = 1; i < N; i++ ) { @@ -80,9 +83,10 @@ function dppequ( order, uplo, N, AP, strideAP, offsetAP, S, strideS, offsetS, ou } else { // order === 'column-major' jj += i + 1; } - S[ offsetS + (i * strideS) ] = AP[ offsetAP + (jj * strideAP) ]; - smin = min( smin, S[ offsetS + (i * strideS) ] ); - amax = max( amax, S[ offsetS + (i * strideS) ] ); + S[ is ] = AP[ offsetAP + (jj * strideAP) ]; + smin = min( smin, S[ is ] ); + amax = max( amax, S[ is ] ); + is += strideS; } } else { // uplo === 'L' jj = 0; @@ -92,24 +96,28 @@ function dppequ( order, uplo, N, AP, strideAP, offsetAP, S, strideS, offsetS, ou } else { // order === 'column-major' jj += N - i + 1; } - S[ offsetS + (i * strideS) ] = AP[ offsetAP + (jj * strideAP) ]; - smin = min( smin, S[ offsetS + (i * strideS) ] ); - amax = max( amax, S[ offsetS + (i * strideS) ] ); + S[ is ] = AP[ offsetAP + (jj * strideAP) ]; + smin = min( smin, S[ is ] ); + amax = max( amax, S[ is ] ); + is += strideS; } } + is = offsetS; if ( smin <= 0.0 ) { for ( i = 0; i < N; i++ ) { - if ( S[ offsetS + (i * strideS) ] <= 0.0 ) { + if ( S[ is ] <= 0.0 ) { // Leave first element of `out` unchanged out[ offsetOut + strideOut ] = amax; // amax info = i; return info; } + is += strideS; } } else { for ( i = 0; i < N; i++ ) { - S[ offsetS + (i * strideS) ] = 1.0 / sqrt( S[ offsetS + (i * strideS) ] ); // eslint-disable-line max-len + S[ is ] = 1.0 / sqrt( S[ is ] ); + is += strideS; } } From 37b673122188fb651dfbcefa833f4e069b167e61 Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Mon, 26 May 2025 17:39:45 +0000 Subject: [PATCH 16/28] 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/dppequ/lib/base.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/base.js b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/base.js index 120ef84ad5df..75463c9da11e 100644 --- a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/base.js +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/base.js @@ -59,7 +59,7 @@ function dppequ( order, uplo, N, AP, strideAP, offsetAP, S, strideS, offsetS, ou var info; var smin; var amax; - var jj; + var iap; var is; var i; @@ -75,28 +75,27 @@ function dppequ( order, uplo, N, AP, strideAP, offsetAP, S, strideS, offsetS, ou amax = S[ is ]; is = offsetS + strideS; + iap = offsetAP; if ( uplo === 'U' ) { - jj = 0; for ( i = 1; i < N; i++ ) { if ( order === 'row-major' ) { - jj += N - i + 1; + iap += ( N - i + 1 ) * strideAP; } else { // order === 'column-major' - jj += i + 1; + iap += ( i + 1 ) * strideAP; } - S[ is ] = AP[ offsetAP + (jj * strideAP) ]; + S[ is ] = AP[ iap ]; smin = min( smin, S[ is ] ); amax = max( amax, S[ is ] ); is += strideS; } } else { // uplo === 'L' - jj = 0; for ( i = 1; i < N; i++ ) { if ( order === 'row-major' ) { - jj += i + 1; + iap += ( i + 1 ) * strideAP; } else { // order === 'column-major' - jj += N - i + 1; + iap += ( N - i + 1 ) * strideAP; } - S[ is ] = AP[ offsetAP + (jj * strideAP) ]; + S[ is ] = AP[ iap ]; smin = min( smin, S[ is ] ); amax = max( amax, S[ is ] ); is += strideS; From 5b87ba7f6e319b7b5b43f69d4e3533eb085a6987 Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Mon, 26 May 2025 17:52:10 +0000 Subject: [PATCH 17/28] docs: add description --- 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/dppequ/lib/base.js | 8 ++++---- lib/node_modules/@stdlib/lapack/base/dppequ/lib/dppequ.js | 8 ++++---- .../@stdlib/lapack/base/dppequ/lib/ndarray.js | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/base.js b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/base.js index 75463c9da11e..1c6893fffef9 100644 --- a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/base.js +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/base.js @@ -30,13 +30,13 @@ var min = require( '@stdlib/math/base/special/min' ); /** * Computes the row and column scaling factors intended to equilibrate a symmetric positive definite matrix `A` in packed storage and reduce it's condition number (with respect to the two-norm). * -* @param {string} order - specifies whether `AP` is packed in row-major or column-major order -* @param {string} uplo - 'Upper' or 'Lower' triangle of `A` is stored +* @param {string} order - storage layout +* @param {string} uplo - specifies whether upper or lower triangle of `A` is stored ( `upper` or `lower` ) * @param {NonNegativeInteger} N - order of the matrix `A` -* @param {Float64Array} AP - array containing the upper or lower triangle of `A` in packed form +* @param {Float64Array} AP - array containing the upper or lower triangle of `A` in packed form, expectes `N * ( N + 1 ) / 2` indexed elements * @param {integer} strideAP - stride length for `AP` * @param {integer} offsetAP - starting index for `AP` -* @param {Float64Array} S - array to store the scale factors of `A` +* @param {Float64Array} S - array to store the scale factors of `A`, expects `N` indexed elements * @param {integer} strideS - stride length for `S` * @param {integer} offsetS - starting index for `S` * @param {Float64Array} out - array to store the output diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/dppequ.js b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/dppequ.js index 947507c94276..c040df77b690 100644 --- a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/dppequ.js +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/dppequ.js @@ -30,11 +30,11 @@ var base = require( './base.js' ); /** * Computes the row and column scaling factors intended to equilibrate a symmetric positive definite matrix `A` in packed storage and reduce it's condition number (with respect to the two-norm). * -* @param {string} order - specifies whether `AP` is packed in row-major or column-major order -* @param {string} uplo - 'Upper' or 'Lower' triangle of `A` is stored +* @param {string} order - storage layout +* @param {string} uplo - specifies whether upper or lower triangle of `A` is stored ( `upper` or `lower` ) * @param {NonNegativeInteger} N - order of the matrix `A` -* @param {Float64Array} AP - array containing the upper or lower triangle of `A` in packed form -* @param {Float64Array} S - array to store the scale factors of `A` +* @param {Float64Array} AP - array containing the upper or lower triangle of `A` in packed form, expectes `N * ( N + 1 ) / 2` indexed elements +* @param {Float64Array} S - array to store the scale factors of `A`, expects `N` indexed elements * @param {Float64Array} out - array to store the output * @throws {TypeError} first argument must be a valid order * @throws {RangeError} third argument must be a nonnegative integer diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/ndarray.js b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/ndarray.js index 8c264abd01f4..007b83abb348 100644 --- a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/ndarray.js +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/ndarray.js @@ -30,13 +30,13 @@ var base = require( './base.js' ); /** * Computes the row and column scaling factors intended to equilibrate a symmetric positive definite matrix `A` in packed storage and reduce it's condition number (with respect to the two-norm) using alternative indexing semantics. * -* @param {string} order - specifies whether `AP` is packed in row-major or column-major order -* @param {string} uplo - 'Upper' or 'Lower' triangle of `A` is stored +* @param {string} order - storage layout +* @param {string} uplo - specifies whether upper or lower triangle of `A` is stored ( `upper` or `lower` ) * @param {NonNegativeInteger} N - order of the matrix `A` -* @param {Float64Array} AP - array containing the upper or lower triangle of `A` in packed form +* @param {Float64Array} AP - array containing the upper or lower triangle of `A` in packed form, expectes `N * ( N + 1 ) / 2` indexed elements * @param {integer} strideAP - stride length for `AP` * @param {integer} offsetAP - starting index for `AP` -* @param {Float64Array} S - array to store the scale factors of `A` +* @param {Float64Array} S - array to store the scale factors of `A`, expects `N` indexed elements * @param {integer} strideS - stride length for `S` * @param {integer} offsetS - starting index for `S` * @param {Float64Array} out - array to store the output From a8ca2bac256309a45f6b8d0690fc574ce88d5919 Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Tue, 27 May 2025 03:45:04 +0000 Subject: [PATCH 18/28] refactor: use stdlib conventions --- 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/dppequ/lib/base.js | 6 +-- .../@stdlib/lapack/base/dppequ/lib/dppequ.js | 9 +++- .../@stdlib/lapack/base/dppequ/lib/index.js | 4 +- .../@stdlib/lapack/base/dppequ/lib/ndarray.js | 9 +++- .../lapack/base/dppequ/test/test.dppequ.js | 22 ++++---- .../lapack/base/dppequ/test/test.ndarray.js | 54 +++++++++---------- 6 files changed, 57 insertions(+), 47 deletions(-) diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/base.js b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/base.js index 1c6893fffef9..fd1ba2065def 100644 --- a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/base.js +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/base.js @@ -51,7 +51,7 @@ var min = require( '@stdlib/math/base/special/min' ); * var S = new Float64Array( 3 ); * var out = new Float64Array( 2 ); * -* dppequ( 'row-major', 'L', 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); +* dppequ( 'row-major', 'lower', 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); * // S => [ 1, ~0.58, ~0.33 ] * // out => [ ~0.33, 9 ] */ @@ -76,7 +76,7 @@ function dppequ( order, uplo, N, AP, strideAP, offsetAP, S, strideS, offsetS, ou is = offsetS + strideS; iap = offsetAP; - if ( uplo === 'U' ) { + if ( uplo === 'upper' ) { for ( i = 1; i < N; i++ ) { if ( order === 'row-major' ) { iap += ( N - i + 1 ) * strideAP; @@ -88,7 +88,7 @@ function dppequ( order, uplo, N, AP, strideAP, offsetAP, S, strideS, offsetS, ou amax = max( amax, S[ is ] ); is += strideS; } - } else { // uplo === 'L' + } else { // uplo === 'lower' for ( i = 1; i < N; i++ ) { if ( order === 'row-major' ) { iap += ( i + 1 ) * strideAP; diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/dppequ.js b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/dppequ.js index c040df77b690..21debc6c5133 100644 --- a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/dppequ.js +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/dppequ.js @@ -22,6 +22,7 @@ var isLayout = require( '@stdlib/blas/base/assert/is-layout' ); var format = require( '@stdlib/string/format' ); +var isMatrixTriangle = require( '@stdlib/blas/base/assert/is-matrix-triangle' ); var base = require( './base.js' ); @@ -37,6 +38,7 @@ var base = require( './base.js' ); * @param {Float64Array} S - array to store the scale factors of `A`, expects `N` indexed elements * @param {Float64Array} out - array to store the output * @throws {TypeError} first argument must be a valid order +* @throws {TypeError} second argument must be a valid side * @throws {RangeError} third argument must be a nonnegative integer * @returns {integer} status code * @@ -47,7 +49,7 @@ var base = require( './base.js' ); * var S = new Float64Array( 3 ); * var out = new Float64Array( 2 ); * -* dppequ( 'row-major', 'L', 3, AP, S, out ); +* dppequ( 'row-major', 'lower', 3, AP, S, out ); * // S => [ 1, ~0.58, ~0.33 ] * // out => [ ~0.33, 9 ] */ @@ -55,8 +57,11 @@ function dppequ( order, uplo, N, AP, S, out ) { if ( !isLayout( order ) ) { throw new TypeError( format( 'invalid argument. First argument must be a valid order. Value: `%s`.', order ) ); } + if ( !isMatrixTriangle( uplo ) ) { + throw new TypeError( format( 'invalid argument. Second argument must be a valid side. Value: `%s`.', order ) ); + } if ( N < 0 ) { - throw new RangeError( format( 'invalid argument. First argument must be a nonnegative integer. Value: `%d`.', N ) ); + throw new RangeError( format( 'invalid argument. Third argument must be a nonnegative integer. Value: `%d`.', N ) ); } return base( order, uplo, N, AP, 1, 0, S, 1, 0, out, 1, 0 ); } diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/index.js b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/index.js index 40790ac7c266..9828bb32ee86 100644 --- a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/index.js +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/index.js @@ -31,7 +31,7 @@ * var S = new Float64Array( 3 ); * var out = new Float64Array( 2 ); * -* dppequ( 'row-major', 'L', 3, AP, S, out ); +* dppequ( 'row-major', 'lower', 3, AP, S, out ); * // S => [ 1, ~0.58, ~0.33 ] * // out => [ ~0.33, 9 ] * @@ -43,7 +43,7 @@ * var S = new Float64Array( 3 ); * var out = new Float64Array( 2 ); * -* dppequ.ndarray( 'row-major', 'L', 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); +* dppequ.ndarray( 'row-major', 'lower', 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); * // S => [ 1, ~0.58, ~0.33 ] * // out => [ ~0.33, 9 ] */ diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/ndarray.js b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/ndarray.js index 007b83abb348..819b908a1a55 100644 --- a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/ndarray.js +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/ndarray.js @@ -22,6 +22,7 @@ var isLayout = require( '@stdlib/blas/base/assert/is-layout' ); var format = require( '@stdlib/string/format' ); +var isMatrixTriangle = require( '@stdlib/blas/base/assert/is-matrix-triangle' ); var base = require( './base.js' ); @@ -43,6 +44,7 @@ var base = require( './base.js' ); * @param {integer} strideOut - stride length for `out` * @param {integer} offsetOut - starting index for `out` * @throws {TypeError} first argument must be a valid order +* @throws {TypeError} first argument must be a valid side * @throws {RangeError} third argument must be a nonnegative integer * @returns {integer} status code * @@ -53,7 +55,7 @@ var base = require( './base.js' ); * var S = new Float64Array( 3 ); * var out = new Float64Array( 2 ); * -* dppequ( 'row-major', 'L', 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); +* dppequ( 'row-major', 'lower', 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); * // S => [ 1, ~0.58, ~0.33 ] * // out => [ ~0.33, 9 ] */ @@ -62,7 +64,10 @@ function dppequ( order, uplo, N, AP, strideAP, offsetAP, S, strideS, offsetS, ou throw new TypeError( format( 'invalid argument. First argument must be a valid order. Value: `%s`.', order ) ); } if ( N < 0 ) { - throw new RangeError( format( 'invalid argument. First argument must be a nonnegative integer. Value: `%d`.', N ) ); + throw new RangeError( format( 'invalid argument. Third argument must be a nonnegative integer. Value: `%d`.', N ) ); + } + if ( !isMatrixTriangle( uplo ) ) { + throw new TypeError( format( 'invalid argument. Second argument must be a valid side. Value: `%s`.', order ) ); } return base( order, uplo, N, AP, strideAP, offsetAP, S, strideS, offsetS, out, strideOut, offsetOut ); // eslint-disable-line max-len } diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.dppequ.js b/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.dppequ.js index 8476e0085adc..c4a5e592de52 100644 --- a/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.dppequ.js +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.dppequ.js @@ -66,7 +66,7 @@ tape( 'the function throws an error if provided an invalid third argument', func function badValue( value ) { return function badValue() { - dppequ( 'row-major', 'L', value, AP, S, out ); + dppequ( 'row-major', 'lower', value, AP, S, out ); }; } }); @@ -105,7 +105,7 @@ tape( 'the function throws an error if provided a first argument which is not a function badValue( value ) { return function badValue() { - dppequ( value, 'L', 3, AP, S, out ); + dppequ( value, 'lower', 3, AP, S, out ); }; } }); @@ -122,7 +122,7 @@ tape( 'the function leaves the row and column scaling factors intended to equili S = new Float64Array( 3 ); out = new Float64Array( 2 ); - info = dppequ( 'row-major', 'L', 0, AP, S, out ); + info = dppequ( 'row-major', 'lower', 0, AP, S, out ); expectedOut = new Float64Array( [ 1.0, 0.0 ] ); expectedS = new Float64Array( 3 ); @@ -145,7 +145,7 @@ tape( 'the function calculates the row and column scaling factors intended to eq S = new Float64Array( 3 ); out = new Float64Array( 2 ); - info = dppequ( 'row-major', 'L', 3, AP, S, out ); + info = dppequ( 'row-major', 'lower', 3, AP, S, out ); expectedOut = new Float64Array( [ 0.33333333333333331, 9.0 ] ); expectedS = new Float64Array( [ 1.0, 0.57735026918962584, 0.33333333333333331 ] ); @@ -168,7 +168,7 @@ tape( 'the function calculates the row and column scaling factors intended to eq S = new Float64Array( 3 ); out = new Float64Array( 2 ); - info = dppequ( 'column-major', 'L', 3, AP, S, out ); + info = dppequ( 'column-major', 'lower', 3, AP, S, out ); expectedOut = new Float64Array( [ 0.33333333333333331, 9.0 ] ); expectedS = new Float64Array( [ 1.0, 0.57735026918962584, 0.33333333333333331 ] ); @@ -191,7 +191,7 @@ tape( 'the function calculates the row and column scaling factors intended to eq S = new Float64Array( 3 ); out = new Float64Array( 2 ); - info = dppequ( 'row-major', 'U', 3, AP, S, out ); + info = dppequ( 'row-major', 'upper', 3, AP, S, out ); expectedOut = new Float64Array( [ 0.33333333333333331, 9.0 ] ); expectedS = new Float64Array( [ 1.0, 0.44721359549995793, 0.33333333333333331 ] ); @@ -214,7 +214,7 @@ tape( 'the function calculates the row and column scaling factors intended to eq S = new Float64Array( 3 ); out = new Float64Array( 2 ); - info = dppequ( 'column-major', 'U', 3, AP, S, out ); + info = dppequ( 'column-major', 'upper', 3, AP, S, out ); expectedOut = new Float64Array( [ 0.33333333333333331, 9.0 ] ); expectedS = new Float64Array( [ 1.0, 0.44721359549995793, 0.33333333333333331 ] ); @@ -237,7 +237,7 @@ tape( 'the function finds the first non-positive diagonal element and returns (u S = new Float64Array( 3 ); out = new Float64Array( 2 ); - info = dppequ( 'column-major', 'U', 3, AP, S, out ); + info = dppequ( 'column-major', 'upper', 3, AP, S, out ); expectedOut = new Float64Array( [ 0.0, 1.0 ] ); expectedS = new Float64Array( [ 1.0, -1.0, 1.0 ] ); @@ -260,7 +260,7 @@ tape( 'the function finds the first non-positive diagonal element and returns (u S = new Float64Array( 3 ); out = new Float64Array( 2 ); - info = dppequ( 'row-major', 'U', 3, AP, S, out ); + info = dppequ( 'row-major', 'upper', 3, AP, S, out ); expectedOut = new Float64Array( [ 0.0, 1.0 ] ); expectedS = new Float64Array( [ 1.0, -1.0, 1.0 ] ); @@ -283,7 +283,7 @@ tape( 'the function finds the first non-positive diagonal element and returns (l S = new Float64Array( 3 ); out = new Float64Array( 2 ); - info = dppequ( 'column-major', 'L', 3, AP, S, out ); + info = dppequ( 'column-major', 'lower', 3, AP, S, out ); expectedOut = new Float64Array( [ 0.0, 1.0 ] ); expectedS = new Float64Array( [ 1.0, 0.0, 1.0 ] ); @@ -306,7 +306,7 @@ tape( 'the function finds the first non-positive diagonal element and returns (l S = new Float64Array( 3 ); out = new Float64Array( 2 ); - info = dppequ( 'row-major', 'L', 3, AP, S, out ); + info = dppequ( 'row-major', 'lower', 3, AP, S, out ); expectedOut = new Float64Array( [ 0.0, 1.0 ] ); expectedS = new Float64Array( [ 1.0, 0.0, 1.0 ] ); diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.ndarray.js index d75affbbd4b8..938495535126 100644 --- a/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.ndarray.js @@ -66,7 +66,7 @@ tape( 'the function throws an error if provided an invalid third argument', func function badValue( value ) { return function badValue() { - dppequ( 'row-major', 'L', value, AP, 1, 0, S, 1, 0, out, 1, 0 ); + dppequ( 'row-major', 'lower', value, AP, 1, 0, S, 1, 0, out, 1, 0 ); }; } }); @@ -105,7 +105,7 @@ tape( 'the function throws an error if provided a first argument which is not a function badValue( value ) { return function badValue() { - dppequ( value, 'L', 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); + dppequ( value, 'lower', 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); }; } }); @@ -122,7 +122,7 @@ tape( 'the function leaves the row and column scaling factors intended to equili S = new Float64Array( 3 ); out = new Float64Array( 2 ); - info = dppequ( 'row-major', 'L', 0, AP, 1, 0, S, 1, 0, out, 1, 0 ); + info = dppequ( 'row-major', 'lower', 0, AP, 1, 0, S, 1, 0, out, 1, 0 ); expectedOut = new Float64Array( [ 1.0, 0.0 ] ); expectedS = new Float64Array( 3 ); @@ -145,7 +145,7 @@ tape( 'the function calculates the row and column scaling factors intended to eq S = new Float64Array( 3 ); out = new Float64Array( 2 ); - info = dppequ( 'row-major', 'L', 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); + info = dppequ( 'row-major', 'lower', 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); expectedOut = new Float64Array( [ 0.33333333333333331, 9.0 ] ); expectedS = new Float64Array( [ 1.0, 0.57735026918962584, 0.33333333333333331 ] ); @@ -168,7 +168,7 @@ tape( 'the function calculates the row and column scaling factors intended to eq S = new Float64Array( 3 ); out = new Float64Array( 2 ); - info = dppequ( 'column-major', 'L', 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); + info = dppequ( 'column-major', 'lower', 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); expectedOut = new Float64Array( [ 0.33333333333333331, 9.0 ] ); expectedS = new Float64Array( [ 1.0, 0.57735026918962584, 0.33333333333333331 ] ); @@ -191,7 +191,7 @@ tape( 'the function calculates the row and column scaling factors intended to eq S = new Float64Array( 3 ); out = new Float64Array( 2 ); - info = dppequ( 'row-major', 'U', 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); + info = dppequ( 'row-major', 'upper', 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); expectedOut = new Float64Array( [ 0.33333333333333331, 9.0 ] ); expectedS = new Float64Array( [ 1.0, 0.44721359549995793, 0.33333333333333331 ] ); @@ -214,7 +214,7 @@ tape( 'the function calculates the row and column scaling factors intended to eq S = new Float64Array( 3 ); out = new Float64Array( 2 ); - info = dppequ( 'column-major', 'U', 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); + info = dppequ( 'column-major', 'upper', 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); expectedOut = new Float64Array( [ 0.33333333333333331, 9.0 ] ); expectedS = new Float64Array( [ 1.0, 0.44721359549995793, 0.33333333333333331 ] ); @@ -237,7 +237,7 @@ tape( 'the function finds the first non-positive diagonal element and returns (u S = new Float64Array( 3 ); out = new Float64Array( 2 ); - info = dppequ( 'column-major', 'U', 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); + info = dppequ( 'column-major', 'upper', 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); expectedOut = new Float64Array( [ 0.0, 1.0 ] ); expectedS = new Float64Array( [ 1.0, -1.0, 1.0 ] ); @@ -260,7 +260,7 @@ tape( 'the function finds the first non-positive diagonal element and returns (u S = new Float64Array( 3 ); out = new Float64Array( 2 ); - info = dppequ( 'row-major', 'U', 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); + info = dppequ( 'row-major', 'upper', 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); expectedOut = new Float64Array( [ 0.0, 1.0 ] ); expectedS = new Float64Array( [ 1.0, -1.0, 1.0 ] ); @@ -283,7 +283,7 @@ tape( 'the function finds the first non-positive diagonal element and returns (l S = new Float64Array( 3 ); out = new Float64Array( 2 ); - info = dppequ( 'column-major', 'L', 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); + info = dppequ( 'column-major', 'lower', 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); expectedOut = new Float64Array( [ 0.0, 1.0 ] ); expectedS = new Float64Array( [ 1.0, 0.0, 1.0 ] ); @@ -306,7 +306,7 @@ tape( 'the function finds the first non-positive diagonal element and returns (l S = new Float64Array( 3 ); out = new Float64Array( 2 ); - info = dppequ( 'row-major', 'L', 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); + info = dppequ( 'row-major', 'lower', 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); expectedOut = new Float64Array( [ 0.0, 1.0 ] ); expectedS = new Float64Array( [ 1.0, 0.0, 1.0 ] ); @@ -329,7 +329,7 @@ tape( 'the function calculates the row and column scaling factors intended to eq S = new Float64Array( 3 ); out = new Float64Array( 2 ); - info = dppequ( 'row-major', 'L', 3, AP, -1, 5, S, -1, 2, out, -1, 1 ); + info = dppequ( 'row-major', 'lower', 3, AP, -1, 5, S, -1, 2, out, -1, 1 ); expectedOut = new Float64Array( [ 9.0, 0.33333333333333331 ] ); expectedS = new Float64Array( [ 0.33333333333333331, 0.57735026918962584, 1.0 ] ); @@ -352,7 +352,7 @@ tape( 'the function calculates the row and column scaling factors intended to eq S = new Float64Array( 3 ); out = new Float64Array( 2 ); - info = dppequ( 'column-major', 'L', 3, AP, -1, 5, S, -1, 2, out, -1, 1 ); + info = dppequ( 'column-major', 'lower', 3, AP, -1, 5, S, -1, 2, out, -1, 1 ); expectedOut = new Float64Array( [ 9.0, 0.33333333333333331 ] ); expectedS = new Float64Array( [ 0.33333333333333331, 0.57735026918962584, 1.0 ] ); @@ -375,7 +375,7 @@ tape( 'the function calculates the row and column scaling factors intended to eq S = new Float64Array( 3 ); out = new Float64Array( 2 ); - info = dppequ( 'row-major', 'U', 3, AP, -1, 5, S, -1, 2, out, -1, 1 ); + info = dppequ( 'row-major', 'upper', 3, AP, -1, 5, S, -1, 2, out, -1, 1 ); expectedOut = new Float64Array( [ 9.0, 0.33333333333333331 ] ); expectedS = new Float64Array( [ 0.33333333333333331, 0.44721359549995793, 1.0 ] ); @@ -399,7 +399,7 @@ tape( 'the function calculates the row and column scaling factors intended to eq S = new Float64Array( 3 ); out = new Float64Array( 2 ); - info = dppequ( 'column-major', 'U', 3, AP, -1, 5, S, -1, 2, out, -1, 1 ); + info = dppequ( 'column-major', 'upper', 3, AP, -1, 5, S, -1, 2, out, -1, 1 ); expectedOut = new Float64Array( [ 9.0, 0.33333333333333331 ] ); expectedS = new Float64Array( [ 0.33333333333333331, 0.44721359549995793, 1.0 ] ); @@ -422,7 +422,7 @@ tape( 'the function finds the first non-positive diagonal element with negative S = new Float64Array( 3 ); out = new Float64Array( 2 ); - info = dppequ( 'column-major', 'U', 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); + info = dppequ( 'column-major', 'upper', 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); expectedOut = new Float64Array( [ 0.0, 1.0 ] ); expectedS = new Float64Array( [ 1.0, -1.0, 1.0 ] ); @@ -445,7 +445,7 @@ tape( 'the function finds the first non-positive diagonal element with negative S = new Float64Array( 3 ); out = new Float64Array( 2 ); - info = dppequ( 'row-major', 'U', 3, AP, -1, 5, S, -1, 2, out, -1, 1 ); + info = dppequ( 'row-major', 'upper', 3, AP, -1, 5, S, -1, 2, out, -1, 1 ); expectedOut = new Float64Array( [ 1.0, 0.0 ] ); expectedS = new Float64Array( [ 1.0, -1.0, 1.0 ] ); @@ -468,7 +468,7 @@ tape( 'the function finds the first non-positive diagonal element with negative S = new Float64Array( 3 ); out = new Float64Array( 2 ); - info = dppequ( 'column-major', 'L', 3, AP, -1, 5, S, -1, 2, out, -1, 1 ); + info = dppequ( 'column-major', 'lower', 3, AP, -1, 5, S, -1, 2, out, -1, 1 ); expectedOut = new Float64Array( [ 1.0, 0.0 ] ); expectedS = new Float64Array( [ 1.0, 0.0, 1.0 ] ); @@ -491,7 +491,7 @@ tape( 'the function finds the first non-positive diagonal element with negative S = new Float64Array( 3 ); out = new Float64Array( 2 ); - info = dppequ( 'row-major', 'L', 3, AP, -1, 5, S, -1, 2, out, -1, 1 ); + info = dppequ( 'row-major', 'lower', 3, AP, -1, 5, S, -1, 2, out, -1, 1 ); expectedOut = new Float64Array( [ 1.0, 0.0 ] ); expectedS = new Float64Array( [ 1.0, 0.0, 1.0 ] ); @@ -514,7 +514,7 @@ tape( 'the function calculates the row and column scaling factors intended to eq S = new Float64Array( 4 ); out = new Float64Array( 3 ); - info = dppequ( 'row-major', 'L', 3, AP, 1, 1, S, 1, 1, out, 1, 1 ); + info = dppequ( 'row-major', 'lower', 3, AP, 1, 1, S, 1, 1, out, 1, 1 ); expectedOut = new Float64Array( [ 0.0, 0.33333333333333331, 9.0 ] ); expectedS = new Float64Array( [ 0.0, 1.0, 0.57735026918962584, 0.33333333333333331 ] ); @@ -537,7 +537,7 @@ tape( 'the function calculates the row and column scaling factors intended to eq S = new Float64Array( 4 ); out = new Float64Array( 3 ); - info = dppequ( 'column-major', 'L', 3, AP, 1, 1, S, 1, 1, out, 1, 1 ); + info = dppequ( 'column-major', 'lower', 3, AP, 1, 1, S, 1, 1, out, 1, 1 ); expectedOut = new Float64Array( [ 0.0, 0.33333333333333331, 9.0 ] ); expectedS = new Float64Array( [ 0.0, 1.0, 0.57735026918962584, 0.33333333333333331 ] ); @@ -560,7 +560,7 @@ tape( 'the function calculates the row and column scaling factors intended to eq S = new Float64Array( 4 ); out = new Float64Array( 3 ); - info = dppequ( 'row-major', 'U', 3, AP, 1, 1, S, 1, 1, out, 1, 1 ); + info = dppequ( 'row-major', 'upper', 3, AP, 1, 1, S, 1, 1, out, 1, 1 ); expectedOut = new Float64Array( [ 0.0, 0.33333333333333331, 9.0 ] ); expectedS = new Float64Array( [ 0.0, 1.0, 0.44721359549995793, 0.33333333333333331 ] ); @@ -583,7 +583,7 @@ tape( 'the function calculates the row and column scaling factors intended to eq S = new Float64Array( 4 ); out = new Float64Array( 3 ); - info = dppequ( 'column-major', 'U', 3, AP, 1, 1, S, 1, 1, out, 1, 1 ); + info = dppequ( 'column-major', 'upper', 3, AP, 1, 1, S, 1, 1, out, 1, 1 ); expectedOut = new Float64Array( [ 0.0, 0.33333333333333331, 9.0 ] ); expectedS = new Float64Array( [ 0.0, 1.0, 0.44721359549995793, 0.33333333333333331 ] ); @@ -606,7 +606,7 @@ tape( 'the function finds the first non-positive diagonal element with offsets a S = new Float64Array( 4 ); out = new Float64Array( 3 ); - info = dppequ( 'column-major', 'U', 3, AP, 1, 1, S, 1, 1, out, 1, 1 ); + info = dppequ( 'column-major', 'upper', 3, AP, 1, 1, S, 1, 1, out, 1, 1 ); expectedOut = new Float64Array( [ 0.0, 0.0, 1.0 ] ); expectedS = new Float64Array( [ 0.0, 1.0, -1.0, 1.0 ] ); @@ -629,7 +629,7 @@ tape( 'the function finds the first non-positive diagonal element with offsets a S = new Float64Array( 4 ); out = new Float64Array( 3 ); - info = dppequ( 'row-major', 'U', 3, AP, 1, 1, S, 1, 1, out, 1, 1 ); + info = dppequ( 'row-major', 'upper', 3, AP, 1, 1, S, 1, 1, out, 1, 1 ); expectedOut = new Float64Array( [ 0.0, 0.0, 1.0 ] ); expectedS = new Float64Array( [ 0.0, 1.0, -1.0, 1.0 ] ); @@ -652,7 +652,7 @@ tape( 'the function finds the first non-positive diagonal element with offsets a S = new Float64Array( 4 ); out = new Float64Array( 3 ); - info = dppequ( 'column-major', 'L', 3, AP, 1, 1, S, 1, 1, out, 1, 1 ); + info = dppequ( 'column-major', 'lower', 3, AP, 1, 1, S, 1, 1, out, 1, 1 ); expectedOut = new Float64Array( [ 0.0, 0.0, 1.0 ] ); expectedS = new Float64Array( [ 0.0, 1.0, 0.0, 1.0 ] ); @@ -675,7 +675,7 @@ tape( 'the function finds the first non-positive diagonal element with offsets a S = new Float64Array( 4 ); out = new Float64Array( 3 ); - info = dppequ( 'row-major', 'L', 3, AP, 1, 1, S, 1, 1, out, 1, 1 ); + info = dppequ( 'row-major', 'lower', 3, AP, 1, 1, S, 1, 1, out, 1, 1 ); expectedOut = new Float64Array( [ 0.0, 0.0, 1.0 ] ); expectedS = new Float64Array( [ 0.0, 1.0, 0.0, 1.0 ] ); From 0e9907c85a5ff5b8083a1d76cbefadda9dc7bf55 Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Tue, 27 May 2025 03:48:00 +0000 Subject: [PATCH 19/28] test: add test to check uplo --- 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/dppequ/test/test.dppequ.js | 39 +++++++++++++++++++ .../lapack/base/dppequ/test/test.ndarray.js | 39 +++++++++++++++++++ 2 files changed, 78 insertions(+) diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.dppequ.js b/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.dppequ.js index c4a5e592de52..86212cf206bd 100644 --- a/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.dppequ.js +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.dppequ.js @@ -110,6 +110,45 @@ tape( 'the function throws an error if provided a first argument which is not a } }); +tape( 'the function throws an error if provided a second argument which is not a valid side', function test( t ) { + var values; + var out; + var AP; + var S; + var i; + + values = [ + 'foo', + 'bar', + 'beep', + 'boop', + -5, + NaN, + true, + false, + null, + void 0, + [], + {}, + function noop() {} + ]; + + AP = new Float64Array( [ 1.0, 2.0, 3.0, 5.0, 6.0, 9.0 ] ); + S = new Float64Array( 3 ); + out = 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() { + dppequ( 'row-major', value, 3, AP, S, out ); + }; + } +}); + tape( 'the function leaves the row and column scaling factors intended to equilibrate a symmetric positive definite matrix `A` in packed storage unchanged if N is equal to 0', function test( t ) { var expectedOut; var expectedS; diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.ndarray.js index 938495535126..ba843f6e0760 100644 --- a/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.ndarray.js @@ -110,6 +110,45 @@ tape( 'the function throws an error if provided a first argument which is not a } }); +tape( 'the function throws an error if provided a second argument which is not a valid side', function test( t ) { + var values; + var out; + var AP; + var S; + var i; + + values = [ + 'foo', + 'bar', + 'beep', + 'boop', + -5, + NaN, + true, + false, + null, + void 0, + [], + {}, + function noop() {} + ]; + + AP = new Float64Array( [ 1.0, 2.0, 3.0, 5.0, 6.0, 9.0 ] ); + S = new Float64Array( 3 ); + out = 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() { + dppequ( 'row-major', value, 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); + }; + } +}); + tape( 'the function leaves the row and column scaling factors intended to equilibrate a symmetric positive definite matrix `A` in packed storage unchanged if N is equal to 0', function test( t ) { var expectedOut; var expectedS; From 6ee35deea573997fb9b927ee345dec4c6b5b5f91 Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Tue, 27 May 2025 04:17:08 +0000 Subject: [PATCH 20/28] 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/dppequ/test/test.ndarray.js | 184 ++++++++++++++++++ 1 file changed, 184 insertions(+) diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.ndarray.js index ba843f6e0760..32adc6254fd2 100644 --- a/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.ndarray.js @@ -724,3 +724,187 @@ tape( 'the function finds the first non-positive diagonal element with offsets a t.end(); }); + +tape( 'the function calculates the row and column scaling factors intended to equilibrate a symmetric positive definite matrix `A` in packed storage with large strides (lower-triangular) (row-major)', function test( t ) { + var expectedOut; + var expectedS; + var info; + var out; + var AP; + var S; + + AP = new Float64Array( [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0, 5.0, 0.0, 6.0, 0.0, 9.0, 0.0 ] ); + S = new Float64Array( 6 ); + out = new Float64Array( 4 ); + + info = dppequ( 'row-major', 'lower', 3, AP, 2, 0, S, 2, 0, out, 2, 0 ); + + expectedOut = new Float64Array( [ 0.33333333333333331, 0.0, 9.0, 0.0 ] ); + expectedS = new Float64Array( [ 1.0, 0.0, 0.57735026918962584, 0.0, 0.33333333333333331, 0.0 ] ); + t.deepEqual( S, expectedS, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( info, 0, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function calculates the row and column scaling factors intended to equilibrate a symmetric positive definite matrix `A` in packed storage with large strides (lower-triangular) (column-major)', function test( t ) { + var expectedOut; + var expectedS; + var info; + var out; + var AP; + var S; + + AP = new Float64Array( [ 1.0, 0.0, 2.0, 0.0, 5.0, 0.0, 3.0, 0.0, 6.0, 0.0, 9.0, 0.0 ] ); + S = new Float64Array( 6 ); + out = new Float64Array( 4 ); + + info = dppequ( 'column-major', 'lower', 3, AP, 2, 0, S, 2, 0, out, 2, 0 ); + + expectedOut = new Float64Array( [ 0.33333333333333331, 0.0, 9.0, 0.0 ] ); + expectedS = new Float64Array( [ 1.0, 0.0, 0.57735026918962584, 0.0, 0.33333333333333331, 0.0 ] ); + t.deepEqual( S, expectedS, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( info, 0, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function calculates the row and column scaling factors intended to equilibrate a symmetric positive definite matrix `A` in packed storage with large strides (upper-triangular) (row-major)', function test( t ) { + var expectedOut; + var expectedS; + var info; + var out; + var AP; + var S; + + AP = new Float64Array( [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0, 5.0, 0.0, 6.0, 0.0, 9.0, 0.0 ] ); + S = new Float64Array( 6 ); + out = new Float64Array( 4 ); + + info = dppequ( 'row-major', 'upper', 3, AP, 2, 0, S, 2, 0, out, 2, 0 ); + + expectedOut = new Float64Array( [ 0.33333333333333331, 0.0, 9.0, 0.0 ] ); + expectedS = new Float64Array( [ 1.0, 0.0, 0.44721359549995793, 0.0, 0.33333333333333331, 0.0 ] ); + t.deepEqual( S, expectedS, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( info, 0, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function calculates the row and column scaling factors intended to equilibrate a symmetric positive definite matrix `A` in packed storage with large strides (upper-triangular) (column-major)', function test( t ) { + var expectedOut; + var expectedS; + var info; + var out; + var AP; + var S; + + AP = new Float64Array( [ 1.0, 0.0, 2.0, 0.0, 5.0, 0.0, 3.0, 0.0, 6.0, 0.0, 9.0, 0.0 ] ); + S = new Float64Array( 6 ); + out = new Float64Array( 4 ); + + info = dppequ( 'column-major', 'upper', 3, AP, 2, 0, S, 2, 0, out, 2, 0 ); + + expectedOut = new Float64Array( [ 0.33333333333333331, 0.0, 9.0, 0.0 ] ); + expectedS = new Float64Array( [ 1.0, 0.0, 0.44721359549995793, 0.0, 0.33333333333333331, 0.0 ] ); + t.deepEqual( S, expectedS, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( info, 0, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function finds the first non-positive diagonal element with large strides and returns (upper-triangular) (column-major)', function test( t ) { + var expectedOut; + var expectedS; + var info; + var out; + var AP; + var S; + + AP = new Float64Array( [ 1.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0 ] ); + S = new Float64Array( 6 ); + out = new Float64Array( 4 ); + + info = dppequ( 'column-major', 'upper', 3, AP, 2, 0, S, 2, 0, out, 2, 0 ); + + expectedOut = new Float64Array( [ 0.0, 0.0, 1.0, 0.0 ] ); + expectedS = new Float64Array( [ 1.0, 0.0, -1.0, 0.0, 1.0, 0.0 ] ); + t.deepEqual( S, expectedS, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( info, 1, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function finds the first non-positive diagonal element with large strides and returns (upper-triangular) (row-major)', function test( t ) { + var expectedOut; + var expectedS; + var info; + var out; + var AP; + var S; + + AP = new Float64Array( [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 0.0, 1.0, 0.0 ] ); + S = new Float64Array( 6 ); + out = new Float64Array( 4 ); + + info = dppequ( 'row-major', 'upper', 3, AP, 2, 0, S, 2, 0, out, 2, 0 ); + + expectedOut = new Float64Array( [ 0.0, 0.0, 1.0, 0.0 ] ); + expectedS = new Float64Array( [ 1.0, 0.0, -1.0, 0.0, 1.0, 0.0 ] ); + t.deepEqual( S, expectedS, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( info, 1, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function finds the first non-positive diagonal element with large strides and returns (lower-triangular) (column-major)', function test( t ) { + var expectedOut; + var expectedS; + var info; + var out; + var AP; + var S; + + AP = new Float64Array( [ 1.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0 ] ); + S = new Float64Array( 6 ); + out = new Float64Array( 4 ); + + info = dppequ( 'column-major', 'lower', 3, AP, 2, 0, S, 2, 0, out, 2, 0 ); + + expectedOut = new Float64Array( [ 0.0, 0.0, 1.0, 0.0 ] ); + expectedS = new Float64Array( [ 1.0, 0.0, 0.0, 0.0, 1.0, 0.0 ] ); + t.deepEqual( S, expectedS, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( info, 1, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function finds the first non-positive diagonal element with large strides and returns (lower-triangular) (row-major)', function test( t ) { + var expectedOut; + var expectedS; + var info; + var out; + var AP; + var S; + + AP = new Float64Array( [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 0.0, 1.0, 0.0 ] ); + S = new Float64Array( 6 ); + out = new Float64Array( 4 ); + + info = dppequ( 'row-major', 'lower', 3, AP, 2, 0, S, 2, 0, out, 2, 0 ); + + expectedOut = new Float64Array( [ 0.0, 0.0, 1.0, 0.0 ] ); + expectedS = new Float64Array( [ 1.0, 0.0, 0.0, 0.0, 1.0, 0.0 ] ); + t.deepEqual( S, expectedS, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( info, 1, 'returns expected value' ); + + t.end(); +}); From 5cda5cff84c2f126c75264631be9b678a42be6d0 Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Tue, 27 May 2025 04:26:42 +0000 Subject: [PATCH 21/28] 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/dppequ/test/test.ndarray.js | 184 ++++++++++++++++++ 1 file changed, 184 insertions(+) diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.ndarray.js index 32adc6254fd2..7ba194f9d756 100644 --- a/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/test/test.ndarray.js @@ -908,3 +908,187 @@ tape( 'the function finds the first non-positive diagonal element with large str t.end(); }); + +tape( 'the function calculates the row and column scaling factors intended to equilibrate a symmetric positive definite matrix `A` in packed storage with mixed strides (lower-triangular) (row-major)', function test( t ) { + var expectedOut; + var expectedS; + var info; + var out; + var AP; + var S; + + AP = new Float64Array( [ 9.0, 6.0, 5.0, 3.0, 2.0, 1.0 ] ); + S = new Float64Array( 3 ); + out = new Float64Array( 2 ); + + info = dppequ( 'row-major', 'lower', 3, AP, -1, 5, S, 1, 0, out, 1, 0 ); + + expectedOut = new Float64Array( [ 0.33333333333333331, 9.0 ] ); + expectedS = new Float64Array( [ 1.0, 0.57735026918962584, 0.33333333333333331 ] ); + t.deepEqual( S, expectedS, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( info, 0, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function calculates the row and column scaling factors intended to equilibrate a symmetric positive definite matrix `A` in packed storage with mixed strides (lower-triangular) (column-major)', function test( t ) { + var expectedOut; + var expectedS; + var info; + var out; + var AP; + var S; + + AP = new Float64Array( [ 9.0, 6.0, 3.0, 5.0, 2.0, 1.0 ] ); + S = new Float64Array( 3 ); + out = new Float64Array( 2 ); + + info = dppequ( 'column-major', 'lower', 3, AP, -1, 5, S, 1, 0, out, 1, 0 ); + + expectedOut = new Float64Array( [ 0.33333333333333331, 9.0 ] ); + expectedS = new Float64Array( [ 1.0, 0.57735026918962584, 0.33333333333333331 ] ); + t.deepEqual( S, expectedS, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( info, 0, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function calculates the row and column scaling factors intended to equilibrate a symmetric positive definite matrix `A` in packed storage with mixed strides (upper-triangular) (row-major)', function test( t ) { + var expectedOut; + var expectedS; + var info; + var out; + var AP; + var S; + + AP = new Float64Array( [ 9.0, 6.0, 5.0, 3.0, 2.0, 1.0 ] ); + S = new Float64Array( 3 ); + out = new Float64Array( 2 ); + + info = dppequ( 'row-major', 'upper', 3, AP, -1, 5, S, 1, 0, out, 1, 0 ); + + expectedOut = new Float64Array( [ 0.33333333333333331, 9.0 ] ); + expectedS = new Float64Array( [ 1.0, 0.44721359549995793, 0.33333333333333331 ] ); + t.deepEqual( S, expectedS, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( info, 0, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function calculates the row and column scaling factors intended to equilibrate a symmetric positive definite matrix `A` in packed storage with mixed strides (upper-triangular) (column-major)', function test( t ) { + var expectedOut; + var expectedS; + var info; + var out; + var AP; + var S; + + AP = new Float64Array( [ 9.0, 6.0, 3.0, 5.0, 2.0, 1.0 ] ); + S = new Float64Array( 3 ); + out = new Float64Array( 2 ); + + info = dppequ( 'column-major', 'upper', 3, AP, -1, 5, S, 1, 0, out, 1, 0 ); + + expectedOut = new Float64Array( [ 0.33333333333333331, 9.0 ] ); + expectedS = new Float64Array( [ 1.0, 0.44721359549995793, 0.33333333333333331 ] ); + t.deepEqual( S, expectedS, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( info, 0, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function finds the first non-positive diagonal element with mixed strides and returns (upper-triangular) (column-major)', function test( t ) { + var expectedOut; + var expectedS; + var info; + var out; + var AP; + var S; + + AP = new Float64Array( [ 1.0, 0.0, 0.0, -1.0, 0.0, 1.0 ] ); + S = new Float64Array( 3 ); + out = new Float64Array( 2 ); + + info = dppequ( 'column-major', 'upper', 3, AP, -1, 5, S, 1, 0, out, 1, 0 ); + + expectedOut = new Float64Array( [ 0.0, 1.0 ] ); + expectedS = new Float64Array( [ 1.0, -1.0, 1.0 ] ); + t.deepEqual( S, expectedS, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( info, 1, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function finds the first non-positive diagonal element with mixed strides and returns (upper-triangular) (row-major)', function test( t ) { + var expectedOut; + var expectedS; + var info; + var out; + var AP; + var S; + + AP = new Float64Array( [ 1.0, 0.0, -1.0, 0.0, 0.0, 1.0 ] ); + S = new Float64Array( 3 ); + out = new Float64Array( 2 ); + + info = dppequ( 'row-major', 'upper', 3, AP, -1, 5, S, 1, 0, out, 1, 0 ); + + expectedOut = new Float64Array( [ 0.0, 1.0 ] ); + expectedS = new Float64Array( [ 1.0, -1.0, 1.0 ] ); + t.deepEqual( S, expectedS, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( info, 1, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function finds the first non-positive diagonal element with mixed strides and returns (lower-triangular) (column-major)', function test( t ) { + var expectedOut; + var expectedS; + var info; + var out; + var AP; + var S; + + AP = new Float64Array( [ 1.0, 0.0, 0.0, -1.0, 0.0, 1.0 ] ); + S = new Float64Array( 3 ); + out = new Float64Array( 2 ); + + info = dppequ( 'column-major', 'lower', 3, AP, -1, 5, S, 1, 0, out, 1, 0 ); + + expectedOut = new Float64Array( [ 0.0, 1.0 ] ); + expectedS = new Float64Array( [ 1.0, 0.0, 1.0 ] ); + t.deepEqual( S, expectedS, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( info, 1, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function finds the first non-positive diagonal element and returns (lower-triangular) (row-major)', function test( t ) { + var expectedOut; + var expectedS; + var info; + var out; + var AP; + var S; + + AP = new Float64Array( [ 1.0, 0.0, -1.0, 0.0, 0.0, 1.0 ] ); + S = new Float64Array( 3 ); + out = new Float64Array( 2 ); + + info = dppequ( 'row-major', 'lower', 3, AP, -1, 5, S, 1, 0, out, 1, 0 ); + + expectedOut = new Float64Array( [ 0.0, 1.0 ] ); + expectedS = new Float64Array( [ 1.0, 0.0, 1.0 ] ); + t.deepEqual( S, expectedS, 'returns expected value' ); + t.deepEqual( out, expectedOut, 'returns expected value' ); + t.deepEqual( info, 1, 'returns expected value' ); + + t.end(); +}); From d3d405e56c80bab35feb62c080579bddd31e02e2 Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Tue, 27 May 2025 06:59:12 +0000 Subject: [PATCH 22/28] bench: add benchmarks --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: passed - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: passed - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../lapack/base/dppequ/benchmark/benchmark.js | 131 ++++++++++++++++++ .../dppequ/benchmark/benchmark.ndarray.js | 131 ++++++++++++++++++ .../lapack/base/dppequ/examples/index.js | 56 ++++++++ .../@stdlib/lapack/base/dppequ/package.json | 69 +++++++++ 4 files changed, 387 insertions(+) create mode 100644 lib/node_modules/@stdlib/lapack/base/dppequ/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/lapack/base/dppequ/benchmark/benchmark.ndarray.js create mode 100644 lib/node_modules/@stdlib/lapack/base/dppequ/examples/index.js create mode 100644 lib/node_modules/@stdlib/lapack/base/dppequ/package.json diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/benchmark/benchmark.js b/lib/node_modules/@stdlib/lapack/base/dppequ/benchmark/benchmark.js new file mode 100644 index 000000000000..0a694862a62b --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/benchmark/benchmark.js @@ -0,0 +1,131 @@ +/** +* @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 pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var dppequ = require( './../lib/dppequ.js' ); + + +// VARIABLES // + +var LAYOUTS = [ + 'row-major', + 'column-major' +]; +var UPLO = [ + 'upper', + 'lower' +]; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - number of elements along each dimension +* @param {string} uplo - specifies whether upper or lower triangle of `A` is stored ( `upper` or `lower` ) +* @param {string} order - storage layout +* @returns {Function} benchmark function +*/ +function createBenchmark( N, uplo, order ) { + var opts; + var out; + var AP; + var S; + + opts = { + 'dtype': 'float64' + }; + + AP = uniform( N * ( N + 1 ) / 2, -10.0, 10.0, opts ); + S = new Float64Array( N ); + out = new Float64Array( 2 ); + 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 = dppequ( order, uplo, N, AP, S, out ); + if ( z < 0 ) { + b.fail( 'should not return an integer lesser than zero' ); + } + } + b.toc(); + if ( z < 0 ) { + b.fail( 'should not return an integer lesser than zero' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var order; + var uplo; + var min; + var max; + var N; + var f; + var i; + var j; + var k; + + min = 1; // 10^min + max = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + for ( j = 0; j < LAYOUTS.length; j++ ) { + order = LAYOUTS[ j ]; + for ( k = 0; k < UPLO.length; k++ ) { + uplo = UPLO[ k ]; + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( N, uplo, order ); + bench( pkg+'::square_matrix:order='+order+',uplo='+uplo+',size='+(N*N), f ); + } + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dppequ/benchmark/benchmark.ndarray.js new file mode 100644 index 000000000000..9bfd59c2008e --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/benchmark/benchmark.ndarray.js @@ -0,0 +1,131 @@ +/** +* @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 pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var dppequ = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var LAYOUTS = [ + 'row-major', + 'column-major' +]; +var UPLO = [ + 'upper', + 'lower' +]; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - number of elements along each dimension +* @param {string} uplo - specifies whether upper or lower triangle of `A` is stored ( `upper` or `lower` ) +* @param {string} order - storage layout +* @returns {Function} benchmark function +*/ +function createBenchmark( N, uplo, order ) { + var opts; + var out; + var AP; + var S; + + opts = { + 'dtype': 'float64' + }; + + AP = uniform( N * ( N + 1 ) / 2, -10.0, 10.0, opts ); + S = new Float64Array( N ); + out = new Float64Array( 2 ); + 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 = dppequ( order, uplo, N, AP, 1, 0, S, 1, 0, out, 1, 0 ); + if ( z < 0 ) { + b.fail( 'should not return an integer lesser than zero' ); + } + } + b.toc(); + if ( z < 0 ) { + b.fail( 'should not return an integer lesser than zero' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var order; + var uplo; + var min; + var max; + var N; + var f; + var i; + var j; + var k; + + min = 1; // 10^min + max = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + for ( j = 0; j < LAYOUTS.length; j++ ) { + order = LAYOUTS[ j ]; + for ( k = 0; k < UPLO.length; k++ ) { + uplo = UPLO[ k ]; + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( N, uplo, order ); + bench( pkg+'::square_matrix:order='+order+',uplo='+uplo+',size='+(N*N), f ); + } + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/examples/index.js b/lib/node_modules/@stdlib/lapack/base/dppequ/examples/index.js new file mode 100644 index 000000000000..d479e1a2c6dc --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/examples/index.js @@ -0,0 +1,56 @@ +/** +* @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'; + +var Float64Array = require( '@stdlib/array/float64' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var ndarray2array = require( '@stdlib/ndarray/base/to-array' ); +var dppequ = require( './../lib' ); + +var i; +var j; + +// Specify matrix meta data: +var shape = [ 3, 3 ]; +var order = 'row-major'; +var uplo = 'upper'; +var strides = shape2strides( shape, order ); +var offset = 0; + +// Define a symmetric positive definite matrix: +var A = new Float64Array( [ 4.0, 1.0, 1.0, 1.0, 3.0, 0.0, 1.0, 0.0, 2.0 ] ); +console.log( ndarray2array( A, shape, strides, offset, order ) ); + +// Convert the matrix to packed storage (upper triangle): +var buf = []; +for ( i = 0; i < shape[ 0 ]; i++ ) { + for ( j = i; j < shape[ 1 ]; j++ ) { + buf.push( A[ (i*strides[ 0 ]) + (j*strides[ 1 ]) + offset ] ); + } +} +console.log( buf ); + +var AP = new Float64Array( buf ); +var out = new Float64Array( 2 ); +var S = new Float64Array( shape[ 0 ] ); +var info = dppequ( order, uplo, shape[ 0 ], AP, S, out ); + +console.log( 'info:', info ); +console.log( 'S:', S ); +console.log( 'out:', out ); diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/package.json b/lib/node_modules/@stdlib/lapack/base/dppequ/package.json new file mode 100644 index 000000000000..7ec8d78a8012 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/package.json @@ -0,0 +1,69 @@ +{ + "name": "@stdlib/lapack/base/dppequ", + "version": "0.0.0", + "description": "LAPACK routine to compute the row and column scaling factors intended to equilibrate a symmetric positive definite matrix `A` in packed storage and reduce it's condition number (with respect to the two-norm).", + "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", + "dppequ", + "copy", + "linear", + "algebra", + "subroutines", + "array", + "ndarray", + "matrix", + "float64", + "double", + "float64array" + ] +} From 78282b840513abaedb2804c265c49f06de2fbd62 Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Tue, 27 May 2025 09:52:39 +0000 Subject: [PATCH 23/28] docs: add index.d.ts --- 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: passed - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../lapack/base/dppequ/benchmark/benchmark.js | 2 +- .../dppequ/benchmark/benchmark.ndarray.js | 2 +- .../lapack/base/dppequ/docs/types/index.d.ts | 134 ++++++++++++++++++ .../lapack/base/dppequ/examples/index.js | 2 +- 4 files changed, 137 insertions(+), 3 deletions(-) create mode 100644 lib/node_modules/@stdlib/lapack/base/dppequ/docs/types/index.d.ts diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/benchmark/benchmark.js b/lib/node_modules/@stdlib/lapack/base/dppequ/benchmark/benchmark.js index 0a694862a62b..18b24aa13fa4 100644 --- a/lib/node_modules/@stdlib/lapack/base/dppequ/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/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. diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dppequ/benchmark/benchmark.ndarray.js index 9bfd59c2008e..91b4d16eef81 100644 --- a/lib/node_modules/@stdlib/lapack/base/dppequ/benchmark/benchmark.ndarray.js +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/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. diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/docs/types/index.d.ts b/lib/node_modules/@stdlib/lapack/base/dppequ/docs/types/index.d.ts new file mode 100644 index 000000000000..53b4dc63b5e5 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/docs/types/index.d.ts @@ -0,0 +1,134 @@ +/* +* @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, successful exit. +* - if greater than zero, then the `i`th diagonal element was non positive. +*/ +type StatusCode = number; + +/** +* Interface describing `dppequ`. +*/ +interface Routine { + /** + * Computes the row and column scaling factors intended to equilibrate a symmetric positive definite matrix `A` in packed storage and reduce it's condition number (with respect to the two-norm). + * + * @param order - storage layout + * @param uplo - specifies whether upper or lower triangle of `A` is stored ( `upper` or `lower` ) + * @param N - order of the matrix `A` + * @param AP - array containing the upper or lower triangle of `A` in packed form, expectes `N * ( N + 1 ) / 2` indexed elements + * @param S - array to store the scale factors of `A`, expects `N` indexed elements + * @param out - array to store the output + * @returns status code + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * var AP = new Float64Array( [ 1.0, 2.0, 3.0, 5.0, 6.0, 9.0 ] ); + * var S = new Float64Array( 3 ); + * var out = new Float64Array( 2 ); + * + * dppequ( 'row-major', 'lower', 3, AP, S, out ); + * // S => [ 1, ~0.58, ~0.33 ] + * // out => [ ~0.33, 9 ] + */ + ( order: Layout, uplo: string, N: number, AP: Float64Array, S: Float64Array, out: Float64Array ): StatusCode; + + /** + * Computes the row and column scaling factors intended to equilibrate a symmetric positive definite matrix `A` in packed storage and reduce it's condition number (with respect to the two-norm) using alternative indexing semantics. + * + * @param order - storage layout + * @param uplo - specifies whether upper or lower triangle of `A` is stored ( `upper` or `lower` ) + * @param N - order of the matrix `A` + * @param AP - array containing the upper or lower triangle of `A` in packed form, expectes `N * ( N + 1 ) / 2` indexed elements + * @param strideAP - stride length for `AP` + * @param offsetAP - starting index for `AP` + * @param S - array to store the scale factors of `A`, expects `N` indexed elements + * @param strideS - stride length for `S` + * @param offsetS - starting index for `S` + * @param out - array to store the output + * @param strideOut - stride length for `out` + * @param offsetOut - starting index for `out` + * @returns status code + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * + * var AP = new Float64Array( [ 1.0, 2.0, 3.0, 5.0, 6.0, 9.0 ] ); + * var S = new Float64Array( 3 ); + * var out = new Float64Array( 2 ); + * + * dppequ.ndarray( 'row-major', 'lower', 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); + * // S => [ 1, ~0.58, ~0.33 ] + * // out => [ ~0.33, 9 ] + */ + ndarray( order: Layout, uplo: string, N: number, AP: Float64Array, strideAP: number, offsetAP: number, S: Float64Array, strideS: number, offsetS: number, out: Float64Array, strideOut: number, offsetOut: number ): StatusCode; +} + +/** +* Computes the row and column scaling factors intended to equilibrate a symmetric positive definite matrix `A` in packed storage and reduce it's condition number (with respect to the two-norm). +* +* @param order - storage layout +* @param uplo - specifies whether upper or lower triangle of `A` is stored ( `upper` or `lower` ) +* @param N - order of the matrix `A` +* @param AP - array containing the upper or lower triangle of `A` in packed form, expectes `N * ( N + 1 ) / 2` indexed elements +* @param S - array to store the scale factors of `A`, expects `N` indexed elements +* @param out - array to store the output +* @returns status code +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var AP = new Float64Array( [ 1.0, 2.0, 3.0, 5.0, 6.0, 9.0 ] ); +* var S = new Float64Array( 3 ); +* var out = new Float64Array( 2 ); +* +* dppequ( 'row-major', 'lower', 3, AP, S, out ); +* // S => [ 1, ~0.58, ~0.33 ] +* // out => [ ~0.33, 9 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var AP = new Float64Array( [ 1.0, 2.0, 3.0, 5.0, 6.0, 9.0 ] ); +* var S = new Float64Array( 3 ); +* var out = new Float64Array( 2 ); +* +* dppequ.ndarray( 'row-major', 'lower', 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); +* // S => [ 1, ~0.58, ~0.33 ] +* // out => [ ~0.33, 9 ] +*/ +declare var dppequ: Routine; + + +// EXPORTS // + +export = dppequ; diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/examples/index.js b/lib/node_modules/@stdlib/lapack/base/dppequ/examples/index.js index d479e1a2c6dc..61bd86767f14 100644 --- a/lib/node_modules/@stdlib/lapack/base/dppequ/examples/index.js +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/examples/index.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. From d2b6b3f27657497eedac320d0b13469f965633e3 Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Tue, 27 May 2025 11:18:40 +0000 Subject: [PATCH 24/28] test: add ts 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: 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/dppequ/docs/types/test.ts | 359 ++++++++++++++++++ 1 file changed, 359 insertions(+) create mode 100644 lib/node_modules/@stdlib/lapack/base/dppequ/docs/types/test.ts diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/docs/types/test.ts b/lib/node_modules/@stdlib/lapack/base/dppequ/docs/types/test.ts new file mode 100644 index 000000000000..3703547e1745 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/docs/types/test.ts @@ -0,0 +1,359 @@ +/* +* @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 dppequ = require( './index' ); + + +// TESTS // + +// The function returns a number... +{ + const AP = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const S = new Float64Array( 3 ); + const out = new Float64Array( 2 ); + + dppequ( 'row-major', 'upper', 3, AP, S, out ); // $ExpectType number +} + +// The compiler throws an error if the function is provided a first argument which is not a string... +{ + const AP = new Float64Array( 6 ); + const S = new Float64Array( 3 ); + const out = new Float64Array( 2 ); + + dppequ( 5, 'upper', 3, AP, S, out ); // $ExpectError + dppequ( true, 'upper', 3, AP, S, out ); // $ExpectError + dppequ( false, 'upper', 3, AP, S, out ); // $ExpectError + dppequ( null, 'upper', 3, AP, S, out ); // $ExpectError + dppequ( void 0, 'upper', 3, AP, S, out ); // $ExpectError + dppequ( [], 'upper', 3, AP, S, out ); // $ExpectError + dppequ( {}, 'upper', 3, AP, S, out ); // $ExpectError + dppequ( ( x: number ): number => x, 'upper', 3, AP, S, out ); // $ExpectError +} + +// The compiler throws an error if the function is provided a second argument which is not a string... +{ + const AP = new Float64Array( 6 ); + const S = new Float64Array( 3 ); + const out = new Float64Array( 2 ); + + dppequ( 'row-major', 5, 3, AP, S, out ); // $ExpectError + dppequ( 'row-major', true, 3, AP, S, out ); // $ExpectError + dppequ( 'row-major', false, 3, AP, S, out ); // $ExpectError + dppequ( 'row-major', null, 3, AP, S, out ); // $ExpectError + dppequ( 'row-major', void 0, 3, AP, S, out ); // $ExpectError + dppequ( 'row-major', [], 3, AP, S, out ); // $ExpectError + dppequ( 'row-major', {}, 3, AP, S, out ); // $ExpectError + dppequ( 'row-major', ( x: number ): number => x, 3, AP, S, out ); // $ExpectError +} + +// The compiler throws an error if the function is provided a third argument which is not a number... +{ + const AP = new Float64Array( 6 ); + const S = new Float64Array( 3 ); + const out = new Float64Array( 2 ); + + dppequ( 'row-major', 'upper', '3', AP, S, out ); // $ExpectError + dppequ( 'row-major', 'upper', true, AP, S, out ); // $ExpectError + dppequ( 'row-major', 'upper', false, AP, S, out ); // $ExpectError + dppequ( 'row-major', 'upper', null, AP, S, out ); // $ExpectError + dppequ( 'row-major', 'upper', void 0, AP, S, out ); // $ExpectError + dppequ( 'row-major', 'upper', [], AP, S, out ); // $ExpectError + dppequ( 'row-major', 'upper', {}, AP, S, out ); // $ExpectError + dppequ( 'row-major', 'upper', ( x: number ): number => x, AP, S, out ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fourth argument which is not a Float64Array... +{ + const S = new Float64Array( 3 ); + const out = new Float64Array( 2 ); + + dppequ( 'row-major', 'upper', 3, [], S, out ); // $ExpectError + dppequ( 'row-major', 'upper', 3, 'abc', S, out ); // $ExpectError + dppequ( 'row-major', 'upper', 3, 123, S, out ); // $ExpectError + dppequ( 'row-major', 'upper', 3, null, S, out ); // $ExpectError + dppequ( 'row-major', 'upper', 3, void 0, S, out ); // $ExpectError + dppequ( 'row-major', 'upper', 3, {}, S, out ); // $ExpectError + dppequ( 'row-major', 'upper', 3, true, S, out ); // $ExpectError + dppequ( 'row-major', 'upper', 3, ( x: number ): number => x, S, out ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fifth argument which is not a Float64Array... +{ + const AP = new Float64Array( 6 ); + const out = new Float64Array( 2 ); + + dppequ( 'row-major', 'upper', 3, AP, [], out ); // $ExpectError + dppequ( 'row-major', 'upper', 3, AP, 'abc', out ); // $ExpectError + dppequ( 'row-major', 'upper', 3, AP, 123, out ); // $ExpectError + dppequ( 'row-major', 'upper', 3, AP, null, out ); // $ExpectError + dppequ( 'row-major', 'upper', 3, AP, void 0, out ); // $ExpectError + dppequ( 'row-major', 'upper', 3, AP, {}, out ); // $ExpectError + dppequ( 'row-major', 'upper', 3, AP, true, out ); // $ExpectError + dppequ( 'row-major', 'upper', 3, AP, ( x: number ): number => x, out ); // $ExpectError +} + +// The compiler throws an error if the function is provided a sixth argument which is not a Float64Array... +{ + const AP = new Float64Array( 6 ); + const S = new Float64Array( 3 ); + + dppequ( 'row-major', 'upper', 3, AP, S, [] ); // $ExpectError + dppequ( 'row-major', 'upper', 3, AP, S, 'abc' ); // $ExpectError + dppequ( 'row-major', 'upper', 3, AP, S, 123 ); // $ExpectError + dppequ( 'row-major', 'upper', 3, AP, S, null ); // $ExpectError + dppequ( 'row-major', 'upper', 3, AP, S, void 0 ); // $ExpectError + dppequ( 'row-major', 'upper', 3, AP, S, {} ); // $ExpectError + dppequ( 'row-major', 'upper', 3, AP, S, true ); // $ExpectError + dppequ( 'row-major', 'upper', 3, AP, S, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + const AP = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const S = new Float64Array( 3 ); + const out = new Float64Array( 2 ); + + dppequ(); // $ExpectError + dppequ( 'row-major' ); // $ExpectError + dppequ( 'row-major', 'upper' ); // $ExpectError + dppequ( 'row-major', 'upper', 3 ); // $ExpectError + dppequ( 'row-major', 'upper', 3, AP ); // $ExpectError + dppequ( 'row-major', 'upper', 3, AP, S ); // $ExpectError + dppequ( 'row-major', 'upper', 3, AP, S, out, 10 ); // $ExpectError +} + +// Attached to main export is an `ndarray` method which returns a number... +{ + const AP = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const S = new Float64Array( 3 ); + const out = new Float64Array( 2 ); + + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); // $ExpectType number +} + +// The compiler throws an error if the function is provided a first argument which is not a string... +{ + const AP = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const S = new Float64Array( 3 ); + const out = new Float64Array( 2 ); + + dppequ.ndarray( 5, 'upper', 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); // $ExpectError + dppequ.ndarray( true, 'upper', 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); // $ExpectError + dppequ.ndarray( false, 'upper', 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); // $ExpectError + dppequ.ndarray( null, 'upper', 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); // $ExpectError + dppequ.ndarray( void 0, 'upper', 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); // $ExpectError + dppequ.ndarray( [], 'upper', 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); // $ExpectError + dppequ.ndarray( {}, 'upper', 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); // $ExpectError + dppequ.ndarray( ( x: number ): number => x, 'upper', 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a second argument which is not a string... +{ + const AP = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const S = new Float64Array( 3 ); + const out = new Float64Array( 2 ); + + dppequ.ndarray( 'row-major', 5, 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', true, 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', false, 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', null, 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', void 0, 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', [], 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', {}, 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', ( x: number ): number => x, 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a third argument which is not a number... +{ + const AP = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const S = new Float64Array( 3 ); + const out = new Float64Array( 2 ); + + dppequ.ndarray( 'row-major', 'upper', '5', AP, 1, 0, S, 1, 0, out, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', true, AP, 1, 0, S, 1, 0, out, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', false, AP, 1, 0, S, 1, 0, out, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', null, AP, 1, 0, S, 1, 0, out, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', void 0, AP, 1, 0, S, 1, 0, out, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', [], AP, 1, 0, S, 1, 0, out, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', {}, AP, 1, 0, S, 1, 0, out, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', ( x: number ): number => x, AP, 1, 0, S, 1, 0, out, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fourth argument which is not a Float64Array... +{ + const S = new Float64Array( 3 ); + const out = new Float64Array( 2 ); + + dppequ.ndarray( 'row-major', 'upper', 3, 5, 1, 0, S, 1, 0, out, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, true, 1, 0, S, 1, 0, out, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, false, 1, 0, S, 1, 0, out, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, null, 1, 0, S, 1, 0, out, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, void 0, 1, 0, S, 1, 0, out, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, [], 1, 0, S, 1, 0, out, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, {}, 1, 0, S, 1, 0, out, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, ( x: number ): number => x, 1, 0, S, 1, 0, out, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fifth argument which is not a number... +{ + const AP = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const S = new Float64Array( 3 ); + const out = new Float64Array( 2 ); + + dppequ.ndarray( 'row-major', 'upper', 3, AP, '5', 0, S, 1, 0, out, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, true, 0, S, 1, 0, out, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, false, 0, S, 1, 0, out, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, null, 0, S, 1, 0, out, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, void 0, 0, S, 1, 0, out, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, [], 0, S, 1, 0, out, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, {}, 0, S, 1, 0, out, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, ( x: number ): number => x, 0, S, 1, 0, out, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a sixth argument which is not a number... +{ + const AP = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const S = new Float64Array( 3 ); + const out = new Float64Array( 2 ); + + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, '5', S, 1, 0, out, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, true, S, 1, 0, out, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, false, S, 1, 0, out, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, null, S, 1, 0, out, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, void 0, S, 1, 0, out, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, [], S, 1, 0, out, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, {}, S, 1, 0, out, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, ( x: number ): number => x, S, 1, 0, out, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a seventh argument which is not a Float64Array... +{ + const AP = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const out = new Float64Array( 2 ); + + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, 0, 5, 1, 0, out, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, 0, true, 1, 0, out, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, 0, false, 1, 0, out, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, 0, null, 1, 0, out, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, 0, void 0, 1, 0, out, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, 0, [], 1, 0, out, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, 0, {}, 1, 0, out, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, 0, ( x: number ): number => x, 1, 0, out, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided an eighth argument which is not a number... +{ + const AP = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const S = new Float64Array( 3 ); + const out = new Float64Array( 2 ); + + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, 0, S, '5', 0, out, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, 0, S, true, 0, out, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, 0, S, false, 0, out, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, 0, S, null, 0, out, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, 0, S, void 0, 0, out, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, 0, S, [], 0, out, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, 0, S, {}, 0, out, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, 0, S, ( x: number ): number => x, 0, out, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a ninth argument which is not a number... +{ + const AP = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const S = new Float64Array( 3 ); + const out = new Float64Array( 2 ); + + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, 0, S, 1, '5', out, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, 0, S, 1, true, out, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, 0, S, 1, false, out, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, 0, S, 1, null, out, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, 0, S, 1, void 0, out, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, 0, S, 1, [], out, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, 0, S, 1, {}, out, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, 0, S, 1, ( x: number ): number => x, out, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a tenth argument which is not a Float64Array... +{ + const AP = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const S = new Float64Array( 3 ); + + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, 0, S, 1, 0, 5, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, 0, S, 1, 0, true, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, 0, S, 1, 0, false, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, 0, S, 1, 0, null, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, 0, S, 1, 0, void 0, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, 0, S, 1, 0, [], 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, 0, S, 1, 0, {}, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, 0, S, 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 AP = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const S = new Float64Array( 3 ); + const out = new Float64Array( 2 ); + + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, 0, S, 1, 0, out, '5', 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, 0, S, 1, 0, out, true, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, 0, S, 1, 0, out, false, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, 0, S, 1, 0, out, null, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, 0, S, 1, 0, out, void 0, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, 0, S, 1, 0, out, [], 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, 0, S, 1, 0, out, {}, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, 0, S, 1, 0, out, ( 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 AP = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const S = new Float64Array( 3 ); + const out = new Float64Array( 2 ); + + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, 0, S, 1, 0, out, 1, '5' ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, 0, S, 1, 0, out, 1, true ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, 0, S, 1, 0, out, 1, false ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, 0, S, 1, 0, out, 1, null ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, 0, S, 1, 0, out, 1, void 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, 0, S, 1, 0, out, 1, [] ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, 0, S, 1, 0, out, 1, {} ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, 0, S, 1, 0, out, 1, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided an unsupported number of arguments... +{ + const AP = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + const S = new Float64Array( 3 ); + const out = new Float64Array( 2 ); + + dppequ.ndarray(); // $ExpectError + dppequ.ndarray( 'row-major' ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper' ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, 0, S ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, 0, S, 1 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, 0, S, 1, 0 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, 0, S, 1, 0, out ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, 0, S, 1, 0, out, 1 ); // $ExpectError + dppequ.ndarray( 'row-major', 'upper', 3, AP, 1, 0, S, 1, 0, out, 1, 0, 10 ); // $ExpectError +} + From 69a3907d87035a0ce5f8e9bb63890774ffa035fa Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Tue, 27 May 2025 13:48:07 +0000 Subject: [PATCH 25/28] docs: add notes --- 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: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../lapack/base/dppequ/docs/types/index.d.ts | 15 +++++++++++++++ .../@stdlib/lapack/base/dppequ/lib/base.js | 5 +++++ .../@stdlib/lapack/base/dppequ/lib/dppequ.js | 5 +++++ .../@stdlib/lapack/base/dppequ/lib/ndarray.js | 5 +++++ 4 files changed, 30 insertions(+) diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/docs/types/index.d.ts b/lib/node_modules/@stdlib/lapack/base/dppequ/docs/types/index.d.ts index 53b4dc63b5e5..38cc2b1a7140 100644 --- a/lib/node_modules/@stdlib/lapack/base/dppequ/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/docs/types/index.d.ts @@ -41,6 +41,11 @@ interface Routine { /** * Computes the row and column scaling factors intended to equilibrate a symmetric positive definite matrix `A` in packed storage and reduce it's condition number (with respect to the two-norm). * + * ## Notes + * + * - the function returns `0` if it sucessfully exits. + * - if the function returns an integer `i` greater then zero then the `i`th diagonal element was non positive. + * * @param order - storage layout * @param uplo - specifies whether upper or lower triangle of `A` is stored ( `upper` or `lower` ) * @param N - order of the matrix `A` @@ -65,6 +70,11 @@ interface Routine { /** * Computes the row and column scaling factors intended to equilibrate a symmetric positive definite matrix `A` in packed storage and reduce it's condition number (with respect to the two-norm) using alternative indexing semantics. * + * ## Notes + * + * - the function returns `0` if it sucessfully exits. + * - if the function returns an integer `i` greater then zero then the `i`th diagonal element was non positive. + * * @param order - storage layout * @param uplo - specifies whether upper or lower triangle of `A` is stored ( `upper` or `lower` ) * @param N - order of the matrix `A` @@ -96,6 +106,11 @@ interface Routine { /** * Computes the row and column scaling factors intended to equilibrate a symmetric positive definite matrix `A` in packed storage and reduce it's condition number (with respect to the two-norm). * +* ## Notes +* +* - the function returns `0` if it sucessfully exits. +* - if the function returns an integer `i` greater then zero then the `i`th diagonal element was non positive. +* * @param order - storage layout * @param uplo - specifies whether upper or lower triangle of `A` is stored ( `upper` or `lower` ) * @param N - order of the matrix `A` diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/base.js b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/base.js index fd1ba2065def..ec81a6528b56 100644 --- a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/base.js +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/base.js @@ -30,6 +30,11 @@ var min = require( '@stdlib/math/base/special/min' ); /** * Computes the row and column scaling factors intended to equilibrate a symmetric positive definite matrix `A` in packed storage and reduce it's condition number (with respect to the two-norm). * +* ## Notes +* +* - the function returns `0` if it sucessfully exits. +* - if the function returns an integer `i` greater then zero then the `i`th diagonal element was non positive. +* * @param {string} order - storage layout * @param {string} uplo - specifies whether upper or lower triangle of `A` is stored ( `upper` or `lower` ) * @param {NonNegativeInteger} N - order of the matrix `A` diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/dppequ.js b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/dppequ.js index 21debc6c5133..51c01908337a 100644 --- a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/dppequ.js +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/dppequ.js @@ -31,6 +31,11 @@ var base = require( './base.js' ); /** * Computes the row and column scaling factors intended to equilibrate a symmetric positive definite matrix `A` in packed storage and reduce it's condition number (with respect to the two-norm). * +* ## Notes +* +* - the function returns `0` if it sucessfully exits. +* - if the function returns an integer `i` greater then zero then the `i`th diagonal element was non positive. +* * @param {string} order - storage layout * @param {string} uplo - specifies whether upper or lower triangle of `A` is stored ( `upper` or `lower` ) * @param {NonNegativeInteger} N - order of the matrix `A` diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/ndarray.js b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/ndarray.js index 819b908a1a55..af02cb914d13 100644 --- a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/ndarray.js +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/ndarray.js @@ -31,6 +31,11 @@ var base = require( './base.js' ); /** * Computes the row and column scaling factors intended to equilibrate a symmetric positive definite matrix `A` in packed storage and reduce it's condition number (with respect to the two-norm) using alternative indexing semantics. * +* ## Notes +* +* - the function returns `0` if it sucessfully exits. +* - if the function returns an integer `i` greater then zero then the `i`th diagonal element was non positive. +* * @param {string} order - storage layout * @param {string} uplo - specifies whether upper or lower triangle of `A` is stored ( `upper` or `lower` ) * @param {NonNegativeInteger} N - order of the matrix `A` From 45d15f0c0c8dc0b2cb9bbb6a855a514f9ab95bef Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Tue, 27 May 2025 15:02:57 +0000 Subject: [PATCH 26/28] 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: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/lapack/base/dppequ/README.md | 280 ++++++++++++++++++ .../lapack/base/dppequ/docs/types/index.d.ts | 12 +- .../@stdlib/lapack/base/dppequ/lib/base.js | 4 +- .../@stdlib/lapack/base/dppequ/lib/dppequ.js | 4 +- .../@stdlib/lapack/base/dppequ/lib/ndarray.js | 4 +- 5 files changed, 298 insertions(+), 6 deletions(-) create mode 100644 lib/node_modules/@stdlib/lapack/base/dppequ/README.md diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/README.md b/lib/node_modules/@stdlib/lapack/base/dppequ/README.md new file mode 100644 index 000000000000..2a8ea26d8e3b --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/README.md @@ -0,0 +1,280 @@ + + +# dppequ + +> LAPACK routine to compute the row and column scaling factors intended to equilibrate a symmetric positive definite matrix `A` in packed storage and reduce it's condition number (with respect to the two-norm). + +
+ +## Usage + +```javascript +var dppequ = require( '@stdlib/lapack/base/dppequ' ); +``` + +#### dppequ( order, uplo, N, AP, S, out ) + +Computes the row and column scaling factors intended to equilibrate a symmetric positive definite matrix `A` in packed storage and reduce it's condition number (with respect to the two-norm). + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); + +var AP = new Float64Array( [ 1.0, 2.0, 3.0, 5.0, 6.0, 9.0 ] ); +var S = new Float64Array( 3 ); +var out = new Float64Array( 2 ); + +dppequ( 'row-major', 'lower', 3, AP, S, out ); +// S => [ 1.0, ~0.58, ~0.33 ] +// out => [ ~0.33, 9.0 ] +``` + +The function has the following parameters: + +- **order**: storage layout. +- **uplo**: specifies whether upper or lower triangle of `A` is stored ( `upper` or `lower` ). +- **AP**: array containing the upper or lower triangle of `A` in packed form stored in linear memory as a [`Float64Array`][mdn-float64array], expectes `N * ( N + 1 ) / 2` indexed elements +- **S**: array to store the scale factors of `A` in linear memory as a [`Float64Array`][mdn-float64array], expects `N` indexed elements. +- **out**: the first element of `out` represents `scond`, the second element of out represents `amax`. if `scond` >= 0.1 and `amax` is not close to overflow/underflow it isn't worth scaling the matrix by `S`, if `amax` is close to underflow/overflow the matrix shoud be scaled. expects a [`Float64Array`][mdn-float64array] with 2 indexed elements. + +Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views. + + + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); + +// Initial arrays... +var AP0 = new Float64Array( [ 0.0, 1.0, 2.0, 3.0, 5.0, 6.0, 9.0 ] ); +var S0 = new Float64Array( 4 ); +var out0 = new Float64Array( 3 ); + +// Create offset views... +var AP1 = new Float64Array( AP0.buffer, AP0.BYTES_PER_ELEMENT*1 ); // start at 2nd element +var S1 = new Float64Array( S0.buffer, S0.BYTES_PER_ELEMENT*1 ); // start at 2nd element +var out1 = new Float64Array( out0.buffer, out0.BYTES_PER_ELEMENT*1 ); // start at 2nd element + +dppequ( 'row-major', 'lower', 3, AP1, S1, out1 ); +// S0 => [ 0.0, 1.0, ~0.58, ~0.33 ] +// out => [ ~0.33, 9.0 ] +``` + +#### dppequ.ndarray( order, uplo, N, AP, sap, oap, S, ss, os, out, so, oo ) + +Computes the row and column scaling factors intended to equilibrate a symmetric positive definite matrix `A` in packed storage and reduce it's condition number (with respect to the two-norm) using alternative indexing semantics. + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); + +var AP = new Float64Array( [ 1.0, 2.0, 3.0, 5.0, 6.0, 9.0 ] ); +var S = new Float64Array( 3 ); +var out = new Float64Array( 2 ); + +dppequ.ndarray( 'row-major', 'lower', 3, AP, 1, 0, S, 1, 0, out, 1, 0 ); +// S => [ 1.0, ~0.58, ~0.33 ] +// out => [ ~0.33, 9.0 ] +``` + +The function has the following parameters: + +- **order**: storage layout. +- **uplo**: specifies whether upper or lower triangle of `A` is stored ( `upper` or `lower` ). +- **AP**: array containing the upper or lower triangle of `A` in packed form stored in linear memory as a [`Float64Array`][mdn-float64array], expectes `N * ( N + 1 ) / 2` indexed elements. +- **sap**: index increment for `AP`. +- **oap**: starting index of `AP`. +- **S**: array to store the scale factors of `A` in linear memory as a [`Float64Array`][mdn-float64array], expects `N` indexed elements. +- **ss**: index increment for `S`. +- **os**: starting index of `S`. +- **out**: the first element of `out` represents `scond`, the second element of out represents `amax`. if `scond` >= 0.1 and `amax` is not close to overflow/underflow it isn't worth scaling the matrix by `S`, if `amax` is close to underflow/overflow the matrix shoud be scaled. expects a [`Float64Array`][mdn-float64array] with 2 indexed elements. +- **so**: index increment for `out`. +- **oo**: starting index of `out`. + +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 AP = new Float64Array( [ 0.0, 1.0, 2.0, 3.0, 5.0, 6.0, 9.0 ] ); +var S = new Float64Array( 4 ); +var out = new Float64Array( 3 ); + +dppequ.ndarray( 'row-major', 'lower', 3, AP, 1, 1, S, 1, 1, out, 1, 1 ); +// S => [ 0.0, 1.0, ~0.58, ~0.33 ] +// out => [ 0.0, ~0.33, 9.0 ] +``` + +
+ + + +
+ +## Notes + +- `dppequ()` corresponds to the [LAPACK][LAPACK] function [`dppequ`][lapack-dppequ]. + +
+ + + +
+ +## Examples + + + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var ndarray2array = require( '@stdlib/ndarray/base/to-array' ); +var dppequ = require( '@stdlib/lapack/base/dppequ' ); + +var i; +var j; + +// Specify matrix meta data: +var shape = [ 3, 3 ]; +var order = 'row-major'; +var uplo = 'upper'; +var strides = shape2strides( shape, order ); +var offset = 0; + +// Define a symmetric positive definite matrix: +var A = new Float64Array( [ 4.0, 1.0, 1.0, 1.0, 3.0, 0.0, 1.0, 0.0, 2.0 ] ); +console.log( ndarray2array( A, shape, strides, offset, order ) ); + +// Convert the matrix to packed storage (upper triangle): +var buf = []; +for ( i = 0; i < shape[ 0 ]; i++ ) { + for ( j = i; j < shape[ 1 ]; j++ ) { + buf.push( A[ (i*strides[ 0 ]) + (j*strides[ 1 ]) + offset ] ); + } +} +console.log( buf ); + +var AP = new Float64Array( buf ); +var out = new Float64Array( 2 ); +var S = new Float64Array( shape[ 0 ] ); +var info = dppequ( order, uplo, shape[ 0 ], AP, S, out ); + +console.log( 'info:', info ); +console.log( 'S:', S ); +console.log( 'out:', out ); +``` + +
+ + + + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +TODO +``` + +#### TODO + +TODO. + +```c +TODO +``` + +TODO + +```c +TODO +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +TODO +``` + +
+ + + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/docs/types/index.d.ts b/lib/node_modules/@stdlib/lapack/base/dppequ/docs/types/index.d.ts index 38cc2b1a7140..b9338ea3cd72 100644 --- a/lib/node_modules/@stdlib/lapack/base/dppequ/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/docs/types/index.d.ts @@ -45,10 +45,12 @@ interface Routine { * * - the function returns `0` if it sucessfully exits. * - if the function returns an integer `i` greater then zero then the `i`th diagonal element was non positive. + * - the first indexed element of `out` represents `scond` and the second indexed elements represents `amax`, if it `scond` >= 0.1 and `amax` is not close to overflow/underflow then it is not worth scaling by `S`. + * - if `amax` is too close to overflow/underflow, the matrix should be scaled. * * @param order - storage layout * @param uplo - specifies whether upper or lower triangle of `A` is stored ( `upper` or `lower` ) - * @param N - order of the matrix `A` + * @param N - number of rows/columns in `A` * @param AP - array containing the upper or lower triangle of `A` in packed form, expectes `N * ( N + 1 ) / 2` indexed elements * @param S - array to store the scale factors of `A`, expects `N` indexed elements * @param out - array to store the output @@ -74,10 +76,12 @@ interface Routine { * * - the function returns `0` if it sucessfully exits. * - if the function returns an integer `i` greater then zero then the `i`th diagonal element was non positive. + * - the first indexed element of `out` represents `scond` and the second indexed elements represents `amax`, if it `scond` >= 0.1 and `amax` is not close to overflow/underflow then it is not worth scaling by `S`. + * - if `amax` is too close to overflow/underflow, the matrix should be scaled. * * @param order - storage layout * @param uplo - specifies whether upper or lower triangle of `A` is stored ( `upper` or `lower` ) - * @param N - order of the matrix `A` + * @param N - number of rows/columns in `A` * @param AP - array containing the upper or lower triangle of `A` in packed form, expectes `N * ( N + 1 ) / 2` indexed elements * @param strideAP - stride length for `AP` * @param offsetAP - starting index for `AP` @@ -110,10 +114,12 @@ interface Routine { * * - the function returns `0` if it sucessfully exits. * - if the function returns an integer `i` greater then zero then the `i`th diagonal element was non positive. +* - the first indexed element of `out` represents `scond` and the second indexed elements represents `amax`, if it `scond` >= 0.1 and `amax` is not close to overflow/underflow then it is not worth scaling by `S`. +* - if `amax` is too close to overflow/underflow, the matrix should be scaled. * * @param order - storage layout * @param uplo - specifies whether upper or lower triangle of `A` is stored ( `upper` or `lower` ) -* @param N - order of the matrix `A` +* @param N - number of rows/columns in `A` * @param AP - array containing the upper or lower triangle of `A` in packed form, expectes `N * ( N + 1 ) / 2` indexed elements * @param S - array to store the scale factors of `A`, expects `N` indexed elements * @param out - array to store the output diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/base.js b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/base.js index ec81a6528b56..e648b75b3142 100644 --- a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/base.js +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/base.js @@ -34,10 +34,12 @@ var min = require( '@stdlib/math/base/special/min' ); * * - the function returns `0` if it sucessfully exits. * - if the function returns an integer `i` greater then zero then the `i`th diagonal element was non positive. +* - the first indexed element of `out` represents `scond` and the second indexed elements represents `amax`, if it `scond` >= 0.1 and `amax` is not close to overflow/underflow then it is not worth scaling by `S`. +* - if `amax` is too close to overflow/underflow, the matrix should be scaled. * * @param {string} order - storage layout * @param {string} uplo - specifies whether upper or lower triangle of `A` is stored ( `upper` or `lower` ) -* @param {NonNegativeInteger} N - order of the matrix `A` +* @param {NonNegativeInteger} N - number of rows/columns in `A` * @param {Float64Array} AP - array containing the upper or lower triangle of `A` in packed form, expectes `N * ( N + 1 ) / 2` indexed elements * @param {integer} strideAP - stride length for `AP` * @param {integer} offsetAP - starting index for `AP` diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/dppequ.js b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/dppequ.js index 51c01908337a..0e6e4e5af5c3 100644 --- a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/dppequ.js +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/dppequ.js @@ -35,10 +35,12 @@ var base = require( './base.js' ); * * - the function returns `0` if it sucessfully exits. * - if the function returns an integer `i` greater then zero then the `i`th diagonal element was non positive. +* - the first indexed element of `out` represents `scond` and the second indexed elements represents `amax`, if it `scond` >= 0.1 and `amax` is not close to overflow/underflow then it is not worth scaling by `S`. +* - if `amax` is too close to overflow/underflow, the matrix should be scaled. * * @param {string} order - storage layout * @param {string} uplo - specifies whether upper or lower triangle of `A` is stored ( `upper` or `lower` ) -* @param {NonNegativeInteger} N - order of the matrix `A` +* @param {NonNegativeInteger} N - number of rows/columns in `A` * @param {Float64Array} AP - array containing the upper or lower triangle of `A` in packed form, expectes `N * ( N + 1 ) / 2` indexed elements * @param {Float64Array} S - array to store the scale factors of `A`, expects `N` indexed elements * @param {Float64Array} out - array to store the output diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/ndarray.js b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/ndarray.js index af02cb914d13..92d8753ed454 100644 --- a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/ndarray.js +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/ndarray.js @@ -35,10 +35,12 @@ var base = require( './base.js' ); * * - the function returns `0` if it sucessfully exits. * - if the function returns an integer `i` greater then zero then the `i`th diagonal element was non positive. +* - the first indexed element of `out` represents `scond` and the second indexed elements represents `amax`, if it `scond` >= 0.1 and `amax` is not close to overflow/underflow then it is not worth scaling by `S`. +* - if `amax` is too close to overflow/underflow, the matrix should be scaled. * * @param {string} order - storage layout * @param {string} uplo - specifies whether upper or lower triangle of `A` is stored ( `upper` or `lower` ) -* @param {NonNegativeInteger} N - order of the matrix `A` +* @param {NonNegativeInteger} N - number of rows/columns in `A` * @param {Float64Array} AP - array containing the upper or lower triangle of `A` in packed form, expectes `N * ( N + 1 ) / 2` indexed elements * @param {integer} strideAP - stride length for `AP` * @param {integer} offsetAP - starting index for `AP` From 8fa09252c654b7102cd7f6f59404ce9a20426139 Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Tue, 27 May 2025 15:56:33 +0000 Subject: [PATCH 27/28] 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: passed - task: lint_package_json status: na - task: lint_repl_help status: passed - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/lapack/base/dppequ/README.md | 4 +- .../@stdlib/lapack/base/dppequ/docs/repl.txt | 141 ++++++++++++++++++ .../lapack/base/dppequ/docs/types/index.d.ts | 6 +- .../@stdlib/lapack/base/dppequ/lib/base.js | 2 +- .../@stdlib/lapack/base/dppequ/lib/dppequ.js | 2 +- .../@stdlib/lapack/base/dppequ/lib/ndarray.js | 2 +- 6 files changed, 149 insertions(+), 8 deletions(-) create mode 100644 lib/node_modules/@stdlib/lapack/base/dppequ/docs/repl.txt diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/README.md b/lib/node_modules/@stdlib/lapack/base/dppequ/README.md index 2a8ea26d8e3b..cfb7e5e8d06e 100644 --- a/lib/node_modules/@stdlib/lapack/base/dppequ/README.md +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/README.md @@ -50,7 +50,7 @@ The function has the following parameters: - **order**: storage layout. - **uplo**: specifies whether upper or lower triangle of `A` is stored ( `upper` or `lower` ). -- **AP**: array containing the upper or lower triangle of `A` in packed form stored in linear memory as a [`Float64Array`][mdn-float64array], expectes `N * ( N + 1 ) / 2` indexed elements +- **AP**: array containing the upper or lower triangle of `A` in packed form stored in linear memory as a [`Float64Array`][mdn-float64array], expects `N * ( N + 1 ) / 2` indexed elements - **S**: array to store the scale factors of `A` in linear memory as a [`Float64Array`][mdn-float64array], expects `N` indexed elements. - **out**: the first element of `out` represents `scond`, the second element of out represents `amax`. if `scond` >= 0.1 and `amax` is not close to overflow/underflow it isn't worth scaling the matrix by `S`, if `amax` is close to underflow/overflow the matrix shoud be scaled. expects a [`Float64Array`][mdn-float64array] with 2 indexed elements. @@ -96,7 +96,7 @@ The function has the following parameters: - **order**: storage layout. - **uplo**: specifies whether upper or lower triangle of `A` is stored ( `upper` or `lower` ). -- **AP**: array containing the upper or lower triangle of `A` in packed form stored in linear memory as a [`Float64Array`][mdn-float64array], expectes `N * ( N + 1 ) / 2` indexed elements. +- **AP**: array containing the upper or lower triangle of `A` in packed form stored in linear memory as a [`Float64Array`][mdn-float64array], expects `N * ( N + 1 ) / 2` indexed elements. - **sap**: index increment for `AP`. - **oap**: starting index of `AP`. - **S**: array to store the scale factors of `A` in linear memory as a [`Float64Array`][mdn-float64array], expects `N` indexed elements. diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/docs/repl.txt b/lib/node_modules/@stdlib/lapack/base/dppequ/docs/repl.txt new file mode 100644 index 000000000000..38fbb7d1e14e --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/docs/repl.txt @@ -0,0 +1,141 @@ + +{{alias}}( order, uplo, N, AP, S, out ) + Computes the row and column scaling factors intended to equilibrate a + symmetric positive definite matrix `A` in packed storage and reduce + it's condition number (with respect to the two-norm). + + The function returns a status code. If the status code is equal to zero then + it shows a sucessful exit. If the status code it a positive integer `I` then + it means that the `I`th diagonal element had a non positive value. + + The first element of `out` represents `scond` and the second element of + `out` represents `amax`. if `scond` >= 0.1 and `amax` is not too close to + overflow/underflow then it is not worth scaling by `S`. if `amax` is close + to overflow/underflow the matrix should be scaled. + + 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'. + + uplo: string + Specifies whether upper or lower triangle of `A` is stored. + + N: integer + Number of rows/columns in `A`. + + AP: Float64Array + Array containing the upper or lower triangle of `A` in packed form, + expects `N * ( N + 1 ) / 2` indexed elements. + + S: Float64Array + Array to store the scale factors of `A`, expects `N` indexed + elements. + + out: Float64Array + Array to store `scond` and `amax`, expects 2 indexed elements. + + Returns + ------- + info: integer + Status code. + + Examples + -------- + > var AP = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0, 5.0, 6.0, 9.0 ] ); + > var S = new {{alias:@stdlib/array/float64}}( 3 ); + > var out = new {{alias:@stdlib/array/float64}}( 2 ); + > var ord = 'row-major'; + > var uplo = 'lower'; + > {{alias}}( 'row-major', 'lower', 3, AP, S, out ) + 0 + > S + [ 1, ~0.58, ~0.33 ] + > out + [ ~0.33, 9 ] + + +{{alias}}.ndarray( order, uplo, N, AP, sap, oap, S, ss, os, out, so, oo ) + Computes the row and column scaling factors intended to equilibrate a + symmetric positive definite matrix `A` in packed storage and reduce + it's condition number (with respect to the two-norm). + + The function returns a status code. If the status code is equal to zero then + it shows a sucessful exit. If the status code it a positive integer `I` then + it means that the `I`th diagonal element had a non positive value. + + The first element of `out` represents `scond` and the second element of + `out` represents `amax`. if `scond` >= 0.1 and `amax` is not too close to + overflow/underflow then it is not worth scaling by `S`. if `amax` is close + to overflow/underflow the matrix should be scaled. + + While typed array views mandate a view offset based on the underlying + buffer, the offset parameters support indexing semantics based on starting + indices. + + Parameters + ---------- + order: string + Row-major (C-style) or column-major (Fortran-style) order. Must be + either 'row-major' or 'column-major'. + + uplo: string + Specifies whether upper or lower triangle of `A` is stored. + + N: integer + Number of rows/columns in `A`. + + AP: Float64Array + Array containing the upper or lower triangle of `A` in packed form, + expects `N * ( N + 1 ) / 2` indexed elements. + + sap: integer + Stride length for `AP`. + + oap: integer + Starting index for `AP`. + + S: Float64Array + Array to store the scale factors of `A`, expects `N` indexed + elements. + + ss: integer + Stride length for `S`. + + os: integer + Starting index for `S`. + + out: Float64Array + Array to store `scond` and `amax`, expects 2 indexed elements. + + so: integer + Stride length for `out`. + + oo: integer + Starting index for `out`. + + Returns + ------- + info: integer + Status code. + + Examples + -------- + > var AP = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0, 5.0, 6.0, 9.0 ] ); + > var S = new {{alias:@stdlib/array/float64}}( 3 ); + > var out = new {{alias:@stdlib/array/float64}}( 2 ); + > var ord = 'row-major'; + > var uplo = 'lower'; + > {{alias}}.ndarray( ord, uplo, 3, AP, 1, 0, S, 1, 0, out, 1, 0 ) + 0 + > S + [ 1, ~0.58, ~0.33 ] + > out + [ ~0.33, 9 ] + + See Also + -------- diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/docs/types/index.d.ts b/lib/node_modules/@stdlib/lapack/base/dppequ/docs/types/index.d.ts index b9338ea3cd72..5c4b8374a055 100644 --- a/lib/node_modules/@stdlib/lapack/base/dppequ/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/docs/types/index.d.ts @@ -51,7 +51,7 @@ interface Routine { * @param order - storage layout * @param uplo - specifies whether upper or lower triangle of `A` is stored ( `upper` or `lower` ) * @param N - number of rows/columns in `A` - * @param AP - array containing the upper or lower triangle of `A` in packed form, expectes `N * ( N + 1 ) / 2` indexed elements + * @param AP - array containing the upper or lower triangle of `A` in packed form, expects `N * ( N + 1 ) / 2` indexed elements * @param S - array to store the scale factors of `A`, expects `N` indexed elements * @param out - array to store the output * @returns status code @@ -82,7 +82,7 @@ interface Routine { * @param order - storage layout * @param uplo - specifies whether upper or lower triangle of `A` is stored ( `upper` or `lower` ) * @param N - number of rows/columns in `A` - * @param AP - array containing the upper or lower triangle of `A` in packed form, expectes `N * ( N + 1 ) / 2` indexed elements + * @param AP - array containing the upper or lower triangle of `A` in packed form, expects `N * ( N + 1 ) / 2` indexed elements * @param strideAP - stride length for `AP` * @param offsetAP - starting index for `AP` * @param S - array to store the scale factors of `A`, expects `N` indexed elements @@ -120,7 +120,7 @@ interface Routine { * @param order - storage layout * @param uplo - specifies whether upper or lower triangle of `A` is stored ( `upper` or `lower` ) * @param N - number of rows/columns in `A` -* @param AP - array containing the upper or lower triangle of `A` in packed form, expectes `N * ( N + 1 ) / 2` indexed elements +* @param AP - array containing the upper or lower triangle of `A` in packed form, expects `N * ( N + 1 ) / 2` indexed elements * @param S - array to store the scale factors of `A`, expects `N` indexed elements * @param out - array to store the output * @returns status code diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/base.js b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/base.js index e648b75b3142..0d91a72e7e21 100644 --- a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/base.js +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/base.js @@ -40,7 +40,7 @@ var min = require( '@stdlib/math/base/special/min' ); * @param {string} order - storage layout * @param {string} uplo - specifies whether upper or lower triangle of `A` is stored ( `upper` or `lower` ) * @param {NonNegativeInteger} N - number of rows/columns in `A` -* @param {Float64Array} AP - array containing the upper or lower triangle of `A` in packed form, expectes `N * ( N + 1 ) / 2` indexed elements +* @param {Float64Array} AP - array containing the upper or lower triangle of `A` in packed form, expects `N * ( N + 1 ) / 2` indexed elements * @param {integer} strideAP - stride length for `AP` * @param {integer} offsetAP - starting index for `AP` * @param {Float64Array} S - array to store the scale factors of `A`, expects `N` indexed elements diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/dppequ.js b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/dppequ.js index 0e6e4e5af5c3..06160dacdd0e 100644 --- a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/dppequ.js +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/dppequ.js @@ -41,7 +41,7 @@ var base = require( './base.js' ); * @param {string} order - storage layout * @param {string} uplo - specifies whether upper or lower triangle of `A` is stored ( `upper` or `lower` ) * @param {NonNegativeInteger} N - number of rows/columns in `A` -* @param {Float64Array} AP - array containing the upper or lower triangle of `A` in packed form, expectes `N * ( N + 1 ) / 2` indexed elements +* @param {Float64Array} AP - array containing the upper or lower triangle of `A` in packed form, expects `N * ( N + 1 ) / 2` indexed elements * @param {Float64Array} S - array to store the scale factors of `A`, expects `N` indexed elements * @param {Float64Array} out - array to store the output * @throws {TypeError} first argument must be a valid order diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/ndarray.js b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/ndarray.js index 92d8753ed454..7e935a9f4e08 100644 --- a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/ndarray.js +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/ndarray.js @@ -41,7 +41,7 @@ var base = require( './base.js' ); * @param {string} order - storage layout * @param {string} uplo - specifies whether upper or lower triangle of `A` is stored ( `upper` or `lower` ) * @param {NonNegativeInteger} N - number of rows/columns in `A` -* @param {Float64Array} AP - array containing the upper or lower triangle of `A` in packed form, expectes `N * ( N + 1 ) / 2` indexed elements +* @param {Float64Array} AP - array containing the upper or lower triangle of `A` in packed form, expects `N * ( N + 1 ) / 2` indexed elements * @param {integer} strideAP - stride length for `AP` * @param {integer} offsetAP - starting index for `AP` * @param {Float64Array} S - array to store the scale factors of `A`, expects `N` indexed elements From 08fe0805da491227aaa24247deee24399d9430cf Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Tue, 27 May 2025 15:58:34 +0000 Subject: [PATCH 28/28] 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: 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/dppequ/lib/base.js | 6 +++--- lib/node_modules/@stdlib/lapack/base/dppequ/lib/ndarray.js | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/base.js b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/base.js index 0d91a72e7e21..a0a6191df04f 100644 --- a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/base.js +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/base.js @@ -42,13 +42,13 @@ var min = require( '@stdlib/math/base/special/min' ); * @param {NonNegativeInteger} N - number of rows/columns in `A` * @param {Float64Array} AP - array containing the upper or lower triangle of `A` in packed form, expects `N * ( N + 1 ) / 2` indexed elements * @param {integer} strideAP - stride length for `AP` -* @param {integer} offsetAP - starting index for `AP` +* @param {NonNegativeInteger} offsetAP - starting index for `AP` * @param {Float64Array} S - array to store the scale factors of `A`, expects `N` indexed elements * @param {integer} strideS - stride length for `S` -* @param {integer} offsetS - starting index for `S` +* @param {NonNegativeInteger} offsetS - starting index for `S` * @param {Float64Array} out - array to store the output * @param {integer} strideOut - stride length for `out` -* @param {integer} offsetOut - starting index for `out` +* @param {NonNegativeInteger} offsetOut - starting index for `out` * @returns {integer} status code * * @example diff --git a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/ndarray.js b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/ndarray.js index 7e935a9f4e08..9e1ca3dd12bd 100644 --- a/lib/node_modules/@stdlib/lapack/base/dppequ/lib/ndarray.js +++ b/lib/node_modules/@stdlib/lapack/base/dppequ/lib/ndarray.js @@ -43,13 +43,13 @@ var base = require( './base.js' ); * @param {NonNegativeInteger} N - number of rows/columns in `A` * @param {Float64Array} AP - array containing the upper or lower triangle of `A` in packed form, expects `N * ( N + 1 ) / 2` indexed elements * @param {integer} strideAP - stride length for `AP` -* @param {integer} offsetAP - starting index for `AP` +* @param {NonNegativeInteger} offsetAP - starting index for `AP` * @param {Float64Array} S - array to store the scale factors of `A`, expects `N` indexed elements * @param {integer} strideS - stride length for `S` -* @param {integer} offsetS - starting index for `S` +* @param {NonNegativeInteger} offsetS - starting index for `S` * @param {Float64Array} out - array to store the output * @param {integer} strideOut - stride length for `out` -* @param {integer} offsetOut - starting index for `out` +* @param {NonNegativeInteger} offsetOut - starting index for `out` * @throws {TypeError} first argument must be a valid order * @throws {TypeError} first argument must be a valid side * @throws {RangeError} third argument must be a nonnegative integer