From 9e58946712706e804ec8ab47f4df2f4ac66de374 Mon Sep 17 00:00:00 2001 From: Prajjwal Bajpai Date: Mon, 19 Jan 2026 18:46:47 +0530 Subject: [PATCH 1/4] feat: add `lapack/base/dlamrg` --- 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: passed - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: passed - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: passed - task: lint_license_headers status: passed --- --- .../@stdlib/lapack/base/dlamrg/README.md | 237 +++++++++++++ .../lapack/base/dlamrg/benchmark/benchmark.js | 118 +++++++ .../dlamrg/benchmark/benchmark.ndarray.js | 118 +++++++ .../@stdlib/lapack/base/dlamrg/docs/repl.txt | 101 ++++++ .../lapack/base/dlamrg/docs/types/index.d.ts | 129 ++++++++ .../lapack/base/dlamrg/docs/types/test.ts | 312 ++++++++++++++++++ .../lapack/base/dlamrg/examples/index.js | 29 ++ .../@stdlib/lapack/base/dlamrg/lib/base.js | 114 +++++++ .../@stdlib/lapack/base/dlamrg/lib/dlamrg.js | 69 ++++ .../@stdlib/lapack/base/dlamrg/lib/index.js | 70 ++++ .../@stdlib/lapack/base/dlamrg/lib/main.js | 35 ++ .../@stdlib/lapack/base/dlamrg/lib/ndarray.js | 75 +++++ .../@stdlib/lapack/base/dlamrg/package.json | 69 ++++ .../lapack/base/dlamrg/test/test.dlamrg.js | 115 +++++++ .../@stdlib/lapack/base/dlamrg/test/test.js | 82 +++++ .../lapack/base/dlamrg/test/test.ndarray.js | 136 ++++++++ 16 files changed, 1809 insertions(+) create mode 100644 lib/node_modules/@stdlib/lapack/base/dlamrg/README.md create mode 100644 lib/node_modules/@stdlib/lapack/base/dlamrg/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/lapack/base/dlamrg/benchmark/benchmark.ndarray.js create mode 100644 lib/node_modules/@stdlib/lapack/base/dlamrg/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/lapack/base/dlamrg/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/lapack/base/dlamrg/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/lapack/base/dlamrg/examples/index.js create mode 100644 lib/node_modules/@stdlib/lapack/base/dlamrg/lib/base.js create mode 100644 lib/node_modules/@stdlib/lapack/base/dlamrg/lib/dlamrg.js create mode 100644 lib/node_modules/@stdlib/lapack/base/dlamrg/lib/index.js create mode 100644 lib/node_modules/@stdlib/lapack/base/dlamrg/lib/main.js create mode 100644 lib/node_modules/@stdlib/lapack/base/dlamrg/lib/ndarray.js create mode 100644 lib/node_modules/@stdlib/lapack/base/dlamrg/package.json create mode 100644 lib/node_modules/@stdlib/lapack/base/dlamrg/test/test.dlamrg.js create mode 100644 lib/node_modules/@stdlib/lapack/base/dlamrg/test/test.js create mode 100644 lib/node_modules/@stdlib/lapack/base/dlamrg/test/test.ndarray.js diff --git a/lib/node_modules/@stdlib/lapack/base/dlamrg/README.md b/lib/node_modules/@stdlib/lapack/base/dlamrg/README.md new file mode 100644 index 000000000000..99251c25081b --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlamrg/README.md @@ -0,0 +1,237 @@ + + +# dlamrg + +> Generates a permutation list to merge the entries of two independently sorted sets into a single set sorted in ascending order. + +
+ +## Usage + +```javascript +var dlamrg = require( '@stdlib/lapack/base/dlamrg' ); +``` + +#### dlamrg( N1, N2, A, DTRD1, DTRD2, index ) + +Generates a permutation list to merge the entries of two independently sorted sets into a single set sorted in ascending order. + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); +var Int32Array = require( '@stdlib/array/int32' ); + +var A = new Float64Array( [ 1.0, 3.0, 2.0, 4.0, 5.0 ] ); +var index = new Int32Array( 5 ); +dlamrg( 2, 3, A, 1, 1, index ); +// index => [ 0, 2, 1, 3, 4 ] +``` + +The function has the following parameters: + +- **N1**: the length of the first sorted list to be merged. +- **N2**: the length of the second sorted list to be merged. +- **A**: the array containing the first and the second sorted lists to be merged as a [`Float64Array`][mdn-float64array]. +- **DTRD1**: stride for the first `N1` elements in `A`. +- **DTRD2**: stride for the last `N2` elements in `A`. +- **index**: the array containing the indices of elements of `A` such that they are in ascending order. + +Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views. + + + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); +var Int32Array = require( '@stdlib/array/int32' ); + +var A = new Float64Array( [ 1.0, 3.0, 2.0, 4.0, 5.0 ] ); + +// Initial array: +var index0 = new Int32Array( 6 ); + +// Create an offset view... +var index1 = new Int32Array( index0.buffer, index0.BYTES_PER_ELEMENT*1 ); // start at 2nd element + +dlamrg( 2, 3, A, 1, 1, index1 ); +// index0 => [ 0, 0, 2, 1, 3, 4 ] +``` + + + +#### dlamrg.ndarray( N1, N2, A, strideA, offsetA, DTRD1, DTRD2, index, strideIndex, offsetIndex ) + +Generates a permutation list to merge the entries of two independently sorted sets into a single set sorted in ascending order. + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); +var Int32Array = require( '@stdlib/array/int32' ); + +var A = new Float64Array( [ 1.0, 3.0, 2.0, 4.0, 5.0 ] ); +var index = new Int32Array( 5 ); +dlamrg.ndarray( 2, 3, A, 1, 0, 1, 1, index, 1, 0 ); +// index => [ 0, 2, 1, 3, 4 ] +``` + +The function has the following additional parameters: + +- **strideA**: stride length for `A`. +- **offsetA**: starting index of `A`. +- **strideIndex**: stride length for `index`. +- **offsetIndex**: starting index of `index`. + +While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameters support indexing semantics based on starting indices. For example, + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); +var Int32Array = require( '@stdlib/array/int32' ); + +var A = new Float64Array( [ 999.9, 1.0, 3.0, 2.0, 4.0, 5.0 ] ); +var index = new Int32Array( 6 ); +dlamrg.ndarray( 2, 3, A, 1, 1, 1, 1, index, 1, 1 ); +// index => [ 0, 1, 3, 2, 4, 5 ] +``` + +
+ + + +
+ +## Notes + +- `dlamrg()` corresponds to the [LAPACK][lapack] routine [`dlamrg`][lapack-dlamrg]. + +
+ + + +
+ +## Examples + + + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); +var Int32Array = require( '@stdlib/array/int32' ); + +var A = new Float64Array( [ 1.0, 3.0, 2.0, 4.0, 5.0 ] ); +var index = new Int32Array( 5 ); +dlamrg( 2, 3, A, 1, 1, index ); +console.log( index ); +``` + +
+ + + + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +TODO +``` + +#### TODO + +TODO. + +```c +TODO +``` + +TODO + +```c +TODO +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +TODO +``` + +
+ + + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/lapack/base/dlamrg/benchmark/benchmark.js b/lib/node_modules/@stdlib/lapack/base/dlamrg/benchmark/benchmark.js new file mode 100644 index 000000000000..795767b23cb3 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlamrg/benchmark/benchmark.js @@ -0,0 +1,118 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var randu = require( '@stdlib/random/base/randu' ); +var Int32Array = require( '@stdlib/array/int32' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pkg = require( './../package.json' ).name; +var dlamrg = require( './../lib/dlamrg.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( len ) { + var index = new Int32Array( len ); + var N1 = floor( randu() * len ); + var N2 = len - N1; + var A1 = uniform( N1, 0.0, 100.0, options ); + var A2 = uniform( N2, 0.0, 100.0, options ); + var A; + + A1.sort(cmp); + A2.sort(cmp); + + function cmp(a, b) { + return b - a; + } + + A = A1.concat(A2); + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + dlamrg( N1, N2, A, 1, 1, index ); + if ( isnan( index[ i%index.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( index[ i%index.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + f = createBenchmark( len ); + bench( pkg+':len='+len, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/lapack/base/dlamrg/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dlamrg/benchmark/benchmark.ndarray.js new file mode 100644 index 000000000000..5385a109d95f --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlamrg/benchmark/benchmark.ndarray.js @@ -0,0 +1,118 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var randu = require( '@stdlib/random/base/randu' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var Int32Array = require( '@stdlib/array/int32' ); +var pkg = require( './../package.json' ).name; +var dlamrg = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( len ) { + var index = new Int32Array( len ); + var N1 = floor( randu() * len ); + var N2 = len - N1; + var A1 = uniform( N1, 0.0, 100.0, options ); + var A2 = uniform( N2, 0.0, 100.0, options ); + var A; + + A1.sort(cmp); + A2.sort(cmp); + + function cmp(a, b) { + return b - a; + } + + A = A1.concat(A2); + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + dlamrg( N1, N2, A, 1, 0, 1, 1, index, 1, 0 ); + if ( isnan( index[ i%index.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( index[ i%index.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + f = createBenchmark( len ); + bench( pkg+':len='+len, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/lapack/base/dlamrg/docs/repl.txt b/lib/node_modules/@stdlib/lapack/base/dlamrg/docs/repl.txt new file mode 100644 index 000000000000..8a9f777a9f38 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlamrg/docs/repl.txt @@ -0,0 +1,101 @@ + +{{alias}}( N1, N2, A, DTRD1, DTRD2, index ) + Generates a permutation list to merge the entries of two independently + sorted sets into a single set sorted in ascending order. + + Indexing is relative to the first index. To introduce an offset, use typed + array views. + + Parameters + ---------- + N1: number + The length of the first sorted list to be merged. + + N2: number + The length of the first sorted list to be merged. + + A: Float64Array + The array containing the first and the second sorted lists to be merged. + + DTRD1: number + The stride for the first `N1` elements in `A`. + + DTRD2: number + The stride for the last `N2` elements in `A`. + + index: Int32Array + The array containing the indices of elements of `A` such that they are + in ascending order. + + Returns + ------- + out: number + Status code. + + Examples + -------- + > var A = new {{alias:@stdlib/array/float64}}( [ 1.0, 3.0, 2.0, 4.0, 5.0 ] ); + > var index = new {{alias:@stdlib/array/int32}}( 5 ); + > {{alias}}( 2, 3, A, 1, 1, index ) + 0 + > index + [ 0, 2, 1, 3, 4 ] + + +{{alias}}.ndarray( N1, N2, A, sA, oA, DTRD1, DTRD2, index, sIndex, oIndex ) + Generates a permutation list to merge the entries of two independently + sorted sets into a single set sorted in ascending order. + + While typed array views mandate a view offset based on the underlying + buffer, the offset parameters support indexing semantics based on starting + indices. + + Parameters + ---------- + N1: number + The length of the first sorted list to be merged. + + N2: number + The length of the first sorted list to be merged. + + A: Float64Array + The array containing the first and the second sorted lists to be merged. + + sA: number + The stride length for `A`. + + oA: number + The starting index of `A`. + + DTRD1: number + The stride for the first `N1` elements in `A`. + + DTRD2: number + The stride for the last `N2` elements in `A`. + + index: Int32Array + The array containing the indices of elements of `A` such that they + are in ascending order. + + sIndex: number + The stride length for `index`. + + oIndex: number + The starting index of `index`. + + Returns + ------- + out: number + Status code. + + Examples + -------- + > var A = new {{alias:@stdlib/array/float64}}( [ 1.0, 3.0, 2.0, 4.0, 5.0 ] ); + > var index = new {{alias:@stdlib/array/int32}}( 5 ); + > {{alias}}.ndarray( 2, 3, A, 1, 0, 1, 1, index, 1, 0 ) + 0 + > index + [ 0, 2, 1, 3, 4 ] + + See Also + -------- diff --git a/lib/node_modules/@stdlib/lapack/base/dlamrg/docs/types/index.d.ts b/lib/node_modules/@stdlib/lapack/base/dlamrg/docs/types/index.d.ts new file mode 100644 index 000000000000..93ffab437d4d --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlamrg/docs/types/index.d.ts @@ -0,0 +1,129 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/// + +/** +* Interface describing `dlartgp`. +*/ +interface Routine { + /** + * Generates a permutation list to merge the entries of two independently sorted sets into a single set sorted in ascending order. + * + * ## Notes + * + * - `A` should have `N1` + `N2` elements. + * - `index` should have `N1` + `N2` elements and is overwritten with indices of array `A` such that the elements are in ascending order. + * + * @param N1 - the length of the first sorted list to be merged. + * @param N2 - the length of the second sorted list to be merged. + * @param A - the array containing the first and the second sorted lists to be merged. + * @param DTRD1 - stride for first `N1` elements in `A`. + * @param DTRD2 - stride for first `N2` elements in `A`. + * @param index - the array containing the indices of elements of `A` such that they are in ascending order. + * @returns status code + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * var Int32Array = require( '@stdlib/array/int32' ) + * + * var A = new Float64Array( [ 1.0, 3.0, 2.0, 4.0, 5.0 ] ); + * var index = new Int32Array( 5 ); + * + * dlamrg( 2, 3, A, 1, 1, index ); + * // index => [ 0, 2, 1, 3, 4 ] + */ + ( N1: number, N2: number, A: Float64Array, DTRD1: number, DTRD2: number, index: Int32Array ): number; + + /** + * Generates a permutation list to merge the entries of two independently sorted sets into a single set sorted in ascending order using alternative indexing semantics. + * + * ## Notes + * + * - `A` should have `N1` + `N2` elements. + * - `index` should have `N1` + `N2` elements and is overwritten with indices of array `A` such that the elements are in ascending order. + * + * @param N1 - the length of the first sorted list to be merged. + * @param N2 - the length of the second sorted list to be merged. + * @param A - the array containing the first and the second sorted lists to be merged. + * @param strideA - stride length for `A`. + * @param offsetA - starting index of `A` + * @param DTRD1 - stride for first `N1` elements in `A`. + * @param DTRD2 - stride for first `N2` elements in `A`. + * @param index - the array containing the indices of elements of `A` such that they are in ascending order. + * @param strideIndex - stride length for `index`. + * @param offsetIndex - starting index of `index` + * @returns status code + * + * @example + * var Float64Array = require( '@stdlib/array/float64' ); + * var Int32Array = require( '@stdlib/array/int32' ) + * + * var A = new Float64Array( [ 1.0, 3.0, 2.0, 4.0, 5.0 ] ); + * var index = new Int32Array( 5 ); + * + * dlamrg.ndarray( 2, 3, A, 1, 0, 1, 1, index, 1, 0 ); + * // index => [ 0, 2, 1, 3, 4 ] + */ + ndarray( N1: number, N2: number, A: Float64Array, strideA: Number, offsetA: Number, DTRD1: number, DTRD2: number, index: Int32Array, strideIndex: Number, offsetIndex: Number ): number; +} + +/** +* Generates a permutation list to merge the entries of two independently sorted sets into a single set sorted in ascending order. +* +* ## Notes +* +* - `A` should have `N1` + `N2` elements. +* - `index` should have `N1` + `N2` elements and is overwritten with indices of array `A` such that the elements are in ascending order. +* +* @param N1 - the length of the first sorted list to be merged. +* @param N2 - the length of the second sorted list to be merged. +* @param A - the array containing the first and the second sorted lists to be merged. +* @param DTRD1 - stride for the first `N1` elements in `A`. +* @param DTRD2 - stride for the last `N2` elements in `A`. +* @param index - the array containing the indices of elements of `A` such that they are in ascending order. +* @returns status code +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var Int32Array = require( '@stdlib/array/int32' ) +* +* var A = new Float64Array( [ 1.0, 3.0, 2.0, 4.0, 5.0 ] ); +* var index = new Int32Array( 5 ); +* +* dlamrg( 2, 3, A, 1, 1, index ); +* // index => [ 0, 2, 1, 3, 4 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var Int32Array = require( '@stdlib/array/int32' ) +* +* var A = new Float64Array( [ 1.0, 3.0, 2.0, 4.0, 5.0 ] ); +* var index = new Int32Array( 5 ); +* +* dlamrg.ndarray( 2, 3, A, 1, 0, 1, 1, index, 1, 0 ); +* // index => [ 0, 2, 1, 3, 4 ] +*/ +declare var dlamrg: Routine; + + +// EXPORTS // + +export = dlamrg; diff --git a/lib/node_modules/@stdlib/lapack/base/dlamrg/docs/types/test.ts b/lib/node_modules/@stdlib/lapack/base/dlamrg/docs/types/test.ts new file mode 100644 index 000000000000..800d950ca0a1 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlamrg/docs/types/test.ts @@ -0,0 +1,312 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +import dlamrg = require( './index' ); + + +// TESTS // + +// The function returns a number... +{ + const A = new Float64Array( 5 ); + const index = new Int32Array( 5 ); + + dlamrg( 2, 3, A, 1, 1, index ); // $ExpectType number +} + +// The compiler throws an error if the function is provided a first argument which is not a number... +{ + const A = new Float64Array( 5 ); + const index = new Int32Array( 5 ); + + dlamrg( '5', 3, A, 1, 1, index ); // $ExpectError + dlamrg( true, 3, A, 1, 1, index ); // $ExpectError + dlamrg( false, 3, A, 1, 1, index ); // $ExpectError + dlamrg( null, 3, A, 1, 1, index ); // $ExpectError + dlamrg( void 0, 3, A, 1, 1, index ); // $ExpectError + dlamrg( [], 3, A, 1, 1, index ); // $ExpectError + dlamrg( {}, 3, A, 1, 1, index ); // $ExpectError + dlamrg( ( x: number ): number => x, 3, A, 1, 1, index ); // $ExpectError +} + +// The compiler throws an error if the function is provided a second argument which is not a number... +{ + const A = new Float64Array( 5 ); + const index = new Int32Array( 5 ); + + dlamrg( 2, '5', A, 1, 1, index ); // $ExpectError + dlamrg( 2, true, A, 1, 1, index ); // $ExpectError + dlamrg( 2, false, A, 1, 1, index ); // $ExpectError + dlamrg( 2, null, A, 1, 1, index ); // $ExpectError + dlamrg( 2, void 0, A, 1, 1, index ); // $ExpectError + dlamrg( 2, [], A, 1, 1, index ); // $ExpectError + dlamrg( 2, {}, A, 1, 1, index ); // $ExpectError + dlamrg( 2, ( x: number ): number => x, A, 1, 1, index ); // $ExpectError +} + +// The compiler throws an error if the function is provided a third argument which is not a Float64Array... +{ + const index = new Int32Array( 5 ); + + dlamrg( 2, 3, '5', 1, 1, index ); // $ExpectError + dlamrg( 2, 3, 5, 1, 1, index ); // $ExpectError + dlamrg( 2, 3, true, 1, 1, index ); // $ExpectError + dlamrg( 2, 3, false, 1, 1, index ); // $ExpectError + dlamrg( 2, 3, null, 1, 1, index ); // $ExpectError + dlamrg( 2, 3, void 0, 1, 1, index ); // $ExpectError + dlamrg( 2, 3, [], 1, 1, index ); // $ExpectError + dlamrg( 2, 3, {}, 1, 1, index ); // $ExpectError + dlamrg( 2, 3, ( x: number ): number => x, 1, 1, index ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fourth argument which is not a number... +{ + const A = new Float64Array( 5 ); + const index = new Int32Array( 5 ); + + dlamrg( 2, 3, A, '5', 1, index ); // $ExpectError + dlamrg( 2, 3, A, true, 1, index ); // $ExpectError + dlamrg( 2, 3, A, false, 1, index ); // $ExpectError + dlamrg( 2, 3, A, null, 1, index ); // $ExpectError + dlamrg( 2, 3, A, void 0, 1, index ); // $ExpectError + dlamrg( 2, 3, A, [], 1, index ); // $ExpectError + dlamrg( 2, 3, A, {}, 1, index ); // $ExpectError + dlamrg( 2, 3, A, ( x: number ): number => x, 1, index ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fifth argument which is not a number... +{ + const A = new Float64Array( 5 ); + const index = new Int32Array( 5 ); + + dlamrg( 2, 3, A, 1, '5', index ); // $ExpectError + dlamrg( 2, 3, A, 1, true, index ); // $ExpectError + dlamrg( 2, 3, A, 1, false, index ); // $ExpectError + dlamrg( 2, 3, A, 1, null, index ); // $ExpectError + dlamrg( 2, 3, A, 1, void 0, index ); // $ExpectError + dlamrg( 2, 3, A, 1, [], index ); // $ExpectError + dlamrg( 2, 3, A, 1, {}, index ); // $ExpectError + dlamrg( 2, 3, A, 1, ( x: number ): number => x, index ); // $ExpectError +} + +// The compiler throws an error if the function is provided a sixth argument which is not a Int32Array... +{ + const A = new Float64Array( 5 ); + + dlamrg( 2, 3, A, 1, 1, '5' ); // $ExpectError + dlamrg( 2, 3, A, 1, 1, 5 ); // $ExpectError + dlamrg( 2, 3, A, 1, 1, true ); // $ExpectError + dlamrg( 2, 3, A, 1, 1, false ); // $ExpectError + dlamrg( 2, 3, A, 1, 1, null ); // $ExpectError + dlamrg( 2, 3, A, 1, 1, void 0 ); // $ExpectError + dlamrg( 2, 3, A, 1, 1, [] ); // $ExpectError + dlamrg( 2, 3, A, 1, 1, {} ); // $ExpectError + dlamrg( 2, 3, A, 1, 1, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + const A = new Float64Array( 5 ); + const index = new Int32Array( 5 ); + + dlamrg(); // $ExpectError + dlamrg( 2 ); // $ExpectError + dlamrg( 2, 3 ); // $ExpectError + dlamrg( 2, 3, A ); // $ExpectError + dlamrg( 2, 3, A, 1 ); // $ExpectError + dlamrg( 2, 3, A, 1, 1 ); // $ExpectError + dlamrg( 2, 3, A, 1, 1, index, 10 ); // $ExpectError +} + +// Attached to main export is an `ndarray` method which returns a number... +{ + const A = new Float64Array( 5 ); + const index = new Int32Array( 5 ); + + dlamrg.ndarray( 2, 3, A, 1, 0, 1, 1, index, 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( 5 ); + const index = new Int32Array( 5 ); + + dlamrg.ndarray( '5', 3, A, 1, 0, 1, 1, index, 1, 0 ); // $ExpectError + dlamrg.ndarray( true, 3, A, 1, 0, 1, 1, index, 1, 0 ); // $ExpectError + dlamrg.ndarray( false, 3, A, 1, 0, 1, 1, index, 1, 0 ); // $ExpectError + dlamrg.ndarray( null, 3, A, 1, 0, 1, 1, index, 1, 0 ); // $ExpectError + dlamrg.ndarray( void 0, 3, A, 1, 0, 1, 1, index, 1, 0 ); // $ExpectError + dlamrg.ndarray( [], 3, A, 1, 0, 1, 1, index, 1, 0 ); // $ExpectError + dlamrg.ndarray( {}, 3, A, 1, 0, 1, 1, index, 1, 0 ); // $ExpectError + dlamrg.ndarray( ( x: number ): number => x, 3, A, 1, 0, 1, 1, index, 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( 5 ); + const index = new Int32Array( 5 ); + + dlamrg.ndarray( 2, '5', A, 1, 0, 1, 1, index, 1, 0 ); // $ExpectError + dlamrg.ndarray( 2, true, A, 1, 0, 1, 1, index, 1, 0 ); // $ExpectError + dlamrg.ndarray( 2, false, A, 1, 0, 1, 1, index, 1, 0 ); // $ExpectError + dlamrg.ndarray( 2, null, A, 1, 0, 1, 1, index, 1, 0 ); // $ExpectError + dlamrg.ndarray( 2, void 0, A, 1, 0, 1, 1, index, 1, 0 ); // $ExpectError + dlamrg.ndarray( 2, [], A, 1, 0, 1, 1, index, 1, 0 ); // $ExpectError + dlamrg.ndarray( 2, {}, A, 1, 0, 1, 1, index, 1, 0 ); // $ExpectError + dlamrg.ndarray( 2, ( x: number ): number => x, A, 1, 0, 1, 1, index, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a third argument which is not a Float64Array... +{ + const index = new Int32Array( 5 ); + + dlamrg.ndarray( 2, 3, '5', 1, 0, 1, 1, index, 1, 0 ); // $ExpectError + dlamrg.ndarray( 2, 3, 5, 1, 0, 1, 1, index, 1, 0 ); // $ExpectError + dlamrg.ndarray( 2, 3, true, 1, 0, 1, 1, index, 1, 0 ); // $ExpectError + dlamrg.ndarray( 2, 3, false, 1, 0, 1, 1, index, 1, 0 ); // $ExpectError + dlamrg.ndarray( 2, 3, null, 1, 0, 1, 1, index, 1, 0 ); // $ExpectError + dlamrg.ndarray( 2, 3, void 0, 1, 0, 1, 1, index, 1, 0 ); // $ExpectError + dlamrg.ndarray( 2, 3, [], 1, 0, 1, 1, index, 1, 0 ); // $ExpectError + dlamrg.ndarray( 2, 3, {}, 1, 0, 1, 1, index, 1, 0 ); // $ExpectError + dlamrg.ndarray( 2, 3, ( x: number ): number => x, 1, 0, 1, 1, index, 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( 5 ); + const index = new Int32Array( 5 ); + + dlamrg.ndarray( 2, 3, A, '5', 0, 1, 1, index, 1, 0 ); // $ExpectError + dlamrg.ndarray( 2, 3, A, true, 0, 1, 1, index, 1, 0 ); // $ExpectError + dlamrg.ndarray( 2, 3, A, false, 0, 1, 1, index, 1, 0 ); // $ExpectError + dlamrg.ndarray( 2, 3, A, null, 0, 1, 1, index, 1, 0 ); // $ExpectError + dlamrg.ndarray( 2, 3, A, void 0, 0, 1, 1, index, 1, 0 ); // $ExpectError + dlamrg.ndarray( 2, 3, A, [], 0, 1, 1, index, 1, 0 ); // $ExpectError + dlamrg.ndarray( 2, 3, A, {}, 0, 1, 1, index, 1, 0 ); // $ExpectError + dlamrg.ndarray( 2, 3, A, ( x: number ): number => x, 0, 1, 1, index, 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( 5 ); + const index = new Int32Array( 5 ); + + dlamrg.ndarray( 2, 3, A, 1, '5', 1, 1, index, 1, 0 ); // $ExpectError + dlamrg.ndarray( 2, 3, A, 1, true, 1, 1, index, 1, 0 ); // $ExpectError + dlamrg.ndarray( 2, 3, A, 1, false, 1, 1, index, 1, 0 ); // $ExpectError + dlamrg.ndarray( 2, 3, A, 1, null, 1, 1, index, 1, 0 ); // $ExpectError + dlamrg.ndarray( 2, 3, A, 1, void 0, 1, 1, index, 1, 0 ); // $ExpectError + dlamrg.ndarray( 2, 3, A, 1, [], 1, 1, index, 1, 0 ); // $ExpectError + dlamrg.ndarray( 2, 3, A, 1, {}, 1, 1, index, 1, 0 ); // $ExpectError + dlamrg.ndarray( 2, 3, A, 1, ( x: number ): number => x, 1, 1, index, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a sixth argument which is not a number... +{ + const A = new Float64Array( 5 ); + const index = new Int32Array( 5 ); + + dlamrg.ndarray( 2, 3, A, 1, 0, '5', 1, index, 1, 0 ); // $ExpectError + dlamrg.ndarray( 2, 3, A, 1, 0, true, 1, index, 1, 0 ); // $ExpectError + dlamrg.ndarray( 2, 3, A, 1, 0, false, 1, index, 1, 0 ); // $ExpectError + dlamrg.ndarray( 2, 3, A, 1, 0, null, 1, index, 1, 0 ); // $ExpectError + dlamrg.ndarray( 2, 3, A, 1, 0, void 0, 1, index, 1, 0 ); // $ExpectError + dlamrg.ndarray( 2, 3, A, 1, 0, [], 1, index, 1, 0 ); // $ExpectError + dlamrg.ndarray( 2, 3, A, 1, 0, {}, 1, index, 1, 0 ); // $ExpectError + dlamrg.ndarray( 2, 3, A, 1, 0, ( x: number ): number => x, 1, index, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a seventh argument which is not a number... +{ + const A = new Float64Array( 5 ); + const index = new Int32Array( 5 ); + + dlamrg.ndarray( 2, 3, A, 1, 0, 1, '5', index, 1, 0 ); // $ExpectError + dlamrg.ndarray( 2, 3, A, 1, 0, 1, true, index, 1, 0 ); // $ExpectError + dlamrg.ndarray( 2, 3, A, 1, 0, 1, false, index, 1, 0 ); // $ExpectError + dlamrg.ndarray( 2, 3, A, 1, 0, 1, null, index, 1, 0 ); // $ExpectError + dlamrg.ndarray( 2, 3, A, 1, 0, 1, void 0, index, 1, 0 ); // $ExpectError + dlamrg.ndarray( 2, 3, A, 1, 0, 1, [], index, 1, 0 ); // $ExpectError + dlamrg.ndarray( 2, 3, A, 1, 0, 1, {}, index, 1, 0 ); // $ExpectError + dlamrg.ndarray( 2, 3, A, 1, 0, 1, ( x: number ): number => x, index, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a eighth argument which is not a number... +{ + const A = new Float64Array( 5 ); + + dlamrg.ndarray( 2, 3, A, 1, 0, 1, 1, '5', 1, 0 ); // $ExpectError + dlamrg.ndarray( 2, 3, A, 1, 0, 1, 1, 5, 1, 0 ); // $ExpectError + dlamrg.ndarray( 2, 3, A, 1, 0, 1, 1, true, 1, 0 ); // $ExpectError + dlamrg.ndarray( 2, 3, A, 1, 0, 1, 1, false, 1, 0 ); // $ExpectError + dlamrg.ndarray( 2, 3, A, 1, 0, 1, 1, null, 1, 0 ); // $ExpectError + dlamrg.ndarray( 2, 3, A, 1, 0, 1, 1, void 0, 1, 0 ); // $ExpectError + dlamrg.ndarray( 2, 3, A, 1, 0, 1, 1, [], 1, 0 ); // $ExpectError + dlamrg.ndarray( 2, 3, A, 1, 0, 1, 1, {}, 1, 0 ); // $ExpectError + dlamrg.ndarray( 2, 3, A, 1, 0, 1, 1, ( x: number ): number => x, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a ninth argument which is not a number... +{ + const A = new Float64Array( 5 ); + const index = new Int32Array( 5 ); + + dlamrg.ndarray( 2, 3, A, 1, 0, 1, 1, index, '5', 0 ); // $ExpectError + dlamrg.ndarray( 2, 3, A, 1, 0, 1, 1, index, true, 0 ); // $ExpectError + dlamrg.ndarray( 2, 3, A, 1, 0, 1, 1, index, false, 0 ); // $ExpectError + dlamrg.ndarray( 2, 3, A, 1, 0, 1, 1, index, null, 0 ); // $ExpectError + dlamrg.ndarray( 2, 3, A, 1, 0, 1, 1, index, void 0, 0 ); // $ExpectError + dlamrg.ndarray( 2, 3, A, 1, 0, 1, 1, index, [], 0 ); // $ExpectError + dlamrg.ndarray( 2, 3, A, 1, 0, 1, 1, index, {}, 0 ); // $ExpectError + dlamrg.ndarray( 2, 3, A, 1, 0, 1, 1, index, ( x: number ): number => x, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a tenth argument which is not a number... +{ + const A = new Float64Array( 5 ); + const index = new Int32Array( 5 ); + + dlamrg.ndarray( 2, 3, A, 1, 0, 1, 1, index, 1, '5' ); // $ExpectError + dlamrg.ndarray( 2, 3, A, 1, 0, 1, 1, index, 1, true ); // $ExpectError + dlamrg.ndarray( 2, 3, A, 1, 0, 1, 1, index, 1, false ); // $ExpectError + dlamrg.ndarray( 2, 3, A, 1, 0, 1, 1, index, 1, null ); // $ExpectError + dlamrg.ndarray( 2, 3, A, 1, 0, 1, 1, index, 1, void 0 ); // $ExpectError + dlamrg.ndarray( 2, 3, A, 1, 0, 1, 1, index, 1, [] ); // $ExpectError + dlamrg.ndarray( 2, 3, A, 1, 0, 1, 1, index, 1, {} ); // $ExpectError + dlamrg.ndarray( 2, 3, A, 1, 0, 1, 1, index, 1, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided an unsupported number of arguments... +{ + const A = new Float64Array( 5 ); + const index = new Int32Array( 5 ); + + dlamrg.ndarray(); // $ExpectError + dlamrg.ndarray( 2 ); // $ExpectError + dlamrg.ndarray( 2, 3 ); // $ExpectError + dlamrg.ndarray( 2, 3, A ); // $ExpectError + dlamrg.ndarray( 2, 3, A, 1 ); // $ExpectError + dlamrg.ndarray( 2, 3, A, 1, 0 ); // $ExpectError + dlamrg.ndarray( 2, 3, A, 1, 0, 1 ); // $ExpectError + dlamrg.ndarray( 2, 3, A, 1, 0, 1, 1 ); // $ExpectError + dlamrg.ndarray( 2, 3, A, 1, 0, 1, 1, index ); // $ExpectError + dlamrg.ndarray( 2, 3, A, 1, 0, 1, 1, index, 1 ); // $ExpectError + dlamrg.ndarray( 2, 3, A, 1, 0, 1, 1, index, 1, 0, 10 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlamrg/examples/index.js b/lib/node_modules/@stdlib/lapack/base/dlamrg/examples/index.js new file mode 100644 index 000000000000..31b0049d83c7 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlamrg/examples/index.js @@ -0,0 +1,29 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var Float64Array = require( '@stdlib/array/float64' ); +var Int32Array = require( '@stdlib/array/int32' ); +var dlamrg = require( './../lib' ); + +var A = new Float64Array( [ 1.0, 3.0, 2.0, 4.0, 5.0 ] ); +var index = new Int32Array( 5 ); + +dlamrg( 2, 3, A, 1, 1, index ); +console.log( index ); diff --git a/lib/node_modules/@stdlib/lapack/base/dlamrg/lib/base.js b/lib/node_modules/@stdlib/lapack/base/dlamrg/lib/base.js new file mode 100644 index 000000000000..8397f6d982c9 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlamrg/lib/base.js @@ -0,0 +1,114 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MAIN // + +/** +* Generates a permutation list to merge the entries of two independently sorted sets into a single set sorted in ascending order. +* +* ## Notes +* +* - `A` should have `N1` + `N2` elements. +* - `index` should have `N1` + `N2` elements and is overwritten with indices of array `A` such that the elements are in ascending order. +* +* @private +* @param {number} N1 - the length of the first sorted list to be merged. +* @param {number} N2 - the length of the second sorted list to be merged. +* @param {Float64Array} A - the array containing the first and the second sorted lists to be merged. +* @param {integer} strideA - stride length for `A` +* @param {NonNegativeInteger} offsetA - starting index of `A` +* @param {integer} DTRD1 - stride for first `N1` elements in `A`. +* @param {integer} DTRD2 - stride for last `N2` elements in `A`. +* @param {Int32Array} index - the array containing the indices of elements of `A` such that they are in ascending order. +* @param {integer} strideIndex - stride length for `index`. +* @param {NonNegativeInteger} offsetIndex - starting index of `index`. +* @returns {integer} status code +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var Int32Array = require( '@stdlib/array/int32' ) +* +* var A = new Float64Array( [ 1.0, 3.0, 2.0, 4.0, 5.0 ] ); +* var index = new Int32Array( 5 ); +* +* dlamrg( 2, 3, A, 1, 0, 1, 1, index, 1, 0 ); +* // index => [ 0, 2, 1, 3, 4 ] +*/ +function dlamrg( N1, N2, A, strideA, offsetA, DTRD1, DTRD2, index, strideIndex, offsetIndex ) { + var ind1; + var ind2; + var n1sv; + var n2sv; + var i; + var j; + + n1sv = N1; + n2sv = N2; + if ( DTRD1 > 0 ) { + ind1 = offsetA; + } + else { + ind1 = offsetA + ( ( N1 - 1 )*strideA ); + } + + if ( DTRD2 > 0 ) { + ind2 = ( offsetA ) + ( N1*strideA ); + } + else { + ind2 = offsetA + ( ( N1 + N2 - 1 )*strideA ); + } + + i = offsetIndex; + while ( n1sv > 0 && n2sv > 0 ) { + if ( A[ ind1 ] <= A[ ind2 ] ) { + index[ i ] = ind1; + i += strideIndex; + ind1 += DTRD1*strideA; + n1sv -= 1; + } else { + index[ i ] = ind2; + i += strideIndex; + ind2 += DTRD2*strideA; + n2sv -= 1; + } + } + + if (n1sv === 0) { + for (j = 1; j <= n2sv; j++) { + index[ i ] = ind2; + i += strideIndex; + ind2 += DTRD2*strideA; + } + } + else { + for ( j = 1; j <= n1sv; j++) { + index[ i ] = ind1; + i += strideIndex; + ind1 += DTRD1*strideA; + } + } + + return 0; +} + + +// EXPORTS // + +module.exports = dlamrg; diff --git a/lib/node_modules/@stdlib/lapack/base/dlamrg/lib/dlamrg.js b/lib/node_modules/@stdlib/lapack/base/dlamrg/lib/dlamrg.js new file mode 100644 index 000000000000..a88066779a9f --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlamrg/lib/dlamrg.js @@ -0,0 +1,69 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var format = require( '@stdlib/string/format' ); +var base = require( './base.js' ); + + +// MAIN // + +/** +* Generates a permutation list to merge the entries of two independently sorted sets into a single set sorted in ascending order. +* +* ## Notes +* +* - `A` should have `N1` + `N2` elements. +* - `index` should have `N1` + `N2` elements and is overwritten with indices of array `A` such that the elements are in ascending order. +* +* @param {number} N1 - the length of the first sorted list to be merged. +* @param {number} N2 - the length of the second sorted list to be merged. +* @param {Float64Array} A - the array containing the first and the second sorted lists to be merged. +* @param {integer} DTRD1 - stride for first `N1` elements in `A`. +* @param {integer} DTRD2 - stride for first `N2` elements in `A`. +* @param {Int32Array} index - the array containing the indices of elements of `A` such that they are in ascending order. +* @throws {RangeError} first and second argument(s) must be a nonnegative integer +* @returns {integer} status code +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var Int32Array = require( '@stdlib/array/int32' ) +* +* var A = new Float64Array( [ 1.0, 3.0, 2.0, 4.0, 5.0 ] ); +* var index = new Int32Array( 5 ); +* +* dlamrg( 2, 3, A, 1, 1, index ); +* // index => [ 0, 2, 1, 3, 4 ] +*/ +function dlamrg( N1, N2, A, DTRD1, DTRD2, index ) { + if ( N1 < 0 ) { + throw new RangeError( format( 'invalid argument. First argument must be a nonnegative integer. Value: `%d`.', N1 ) ); + } + if ( N2 < 0 ) { + throw new RangeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%d`.', N2 ) ); + } + return base( N1, N2, A, 1, 0, DTRD1, DTRD2, index, 1, 0 ); +} + + +// EXPORTS // + +module.exports = dlamrg; diff --git a/lib/node_modules/@stdlib/lapack/base/dlamrg/lib/index.js b/lib/node_modules/@stdlib/lapack/base/dlamrg/lib/index.js new file mode 100644 index 000000000000..2e36b835172e --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlamrg/lib/index.js @@ -0,0 +1,70 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* LAPACK routine to merge the entries of two independently sorted sets into a single set sorted in ascending order. +* +* @module @stdlib/lapack/base/dlamrg +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var Int32Array = require( '@stdlib/array/int32' ) +* var dlamrg = require( '@stdlib/lapack/base/dlamrg' ); +* +* var A = new Float64Array( [ 1.0, 3.0, 2.0, 4.0, 5.0 ] ); +* var index = new Int32Array( 5 ); +* +* dlamrg.ndarray( 2, 3, A, 1, 0, 1, 1, index, 1, 0 ); +* // index => [ 0, 2, 1, 3, 4 ] +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var Int32Array = require( '@stdlib/array/int32' ) +* var dlamrg = require( '@stdlib/lapack/base/dlamrg' ); +* +* var A = new Float64Array( [ 1.0, 3.0, 2.0, 4.0, 5.0 ] ); +* var index = new Int32Array( 5 ); +* +* dlamrg( 2, 3, A, 1, 1, index ); +* // index => [ 0, 2, 1, 3, 4 ] +*/ + +// 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 dlamrg; +var tmp = tryRequire( join( __dirname, './native.js' ) ); +if ( isError( tmp ) ) { + dlamrg = main; +} else { + dlamrg = tmp; +} + + +// EXPORTS // + +module.exports = dlamrg; diff --git a/lib/node_modules/@stdlib/lapack/base/dlamrg/lib/main.js b/lib/node_modules/@stdlib/lapack/base/dlamrg/lib/main.js new file mode 100644 index 000000000000..20f79066b071 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlamrg/lib/main.js @@ -0,0 +1,35 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var dlamrg = require( './dlamrg.js' ); +var ndarray = require( './ndarray.js' ); + + +// MAIN // + +setReadOnly( dlamrg, 'ndarray', ndarray ); + + +// EXPORTS // + +module.exports = dlamrg; diff --git a/lib/node_modules/@stdlib/lapack/base/dlamrg/lib/ndarray.js b/lib/node_modules/@stdlib/lapack/base/dlamrg/lib/ndarray.js new file mode 100644 index 000000000000..1e95088273c7 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlamrg/lib/ndarray.js @@ -0,0 +1,75 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var format = require( '@stdlib/string/format' ); +var base = require( './base.js' ); + + +// MAIN // + +/** +* Generates a permutation list to merge the entries of two independently sorted sets into a single set sorted in ascending order. +* +* ## Notes +* +* - `A` should have `N1` + `N2` elements. +* - `index` should have `N1` + `N2` elements and is overwritten with indices of array `A` such that the elements are in ascending order. +* +* @name dlamrg +* @type {Function} +* @param {number} N1 - the length of the first sorted list to be merged. +* @param {number} N2 - the length of the second sorted list to be merged. +* @param {Float64Array} A - the array containing the first and the second sorted lists to be merged. +* @param {integer} strideA - stride length for `A` +* @param {NonNegativeInteger} offsetA - starting index of `A` +* @param {integer} DTRD1 - stride for first `N1` elements in `A`. +* @param {integer} DTRD2 - stride for first `N2` elements in `A`. +* @param {Int32Array} index - the array containing the indices of elements of `A` such that they are in ascending order. +* @param {integer} strideIndex - stride length for `index`. +* @param {NonNegativeInteger} offsetIndex - starting index of `index`. +* @throws {RangeError} first and second argument(s) must be a nonnegative integer +* @returns {integer} status code +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var Int32Array = require( '@stdlib/array/int32' ) +* +* var A = new Float64Array( [ 1.0, 3.0, 2.0, 4.0, 5.0 ] ); +* var index = new Int32Array( 5 ); +* +* dlamrg( 2, 3, A, 1, 0, 1, 1, index, 1, 0 ); +* // index => [ 0, 2, 1, 3, 4 ] +*/ +function dlamrg( N1, N2, A, strideA, offsetA, DTRD1, DTRD2, index, strideIndex, offsetIndex ) { + if ( N1 < 0 ) { + throw new RangeError( format( 'invalid argument. First argument must be a nonnegative integer. Value: `%d`.', N1 ) ); + } + if ( N2 < 0 ) { + throw new RangeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%d`.', N2 ) ); + } + return base( N1, N2, A, strideA, offsetA, DTRD1, DTRD2, index, strideIndex, offsetIndex ); +} + + +// EXPORTS // + +module.exports = dlamrg; diff --git a/lib/node_modules/@stdlib/lapack/base/dlamrg/package.json b/lib/node_modules/@stdlib/lapack/base/dlamrg/package.json new file mode 100644 index 000000000000..147b3f1271d4 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlamrg/package.json @@ -0,0 +1,69 @@ +{ + "name": "@stdlib/lapack/base/dlamrg", + "version": "0.0.0", + "description": "Generates a permutation list to merge the entries of two independently sorted sets into a single set sorted in ascending order", + "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", + "dlamrg", + "cholesky", + "factorization", + "linear", + "algebra", + "subroutines", + "array", + "ndarray", + "float64", + "double", + "float64array" + ] +} diff --git a/lib/node_modules/@stdlib/lapack/base/dlamrg/test/test.dlamrg.js b/lib/node_modules/@stdlib/lapack/base/dlamrg/test/test.dlamrg.js new file mode 100644 index 000000000000..56dc5be39955 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlamrg/test/test.dlamrg.js @@ -0,0 +1,115 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Float64Array = require( '@stdlib/array/float64' ); +var Int32Array = require( '@stdlib/array/float64' ); +var dlamrg = require( './../lib/dlamrg.js' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof dlamrg, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 6', function test( t ) { + t.strictEqual( dlamrg.length, 6, 'returns expected value' ); + t.end(); +}); + +tape( 'the function throws an error if provided a first argument which is less than zero', function test( t ) { + var values; + var index; + var A; + var i; + + A = new Float64Array( [ 1.0, 3.0, 2.0, 4.0, 5.0 ] ); + index = new Int32Array( 5 ); + + values = [ + -1, + -2, + -3 + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); + } + + function badValue( value ) { + return function badValue() { + dlamrg( value, 3, A, 1, 1, index ); + }; + } + t.end(); +}); + +tape( 'the function throws an error if provided a second argument which is less than zero', function test( t ) { + var values; + var index; + var A; + var i; + + A = new Float64Array( [ 1.0, 3.0, 2.0, 4.0, 5.0 ] ); + index = new Int32Array( 5 ); + dlamrg( 2, 3, A, 1, 1, index ); + + values = [ + -1, + -2, + -3 + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); + } + + function badValue( value ) { + return function badValue() { + dlamrg( 2, value, A, 1, 1, index ); + }; + } + t.end(); +}); + +tape( 'the function generates a permutation list to merge the entries of two independently sorted sets into a single set sorted in ascending order', function test( t ) { + var expectedIndex; + var index; + var A; + + A = new Float64Array( [ 1.0, 3.0, 2.0, 4.0, 5.0 ] ); + index = new Int32Array( 5 ); + dlamrg( 2, 3, A, 1, 1, index ); + expectedIndex = new Int32Array( [ 0, 2, 1, 3, 4 ] ); + t.deepEqual( index, expectedIndex, 'returns expected value' ); + + A = new Float64Array( [ 3.0, 1.0, 5.0, 4.0, 2.0 ] ); + index = new Int32Array( 5 ); + dlamrg( 2, 3, A, -1, -1, index ); + expectedIndex = new Int32Array( [ 1, 4, 0, 3, 2 ] ); + t.deepEqual( index, expectedIndex, 'returns expected value' ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/lapack/base/dlamrg/test/test.js b/lib/node_modules/@stdlib/lapack/base/dlamrg/test/test.js new file mode 100644 index 000000000000..83d8324f52fe --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlamrg/test/test.js @@ -0,0 +1,82 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var proxyquire = require( 'proxyquire' ); +var IS_BROWSER = require( '@stdlib/assert/is-browser' ); +var dlamrg = 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 dlamrg, '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 dlamrg.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 dlamrg = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( dlamrg, 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 dlamrg; + var main; + + main = require( './../lib/dlamrg.js' ); + + dlamrg = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( dlamrg, main, 'returns expected value' ); + t.end(); + + function tryRequire() { + return new Error( 'Cannot find module' ); + } +}); diff --git a/lib/node_modules/@stdlib/lapack/base/dlamrg/test/test.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dlamrg/test/test.ndarray.js new file mode 100644 index 000000000000..2dbea5132905 --- /dev/null +++ b/lib/node_modules/@stdlib/lapack/base/dlamrg/test/test.ndarray.js @@ -0,0 +1,136 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-len */ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Float64Array = require( '@stdlib/array/float64' ); +var Int32Array = require( '@stdlib/array/float64' ); +var dlamrg = require( './../lib/ndarray.js' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof dlamrg, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 10', function test( t ) { + t.strictEqual( dlamrg.length, 10, 'returns expected value' ); + t.end(); +}); + +tape( 'the function throws an error if provided a first argument which is less than zero', function test( t ) { + var values; + var index; + var A; + var i; + + A = new Float64Array( [ 999.9, 999.9, 5.0, 999.9, 999.9, 8.0, 999.9, 999.9, 6.0, 999.9, 999.9, 7.0 ] ); + index = new Int32Array( 9 ); + + values = [ + -1, + -2, + -3 + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); + } + + function badValue( value ) { + return function badValue() { + dlamrg( value, 2, A, 3, 2, 1, 1, index, 2, 2 ); + }; + } + t.end(); +}); + +tape( 'the function throws an error if provided a second argument which is less than zero', function test( t ) { + var values; + var index; + var A; + var i; + + A = new Float64Array( [ 999.9, 999.9, 5.0, 999.9, 999.9, 8.0, 999.9, 999.9, 6.0, 999.9, 999.9, 7.0 ] ); + index = new Int32Array( 9 ); + + values = [ + -1, + -2, + -3 + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); + } + + function badValue( value ) { + return function badValue() { + dlamrg( 2, value, A, 3, 2, 1, 1, index, 2, 2 ); + }; + } + t.end(); +}); + +tape( 'the function supports complex access pattern to store computed values', function test( t ) { + var expectedIndex; + var index; + var A; + + A = new Float64Array( [ 999.9, 999.9, 5.0, 999.9, 999.9, 8.0, 999.9, 999.9, 6.0, 999.9, 999.9, 7.0 ] ); + index = new Int32Array( 9 ); + dlamrg( 2, 2, A, 3, 2, 1, 1, index, 2, 2 ); + expectedIndex = new Int32Array( [ 0, 0, 2, 0, 8, 0, 11, 0, 5 ] ); + t.deepEqual( index, expectedIndex, 'returns expected value' ); + + A = new Float64Array( [ 999.9, 999.9, 8.0, 999.9, 999.9, 5.0, 999.9, 999.9, 7.0, 999.9, 999.9, 6.0 ] ); + index = new Int32Array( 9 ); + dlamrg( 2, 2, A, 3, 2, -1, -1, index, 2, 2 ); + expectedIndex = new Int32Array( [ 0, 0, 5, 0, 11, 0, 8, 0, 2 ] ); + t.deepEqual( index, expectedIndex, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports accessing elements in reverse order to store computed values', function test( t ) { + var expectedIndex; + var index; + var A; + + A = new Float64Array( [ 999.9, 999.9, 5.0, 999.9, 999.9, 8.0, 999.9, 999.9, 7.0, 999.9, 999.9, 6.0 ] ); + index = new Int32Array( 9 ); + dlamrg( 2, 2, A, 3, 2, 1, -1, index, -2, index.length-1 ); + expectedIndex = new Int32Array( [ 0, 0, 5, 0, 8, 0, 11, 0, 2 ] ); + t.deepEqual( index, expectedIndex, 'returns expected value' ); + + A = new Float64Array( [ 999.9, 999.9, 7.0, 999.9, 999.9, 6.0, 999.9, 999.9, 5.0, 999.9, 999.9, 8.0 ] ); + index = new Int32Array( 9 ); + dlamrg( 2, 2, A, 3, 2, -1, 1, index, -2, index.length-1 ); + expectedIndex = new Int32Array( [ 0, 0, 11, 0, 2, 0, 5, 0, 8 ] ); + t.deepEqual( index, expectedIndex, 'returns expected value' ); + + t.end(); +}); From d848a0a5799758d8eb26fa4b9a79a479409335ba Mon Sep 17 00:00:00 2001 From: Prajjwal Bajpai Date: Mon, 19 Jan 2026 22:10:50 +0530 Subject: [PATCH 2/4] fix(dlamrg): fixed failing benchmarks and examples --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: 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: passed - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- lib/node_modules/@stdlib/lapack/base/dlamrg/README.md | 10 +++++----- .../@stdlib/lapack/base/dlamrg/benchmark/benchmark.js | 3 ++- .../lapack/base/dlamrg/benchmark/benchmark.ndarray.js | 3 ++- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/node_modules/@stdlib/lapack/base/dlamrg/README.md b/lib/node_modules/@stdlib/lapack/base/dlamrg/README.md index 99251c25081b..3472bd105332 100644 --- a/lib/node_modules/@stdlib/lapack/base/dlamrg/README.md +++ b/lib/node_modules/@stdlib/lapack/base/dlamrg/README.md @@ -75,7 +75,7 @@ dlamrg( 2, 3, A, 1, 1, index1 ); -#### dlamrg.ndarray( N1, N2, A, strideA, offsetA, DTRD1, DTRD2, index, strideIndex, offsetIndex ) +#### dlamrg.ndarray( N1, N2, A, sA, oA, DTRD1, DTRD2, index, sIndex, oIndex ) Generates a permutation list to merge the entries of two independently sorted sets into a single set sorted in ascending order. @@ -91,10 +91,10 @@ dlamrg.ndarray( 2, 3, A, 1, 0, 1, 1, index, 1, 0 ); The function has the following additional parameters: -- **strideA**: stride length for `A`. -- **offsetA**: starting index of `A`. -- **strideIndex**: stride length for `index`. -- **offsetIndex**: starting index of `index`. +- **sA**: stride length for `A`. +- **oA**: starting index of `A`. +- **sIndex**: stride length for `index`. +- **oIndex**: starting index of `index`. 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, diff --git a/lib/node_modules/@stdlib/lapack/base/dlamrg/benchmark/benchmark.js b/lib/node_modules/@stdlib/lapack/base/dlamrg/benchmark/benchmark.js index 795767b23cb3..4745e2403c7d 100644 --- a/lib/node_modules/@stdlib/lapack/base/dlamrg/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/lapack/base/dlamrg/benchmark/benchmark.js @@ -27,6 +27,7 @@ var pow = require( '@stdlib/math/base/special/pow' ); var randu = require( '@stdlib/random/base/randu' ); var Int32Array = require( '@stdlib/array/int32' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var merge = require( '@stdlib/utils/merge' ); var pkg = require( './../package.json' ).name; var dlamrg = require( './../lib/dlamrg.js' ); @@ -62,7 +63,7 @@ function createBenchmark( len ) { return b - a; } - A = A1.concat(A2); + A = merge( A1, A2 ); return benchmark; /** diff --git a/lib/node_modules/@stdlib/lapack/base/dlamrg/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dlamrg/benchmark/benchmark.ndarray.js index 5385a109d95f..cba1275697bd 100644 --- a/lib/node_modules/@stdlib/lapack/base/dlamrg/benchmark/benchmark.ndarray.js +++ b/lib/node_modules/@stdlib/lapack/base/dlamrg/benchmark/benchmark.ndarray.js @@ -27,6 +27,7 @@ var pow = require( '@stdlib/math/base/special/pow' ); var randu = require( '@stdlib/random/base/randu' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var Int32Array = require( '@stdlib/array/int32' ); +var merge = require( '@stdlib/utils/merge' ); var pkg = require( './../package.json' ).name; var dlamrg = require( './../lib/ndarray.js' ); @@ -62,7 +63,7 @@ function createBenchmark( len ) { return b - a; } - A = A1.concat(A2); + A = merge( A1, A2 ); return benchmark; /** From 439116bcdeecc610156b4e7347d50810bf4c0c59 Mon Sep 17 00:00:00 2001 From: Prajjwal Bajpai Date: Mon, 19 Jan 2026 22:14:40 +0530 Subject: [PATCH 3/4] fix: missing imports in examples in `README.md` --- 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: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- lib/node_modules/@stdlib/lapack/base/dlamrg/README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/node_modules/@stdlib/lapack/base/dlamrg/README.md b/lib/node_modules/@stdlib/lapack/base/dlamrg/README.md index 3472bd105332..452863c5dacd 100644 --- a/lib/node_modules/@stdlib/lapack/base/dlamrg/README.md +++ b/lib/node_modules/@stdlib/lapack/base/dlamrg/README.md @@ -37,6 +37,7 @@ Generates a permutation list to merge the entries of two independently sorted se ```javascript var Float64Array = require( '@stdlib/array/float64' ); var Int32Array = require( '@stdlib/array/int32' ); +var dlamrg = require( '@stdlib/lapack/base/dlamrg' ); var A = new Float64Array( [ 1.0, 3.0, 2.0, 4.0, 5.0 ] ); var index = new Int32Array( 5 ); @@ -60,6 +61,7 @@ Note that indexing is relative to the first index. To introduce an offset, use [ ```javascript var Float64Array = require( '@stdlib/array/float64' ); var Int32Array = require( '@stdlib/array/int32' ); +var dlamrg = require( '@stdlib/lapack/base/dlamrg' ); var A = new Float64Array( [ 1.0, 3.0, 2.0, 4.0, 5.0 ] ); @@ -82,6 +84,7 @@ Generates a permutation list to merge the entries of two independently sorted se ```javascript var Float64Array = require( '@stdlib/array/float64' ); var Int32Array = require( '@stdlib/array/int32' ); +var dlamrg = require( '@stdlib/lapack/base/dlamrg' ); var A = new Float64Array( [ 1.0, 3.0, 2.0, 4.0, 5.0 ] ); var index = new Int32Array( 5 ); @@ -101,6 +104,7 @@ While [`typed array`][mdn-typed-array] views mandate a view offset based on the ```javascript var Float64Array = require( '@stdlib/array/float64' ); var Int32Array = require( '@stdlib/array/int32' ); +var dlamrg = require( '@stdlib/lapack/base/dlamrg' ); var A = new Float64Array( [ 999.9, 1.0, 3.0, 2.0, 4.0, 5.0 ] ); var index = new Int32Array( 6 ); @@ -131,6 +135,7 @@ dlamrg.ndarray( 2, 3, A, 1, 1, 1, 1, index, 1, 1 ); ```javascript var Float64Array = require( '@stdlib/array/float64' ); var Int32Array = require( '@stdlib/array/int32' ); +var dlamrg = require( '@stdlib/lapack/base/dlamrg' ); var A = new Float64Array( [ 1.0, 3.0, 2.0, 4.0, 5.0 ] ); var index = new Int32Array( 5 ); From 00efa662de177db4a27a158d51df8400126b156d Mon Sep 17 00:00:00 2001 From: Prajjwal Bajpai Date: Tue, 20 Jan 2026 22:27:13 +0530 Subject: [PATCH 4/4] fix: lint warnings --- 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: passed - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/lapack/base/dlamrg/benchmark/benchmark.js | 3 ++- .../@stdlib/lapack/base/dlamrg/benchmark/benchmark.ndarray.js | 3 ++- lib/node_modules/@stdlib/lapack/base/dlamrg/lib/base.js | 2 +- lib/node_modules/@stdlib/lapack/base/dlamrg/lib/ndarray.js | 4 ++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/node_modules/@stdlib/lapack/base/dlamrg/benchmark/benchmark.js b/lib/node_modules/@stdlib/lapack/base/dlamrg/benchmark/benchmark.js index 4745e2403c7d..86e6235b49af 100644 --- a/lib/node_modules/@stdlib/lapack/base/dlamrg/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/lapack/base/dlamrg/benchmark/benchmark.js @@ -28,6 +28,7 @@ var randu = require( '@stdlib/random/base/randu' ); var Int32Array = require( '@stdlib/array/int32' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var merge = require( '@stdlib/utils/merge' ); +var format = require( '@stdlib/string/format' ); var pkg = require( './../package.json' ).name; var dlamrg = require( './../lib/dlamrg.js' ); @@ -112,7 +113,7 @@ function main() { for ( i = min; i <= max; i++ ) { len = pow( 10, i ); f = createBenchmark( len ); - bench( pkg+':len='+len, f ); + bench( format( '%s:len=%d', pkg, len ), f ); } } diff --git a/lib/node_modules/@stdlib/lapack/base/dlamrg/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/lapack/base/dlamrg/benchmark/benchmark.ndarray.js index cba1275697bd..c06be054325f 100644 --- a/lib/node_modules/@stdlib/lapack/base/dlamrg/benchmark/benchmark.ndarray.js +++ b/lib/node_modules/@stdlib/lapack/base/dlamrg/benchmark/benchmark.ndarray.js @@ -28,6 +28,7 @@ var randu = require( '@stdlib/random/base/randu' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var Int32Array = require( '@stdlib/array/int32' ); var merge = require( '@stdlib/utils/merge' ); +var format = require( '@stdlib/string/format' ); var pkg = require( './../package.json' ).name; var dlamrg = require( './../lib/ndarray.js' ); @@ -112,7 +113,7 @@ function main() { for ( i = min; i <= max; i++ ) { len = pow( 10, i ); f = createBenchmark( len ); - bench( pkg+':len='+len, f ); + bench( format( '%s:len=%d', pkg, len ), f ); } } diff --git a/lib/node_modules/@stdlib/lapack/base/dlamrg/lib/base.js b/lib/node_modules/@stdlib/lapack/base/dlamrg/lib/base.js index 8397f6d982c9..df69bcde1426 100644 --- a/lib/node_modules/@stdlib/lapack/base/dlamrg/lib/base.js +++ b/lib/node_modules/@stdlib/lapack/base/dlamrg/lib/base.js @@ -51,7 +51,7 @@ * dlamrg( 2, 3, A, 1, 0, 1, 1, index, 1, 0 ); * // index => [ 0, 2, 1, 3, 4 ] */ -function dlamrg( N1, N2, A, strideA, offsetA, DTRD1, DTRD2, index, strideIndex, offsetIndex ) { +function dlamrg( N1, N2, A, strideA, offsetA, DTRD1, DTRD2, index, strideIndex, offsetIndex ) { // eslint-disable-line max-len var ind1; var ind2; var n1sv; diff --git a/lib/node_modules/@stdlib/lapack/base/dlamrg/lib/ndarray.js b/lib/node_modules/@stdlib/lapack/base/dlamrg/lib/ndarray.js index 1e95088273c7..8521771eb755 100644 --- a/lib/node_modules/@stdlib/lapack/base/dlamrg/lib/ndarray.js +++ b/lib/node_modules/@stdlib/lapack/base/dlamrg/lib/ndarray.js @@ -59,14 +59,14 @@ var base = require( './base.js' ); * dlamrg( 2, 3, A, 1, 0, 1, 1, index, 1, 0 ); * // index => [ 0, 2, 1, 3, 4 ] */ -function dlamrg( N1, N2, A, strideA, offsetA, DTRD1, DTRD2, index, strideIndex, offsetIndex ) { +function dlamrg( N1, N2, A, strideA, offsetA, DTRD1, DTRD2, index, strideIndex, offsetIndex ) { // eslint-disable-line max-len if ( N1 < 0 ) { throw new RangeError( format( 'invalid argument. First argument must be a nonnegative integer. Value: `%d`.', N1 ) ); } if ( N2 < 0 ) { throw new RangeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%d`.', N2 ) ); } - return base( N1, N2, A, strideA, offsetA, DTRD1, DTRD2, index, strideIndex, offsetIndex ); + return base( N1, N2, A, strideA, offsetA, DTRD1, DTRD2, index, strideIndex, offsetIndex ); // eslint-disable-line max-len }