From 9e8d0f68977a5e036286bf470f90b24db7af1bd0 Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Sat, 24 May 2025 18:53:43 +0000 Subject: [PATCH 01/12] feat: add base implementation --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/lapack/base/iladlc/lib/base.js | 98 +++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 lib/node_modules/@stdlib/lapack/base/iladlc/lib/base.js diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/lib/base.js b/lib/node_modules/@stdlib/lapack/base/iladlc/lib/base.js new file mode 100644 index 000000000000..5810dddfdb35 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/lib/base.js @@ -0,0 +1,98 @@ +/** +* @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 isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major' ); + + +// MAIN // + +/** +* Finds the index of the last non zero column in a matrix `A`. +* +* @private +* @param {PositiveInteger} M - number of rows in `A` +* @param {PositiveInteger} N - number of columns in `A` +* @param {Float64Array} A - input matrix +* @param {integer} strideA1 - stride of the first dimension of `A` +* @param {integer} strideA2 - stride of the second dimension of `A` +* @param {NonNegativeInteger} offsetA - index offset for `A` +* @returns {integer} index of the last column +* +* @example +* var Float64array = require( '@stdlib/array/float64' ); +* +* var A = new Float64array( [ 1.0, 2.0, 0.0, 3.0, 4.0, 0.0 ] ); // => [ [ 1.0, 2.0, 0.0 ], [ 3.0, 4.0, 0.0 ] ] +* +* var out = iladlc( 3, 2, A, 2, 1, 0 ); +* // returns 1 +*/ +function iladlc( M, N, A, strideA1, strideA2, offsetA ) { + var ia1; + var ia2; + var i; + var j; + + if ( M === 0 || N === 0 ) { + return -1; // Invalid index + } + + ia1 = offsetA + ( (N-1) * strideA2 ); // A( 1, N ) + ia2 = ia1 + ( (M-1) * strideA2 ); // A( M, N ) + + // Quick test for common case where corners are non-zero: + if ( A[ ia1 ] !== 0.0 || A[ ia2 ] !== 0.0 ) { + return N - 1; + } + + if ( isRowMajor( [ strideA1, strideA2 ] ) ) { + ia1 = offsetA; + for ( i = 0; i < M; i++ ) { + ia2 = ( N - 1 ) * strideA2; + for ( j = N-1; j >= 0; j-- ) { + if ( A[ ia1 + ia2 ] !== 0.0 ) { + return j; + } + ia2 -= strideA2; + } + ia1 += strideA1; + } + } else { + ia1 = offsetA + ( (N-1) * strideA2 ); + for ( i = N-1; i >= 0; i-- ) { + ia1 = 0; + for ( j = 0; j < M; j++ ) { + if ( A[ ia1 + ia2 ] !== 0.0 ) { + return i; + } + ia1 += strideA1; + } + ia1 -= strideA2; + } + } + + return -1; +} + + +// EXPORTS // + +module.exports = iladlc; From 54aca86c5718ba62ec7051e0fdf02c3c29c22c4e Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Sat, 24 May 2025 19:31:24 +0000 Subject: [PATCH 02/12] 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/iladlc/lib/base.js | 6 +- .../@stdlib/lapack/base/iladlc/lib/iladlc.js | 76 +++++++++++++++++++ .../@stdlib/lapack/base/iladlc/lib/index.js | 57 ++++++++++++++ .../@stdlib/lapack/base/iladlc/lib/main.js | 35 +++++++++ .../@stdlib/lapack/base/iladlc/lib/ndarray.js | 54 +++++++++++++ 5 files changed, 225 insertions(+), 3 deletions(-) create mode 100644 lib/node_modules/@stdlib/lapack/base/iladlc/lib/iladlc.js create mode 100644 lib/node_modules/@stdlib/lapack/base/iladlc/lib/index.js create mode 100644 lib/node_modules/@stdlib/lapack/base/iladlc/lib/main.js create mode 100644 lib/node_modules/@stdlib/lapack/base/iladlc/lib/ndarray.js diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/lib/base.js b/lib/node_modules/@stdlib/lapack/base/iladlc/lib/base.js index 5810dddfdb35..ed06cb6ac0af 100644 --- a/lib/node_modules/@stdlib/lapack/base/iladlc/lib/base.js +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/lib/base.js @@ -35,14 +35,14 @@ var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major' ); * @param {integer} strideA1 - stride of the first dimension of `A` * @param {integer} strideA2 - stride of the second dimension of `A` * @param {NonNegativeInteger} offsetA - index offset for `A` -* @returns {integer} index of the last column +* @returns {integer} index of the last non zero column * * @example * var Float64array = require( '@stdlib/array/float64' ); * * var A = new Float64array( [ 1.0, 2.0, 0.0, 3.0, 4.0, 0.0 ] ); // => [ [ 1.0, 2.0, 0.0 ], [ 3.0, 4.0, 0.0 ] ] * -* var out = iladlc( 3, 2, A, 2, 1, 0 ); +* var out = iladlc( 2, 3, A, 3, 1, 0 ); * // returns 1 */ function iladlc( M, N, A, strideA1, strideA2, offsetA ) { @@ -56,7 +56,7 @@ function iladlc( M, N, A, strideA1, strideA2, offsetA ) { } ia1 = offsetA + ( (N-1) * strideA2 ); // A( 1, N ) - ia2 = ia1 + ( (M-1) * strideA2 ); // A( M, N ) + ia2 = ia1 + ( (M-1) * strideA1 ); // A( M, N ) // Quick test for common case where corners are non-zero: if ( A[ ia1 ] !== 0.0 || A[ ia2 ] !== 0.0 ) { diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/lib/iladlc.js b/lib/node_modules/@stdlib/lapack/base/iladlc/lib/iladlc.js new file mode 100644 index 000000000000..79018561c310 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/lib/iladlc.js @@ -0,0 +1,76 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var isLayout = require( '@stdlib/blas/base/assert/is-layout' ); +var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major-string' ); +var isColumnMajor = require( '@stdlib/ndarray/base/assert/is-column-major-string' ); +var max = require( '@stdlib/math/base/special/max' ); +var format = require( '@stdlib/string/format' ); +var base = require( './base.js' ); + + +// MAIN // + +/** +* Finds the index of the last non zero column in a matrix `A`. +* +* @param {string} order - storage layout +* @param {PositiveInteger} M - number of rows in `A` +* @param {PositiveInteger} N - number of columns in `A` +* @param {Float64Array} A - input matrix +* @param {integer} LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) +* @throws {TypeError} first argument must be a valid order +* @throws {RangeError} fifth argument must be greater than or equal to max(1,N) +* @returns {integer} index of the last non zero column +* +* @example +* var Float64array = require( '@stdlib/array/float64' ); +* +* var A = new Float64array( [ 1.0, 2.0, 0.0, 3.0, 4.0, 0.0 ] ); // => [ [ 1.0, 2.0, 0.0 ], [ 3.0, 4.0, 0.0 ] ] +* +* var out = iladlc( 'row-major', 2, 3, A, 3 ); +* // returns 1 +*/ +function iladlc( order, M, N, A, LDA ) { + var sa1; + var sa2; + + if ( !isLayout( order ) ) { + throw new TypeError( format( 'invalid argument. First argument must be a valid order. Value: `%s`.', order ) ); + } + if ( isRowMajor( order ) && LDA < max( 1, N ) ) { + throw new RangeError( format( 'invalid argument. Fourth argument must be greater than or equal to max(1,%d). Value: `%d`.', N, LDA ) ); + } + if ( isColumnMajor( order ) ) { + sa1 = 1; + sa2 = LDA; + } else { // order === 'row-major' + sa1 = LDA; + sa2 = 1; + } + return base( M, N, A, sa1, sa2, 0 ); +} + + +// EXPORTS // + +module.exports = iladlc; diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/lib/index.js b/lib/node_modules/@stdlib/lapack/base/iladlc/lib/index.js new file mode 100644 index 000000000000..486fb609deb5 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/lib/index.js @@ -0,0 +1,57 @@ +/** +* @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 find the index of the last non zero row in a input matrix. +* +* @module @stdlib/lapack/base/iladlc +* +* @example +* var Float64array = require( '@stdlib/array/float64' ); +* var iladlc = require( '@stdlib/lapack/base/iladlc' ); +* +* var A = new Float64array( [ 1.0, 2.0, 0.0, 3.0, 4.0, 0.0 ] ); // => [ [ 1.0, 2.0, 0.0 ], [ 3.0, 4.0, 0.0 ] ] +* +* var out = iladlc( 'row-major', 2, 3, A, 3 ); +* // returns 1 +*/ + +// 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 iladlc; +var tmp = tryRequire( join( __dirname, './native.js' ) ); +if ( isError( tmp ) ) { + iladlc = main; +} else { + iladlc = tmp; +} + + +// EXPORTS // + +module.exports = iladlc; diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/lib/main.js b/lib/node_modules/@stdlib/lapack/base/iladlc/lib/main.js new file mode 100644 index 000000000000..f97d6f686359 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/lib/main.js @@ -0,0 +1,35 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var iladlc = require( './iladlc.js' ); +var ndarray = require( './ndarray.js' ); + + +// MAIN // + +setReadOnly( iladlc, 'ndarray', ndarray ); + + +// EXPORTS // + +module.exports = iladlc; diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/lib/ndarray.js b/lib/node_modules/@stdlib/lapack/base/iladlc/lib/ndarray.js new file mode 100644 index 000000000000..e2e70d49b72d --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/lib/ndarray.js @@ -0,0 +1,54 @@ +/** +* @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 base = require( './base.js' ); + + +// MAIN // + +/** +* Finds the index of the last non zero column in a matrix `A` using alternative indexing semantics. +* +* @param {PositiveInteger} M - number of rows in `A` +* @param {PositiveInteger} N - number of columns in `A` +* @param {Float64Array} A - input matrix +* @param {integer} strideA1 - stride of the first dimension of `A` +* @param {integer} strideA2 - stride of the second dimension of `A` +* @param {NonNegativeInteger} offsetA - index offset for `A` +* @returns {integer} index of the last non zero column +* +* @example +* var Float64array = require( '@stdlib/array/float64' ); +* +* var A = new Float64array( [ 1.0, 2.0, 0.0, 3.0, 4.0, 0.0 ] ); // => [ [ 1.0, 2.0, 0.0 ], [ 3.0, 4.0, 0.0 ] ] +* +* var out = iladlc( 2, 3, A, 3, 1, 0 ); +* // returns 1 +*/ +function iladlc( M, N, A, strideA1, strideA2, offsetA ) { + return base( M, N, A, strideA1, strideA2, offsetA ); +} + + +// EXPORTS // + +module.exports = iladlc; From 74817d9c9e8d8bf644842656f88b5b839dc18186 Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Sat, 24 May 2025 20:40:10 +0000 Subject: [PATCH 03/12] test: add fixtures --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../iladlc/test/fixtures/column_major.json | 15 ++++++++++ .../test/fixtures/column_major_zeros.json | 15 ++++++++++ .../fixtures/large_strides/column_major.json | 28 +++++++++++++++++++ .../large_strides/column_major_zeros.json | 28 +++++++++++++++++++ .../fixtures/large_strides/row_major.json | 28 +++++++++++++++++++ .../large_strides/row_major_zeros.json | 28 +++++++++++++++++++ .../fixtures/mixed_strides/column_major.json | 22 +++++++++++++++ .../mixed_strides/column_major_zeros.json | 22 +++++++++++++++ .../fixtures/mixed_strides/row_major.json | 22 +++++++++++++++ .../mixed_strides/row_major_zeros.json | 22 +++++++++++++++ .../negative_strides/column_major.json | 22 +++++++++++++++ .../negative_strides/column_major_zeros.json | 22 +++++++++++++++ .../fixtures/negative_strides/row_major.json | 22 +++++++++++++++ .../negative_strides/row_major_zeros.json | 22 +++++++++++++++ .../test/fixtures/offsets/column_major.json | 23 +++++++++++++++ .../fixtures/offsets/column_major_zeros.json | 23 +++++++++++++++ .../test/fixtures/offsets/row_major.json | 23 +++++++++++++++ .../fixtures/offsets/row_major_zeros.json | 23 +++++++++++++++ .../base/iladlc/test/fixtures/row_major.json | 15 ++++++++++ .../iladlc/test/fixtures/row_major_zeros.json | 15 ++++++++++ 20 files changed, 440 insertions(+) create mode 100644 lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/column_major.json create mode 100644 lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/column_major_zeros.json create mode 100644 lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/large_strides/column_major.json create mode 100644 lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/large_strides/column_major_zeros.json create mode 100644 lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/large_strides/row_major.json create mode 100644 lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/large_strides/row_major_zeros.json create mode 100644 lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/mixed_strides/column_major.json create mode 100644 lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/mixed_strides/column_major_zeros.json create mode 100644 lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/mixed_strides/row_major.json create mode 100644 lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/mixed_strides/row_major_zeros.json create mode 100644 lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/negative_strides/column_major.json create mode 100644 lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/negative_strides/column_major_zeros.json create mode 100644 lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/negative_strides/row_major.json create mode 100644 lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/negative_strides/row_major_zeros.json create mode 100644 lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/offsets/column_major.json create mode 100644 lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/offsets/column_major_zeros.json create mode 100644 lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/offsets/row_major.json create mode 100644 lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/offsets/row_major_zeros.json create mode 100644 lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/row_major.json create mode 100644 lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/row_major_zeros.json diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/column_major.json b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/column_major.json new file mode 100644 index 000000000000..ff5f7992d6db --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/column_major.json @@ -0,0 +1,15 @@ +{ + "order": "column-major", + "A": [ 1.0, 4.0, 2.0, 1.0, 3.0, 0.0 ], + "M": 2, + "N": 3, + "strideA1": 1, + "strideA2": 2, + "offsetA": 0, + "LDA": 2, + "A_mat": [ + [ 1.0, 2.0, 3.0 ], + [ 4.0, 1.0, 0.0 ] + ], + "expected": 2 +} diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/column_major_zeros.json b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/column_major_zeros.json new file mode 100644 index 000000000000..f480814443be --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/column_major_zeros.json @@ -0,0 +1,15 @@ +{ + "order": "column-major", + "A": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + "M": 2, + "N": 3, + "strideA1": 1, + "strideA2": 2, + "offsetA": 0, + "LDA": 2, + "A_mat": [ + [ 0.0, 0.0, 0.0 ], + [ 0.0, 0.0, 0.0 ] + ], + "expected": -1 +} diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/large_strides/column_major.json b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/large_strides/column_major.json new file mode 100644 index 000000000000..85a499fd856c --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/large_strides/column_major.json @@ -0,0 +1,28 @@ +{ + "order": "column-major", + "A": [ + 1.0, + 9999.0, + 4.0, + 9999.0, + 2.0, + 9999.0, + 1.0, + 9999.0, + 3.0, + 9999.0, + 0.0, + 9999.0 + ], + "M": 2, + "N": 3, + "strideA1": 2, + "strideA2": 4, + "offsetA": 0, + "LDA": 2, + "A_mat": [ + [ 1.0, 2.0, 3.0 ], + [ 4.0, 1.0, 0.0 ] + ], + "expected": 2 +} diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/large_strides/column_major_zeros.json b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/large_strides/column_major_zeros.json new file mode 100644 index 000000000000..a5832e296c80 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/large_strides/column_major_zeros.json @@ -0,0 +1,28 @@ +{ + "order": "column-major", + "A": [ + 0.0, + 9999.0, + 0.0, + 9999.0, + 0.0, + 9999.0, + 0.0, + 9999.0, + 0.0, + 9999.0, + 0.0, + 9999.0 + ], + "M": 2, + "N": 3, + "strideA1": 2, + "strideA2": 4, + "offsetA": 0, + "LDA": 2, + "A_mat": [ + [ 0.0, 0.0, 0.0 ], + [ 0.0, 0.0, 0.0 ] + ], + "expected": -1 +} diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/large_strides/row_major.json b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/large_strides/row_major.json new file mode 100644 index 000000000000..3f9099915679 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/large_strides/row_major.json @@ -0,0 +1,28 @@ +{ + "order": "row-major", + "A": [ + 1.0, + 9999.0, + 2.0, + 9999.0, + 3.0, + 9999.0, + 4.0, + 9999.0, + 1.0, + 9999.0, + 0.0, + 9999.0 + ], + "M": 2, + "N": 3, + "strideA1": 6, + "strideA2": 2, + "offsetA": 0, + "LDA": 3, + "A_mat": [ + [ 1.0, 2.0, 3.0 ], + [ 4.0, 1.0, 0.0 ] + ], + "expected": 2 +} diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/large_strides/row_major_zeros.json b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/large_strides/row_major_zeros.json new file mode 100644 index 000000000000..a4600f4cc890 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/large_strides/row_major_zeros.json @@ -0,0 +1,28 @@ +{ + "order": "row-major", + "A": [ + 0.0, + 9999.0, + 0.0, + 9999.0, + 0.0, + 9999.0, + 0.0, + 9999.0, + 0.0, + 9999.0, + 0.0, + 9999.0 + ], + "M": 2, + "N": 3, + "strideA1": 6, + "strideA2": 2, + "offsetA": 0, + "LDA": 3, + "A_mat": [ + [ 0.0, 0.0, 0.0 ], + [ 0.0, 0.0, 0.0 ] + ], + "expected": -1 +} diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/mixed_strides/column_major.json b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/mixed_strides/column_major.json new file mode 100644 index 000000000000..3fdbf15d5d23 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/mixed_strides/column_major.json @@ -0,0 +1,22 @@ +{ + "order": "column-major", + "A": [ + 3.0, + 0.0, + 2.0, + 1.0, + 1.0, + 4.0 + ], + "M": 2, + "N": 3, + "strideA1": 1, + "strideA2": -2, + "offsetA": 4, + "LDA": 2, + "A_mat": [ + [ 1.0, 2.0, 3.0 ], + [ 4.0, 1.0, 0.0 ] + ], + "expected": 2 +} diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/mixed_strides/column_major_zeros.json b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/mixed_strides/column_major_zeros.json new file mode 100644 index 000000000000..8d10b99a7f59 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/mixed_strides/column_major_zeros.json @@ -0,0 +1,22 @@ +{ + "order": "column-major", + "A": [ + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ], + "M": 2, + "N": 3, + "strideA1": 1, + "strideA2": -2, + "offsetA": 4, + "LDA": 2, + "A_mat": [ + [ 0.0, 0.0, 0.0 ], + [ 0.0, 0.0, 0.0 ] + ], + "expected": -1 +} diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/mixed_strides/row_major.json b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/mixed_strides/row_major.json new file mode 100644 index 000000000000..53ad27842436 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/mixed_strides/row_major.json @@ -0,0 +1,22 @@ +{ + "order": "row-major", + "A": [ + 4.0, + 1.0, + 0.0, + 1.0, + 2.0, + 3.0 + ], + "M": 2, + "N": 3, + "strideA1": -3, + "strideA2": 1, + "offsetA": 3, + "LDA": 3, + "A_mat": [ + [ 1.0, 2.0, 3.0 ], + [ 4.0, 1.0, 0.0 ] + ], + "expected": 2 +} diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/mixed_strides/row_major_zeros.json b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/mixed_strides/row_major_zeros.json new file mode 100644 index 000000000000..99450022d8cc --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/mixed_strides/row_major_zeros.json @@ -0,0 +1,22 @@ +{ + "order": "row-major", + "A": [ + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ], + "M": 2, + "N": 3, + "strideA1": -3, + "strideA2": 1, + "offsetA": 3, + "LDA": 3, + "A_mat": [ + [ 0.0, 0.0, 0.0 ], + [ 0.0, 0.0, 0.0 ] + ], + "expected": -1 +} diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/negative_strides/column_major.json b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/negative_strides/column_major.json new file mode 100644 index 000000000000..d47cfa90b372 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/negative_strides/column_major.json @@ -0,0 +1,22 @@ +{ + "order": "column-major", + "A": [ + 0.0, + 3.0, + 1.0, + 2.0, + 4.0, + 1.0 + ], + "M": 2, + "N": 3, + "strideA1": -1, + "strideA2": -2, + "offsetA": 5, + "LDA": 2, + "A_mat": [ + [ 1.0, 2.0, 3.0 ], + [ 4.0, 1.0, 0.0 ] + ], + "expected": 2 +} diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/negative_strides/column_major_zeros.json b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/negative_strides/column_major_zeros.json new file mode 100644 index 000000000000..1123e8d1b252 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/negative_strides/column_major_zeros.json @@ -0,0 +1,22 @@ +{ + "order": "column-major", + "A": [ + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ], + "M": 2, + "N": 3, + "strideA1": -1, + "strideA2": -2, + "offsetA": 5, + "LDA": 2, + "A_mat": [ + [ 0.0, 0.0, 0.0 ], + [ 0.0, 0.0, 0.0 ] + ], + "expected": -1 +} diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/negative_strides/row_major.json b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/negative_strides/row_major.json new file mode 100644 index 000000000000..2ffdf1dd0c9f --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/negative_strides/row_major.json @@ -0,0 +1,22 @@ +{ + "order": "row-major", + "A": [ + 0.0, + 1.0, + 4.0, + 3.0, + 2.0, + 1.0 + ], + "M": 2, + "N": 3, + "strideA1": -3, + "strideA2": -1, + "offsetA": 5, + "LDA": 3, + "A_mat": [ + [ 1.0, 2.0, 3.0 ], + [ 4.0, 1.0, 0.0 ] + ], + "expected": 2 +} diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/negative_strides/row_major_zeros.json b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/negative_strides/row_major_zeros.json new file mode 100644 index 000000000000..8525dd854700 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/negative_strides/row_major_zeros.json @@ -0,0 +1,22 @@ +{ + "order": "row-major", + "A": [ + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ], + "M": 2, + "N": 3, + "strideA1": -3, + "strideA2": -1, + "offsetA": 5, + "LDA": 3, + "A_mat": [ + [ 0.0, 0.0, 0.0 ], + [ 0.0, 0.0, 0.0 ] + ], + "expected": -1 +} diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/offsets/column_major.json b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/offsets/column_major.json new file mode 100644 index 000000000000..e576a42b7cb7 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/offsets/column_major.json @@ -0,0 +1,23 @@ +{ + "order": "column-major", + "A": [ + 9999.0, + 1.0, + 4.0, + 2.0, + 1.0, + 3.0, + 0.0 + ], + "M": 2, + "N": 3, + "strideA1": 1, + "strideA2": 2, + "offsetA": 1, + "LDA": 2, + "A_mat": [ + [ 1.0, 2.0, 3.0 ], + [ 4.0, 1.0, 0.0 ] + ], + "expected": 2 +} diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/offsets/column_major_zeros.json b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/offsets/column_major_zeros.json new file mode 100644 index 000000000000..b544ba368326 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/offsets/column_major_zeros.json @@ -0,0 +1,23 @@ +{ + "order": "column-major", + "A": [ + 9999.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ], + "M": 2, + "N": 3, + "strideA1": 1, + "strideA2": 2, + "offsetA": 1, + "LDA": 2, + "A_mat": [ + [ 0.0, 0.0, 0.0 ], + [ 0.0, 0.0, 0.0 ] + ], + "expected": -1 +} diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/offsets/row_major.json b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/offsets/row_major.json new file mode 100644 index 000000000000..daf4cf4e7f2d --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/offsets/row_major.json @@ -0,0 +1,23 @@ +{ + "order": "row-major", + "A": [ + 9999.0, + 1.0, + 2.0, + 3.0, + 4.0, + 1.0, + 0.0 + ], + "M": 2, + "N": 3, + "strideA1": 3, + "strideA2": 1, + "offsetA": 1, + "LDA": 3, + "A_mat": [ + [ 1.0, 2.0, 3.0 ], + [ 4.0, 1.0, 0.0 ] + ], + "expected": 2 +} diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/offsets/row_major_zeros.json b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/offsets/row_major_zeros.json new file mode 100644 index 000000000000..0beb43f62a9f --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/offsets/row_major_zeros.json @@ -0,0 +1,23 @@ +{ + "order": "row-major", + "A": [ + 9999.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ], + "M": 2, + "N": 3, + "strideA1": 3, + "strideA2": 1, + "offsetA": 1, + "LDA": 3, + "A_mat": [ + [ 0.0, 0.0, 0.0 ], + [ 0.0, 0.0, 0.0 ] + ], + "expected": -1 +} diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/row_major.json b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/row_major.json new file mode 100644 index 000000000000..1764ee8ed35b --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/row_major.json @@ -0,0 +1,15 @@ +{ + "order": "row-major", + "A": [ 1.0, 2.0, 3.0, 4.0, 1.0, 0.0 ], + "M": 2, + "N": 3, + "strideA1": 3, + "strideA2": 1, + "offsetA": 0, + "LDA": 3, + "A_mat": [ + [ 1.0, 2.0, 3.0 ], + [ 4.0, 1.0, 0.0 ] + ], + "expected": 2 +} diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/row_major_zeros.json b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/row_major_zeros.json new file mode 100644 index 000000000000..aaafc221b206 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/row_major_zeros.json @@ -0,0 +1,15 @@ +{ + "order": "row-major", + "A": [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + "M": 2, + "N": 3, + "strideA1": 3, + "strideA2": 1, + "offsetA": 0, + "LDA": 3, + "A_mat": [ + [ 0.0, 0.0, 0.0 ], + [ 0.0, 0.0, 0.0 ] + ], + "expected": -1 +} From a870958a1714eb56ace0250750d8673424212a2e Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Sun, 25 May 2025 06:24:07 +0000 Subject: [PATCH 04/12] test: write all 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/iladlc/lib/base.js | 4 +- .../iladlc/test/fixtures/column_major.json | 6 +- .../fixtures/large_strides/column_major.json | 6 +- .../fixtures/large_strides/row_major.json | 6 +- .../fixtures/mixed_strides/column_major.json | 6 +- .../fixtures/mixed_strides/row_major.json | 6 +- .../negative_strides/column_major.json | 6 +- .../fixtures/negative_strides/row_major.json | 6 +- .../test/fixtures/offsets/column_major.json | 6 +- .../test/fixtures/offsets/row_major.json | 6 +- .../base/iladlc/test/fixtures/row_major.json | 6 +- .../lapack/base/iladlc/test/test.iladlc.js | 196 ++++++++++ .../@stdlib/lapack/base/iladlc/test/test.js | 82 ++++ .../lapack/base/iladlc/test/test.ndarray.js | 349 ++++++++++++++++++ 14 files changed, 659 insertions(+), 32 deletions(-) create mode 100644 lib/node_modules/@stdlib/lapack/base/iladlc/test/test.iladlc.js create mode 100644 lib/node_modules/@stdlib/lapack/base/iladlc/test/test.js create mode 100644 lib/node_modules/@stdlib/lapack/base/iladlc/test/test.ndarray.js diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/lib/base.js b/lib/node_modules/@stdlib/lapack/base/iladlc/lib/base.js index ed06cb6ac0af..9ec413526ad9 100644 --- a/lib/node_modules/@stdlib/lapack/base/iladlc/lib/base.js +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/lib/base.js @@ -78,12 +78,12 @@ function iladlc( M, N, A, strideA1, strideA2, offsetA ) { } else { ia1 = offsetA + ( (N-1) * strideA2 ); for ( i = N-1; i >= 0; i-- ) { - ia1 = 0; + ia2 = 0; for ( j = 0; j < M; j++ ) { if ( A[ ia1 + ia2 ] !== 0.0 ) { return i; } - ia1 += strideA1; + ia2 += strideA1; } ia1 -= strideA2; } diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/column_major.json b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/column_major.json index ff5f7992d6db..75b1e74f3f39 100644 --- a/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/column_major.json +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/column_major.json @@ -1,6 +1,6 @@ { "order": "column-major", - "A": [ 1.0, 4.0, 2.0, 1.0, 3.0, 0.0 ], + "A": [ 1.0, 4.0, 2.0, 1.0, 0.0, 0.0 ], "M": 2, "N": 3, "strideA1": 1, @@ -8,8 +8,8 @@ "offsetA": 0, "LDA": 2, "A_mat": [ - [ 1.0, 2.0, 3.0 ], + [ 1.0, 2.0, 0.0 ], [ 4.0, 1.0, 0.0 ] ], - "expected": 2 + "expected": 1 } diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/large_strides/column_major.json b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/large_strides/column_major.json index 85a499fd856c..f75917461c24 100644 --- a/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/large_strides/column_major.json +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/large_strides/column_major.json @@ -9,7 +9,7 @@ 9999.0, 1.0, 9999.0, - 3.0, + 0.0, 9999.0, 0.0, 9999.0 @@ -21,8 +21,8 @@ "offsetA": 0, "LDA": 2, "A_mat": [ - [ 1.0, 2.0, 3.0 ], + [ 1.0, 2.0, 0.0 ], [ 4.0, 1.0, 0.0 ] ], - "expected": 2 + "expected": 1 } diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/large_strides/row_major.json b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/large_strides/row_major.json index 3f9099915679..9f679c20e503 100644 --- a/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/large_strides/row_major.json +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/large_strides/row_major.json @@ -5,7 +5,7 @@ 9999.0, 2.0, 9999.0, - 3.0, + 0.0, 9999.0, 4.0, 9999.0, @@ -21,8 +21,8 @@ "offsetA": 0, "LDA": 3, "A_mat": [ - [ 1.0, 2.0, 3.0 ], + [ 1.0, 2.0, 0.0 ], [ 4.0, 1.0, 0.0 ] ], - "expected": 2 + "expected": 1 } diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/mixed_strides/column_major.json b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/mixed_strides/column_major.json index 3fdbf15d5d23..6255823ae44a 100644 --- a/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/mixed_strides/column_major.json +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/mixed_strides/column_major.json @@ -1,7 +1,7 @@ { "order": "column-major", "A": [ - 3.0, + 0.0, 0.0, 2.0, 1.0, @@ -15,8 +15,8 @@ "offsetA": 4, "LDA": 2, "A_mat": [ - [ 1.0, 2.0, 3.0 ], + [ 1.0, 2.0, 0.0 ], [ 4.0, 1.0, 0.0 ] ], - "expected": 2 + "expected": 1 } diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/mixed_strides/row_major.json b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/mixed_strides/row_major.json index 53ad27842436..2a5419a31eb2 100644 --- a/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/mixed_strides/row_major.json +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/mixed_strides/row_major.json @@ -6,7 +6,7 @@ 0.0, 1.0, 2.0, - 3.0 + 0.0 ], "M": 2, "N": 3, @@ -15,8 +15,8 @@ "offsetA": 3, "LDA": 3, "A_mat": [ - [ 1.0, 2.0, 3.0 ], + [ 1.0, 2.0, 0.0 ], [ 4.0, 1.0, 0.0 ] ], - "expected": 2 + "expected": 1 } diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/negative_strides/column_major.json b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/negative_strides/column_major.json index d47cfa90b372..62e842441497 100644 --- a/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/negative_strides/column_major.json +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/negative_strides/column_major.json @@ -2,7 +2,7 @@ "order": "column-major", "A": [ 0.0, - 3.0, + 0.0, 1.0, 2.0, 4.0, @@ -15,8 +15,8 @@ "offsetA": 5, "LDA": 2, "A_mat": [ - [ 1.0, 2.0, 3.0 ], + [ 1.0, 2.0, 0.0 ], [ 4.0, 1.0, 0.0 ] ], - "expected": 2 + "expected": 1 } diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/negative_strides/row_major.json b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/negative_strides/row_major.json index 2ffdf1dd0c9f..50dec8496a73 100644 --- a/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/negative_strides/row_major.json +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/negative_strides/row_major.json @@ -4,7 +4,7 @@ 0.0, 1.0, 4.0, - 3.0, + 0.0, 2.0, 1.0 ], @@ -15,8 +15,8 @@ "offsetA": 5, "LDA": 3, "A_mat": [ - [ 1.0, 2.0, 3.0 ], + [ 1.0, 2.0, 0.0 ], [ 4.0, 1.0, 0.0 ] ], - "expected": 2 + "expected": 1 } diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/offsets/column_major.json b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/offsets/column_major.json index e576a42b7cb7..eff5c767d2c7 100644 --- a/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/offsets/column_major.json +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/offsets/column_major.json @@ -6,7 +6,7 @@ 4.0, 2.0, 1.0, - 3.0, + 0.0, 0.0 ], "M": 2, @@ -16,8 +16,8 @@ "offsetA": 1, "LDA": 2, "A_mat": [ - [ 1.0, 2.0, 3.0 ], + [ 1.0, 2.0, 0.0 ], [ 4.0, 1.0, 0.0 ] ], - "expected": 2 + "expected": 1 } diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/offsets/row_major.json b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/offsets/row_major.json index daf4cf4e7f2d..a711dc2ce270 100644 --- a/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/offsets/row_major.json +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/offsets/row_major.json @@ -4,7 +4,7 @@ 9999.0, 1.0, 2.0, - 3.0, + 0.0, 4.0, 1.0, 0.0 @@ -16,8 +16,8 @@ "offsetA": 1, "LDA": 3, "A_mat": [ - [ 1.0, 2.0, 3.0 ], + [ 1.0, 2.0, 0.0 ], [ 4.0, 1.0, 0.0 ] ], - "expected": 2 + "expected": 1 } diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/row_major.json b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/row_major.json index 1764ee8ed35b..820ab2f8010c 100644 --- a/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/row_major.json +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/test/fixtures/row_major.json @@ -1,6 +1,6 @@ { "order": "row-major", - "A": [ 1.0, 2.0, 3.0, 4.0, 1.0, 0.0 ], + "A": [ 1.0, 2.0, 0.0, 4.0, 1.0, 0.0 ], "M": 2, "N": 3, "strideA1": 3, @@ -8,8 +8,8 @@ "offsetA": 0, "LDA": 3, "A_mat": [ - [ 1.0, 2.0, 3.0 ], + [ 1.0, 2.0, 0.0 ], [ 4.0, 1.0, 0.0 ] ], - "expected": 2 + "expected": 1 } diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/test/test.iladlc.js b/lib/node_modules/@stdlib/lapack/base/iladlc/test/test.iladlc.js new file mode 100644 index 000000000000..ac06ef045782 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/test/test.iladlc.js @@ -0,0 +1,196 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Float64Array = require( '@stdlib/array/float64' ); +var iladlc = require( './../lib/iladlc.js' ); + + +// FIXTURES // + +var ROW_MAJOR_DATA = require( './fixtures/row_major.json' ); +var ROW_MAJOR_ZEROS = require( './fixtures/row_major_zeros.json' ); +var COLUMN_MAJOR_DATA = require( './fixtures/column_major.json' ); +var COLUMN_MAJOR_ZEROS = require( './fixtures/column_major_zeros.json' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof iladlc, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 5', function test( t ) { + t.strictEqual( iladlc.length, 5, 'returns expected value' ); + t.end(); +}); + +tape( 'the function throws an error if provided a first argument which is not a valid order', function test( t ) { + var values; + var data; + var A; + var i; + + data = ROW_MAJOR_DATA; + + values = [ + 'foo', + 'bar', + 'beep', + 'boop', + -5, + NaN, + true, + false, + null, + void 0, + [], + {}, + function noop() {} + ]; + + A = new Float64Array( data.A ); + + 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() { + iladlc( value, data.M, data.N, A, data.LDA ); + }; + } +}); + +tape( 'the function throws an error if provided a fourth argument which is not a valid `LDA` value (row-major)', function test( t ) { + var values; + var data; + var A; + var i; + + data = ROW_MAJOR_DATA; + + values = [ + 0, + 1 + ]; + + A = new Float64Array( data.A ); + + 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() { + iladlc( data.order, data.M, data.N, A, value ); + }; + } +}); + +tape( 'the function returns an invalid index (-1) when M is zero', function test( t ) { + var data; + var out; + var A; + + data = ROW_MAJOR_DATA; + + A = new Float64Array( data.A ); + out = iladlc( data.order, 0, data.N, A, data.LDA ); + + t.deepEqual( out, -1, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns an invalid index (-1) when N is zero', function test( t ) { + var data; + var out; + var A; + + data = ROW_MAJOR_DATA; + + A = new Float64Array( data.A ); + out = iladlc( data.order, data.M, 0, A, data.LDA ); + + t.deepEqual( out, -1, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns the expected zero based index of the last non zero column of a matrix (row-major)', function test( t ) { + var data; + var out; + var A; + + data = ROW_MAJOR_DATA; + + A = new Float64Array( data.A ); + out = iladlc( data.order, data.M, data.N, A, data.LDA ); + + t.deepEqual( out, data.expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns the expected zero based index of the last non zero column of a matrix (column-major)', function test( t ) { + var data; + var out; + var A; + + data = COLUMN_MAJOR_DATA; + + A = new Float64Array( data.A ); + out = iladlc( data.order, data.M, data.N, A, data.LDA ); + + t.deepEqual( out, data.expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns an invalid index (-1) when all elements in a matrix are zero (row-major)', function test( t ) { + var data; + var out; + var A; + + data = ROW_MAJOR_ZEROS; + + A = new Float64Array( data.A ); + out = iladlc( data.order, data.M, data.N, A, data.LDA ); + + t.deepEqual( out, data.expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns an invalid index (-1) when all elements in a matrix are zero (column-major)', function test( t ) { + var data; + var out; + var A; + + data = COLUMN_MAJOR_ZEROS; + + A = new Float64Array( data.A ); + out = iladlc( data.order, data.M, data.N, A, data.LDA ); + + t.deepEqual( out, data.expected, 'returns expected value' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/test/test.js b/lib/node_modules/@stdlib/lapack/base/iladlc/test/test.js new file mode 100644 index 000000000000..1d911d3b6b33 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/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 iladlc = 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 iladlc, '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 iladlc.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 iladlc = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( iladlc, 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 iladlc; + var main; + + main = require( './../lib/iladlc.js' ); + + iladlc = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( iladlc, main, 'returns expected value' ); + t.end(); + + function tryRequire() { + return new Error( 'Cannot find module' ); + } +}); diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/test/test.ndarray.js b/lib/node_modules/@stdlib/lapack/base/iladlc/test/test.ndarray.js new file mode 100644 index 000000000000..feb9466a828c --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/test/test.ndarray.js @@ -0,0 +1,349 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-len, id-length */ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Float64Array = require( '@stdlib/array/float64' ); +var iladlr = require( './../lib/ndarray.js' ); + + +// FIXTURES // + +var ROW_MAJOR_DATA = require( './fixtures/row_major.json' ); +var ROW_MAJOR_ZEROS = require( './fixtures/row_major_zeros.json' ); +var COLUMN_MAJOR_DATA = require( './fixtures/column_major.json' ); +var COLUMN_MAJOR_ZEROS = require( './fixtures/column_major_zeros.json' ); + +var OFFSET_ROW_MAJOR_DATA = require( './fixtures/offsets/row_major.json' ); +var OFFSET_ROW_MAJOR_ZEROS = require( './fixtures/offsets/row_major_zeros.json' ); +var OFFSET_COLUMN_MAJOR_DATA = require( './fixtures/offsets/column_major.json' ); +var OFFSET_COLUMN_MAJOR_ZEROS = require( './fixtures/offsets/column_major_zeros.json' ); + +var NEGATIVE_STRIDES_ROW_MAJOR_DATA = require( './fixtures/negative_strides/row_major.json' ); +var NEGATIVE_STRIDES_ROW_MAJOR_ZEROS = require( './fixtures/negative_strides/row_major_zeros.json' ); +var NEGATIVE_STRIDES_COLUMN_MAJOR_DATA = require( './fixtures/negative_strides/column_major.json' ); +var NEGATIVE_STRIDES_COLUMN_MAJOR_ZEROS = require( './fixtures/negative_strides/column_major_zeros.json' ); + +var MIXED_STRIDES_ROW_MAJOR_DATA = require( './fixtures/mixed_strides/row_major.json' ); +var MIXED_STRIDES_ROW_MAJOR_ZEROS = require( './fixtures/mixed_strides/row_major_zeros.json' ); +var MIXED_STRIDES_COLUMN_MAJOR_DATA = require( './fixtures/mixed_strides/column_major.json' ); +var MIXED_STRIDES_COLUMN_MAJOR_ZEROS = require( './fixtures/mixed_strides/column_major_zeros.json' ); + +var LARGE_STRIDES_ROW_MAJOR_DATA = require( './fixtures/large_strides/row_major.json' ); +var LARGE_STRIDES_ROW_MAJOR_ZEROS = require( './fixtures/large_strides/row_major_zeros.json' ); +var LARGE_STRIDES_COLUMN_MAJOR_DATA = require( './fixtures/large_strides/column_major.json' ); +var LARGE_STRIDES_COLUMN_MAJOR_ZEROS = require( './fixtures/large_strides/column_major_zeros.json' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof iladlr, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 6', function test( t ) { + t.strictEqual( iladlr.length, 6, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns the expected zero based index of the last non zero column of a matrix (row-major)', function test( t ) { + var data; + var out; + var A; + + data = ROW_MAJOR_DATA; + + A = new Float64Array( data.A ); + out = iladlr( data.M, data.N, A, data.strideA1, data.strideA2, data.offsetA ); + + t.deepEqual( out, data.expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns the expected zero based index of the last non zero column of a matrix (column-major)', function test( t ) { + var data; + var out; + var A; + + data = COLUMN_MAJOR_DATA; + + A = new Float64Array( data.A ); + out = iladlr( data.M, data.N, A, data.strideA1, data.strideA2, data.offsetA ); + + t.deepEqual( out, data.expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns an invalid index (-1) when all elements in a matrix are zero (row-major)', function test( t ) { + var data; + var out; + var A; + + data = ROW_MAJOR_ZEROS; + + A = new Float64Array( data.A ); + out = iladlr( data.M, data.N, A, data.strideA1, data.strideA2, data.offsetA ); + + t.deepEqual( out, data.expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns an invalid index (-1) when all elements in a matrix are zero (column-major)', function test( t ) { + var data; + var out; + var A; + + data = COLUMN_MAJOR_ZEROS; + + A = new Float64Array( data.A ); + out = iladlr( data.M, data.N, A, data.strideA1, data.strideA2, data.offsetA ); + + t.deepEqual( out, data.expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns the expected zero based index of the last non zero column of a matrix (row-major) (offsets)', function test( t ) { + var data; + var out; + var A; + + data = OFFSET_ROW_MAJOR_DATA; + + A = new Float64Array( data.A ); + out = iladlr( data.M, data.N, A, data.strideA1, data.strideA2, data.offsetA ); + + t.deepEqual( out, data.expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns the expected zero based index of the last non zero column of a matrix (column-major) (offsets)', function test( t ) { + var data; + var out; + var A; + + data = OFFSET_COLUMN_MAJOR_DATA; + + A = new Float64Array( data.A ); + out = iladlr( data.M, data.N, A, data.strideA1, data.strideA2, data.offsetA ); + + t.deepEqual( out, data.expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns an invalid index (-1) when all elements in a matrix are zero (row-major) (offsets)', function test( t ) { + var data; + var out; + var A; + + data = OFFSET_ROW_MAJOR_ZEROS; + + A = new Float64Array( data.A ); + out = iladlr( data.M, data.N, A, data.strideA1, data.strideA2, data.offsetA ); + + t.deepEqual( out, data.expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns an invalid index (-1) when all elements in a matrix are zero (column-major) (offsets)', function test( t ) { + var data; + var out; + var A; + + data = OFFSET_COLUMN_MAJOR_ZEROS; + + A = new Float64Array( data.A ); + out = iladlr( data.M, data.N, A, data.strideA1, data.strideA2, data.offsetA ); + + t.deepEqual( out, data.expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns the expected zero based index of the last non zero column of a matrix (row-major) (mixed strides)', function test( t ) { + var data; + var out; + var A; + + data = MIXED_STRIDES_ROW_MAJOR_DATA; + + A = new Float64Array( data.A ); + out = iladlr( data.M, data.N, A, data.strideA1, data.strideA2, data.offsetA ); + + t.deepEqual( out, data.expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns the expected zero based index of the last non zero column of a matrix (column-major) (mixed strides)', function test( t ) { + var data; + var out; + var A; + + data = MIXED_STRIDES_COLUMN_MAJOR_DATA; + + A = new Float64Array( data.A ); + out = iladlr( data.M, data.N, A, data.strideA1, data.strideA2, data.offsetA ); + + t.deepEqual( out, data.expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns an invalid index (-1) when all elements in a matrix are zero (row-major) (mixed strides)', function test( t ) { + var data; + var out; + var A; + + data = MIXED_STRIDES_ROW_MAJOR_ZEROS; + + A = new Float64Array( data.A ); + out = iladlr( data.M, data.N, A, data.strideA1, data.strideA2, data.offsetA ); + + t.deepEqual( out, data.expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns an invalid index (-1) when all elements in a matrix are zero (column-major) (mixed strides)', function test( t ) { + var data; + var out; + var A; + + data = MIXED_STRIDES_COLUMN_MAJOR_ZEROS; + + A = new Float64Array( data.A ); + out = iladlr( data.M, data.N, A, data.strideA1, data.strideA2, data.offsetA ); + + t.deepEqual( out, data.expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns the expected zero based index of the last non zero column of a matrix (row-major) (negative strides)', function test( t ) { + var data; + var out; + var A; + + data = NEGATIVE_STRIDES_ROW_MAJOR_DATA; + + A = new Float64Array( data.A ); + out = iladlr( data.M, data.N, A, data.strideA1, data.strideA2, data.offsetA ); + + t.deepEqual( out, data.expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns the expected zero based index of the last non zero column of a matrix (column-major) (negative strides)', function test( t ) { + var data; + var out; + var A; + + data = NEGATIVE_STRIDES_COLUMN_MAJOR_DATA; + + A = new Float64Array( data.A ); + out = iladlr( data.M, data.N, A, data.strideA1, data.strideA2, data.offsetA ); + + t.deepEqual( out, data.expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns an invalid index (-1) when all elements in a matrix are zero (row-major) (negative strides)', function test( t ) { + var data; + var out; + var A; + + data = NEGATIVE_STRIDES_ROW_MAJOR_ZEROS; + + A = new Float64Array( data.A ); + out = iladlr( data.M, data.N, A, data.strideA1, data.strideA2, data.offsetA ); + + t.deepEqual( out, data.expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns an invalid index (-1) when all elements in a matrix are zero (column-major) (negative strides)', function test( t ) { + var data; + var out; + var A; + + data = NEGATIVE_STRIDES_COLUMN_MAJOR_ZEROS; + + A = new Float64Array( data.A ); + out = iladlr( data.M, data.N, A, data.strideA1, data.strideA2, data.offsetA ); + + t.deepEqual( out, data.expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns the expected zero based index of the last non zero column of a matrix (row-major) (large strides)', function test( t ) { + var data; + var out; + var A; + + data = LARGE_STRIDES_ROW_MAJOR_DATA; + + A = new Float64Array( data.A ); + out = iladlr( data.M, data.N, A, data.strideA1, data.strideA2, data.offsetA ); + + t.deepEqual( out, data.expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns the expected zero based index of the last non zero column of a matrix (column-major) (large strides)', function test( t ) { + var data; + var out; + var A; + + data = LARGE_STRIDES_COLUMN_MAJOR_DATA; + + A = new Float64Array( data.A ); + out = iladlr( data.M, data.N, A, data.strideA1, data.strideA2, data.offsetA ); + + t.deepEqual( out, data.expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns an invalid index (-1) when all elements in a matrix are zero (row-major) (large strides)', function test( t ) { + var data; + var out; + var A; + + data = LARGE_STRIDES_ROW_MAJOR_ZEROS; + + A = new Float64Array( data.A ); + out = iladlr( data.M, data.N, A, data.strideA1, data.strideA2, data.offsetA ); + + t.deepEqual( out, data.expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns an invalid index (-1) when all elements in a matrix are zero (column-major) (large strides)', function test( t ) { + var data; + var out; + var A; + + data = LARGE_STRIDES_COLUMN_MAJOR_ZEROS; + + A = new Float64Array( data.A ); + out = iladlr( data.M, data.N, A, data.strideA1, data.strideA2, data.offsetA ); + + t.deepEqual( out, data.expected, 'returns expected value' ); + t.end(); +}); From 08aa12af62bec39eb82bb364516171cb7f1b8f5a Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Sun, 25 May 2025 07:00:25 +0000 Subject: [PATCH 05/12] 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/iladlc/benchmark/benchmark.js | 114 ++++++++++++++++ .../iladlc/benchmark/benchmark.ndarray.js | 125 ++++++++++++++++++ .../lapack/base/iladlc/examples/index.js | 34 +++++ .../@stdlib/lapack/base/iladlc/package.json | 72 ++++++++++ 4 files changed, 345 insertions(+) create mode 100644 lib/node_modules/@stdlib/lapack/base/iladlc/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/lapack/base/iladlc/benchmark/benchmark.ndarray.js create mode 100644 lib/node_modules/@stdlib/lapack/base/iladlc/examples/index.js create mode 100644 lib/node_modules/@stdlib/lapack/base/iladlc/package.json diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/benchmark/benchmark.js b/lib/node_modules/@stdlib/lapack/base/iladlc/benchmark/benchmark.js new file mode 100644 index 000000000000..e6efa324da44 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/benchmark/benchmark.js @@ -0,0 +1,114 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var iladlc = require( './../lib/iladlc.js' ); + + +// VARIABLES // + +var LAYOUTS = [ + 'row-major', + 'column-major' +]; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {string} order - storage layout +* @param {PositiveInteger} N - number of elements along each dimension +* @returns {Function} benchmark function +*/ +function createBenchmark( order, N ) { + var A; + + A = discreteUniform( N*N, 0.0, 1.0, { + 'dtype': 'float64' + }); + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var z; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + z = iladlc( order, N, N, A, N ); + if ( isnan( z ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var min; + var max; + var ord; + var N; + var f; + var i; + var k; + + min = 1; // 10^min + max = 6; // 10^max + + for ( k = 0; k < LAYOUTS.length; k++ ) { + ord = LAYOUTS[ k ]; + for ( i = min; i <= max; i++ ) { + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( ord, N ); + bench( pkg+'::square_matrix:order='+ord+',size='+(N*N), f ); + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/lapack/base/iladlc/benchmark/benchmark.ndarray.js new file mode 100644 index 000000000000..a75a32fef80b --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/benchmark/benchmark.ndarray.js @@ -0,0 +1,125 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var isColumnMajor = require( '@stdlib/ndarray/base/assert/is-column-major-string' ); +var pkg = require( './../package.json' ).name; +var iladlc = require( './../lib/iladlc.js' ); + + +// VARIABLES // + +var LAYOUTS = [ + 'row-major', + 'column-major' +]; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {string} order - storage layout +* @param {PositiveInteger} N - number of elements along each dimension +* @returns {Function} benchmark function +*/ +function createBenchmark( order, N ) { + var A; + + A = discreteUniform( N*N, 0.0, 1.0, { + 'dtype': 'float64' + }); + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var sa1; + var sa2; + var z; + var i; + + if ( isColumnMajor( order ) ) { + sa1 = 1; + sa2 = N; + } else { // order === 'row-major' + sa1 = N; + sa2 = 1; + } + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + z = iladlc( order, N, N, A, sa1, sa2, 0 ); + if ( isnan( z ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var min; + var max; + var ord; + var N; + var f; + var i; + var k; + + min = 1; // 10^min + max = 6; // 10^max + + for ( k = 0; k < LAYOUTS.length; k++ ) { + ord = LAYOUTS[ k ]; + for ( i = min; i <= max; i++ ) { + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( ord, N ); + bench( pkg+'::square_matrix:order='+ord+',size='+(N*N), f ); + } + } +} + +main(); diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/examples/index.js b/lib/node_modules/@stdlib/lapack/base/iladlc/examples/index.js new file mode 100644 index 000000000000..38ed4505cdf5 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/examples/index.js @@ -0,0 +1,34 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var ndarray2array = require( '@stdlib/ndarray/base/to-array' ); +var Float64Array = require( '@stdlib/array/float64' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var iladlc = require( './../lib' ); + +var shape = [ 3, 3 ]; +var order = 'row-major'; +var strides = shape2strides( shape, order ); + +var A = new Float64Array( [ 1.0, 2.0, 0.0, 3.0, 4.0, 0.0, 5.0, 6.0, 0.0 ] ); +console.log( ndarray2array( A, shape, strides, 0, order ) ); + +var out = iladlc( order, shape[ 0 ], shape[ 1 ], A, strides[ 0 ] ); +console.log( out ); diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/package.json b/lib/node_modules/@stdlib/lapack/base/iladlc/package.json new file mode 100644 index 000000000000..45e43ebd8742 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/package.json @@ -0,0 +1,72 @@ +{ + "name": "@stdlib/lapack/base/iladlc", + "version": "0.0.0", + "description": "LAPACK routine to find the index of the last non zero column in a input matrix.", + "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", + "iladlc", + "last", + "column", + "index", + "matrix", + "auxilary", + "linear", + "algebra", + "subroutines", + "array", + "ndarray", + "float64", + "double", + "float64array" + ] +} From 3422a645f3c29ede38f65a496e752b730af13153 Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Sun, 25 May 2025 20:48:42 +0000 Subject: [PATCH 06/12] 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: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/lapack/base/iladlc/README.md | 258 ++++++++++++++++++ 1 file changed, 258 insertions(+) create mode 100644 lib/node_modules/@stdlib/lapack/base/iladlc/README.md diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/README.md b/lib/node_modules/@stdlib/lapack/base/iladlc/README.md new file mode 100644 index 000000000000..31259d7559ba --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/README.md @@ -0,0 +1,258 @@ + + +# iladlc + +> Find the index of the last non zero column in a matrix `A` + +
+ +## Usage + +```javascript +var iladlc = require( '@stdlib/lapack/base/iladlc' ); +``` + +#### iladlc( order, M, N, A, LDA ) + +Finds the index of the last non zero column in a matrix `A`. + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); + +var A = new Float64Array( [ 1.0, 2.0, 0.0, 3.0, 4.0, 0.0 ] ); + +/* + A = [ + [ 1.0, 2.0, 0.0 ], + [ 3.0, 4.0, 0.0 ] + ] +*/ + +var out = iladlc( 'row-major', 2, 3, A, 3 ); +// returns 1 +``` + +The function has the following parameters: + +- **order**: storage layout. +- **M**: number of rows in `A`. +- **N**: number of columns in `A`. +- **A**: input [`Float64Array`][mdn-float64array]. +- **LDA**: stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`). + +Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views. + + + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); + +// Initial arrays... +var A0 = new Float64Array( [ 9999.0, 1.0, 2.0, 0.0, 3.0, 4.0, 0.0 ] ); + +// Create offset views... +var A1 = new Float64Array( A0.buffer, A0.BYTES_PER_ELEMENT*1 ); // start at 2nd element + +var out = iladlc( 'row-major', 2, 3, A1, 3 ); +// returns 1 +``` + +#### iladlc.ndarray( uplo, M, N, A, sa1, sa2, oa, B, sb1, sb2, ob ) + +Finds the index of the last non zero column in a matrix `A` using alternative indexing semantics. + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); + +var A = new Float64Array( [ 1.0, 2.0, 0.0, 3.0, 4.0, 0.0 ] ); + +/* + A = [ + [ 1.0, 2.0, 0.0 ], + [ 3.0, 4.0, 0.0 ] + ] +*/ + +var out = iladlc.ndarray( 2, 3, A, 3, 1, 0 ); +// returns 1 +``` + +The function has the following parameters: + +- **M**: number of rows in `A`. +- **N**: number of columns in `A`. +- **A**: input [`Float64Array`][mdn-float64array]. +- **sa1**: stride of the first dimension of `A`. +- **sa2**: stride of the second dimension of `A`. +- **oa**: starting index for `A`. + +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 A = new Float64Array( [ 9999.0, 1.0, 2.0, 0.0, 3.0, 4.0, 0.0 ] ); + +/* + A = [ + [ 1.0, 2.0, 0.0 ], + [ 3.0, 4.0, 0.0 ] + ] +*/ + +var out = iladlc.ndarray( 2, 3, A, 3, 1, 1 ); +// returns 1 +``` + +
+ + + +
+ +## Notes + +- `iladlc()` corresponds to the [LAPACK][lapack] routine [`iladlc`][lapack-iladlc]. + +
+ + + +
+ +## Examples + + + +```javascript +var ndarray2array = require( '@stdlib/ndarray/base/to-array' ); +var Float64Array = require( '@stdlib/array/float64' ); +var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); +var iladlc = require( '@stdlib/lapack/base/iladlc' ); + +var shape = [ 3, 3 ]; +var order = 'row-major'; +var strides = shape2strides( shape, order ); + +var A = new Float64Array( [ 1.0, 2.0, 0.0, 3.0, 4.0, 0.0, 5.0, 6.0, 0.0 ] ); +console.log( ndarray2array( A, shape, strides, 0, order ) ); + +var out = iladlc( order, shape[ 0 ], shape[ 1 ], A, strides[ 0 ] ); +console.log( out ); +``` + +
+ + + + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +TODO +``` + +#### TODO + +TODO. + +```c +TODO +``` + +TODO + +```c +TODO +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +TODO +``` + +
+ + + +
+ + + + + + + + + + + + + + From 8afe288c07b22c25f192f76910fcd4ece32dabc9 Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Sun, 25 May 2025 21:00:11 +0000 Subject: [PATCH 07/12] docs: add docs folder --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: passed - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../lapack/base/iladlc/docs/docs/index.d.ts | 101 +++++++++ .../lapack/base/iladlc/docs/docs/test.ts | 213 ++++++++++++++++++ .../@stdlib/lapack/base/iladlc/docs/repl.txt | 75 ++++++ 3 files changed, 389 insertions(+) create mode 100644 lib/node_modules/@stdlib/lapack/base/iladlc/docs/docs/index.d.ts create mode 100644 lib/node_modules/@stdlib/lapack/base/iladlc/docs/docs/test.ts create mode 100644 lib/node_modules/@stdlib/lapack/base/iladlc/docs/repl.txt diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/docs/docs/index.d.ts b/lib/node_modules/@stdlib/lapack/base/iladlc/docs/docs/index.d.ts new file mode 100644 index 000000000000..c97894545b4b --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/docs/docs/index.d.ts @@ -0,0 +1,101 @@ +/* +* @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'; + +/** +* Interface describing `iladlc`. +*/ +interface Routine { + /** + * Finds the index of the last non zero column in a matrix `A`. + * + * @param order - storage layout + * @param M - number of rows in `A` + * @param N - number of columns in `A` + * @param A - input matrix + * @param LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) + * @returns index of the last non zero column + * + * @example + * var Float64array = require( '@stdlib/array/float64' ); + * + * var A = new Float64array( [ 1.0, 2.0, 0.0, 3.0, 4.0, 0.0 ] ); // => [ [ 1.0, 2.0, 0,0 ], [ 3.0, 4.0, 0.0 ] ] + * + * var out = iladlc( 'row-major', 2, 3, A, 3 ); + * // returns 1 + */ + ( order: Layout, M: number, N: number, A: Float64Array, LDA: number ): number; + + /** + * Finds the index of the last non zero column in a matrix `A` using alternative indexing semantics. + * + * @param M - number of rows in `A` + * @param N - number of columns in `A` + * @param A - input matrix + * @param strideA1 - stride of the first dimension of `A` + * @param strideA2 - stride of the second dimension of `A` + * @returns index of the last non zero column + * + * @example + * var Float64array = require( '@stdlib/array/float64' ); + * + * var A = new Float64array( [ 1.0, 2.0, 0.0, 3.0, 4.0, 0.0 ] ); // => [ [ 1.0, 2.0, 0,0 ], [ 3.0, 4.0, 0.0 ] ] + * + * var out = iladlc.ndarray( 2, 3, A, 3, 1, 0 ); + * // returns 1 + */ + ndarray( M: number, N: number, A: Float64Array, strideA1: number, strideA2: number, offsetA: number ): number; +} + +/** +* Finds the index of the last non zero column in a matrix `A`. +* +* @param order - storage layout +* @param M - number of rows in `A` +* @param N - number of columns in `A` +* @param A - input matrix +* @param LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) +* @returns index of the last non zero column +* +* @example +* var Float64array = require( '@stdlib/array/float64' ); +* +* var A = new Float64array( [ 1.0, 2.0, 0.0, 3.0, 4.0, 0.0 ] ); // => [ [ 1.0, 2.0, 0,0 ], [ 3.0, 4.0, 0.0 ] ] +* +* var out = iladlc( 'row-major', 2, 3, A, 3 ); +* // returns 1 +* +* @example +* var Float64array = require( '@stdlib/array/float64' ); +* +* var A = new Float64array( [ 1.0, 2.0, 0.0, 3.0, 4.0, 0.0 ] ); // => [ [ 1.0, 2.0, 0,0 ], [ 3.0, 4.0, 0.0 ] ] +* +* var out = iladlc.ndarray( 2, 3, A, 3, 1, 0 ); +* // returns 1 +*/ +declare var iladlc: Routine; + + +// EXPORTS // + +export = iladlc; diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/docs/docs/test.ts b/lib/node_modules/@stdlib/lapack/base/iladlc/docs/docs/test.ts new file mode 100644 index 000000000000..fa76131e63ae --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/docs/docs/test.ts @@ -0,0 +1,213 @@ +/* +* @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 iladlc = require( './index' ); + + +// TESTS // + +// The function returns a number... +{ + const A = new Float64Array( 4 ); + + iladlc( 'row-major', 2, 2, A, 2 ); // $ExpectType number +} + +// The compiler throws an error if the function is provided a first argument which is not a string... +{ + const A = new Float64Array( 4 ); + + iladlc( 5, 2, 2, A, 2 ); // $ExpectError + iladlc( true, 2, 2, A, 2 ); // $ExpectError + iladlc( false, 2, 2, A, 2 ); // $ExpectError + iladlc( null, 2, 2, A, 2 ); // $ExpectError + iladlc( void 0, 2, 2, A, 2 ); // $ExpectError + iladlc( [], 2, 2, A, 2 ); // $ExpectError + iladlc( {}, 2, 2, A, 2 ); // $ExpectError + iladlc( ( x: number ): number => x, 2, 2, A, 2 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a second argument which is not a number... +{ + const A = new Float64Array( 4 ); + + iladlc( 'row-major', '5', 2, A, 2 ); // $ExpectError + iladlc( 'row-major', true, 2, A, 2 ); // $ExpectError + iladlc( 'row-major', false, 2, A, 2 ); // $ExpectError + iladlc( 'row-major', null, 2, A, 2 ); // $ExpectError + iladlc( 'row-major', void 0, 2, A, 2 ); // $ExpectError + iladlc( 'row-major', [], 2, A, 2 ); // $ExpectError + iladlc( 'row-major', {}, 2, A, 2 ); // $ExpectError + iladlc( 'row-major', ( x: number ): number => x, 2, A, 2 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a third argument which is not a number... +{ + const A = new Float64Array( 4 ); + + iladlc( 'row-major', 2, '5', A, 2 ); // $ExpectError + iladlc( 'row-major', 2, true, A, 2 ); // $ExpectError + iladlc( 'row-major', 2, false, A, 2 ); // $ExpectError + iladlc( 'row-major', 2, null, A, 2 ); // $ExpectError + iladlc( 'row-major', 2, void 0, A, 2 ); // $ExpectError + iladlc( 'row-major', 2, [], A, 2 ); // $ExpectError + iladlc( 'row-major', 2, {}, A, 2 ); // $ExpectError + iladlc( 'row-major', 2, ( x: number ): number => x, A, 2 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fourth argument which is not a Float64Array... +{ + iladlc( 'row-major', 2, 2, '5', 2 ); // $ExpectError + iladlc( 'row-major', 2, 2, 5, 2 ); // $ExpectError + iladlc( 'row-major', 2, 2, true, 2 ); // $ExpectError + iladlc( 'row-major', 2, 2, false, 2 ); // $ExpectError + iladlc( 'row-major', 2, 2, null, 2 ); // $ExpectError + iladlc( 'row-major', 2, 2, void 0, 2 ); // $ExpectError + iladlc( 'row-major', 2, 2, [], 2 ); // $ExpectError + iladlc( 'row-major', 2, 2, {}, 2 ); // $ExpectError + iladlc( 'row-major', 2, 2, ( x: number ): number => x, 2 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fifth argument which is not a number... +{ + const A = new Float64Array( 4 ); + + iladlc( 'row-major', 2, 2, A, '5' ); // $ExpectError + iladlc( 'row-major', 2, 2, A, true ); // $ExpectError + iladlc( 'row-major', 2, 2, A, false ); // $ExpectError + iladlc( 'row-major', 2, 2, A, null ); // $ExpectError + iladlc( 'row-major', 2, 2, A, void 0 ); // $ExpectError + iladlc( 'row-major', 2, 2, A, [] ); // $ExpectError + iladlc( 'row-major', 2, 2, A, {} ); // $ExpectError + iladlc( 'row-major', 2, 2, A, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + const A = new Float64Array( 4 ); + + iladlc(); // $ExpectError + iladlc( 'row-major' ); // $ExpectError + iladlc( 'row-major', 2 ); // $ExpectError + iladlc( 'row-major', 2, 2 ); // $ExpectError + iladlc( 'row-major', 2, 2, A ); // $ExpectError + iladlc( 'row-major', 2, 2, A, 2, 10 ); // $ExpectError +} + +// Attached to main export is an `ndarray` method which returns a number... +{ + const A = new Float64Array( 4 ); + + iladlc.ndarray( 2, 2, A, 2, 1, 0 ); // $ExpectType number +} + +// The compiler throws an error if the function is provided a first argument which is not a number... +{ + const A = new Float64Array( 4 ); + + iladlc.ndarray( '5', 2, A, 2, 1, 0 ); // $ExpectError + iladlc.ndarray( true, 2, A, 2, 1, 0 ); // $ExpectError + iladlc.ndarray( false, 2, A, 2, 1, 0 ); // $ExpectError + iladlc.ndarray( null, 2, A, 2, 1, 0 ); // $ExpectError + iladlc.ndarray( void 0, 2, A, 2, 1, 0 ); // $ExpectError + iladlc.ndarray( [], 2, A, 2, 1, 0 ); // $ExpectError + iladlc.ndarray( {}, 2, A, 2, 1, 0 ); // $ExpectError + iladlc.ndarray( ( x: number ): number => x, 2, A, 2, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a second argument which is not a number... +{ + const A = new Float64Array( 4 ); + + iladlc.ndarray( 2, '5', A, 2, 1, 0 ); // $ExpectError + iladlc.ndarray( 2, true, A, 2, 1, 0 ); // $ExpectError + iladlc.ndarray( 2, false, A, 2, 1, 0 ); // $ExpectError + iladlc.ndarray( 2, null, A, 2, 1, 0 ); // $ExpectError + iladlc.ndarray( 2, void 0, A, 2, 1, 0 ); // $ExpectError + iladlc.ndarray( 2, [], A, 2, 1, 0 ); // $ExpectError + iladlc.ndarray( 2, {}, A, 2, 1, 0 ); // $ExpectError + iladlc.ndarray( 2, ( x: number ): number => x, A, 2, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a third argument which is not a Float64Array... +{ + iladlc.ndarray( 2, 2, '5', 2, 1, 0 ); // $ExpectError + iladlc.ndarray( 2, 2, 5, 2, 1, 0 ); // $ExpectError + iladlc.ndarray( 2, 2, true, 2, 1, 0 ); // $ExpectError + iladlc.ndarray( 2, 2, false, 2, 1, 0 ); // $ExpectError + iladlc.ndarray( 2, 2, null, 2, 1, 0 ); // $ExpectError + iladlc.ndarray( 2, 2, void 0, 2, 1, 0 ); // $ExpectError + iladlc.ndarray( 2, 2, [], 2, 1, 0 ); // $ExpectError + iladlc.ndarray( 2, 2, {}, 2, 1, 0 ); // $ExpectError + iladlc.ndarray( 2, 2, ( x: number ): number => x, 2, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fourth argument which is not a number... +{ + const A = new Float64Array( 4 ); + + iladlc.ndarray( 2, 2, A, '5', 1, 0 ); // $ExpectError + iladlc.ndarray( 2, 2, A, true, 1, 0 ); // $ExpectError + iladlc.ndarray( 2, 2, A, false, 1, 0 ); // $ExpectError + iladlc.ndarray( 2, 2, A, null, 1, 0 ); // $ExpectError + iladlc.ndarray( 2, 2, A, void 0, 1, 0 ); // $ExpectError + iladlc.ndarray( 2, 2, A, [], 1, 0 ); // $ExpectError + iladlc.ndarray( 2, 2, A, {}, 1, 0 ); // $ExpectError + iladlc.ndarray( 2, 2, A, ( x: number ): number => x, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fifth argument which is not a number... +{ + const A = new Float64Array( 4 ); + + iladlc.ndarray( 2, 2, A, 2, '5', 0 ); // $ExpectError + iladlc.ndarray( 2, 2, A, 2, true, 0 ); // $ExpectError + iladlc.ndarray( 2, 2, A, 2, false, 0 ); // $ExpectError + iladlc.ndarray( 2, 2, A, 2, null, 0 ); // $ExpectError + iladlc.ndarray( 2, 2, A, 2, void 0, 0 ); // $ExpectError + iladlc.ndarray( 2, 2, A, 2, [], 0 ); // $ExpectError + iladlc.ndarray( 2, 2, A, 2, {}, 0 ); // $ExpectError + iladlc.ndarray( 2, 2, A, 2, ( x: number ): number => x, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a sixth argument which is not a number... +{ + const A = new Float64Array( 4 ); + + iladlc.ndarray( 2, 2, A, 2, 1, '5' ); // $ExpectError + iladlc.ndarray( 2, 2, A, 2, 1, true ); // $ExpectError + iladlc.ndarray( 2, 2, A, 2, 1, false ); // $ExpectError + iladlc.ndarray( 2, 2, A, 2, 1, null ); // $ExpectError + iladlc.ndarray( 2, 2, A, 2, 1, void 0 ); // $ExpectError + iladlc.ndarray( 2, 2, A, 2, 1, [] ); // $ExpectError + iladlc.ndarray( 2, 2, A, 2, 1, {} ); // $ExpectError + iladlc.ndarray( 2, 2, A, 2, 1, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided an unsupported number of arguments (6-argument version)... +{ + const A = new Float64Array( 4 ); + + iladlc.ndarray(); // $ExpectError + iladlc.ndarray( 2 ); // $ExpectError + iladlc.ndarray( 2, 2 ); // $ExpectError + iladlc.ndarray( 2, 2, A ); // $ExpectError + iladlc.ndarray( 2, 2, A, 2 ); // $ExpectError + iladlc.ndarray( 2, 2, A, 2, 1 ); // $ExpectError + iladlc.ndarray( 2, 2, A, 2, 1, 0, 10 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/docs/repl.txt b/lib/node_modules/@stdlib/lapack/base/iladlc/docs/repl.txt new file mode 100644 index 000000000000..2393167630d1 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/docs/repl.txt @@ -0,0 +1,75 @@ + +{{alias}}( order, M, N, A, LDA ) + Finds the index of the last non zero column in a matrix `A`. + + 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'. + + M: integer + Number of rows in `A`. + + N: integer + Number of columns in `A`. + + A: Float64Array + Input matrix `A`. + + Returns + ------- + iladlr: integer + Zero based index of the last non-zero row. + + Examples + -------- + > var A = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0, 4.0 ] ); + > {{alias}}( 'row-major', 2, 2, A, 2 ) + 1 + + +{{alias}}.ndarray( M, N, A, sa1, sa2, oa ) + Finds the index of the last non zero column in a matrix `A` using + alternative indexing semantics. + + While typed array views mandate a view offset based on the underlying + buffer, the offset parameters support indexing semantics based on starting + indices. + + Parameters + ---------- + M: integer + Number of rows in `A`. + + N: integer + Number of columns in `A`. + + A: Float64Array + Input matrix `A`. + + sa1: integer + Stride of the first dimension of `A`. + + sa2: integer + Stride of the second dimension of `A`. + + oa: integer + Starting index for `A`. + + Returns + ------- + iladlr: integer + Zero based index of the last non-zero row. + + Examples + -------- + > var A = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0, 4.0 ] ); + > {{alias}}.ndarray( 2, 2, A, 2, 1, 0 ) + 1 + + See Also + -------- From 076d95a206bf2373321af3ee46af4dd320330422 Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Fri, 6 Jun 2025 09:29:12 +0000 Subject: [PATCH 08/12] 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: passed - task: lint_package_json status: passed - 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: passed - task: lint_javascript_benchmarks status: passed - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: passed - task: lint_license_headers status: passed --- --- .../@stdlib/lapack/base/iladlc/README.md | 6 +- .../lapack/base/iladlc/benchmark/benchmark.js | 9 +-- .../iladlc/benchmark/benchmark.ndarray.js | 13 ++--- .../@stdlib/lapack/base/iladlc/docs/repl.txt | 14 +++-- .../iladlc/docs/{docs => types}/index.d.ts | 24 ++++++-- .../base/iladlc/docs/{docs => types}/test.ts | 0 .../@stdlib/lapack/base/iladlc/lib/base.js | 55 +++---------------- .../@stdlib/lapack/base/iladlc/lib/iladlc.js | 19 +++++-- .../@stdlib/lapack/base/iladlc/lib/index.js | 6 +- .../@stdlib/lapack/base/iladlc/lib/ndarray.js | 8 ++- .../@stdlib/lapack/base/iladlc/package.json | 2 +- .../lapack/base/iladlc/test/test.iladlc.js | 4 +- .../lapack/base/iladlc/test/test.ndarray.js | 20 +++---- 13 files changed, 85 insertions(+), 95 deletions(-) rename lib/node_modules/@stdlib/lapack/base/iladlc/docs/{docs => types}/index.d.ts (78%) rename lib/node_modules/@stdlib/lapack/base/iladlc/docs/{docs => types}/test.ts (100%) diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/README.md b/lib/node_modules/@stdlib/lapack/base/iladlc/README.md index 31259d7559ba..726a082826be 100644 --- a/lib/node_modules/@stdlib/lapack/base/iladlc/README.md +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/README.md @@ -20,7 +20,7 @@ limitations under the License. # iladlc -> Find the index of the last non zero column in a matrix `A` +> Find the index of the last non-zero column in a matrix `A`
@@ -32,7 +32,7 @@ var iladlc = require( '@stdlib/lapack/base/iladlc' ); #### iladlc( order, M, N, A, LDA ) -Finds the index of the last non zero column in a matrix `A`. +Returns the index of the last non-zero column in a matrix `A`. ```javascript var Float64Array = require( '@stdlib/array/float64' ); @@ -77,7 +77,7 @@ var out = iladlc( 'row-major', 2, 3, A1, 3 ); #### iladlc.ndarray( uplo, M, N, A, sa1, sa2, oa, B, sb1, sb2, ob ) -Finds the index of the last non zero column in a matrix `A` using alternative indexing semantics. +Finds the index of the last non-zero column in a matrix `A` using alternative indexing semantics. ```javascript var Float64Array = require( '@stdlib/array/float64' ); diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/benchmark/benchmark.js b/lib/node_modules/@stdlib/lapack/base/iladlc/benchmark/benchmark.js index e6efa324da44..1d123579f1e9 100644 --- a/lib/node_modules/@stdlib/lapack/base/iladlc/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/benchmark/benchmark.js @@ -22,7 +22,7 @@ var bench = require( '@stdlib/bench' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); -var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var zeros = require( '@stdlib/array/zeros' ); var pow = require( '@stdlib/math/base/special/pow' ); var floor = require( '@stdlib/math/base/special/floor' ); var pkg = require( './../package.json' ).name; @@ -48,11 +48,7 @@ var LAYOUTS = [ * @returns {Function} benchmark function */ function createBenchmark( order, N ) { - var A; - - A = discreteUniform( N*N, 0.0, 1.0, { - 'dtype': 'float64' - }); + var A = zeros( N*N, 'float64' ); return benchmark; /** @@ -67,6 +63,7 @@ function createBenchmark( order, N ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { + A[ 0 ] = i; z = iladlc( order, N, N, A, N ); if ( isnan( z ) ) { b.fail( 'should not return NaN' ); diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/lapack/base/iladlc/benchmark/benchmark.ndarray.js index a75a32fef80b..584f12bd7e37 100644 --- a/lib/node_modules/@stdlib/lapack/base/iladlc/benchmark/benchmark.ndarray.js +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/benchmark/benchmark.ndarray.js @@ -24,10 +24,10 @@ var bench = require( '@stdlib/bench' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var pow = require( '@stdlib/math/base/special/pow' ); var floor = require( '@stdlib/math/base/special/floor' ); -var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var zeros = require( '@stdlib/array/zeros' ); var isColumnMajor = require( '@stdlib/ndarray/base/assert/is-column-major-string' ); var pkg = require( './../package.json' ).name; -var iladlc = require( './../lib/iladlc.js' ); +var iladlc = require( './../lib/ndarray.js' ); // VARIABLES // @@ -49,11 +49,7 @@ var LAYOUTS = [ * @returns {Function} benchmark function */ function createBenchmark( order, N ) { - var A; - - A = discreteUniform( N*N, 0.0, 1.0, { - 'dtype': 'float64' - }); + var A = zeros( N*N, 'float64' ); return benchmark; /** @@ -78,7 +74,8 @@ function createBenchmark( order, N ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - z = iladlc( order, N, N, A, sa1, sa2, 0 ); + A[ 0 ] = i; + z = iladlc( N, N, A, sa1, sa2, 0 ); if ( isnan( z ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/docs/repl.txt b/lib/node_modules/@stdlib/lapack/base/iladlc/docs/repl.txt index 2393167630d1..e161838f254a 100644 --- a/lib/node_modules/@stdlib/lapack/base/iladlc/docs/repl.txt +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/docs/repl.txt @@ -1,10 +1,13 @@ {{alias}}( order, M, N, A, LDA ) - Finds the index of the last non zero column in a matrix `A`. + Returns the index of the last non-zero column in a matrix `A`. Indexing is relative to the first index. To introduce an offset, use typed array views. + If provided an empty matrix or a matrix containing only zeros, the function + returns `-1` (i.e., an invalid index). + Parameters ---------- order: string @@ -23,7 +26,7 @@ Returns ------- iladlr: integer - Zero based index of the last non-zero row. + Zero based index of the last non-zero column. Examples -------- @@ -33,13 +36,16 @@ {{alias}}.ndarray( M, N, A, sa1, sa2, oa ) - Finds the index of the last non zero column in a matrix `A` using + Returns the index of the last non-zero column in a matrix `A` using alternative indexing semantics. While typed array views mandate a view offset based on the underlying buffer, the offset parameters support indexing semantics based on starting indices. + If provided an empty matrix or a matrix containing only zeros, the function + returns `-1` (i.e., an invalid index). + Parameters ---------- M: integer @@ -63,7 +69,7 @@ Returns ------- iladlr: integer - Zero based index of the last non-zero row. + Zero based index of the last non-zero column. Examples -------- diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/docs/docs/index.d.ts b/lib/node_modules/@stdlib/lapack/base/iladlc/docs/types/index.d.ts similarity index 78% rename from lib/node_modules/@stdlib/lapack/base/iladlc/docs/docs/index.d.ts rename to lib/node_modules/@stdlib/lapack/base/iladlc/docs/types/index.d.ts index c97894545b4b..a6df450e97cc 100644 --- a/lib/node_modules/@stdlib/lapack/base/iladlc/docs/docs/index.d.ts +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/docs/types/index.d.ts @@ -27,14 +27,18 @@ import { Layout } from '@stdlib/types/blas'; */ interface Routine { /** - * Finds the index of the last non zero column in a matrix `A`. + * Returns the index of the last non-zero column in a matrix `A`. + * + * ## Notes + * + * - If provided an empty matrix or a matrix containing only zeros, the function returns `-1` (i.e., an invalid index). * * @param order - storage layout * @param M - number of rows in `A` * @param N - number of columns in `A` * @param A - input matrix * @param LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) - * @returns index of the last non zero column + * @returns index of the last non-zero column * * @example * var Float64array = require( '@stdlib/array/float64' ); @@ -47,14 +51,18 @@ interface Routine { ( order: Layout, M: number, N: number, A: Float64Array, LDA: number ): number; /** - * Finds the index of the last non zero column in a matrix `A` using alternative indexing semantics. + * Finds the index of the last non-zero column in a matrix `A` using alternative indexing semantics. + * + * ## Notes + * + * - If provided an empty matrix or a matrix containing only zeros, the function returns `-1` (i.e., an invalid index). * * @param M - number of rows in `A` * @param N - number of columns in `A` * @param A - input matrix * @param strideA1 - stride of the first dimension of `A` * @param strideA2 - stride of the second dimension of `A` - * @returns index of the last non zero column + * @returns index of the last non-zero column * * @example * var Float64array = require( '@stdlib/array/float64' ); @@ -68,14 +76,18 @@ interface Routine { } /** -* Finds the index of the last non zero column in a matrix `A`. +* Returns the index of the last non-zero column in a matrix `A`. +* +* ## Notes +* +* - If provided an empty matrix or a matrix containing only zeros, the function returns `-1` (i.e., an invalid index). * * @param order - storage layout * @param M - number of rows in `A` * @param N - number of columns in `A` * @param A - input matrix * @param LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) -* @returns index of the last non zero column +* @returns index of the last non-zero column * * @example * var Float64array = require( '@stdlib/array/float64' ); diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/docs/docs/test.ts b/lib/node_modules/@stdlib/lapack/base/iladlc/docs/types/test.ts similarity index 100% rename from lib/node_modules/@stdlib/lapack/base/iladlc/docs/docs/test.ts rename to lib/node_modules/@stdlib/lapack/base/iladlc/docs/types/test.ts diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/lib/base.js b/lib/node_modules/@stdlib/lapack/base/iladlc/lib/base.js index 9ec413526ad9..0f76ecf297ad 100644 --- a/lib/node_modules/@stdlib/lapack/base/iladlc/lib/base.js +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/lib/base.js @@ -20,13 +20,17 @@ // MODULES // -var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major' ); +var iladlr = require( '@stdlib/lapack/base/iladlr' ).ndarray; // MAIN // /** -* Finds the index of the last non zero column in a matrix `A`. +* Returns the index of the last non-zero column in a matrix `A`. +* +* ## Notes +* +* - If provided an empty matrix or a matrix containing only zeros, the function returns `-1` (i.e., an invalid index). * * @private * @param {PositiveInteger} M - number of rows in `A` @@ -35,7 +39,7 @@ var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major' ); * @param {integer} strideA1 - stride of the first dimension of `A` * @param {integer} strideA2 - stride of the second dimension of `A` * @param {NonNegativeInteger} offsetA - index offset for `A` -* @returns {integer} index of the last non zero column +* @returns {integer} index of the last non-zero column * * @example * var Float64array = require( '@stdlib/array/float64' ); @@ -46,50 +50,7 @@ var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major' ); * // returns 1 */ function iladlc( M, N, A, strideA1, strideA2, offsetA ) { - var ia1; - var ia2; - var i; - var j; - - if ( M === 0 || N === 0 ) { - return -1; // Invalid index - } - - ia1 = offsetA + ( (N-1) * strideA2 ); // A( 1, N ) - ia2 = ia1 + ( (M-1) * strideA1 ); // A( M, N ) - - // Quick test for common case where corners are non-zero: - if ( A[ ia1 ] !== 0.0 || A[ ia2 ] !== 0.0 ) { - return N - 1; - } - - if ( isRowMajor( [ strideA1, strideA2 ] ) ) { - ia1 = offsetA; - for ( i = 0; i < M; i++ ) { - ia2 = ( N - 1 ) * strideA2; - for ( j = N-1; j >= 0; j-- ) { - if ( A[ ia1 + ia2 ] !== 0.0 ) { - return j; - } - ia2 -= strideA2; - } - ia1 += strideA1; - } - } else { - ia1 = offsetA + ( (N-1) * strideA2 ); - for ( i = N-1; i >= 0; i-- ) { - ia2 = 0; - for ( j = 0; j < M; j++ ) { - if ( A[ ia1 + ia2 ] !== 0.0 ) { - return i; - } - ia2 += strideA1; - } - ia1 -= strideA2; - } - } - - return -1; + return iladlr( N, M, A, strideA2, strideA1, offsetA ); } diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/lib/iladlc.js b/lib/node_modules/@stdlib/lapack/base/iladlc/lib/iladlc.js index 79018561c310..d2ecb6f9ef7d 100644 --- a/lib/node_modules/@stdlib/lapack/base/iladlc/lib/iladlc.js +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/lib/iladlc.js @@ -31,7 +31,11 @@ var base = require( './base.js' ); // MAIN // /** -* Finds the index of the last non zero column in a matrix `A`. +* Returns the index of the last non-zero column in a matrix `A`. +* +* ## Notes +* +* - If provided an empty matrix or a matrix containing only zeros, the function returns `-1` (i.e., an invalid index). * * @param {string} order - storage layout * @param {PositiveInteger} M - number of rows in `A` @@ -40,7 +44,7 @@ var base = require( './base.js' ); * @param {integer} LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) * @throws {TypeError} first argument must be a valid order * @throws {RangeError} fifth argument must be greater than or equal to max(1,N) -* @returns {integer} index of the last non zero column +* @returns {integer} index of the last non-zero column * * @example * var Float64array = require( '@stdlib/array/float64' ); @@ -53,12 +57,17 @@ var base = require( './base.js' ); function iladlc( order, M, N, A, LDA ) { var sa1; var sa2; - + var s; if ( !isLayout( order ) ) { throw new TypeError( format( 'invalid argument. First argument must be a valid order. Value: `%s`.', order ) ); } - if ( isRowMajor( order ) && LDA < max( 1, N ) ) { - throw new RangeError( format( 'invalid argument. Fourth argument must be greater than or equal to max(1,%d). Value: `%d`.', N, LDA ) ); + if ( isRowMajor( order ) ) { + s = N; + } else { + s = M; + } + if ( LDA < max( 1, s ) ) { + throw new RangeError( format( 'invalid argument. Fifth argument must be greater than or equal to max(1,%d). Value: `%d`.', s, LDA ) ); } if ( isColumnMajor( order ) ) { sa1 = 1; diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/lib/index.js b/lib/node_modules/@stdlib/lapack/base/iladlc/lib/index.js index 486fb609deb5..6a5de7a2eaa3 100644 --- a/lib/node_modules/@stdlib/lapack/base/iladlc/lib/index.js +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/lib/index.js @@ -19,7 +19,11 @@ 'use strict'; /** -* LAPACK routine to find the index of the last non zero row in a input matrix. +* LAPACK routine to find the index of the last non-zero column in a input matrix. +* +* ## Notes +* +* - If provided an empty matrix or a matrix containing only zeros, the function returns `-1` (i.e., an invalid index). * * @module @stdlib/lapack/base/iladlc * diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/lib/ndarray.js b/lib/node_modules/@stdlib/lapack/base/iladlc/lib/ndarray.js index e2e70d49b72d..06351fbd120c 100644 --- a/lib/node_modules/@stdlib/lapack/base/iladlc/lib/ndarray.js +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/lib/ndarray.js @@ -26,7 +26,11 @@ var base = require( './base.js' ); // MAIN // /** -* Finds the index of the last non zero column in a matrix `A` using alternative indexing semantics. +* Finds the index of the last non-zero column in a matrix `A` using alternative indexing semantics. +* +* ## Notes +* +* - If provided an empty matrix or a matrix containing only zeros, the function returns `-1` (i.e., an invalid index). * * @param {PositiveInteger} M - number of rows in `A` * @param {PositiveInteger} N - number of columns in `A` @@ -34,7 +38,7 @@ var base = require( './base.js' ); * @param {integer} strideA1 - stride of the first dimension of `A` * @param {integer} strideA2 - stride of the second dimension of `A` * @param {NonNegativeInteger} offsetA - index offset for `A` -* @returns {integer} index of the last non zero column +* @returns {integer} index of the last non-zero column * * @example * var Float64array = require( '@stdlib/array/float64' ); diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/package.json b/lib/node_modules/@stdlib/lapack/base/iladlc/package.json index 45e43ebd8742..31ae84a7411f 100644 --- a/lib/node_modules/@stdlib/lapack/base/iladlc/package.json +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/package.json @@ -1,7 +1,7 @@ { "name": "@stdlib/lapack/base/iladlc", "version": "0.0.0", - "description": "LAPACK routine to find the index of the last non zero column in a input matrix.", + "description": "LAPACK routine to find the index of the last non-zero column in a input matrix.", "license": "Apache-2.0", "author": { "name": "The Stdlib Authors", diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/test/test.iladlc.js b/lib/node_modules/@stdlib/lapack/base/iladlc/test/test.iladlc.js index ac06ef045782..f720a31bee63 100644 --- a/lib/node_modules/@stdlib/lapack/base/iladlc/test/test.iladlc.js +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/test/test.iladlc.js @@ -139,7 +139,7 @@ tape( 'the function returns an invalid index (-1) when N is zero', function test t.end(); }); -tape( 'the function returns the expected zero based index of the last non zero column of a matrix (row-major)', function test( t ) { +tape( 'the function returns the expected zero based index of the last non-zero column of a matrix (row-major)', function test( t ) { var data; var out; var A; @@ -153,7 +153,7 @@ tape( 'the function returns the expected zero based index of the last non zero c t.end(); }); -tape( 'the function returns the expected zero based index of the last non zero column of a matrix (column-major)', function test( t ) { +tape( 'the function returns the expected zero based index of the last non-zero column of a matrix (column-major)', function test( t ) { var data; var out; var A; diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/test/test.ndarray.js b/lib/node_modules/@stdlib/lapack/base/iladlc/test/test.ndarray.js index feb9466a828c..42bd9c081002 100644 --- a/lib/node_modules/@stdlib/lapack/base/iladlc/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/test/test.ndarray.js @@ -68,7 +68,7 @@ tape( 'the function has an arity of 6', function test( t ) { t.end(); }); -tape( 'the function returns the expected zero based index of the last non zero column of a matrix (row-major)', function test( t ) { +tape( 'the function returns the expected zero based index of the last non-zero column of a matrix (row-major)', function test( t ) { var data; var out; var A; @@ -82,7 +82,7 @@ tape( 'the function returns the expected zero based index of the last non zero c t.end(); }); -tape( 'the function returns the expected zero based index of the last non zero column of a matrix (column-major)', function test( t ) { +tape( 'the function returns the expected zero based index of the last non-zero column of a matrix (column-major)', function test( t ) { var data; var out; var A; @@ -124,7 +124,7 @@ tape( 'the function returns an invalid index (-1) when all elements in a matrix t.end(); }); -tape( 'the function returns the expected zero based index of the last non zero column of a matrix (row-major) (offsets)', function test( t ) { +tape( 'the function returns the expected zero based index of the last non-zero column of a matrix (row-major) (offsets)', function test( t ) { var data; var out; var A; @@ -138,7 +138,7 @@ tape( 'the function returns the expected zero based index of the last non zero c t.end(); }); -tape( 'the function returns the expected zero based index of the last non zero column of a matrix (column-major) (offsets)', function test( t ) { +tape( 'the function returns the expected zero based index of the last non-zero column of a matrix (column-major) (offsets)', function test( t ) { var data; var out; var A; @@ -180,7 +180,7 @@ tape( 'the function returns an invalid index (-1) when all elements in a matrix t.end(); }); -tape( 'the function returns the expected zero based index of the last non zero column of a matrix (row-major) (mixed strides)', function test( t ) { +tape( 'the function returns the expected zero based index of the last non-zero column of a matrix (row-major) (mixed strides)', function test( t ) { var data; var out; var A; @@ -194,7 +194,7 @@ tape( 'the function returns the expected zero based index of the last non zero c t.end(); }); -tape( 'the function returns the expected zero based index of the last non zero column of a matrix (column-major) (mixed strides)', function test( t ) { +tape( 'the function returns the expected zero based index of the last non-zero column of a matrix (column-major) (mixed strides)', function test( t ) { var data; var out; var A; @@ -236,7 +236,7 @@ tape( 'the function returns an invalid index (-1) when all elements in a matrix t.end(); }); -tape( 'the function returns the expected zero based index of the last non zero column of a matrix (row-major) (negative strides)', function test( t ) { +tape( 'the function returns the expected zero based index of the last non-zero column of a matrix (row-major) (negative strides)', function test( t ) { var data; var out; var A; @@ -250,7 +250,7 @@ tape( 'the function returns the expected zero based index of the last non zero c t.end(); }); -tape( 'the function returns the expected zero based index of the last non zero column of a matrix (column-major) (negative strides)', function test( t ) { +tape( 'the function returns the expected zero based index of the last non-zero column of a matrix (column-major) (negative strides)', function test( t ) { var data; var out; var A; @@ -292,7 +292,7 @@ tape( 'the function returns an invalid index (-1) when all elements in a matrix t.end(); }); -tape( 'the function returns the expected zero based index of the last non zero column of a matrix (row-major) (large strides)', function test( t ) { +tape( 'the function returns the expected zero based index of the last non-zero column of a matrix (row-major) (large strides)', function test( t ) { var data; var out; var A; @@ -306,7 +306,7 @@ tape( 'the function returns the expected zero based index of the last non zero c t.end(); }); -tape( 'the function returns the expected zero based index of the last non zero column of a matrix (column-major) (large strides)', function test( t ) { +tape( 'the function returns the expected zero based index of the last non-zero column of a matrix (column-major) (large strides)', function test( t ) { var data; var out; var A; From 7b52be74dafd91012a72508810edb0e02ef87b10 Mon Sep 17 00:00:00 2001 From: Aayush Khanna Date: Fri, 6 Jun 2025 10:25:09 +0000 Subject: [PATCH 09/12] chore: cleaning up --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: na - task: lint_repl_help status: passed - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: passed - task: lint_license_headers status: passed --- --- .../@stdlib/lapack/base/iladlc/README.md | 19 +++++----- .../@stdlib/lapack/base/iladlc/docs/repl.txt | 16 ++++---- .../lapack/base/iladlc/docs/types/index.d.ts | 2 +- .../lapack/base/iladlc/docs/types/test.ts | 2 +- .../lapack/base/iladlc/test/test.iladlc.js | 37 ++++++++++++++++--- .../lapack/base/iladlc/test/test.ndarray.js | 20 +++++----- 6 files changed, 62 insertions(+), 34 deletions(-) diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/README.md b/lib/node_modules/@stdlib/lapack/base/iladlc/README.md index 726a082826be..e0715351a0b5 100644 --- a/lib/node_modules/@stdlib/lapack/base/iladlc/README.md +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/README.md @@ -20,7 +20,7 @@ limitations under the License. # iladlc -> Find the index of the last non-zero column in a matrix `A` +> Find the index of the last non-zero column in a matrix `A`.
@@ -65,19 +65,19 @@ Note that indexing is relative to the first index. To introduce an offset, use [ ```javascript var Float64Array = require( '@stdlib/array/float64' ); -// Initial arrays... +// Initial array: var A0 = new Float64Array( [ 9999.0, 1.0, 2.0, 0.0, 3.0, 4.0, 0.0 ] ); -// Create offset views... +// Create an offset view: var A1 = new Float64Array( A0.buffer, A0.BYTES_PER_ELEMENT*1 ); // start at 2nd element var out = iladlc( 'row-major', 2, 3, A1, 3 ); // returns 1 ``` -#### iladlc.ndarray( uplo, M, N, A, sa1, sa2, oa, B, sb1, sb2, ob ) +#### iladlc.ndarray( M, N, A, strideA1, strideA2, offsetA ) -Finds the index of the last non-zero column in a matrix `A` using alternative indexing semantics. +Returns the index of the last non-zero column in a matrix `A` using alternative indexing semantics. ```javascript var Float64Array = require( '@stdlib/array/float64' ); @@ -100,11 +100,11 @@ The function has the following parameters: - **M**: number of rows in `A`. - **N**: number of columns in `A`. - **A**: input [`Float64Array`][mdn-float64array]. -- **sa1**: stride of the first dimension of `A`. -- **sa2**: stride of the second dimension of `A`. -- **oa**: starting index for `A`. +- **strideA1**: stride of the first dimension of `A`. +- **strideA2**: stride of the second dimension of `A`. +- **offsetA**: starting index for `A`. -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, +While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameter supports indexing semantics based on a starting index. For example, ```javascript var Float64Array = require( '@stdlib/array/float64' ); @@ -130,6 +130,7 @@ var out = iladlc.ndarray( 2, 3, A, 3, 1, 1 ); ## Notes +- This routine is commonly used throughout LAPACK to shrink work domains (e.g., before bulge-chasing, deflation, or when trimming Householder panels), thus ensuring that higher-level routines operate only on numerically relevant sub-matrices. - `iladlc()` corresponds to the [LAPACK][lapack] routine [`iladlc`][lapack-iladlc].
diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/docs/repl.txt b/lib/node_modules/@stdlib/lapack/base/iladlc/docs/repl.txt index e161838f254a..6945e7c29f86 100644 --- a/lib/node_modules/@stdlib/lapack/base/iladlc/docs/repl.txt +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/docs/repl.txt @@ -25,8 +25,8 @@ Returns ------- - iladlr: integer - Zero based index of the last non-zero column. + out: integer + Zero-based index of the last non-zero column. Examples -------- @@ -35,7 +35,7 @@ 1 -{{alias}}.ndarray( M, N, A, sa1, sa2, oa ) +{{alias}}.ndarray( M, N, A, strideA1, strideA2, offsetA ) Returns the index of the last non-zero column in a matrix `A` using alternative indexing semantics. @@ -57,19 +57,19 @@ A: Float64Array Input matrix `A`. - sa1: integer + strideA1: integer Stride of the first dimension of `A`. - sa2: integer + strideA2: integer Stride of the second dimension of `A`. - oa: integer + offsetA: integer Starting index for `A`. Returns ------- - iladlr: integer - Zero based index of the last non-zero column. + out: integer + Zero-based index of the last non-zero column. Examples -------- diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/docs/types/index.d.ts b/lib/node_modules/@stdlib/lapack/base/iladlc/docs/types/index.d.ts index a6df450e97cc..b74c6859dc3d 100644 --- a/lib/node_modules/@stdlib/lapack/base/iladlc/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/docs/types/index.d.ts @@ -51,7 +51,7 @@ interface Routine { ( order: Layout, M: number, N: number, A: Float64Array, LDA: number ): number; /** - * Finds the index of the last non-zero column in a matrix `A` using alternative indexing semantics. + * Returns the index of the last non-zero column in a matrix `A` using alternative indexing semantics. * * ## Notes * diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/docs/types/test.ts b/lib/node_modules/@stdlib/lapack/base/iladlc/docs/types/test.ts index fa76131e63ae..d75a38de80ea 100644 --- a/lib/node_modules/@stdlib/lapack/base/iladlc/docs/types/test.ts +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/docs/types/test.ts @@ -199,7 +199,7 @@ import iladlc = require( './index' ); iladlc.ndarray( 2, 2, A, 2, 1, ( x: number ): number => x ); // $ExpectError } -// The compiler throws an error if the `ndarray` method is provided an unsupported number of arguments (6-argument version)... +// The compiler throws an error if the `ndarray` method is provided an unsupported number of arguments... { const A = new Float64Array( 4 ); diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/test/test.iladlc.js b/lib/node_modules/@stdlib/lapack/base/iladlc/test/test.iladlc.js index f720a31bee63..5abceac2236d 100644 --- a/lib/node_modules/@stdlib/lapack/base/iladlc/test/test.iladlc.js +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/test/test.iladlc.js @@ -84,7 +84,7 @@ tape( 'the function throws an error if provided a first argument which is not a } }); -tape( 'the function throws an error if provided a fourth argument which is not a valid `LDA` value (row-major)', function test( t ) { +tape( 'the function throws an error if provided a fifth argument which is not a valid `LDA` value (row-major)', function test( t ) { var values; var data; var A; @@ -111,7 +111,34 @@ tape( 'the function throws an error if provided a fourth argument which is not a } }); -tape( 'the function returns an invalid index (-1) when M is zero', function test( t ) { +tape( 'the function throws an error if provided a fifth argument which is not a valid `LDA` value (column-major)', function test( t ) { + var values; + var data; + var A; + var i; + + data = COLUMN_MAJOR_DATA; + + values = [ + 0, + 1 + ]; + + A = new Float64Array( data.A ); + + 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() { + iladlc( data.order, data.M, data.N, A, value ); + }; + } +}); + +tape( 'the function returns an invalid index (-1) when M is less than or equal to zero', function test( t ) { var data; var out; var A; @@ -125,7 +152,7 @@ tape( 'the function returns an invalid index (-1) when M is zero', function test t.end(); }); -tape( 'the function returns an invalid index (-1) when N is zero', function test( t ) { +tape( 'the function returns an invalid index (-1) when N is less than or equal to zero', function test( t ) { var data; var out; var A; @@ -139,7 +166,7 @@ tape( 'the function returns an invalid index (-1) when N is zero', function test t.end(); }); -tape( 'the function returns the expected zero based index of the last non-zero column of a matrix (row-major)', function test( t ) { +tape( 'the function returns the expected zero-based index of the last non-zero column of a matrix (row-major)', function test( t ) { var data; var out; var A; @@ -153,7 +180,7 @@ tape( 'the function returns the expected zero based index of the last non-zero c t.end(); }); -tape( 'the function returns the expected zero based index of the last non-zero column of a matrix (column-major)', function test( t ) { +tape( 'the function returns the expected zero-based index of the last non-zero column of a matrix (column-major)', function test( t ) { var data; var out; var A; diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/test/test.ndarray.js b/lib/node_modules/@stdlib/lapack/base/iladlc/test/test.ndarray.js index 42bd9c081002..677173508ae2 100644 --- a/lib/node_modules/@stdlib/lapack/base/iladlc/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/test/test.ndarray.js @@ -68,7 +68,7 @@ tape( 'the function has an arity of 6', function test( t ) { t.end(); }); -tape( 'the function returns the expected zero based index of the last non-zero column of a matrix (row-major)', function test( t ) { +tape( 'the function returns the expected zero-based index of the last non-zero column of a matrix (row-major)', function test( t ) { var data; var out; var A; @@ -82,7 +82,7 @@ tape( 'the function returns the expected zero based index of the last non-zero c t.end(); }); -tape( 'the function returns the expected zero based index of the last non-zero column of a matrix (column-major)', function test( t ) { +tape( 'the function returns the expected zero-based index of the last non-zero column of a matrix (column-major)', function test( t ) { var data; var out; var A; @@ -124,7 +124,7 @@ tape( 'the function returns an invalid index (-1) when all elements in a matrix t.end(); }); -tape( 'the function returns the expected zero based index of the last non-zero column of a matrix (row-major) (offsets)', function test( t ) { +tape( 'the function returns the expected zero-based index of the last non-zero column of a matrix (row-major) (offsets)', function test( t ) { var data; var out; var A; @@ -138,7 +138,7 @@ tape( 'the function returns the expected zero based index of the last non-zero c t.end(); }); -tape( 'the function returns the expected zero based index of the last non-zero column of a matrix (column-major) (offsets)', function test( t ) { +tape( 'the function returns the expected zero-based index of the last non-zero column of a matrix (column-major) (offsets)', function test( t ) { var data; var out; var A; @@ -180,7 +180,7 @@ tape( 'the function returns an invalid index (-1) when all elements in a matrix t.end(); }); -tape( 'the function returns the expected zero based index of the last non-zero column of a matrix (row-major) (mixed strides)', function test( t ) { +tape( 'the function returns the expected zero-based index of the last non-zero column of a matrix (row-major) (mixed strides)', function test( t ) { var data; var out; var A; @@ -194,7 +194,7 @@ tape( 'the function returns the expected zero based index of the last non-zero c t.end(); }); -tape( 'the function returns the expected zero based index of the last non-zero column of a matrix (column-major) (mixed strides)', function test( t ) { +tape( 'the function returns the expected zero-based index of the last non-zero column of a matrix (column-major) (mixed strides)', function test( t ) { var data; var out; var A; @@ -236,7 +236,7 @@ tape( 'the function returns an invalid index (-1) when all elements in a matrix t.end(); }); -tape( 'the function returns the expected zero based index of the last non-zero column of a matrix (row-major) (negative strides)', function test( t ) { +tape( 'the function returns the expected zero-based index of the last non-zero column of a matrix (row-major) (negative strides)', function test( t ) { var data; var out; var A; @@ -250,7 +250,7 @@ tape( 'the function returns the expected zero based index of the last non-zero c t.end(); }); -tape( 'the function returns the expected zero based index of the last non-zero column of a matrix (column-major) (negative strides)', function test( t ) { +tape( 'the function returns the expected zero-based index of the last non-zero column of a matrix (column-major) (negative strides)', function test( t ) { var data; var out; var A; @@ -292,7 +292,7 @@ tape( 'the function returns an invalid index (-1) when all elements in a matrix t.end(); }); -tape( 'the function returns the expected zero based index of the last non-zero column of a matrix (row-major) (large strides)', function test( t ) { +tape( 'the function returns the expected zero-based index of the last non-zero column of a matrix (row-major) (large strides)', function test( t ) { var data; var out; var A; @@ -306,7 +306,7 @@ tape( 'the function returns the expected zero based index of the last non-zero c t.end(); }); -tape( 'the function returns the expected zero based index of the last non-zero column of a matrix (column-major) (large strides)', function test( t ) { +tape( 'the function returns the expected zero-based index of the last non-zero column of a matrix (column-major) (large strides)', function test( t ) { var data; var out; var A; From 35434a0a6a77109e5943ec2539355e92c8674d20 Mon Sep 17 00:00:00 2001 From: Athan Date: Fri, 6 Jun 2025 22:54:28 -0700 Subject: [PATCH 10/12] docs: add column-major example --- 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/iladlc/lib/base.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/lib/base.js b/lib/node_modules/@stdlib/lapack/base/iladlc/lib/base.js index 0f76ecf297ad..9971bd25d8ba 100644 --- a/lib/node_modules/@stdlib/lapack/base/iladlc/lib/base.js +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/lib/base.js @@ -48,6 +48,14 @@ var iladlr = require( '@stdlib/lapack/base/iladlr' ).ndarray; * * var out = iladlc( 2, 3, A, 3, 1, 0 ); * // returns 1 +* +* @example +* var Float64array = require( '@stdlib/array/float64' ); +* +* var A = new Float64array( [ 1.0, 3.0, 2.0, 4.0, 0.0, 0.0 ] ); // => [ [ 1.0, 2.0, 0.0 ], [ 3.0, 4.0, 0.0 ] ] +* +* var out = iladlc( 2, 3, A, 1, 2, 0 ); +* // returns 1 */ function iladlc( M, N, A, strideA1, strideA2, offsetA ) { return iladlr( N, M, A, strideA2, strideA1, offsetA ); From 2231950c78c6d7364cd0af34352705ebd18819f3 Mon Sep 17 00:00:00 2001 From: Athan Date: Fri, 6 Jun 2025 22:55:42 -0700 Subject: [PATCH 11/12] refactor: use 'fast' max --- 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/iladlc/lib/iladlc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/lib/iladlc.js b/lib/node_modules/@stdlib/lapack/base/iladlc/lib/iladlc.js index d2ecb6f9ef7d..3231fe0d57a9 100644 --- a/lib/node_modules/@stdlib/lapack/base/iladlc/lib/iladlc.js +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/lib/iladlc.js @@ -23,7 +23,7 @@ var isLayout = require( '@stdlib/blas/base/assert/is-layout' ); var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major-string' ); var isColumnMajor = require( '@stdlib/ndarray/base/assert/is-column-major-string' ); -var max = require( '@stdlib/math/base/special/max' ); +var max = require( '@stdlib/math/base/special/fast/max' ); var format = require( '@stdlib/string/format' ); var base = require( './base.js' ); From c4e471be828e1853f28b78838b204fd4e1048d7a Mon Sep 17 00:00:00 2001 From: Athan Date: Fri, 6 Jun 2025 22:56:25 -0700 Subject: [PATCH 12/12] docs: remove 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- lib/node_modules/@stdlib/lapack/base/iladlc/lib/index.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/node_modules/@stdlib/lapack/base/iladlc/lib/index.js b/lib/node_modules/@stdlib/lapack/base/iladlc/lib/index.js index 6a5de7a2eaa3..b5618f0794e2 100644 --- a/lib/node_modules/@stdlib/lapack/base/iladlc/lib/index.js +++ b/lib/node_modules/@stdlib/lapack/base/iladlc/lib/index.js @@ -21,10 +21,6 @@ /** * LAPACK routine to find the index of the last non-zero column in a input matrix. * -* ## Notes -* -* - If provided an empty matrix or a matrix containing only zeros, the function returns `-1` (i.e., an invalid index). -* * @module @stdlib/lapack/base/iladlc * * @example