From 96aa3017128156f57e44b75137eaef3251adc212 Mon Sep 17 00:00:00 2001 From: headlessNode Date: Sat, 4 Jul 2026 20:21:51 +0500 Subject: [PATCH 1/7] feat: add blas/ext/base/gfirst-index-equal --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown_pkg_readmes status: passed - task: lint_markdown_docs status: na - task: lint_markdown status: na - 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 --- --- .../ext/base/gfirst-index-equal/README.md | 201 +++++++++++++++ .../gfirst-index-equal/benchmark/benchmark.js | 99 ++++++++ .../benchmark/benchmark.ndarray.js | 99 ++++++++ .../ext/base/gfirst-index-equal/docs/repl.txt | 88 +++++++ .../gfirst-index-equal/docs/types/index.d.ts | 116 +++++++++ .../gfirst-index-equal/docs/types/test.ts | 237 ++++++++++++++++++ .../base/gfirst-index-equal/examples/index.js | 35 +++ .../base/gfirst-index-equal/lib/accessors.js | 82 ++++++ .../ext/base/gfirst-index-equal/lib/index.js | 59 +++++ .../ext/base/gfirst-index-equal/lib/main.js | 53 ++++ .../base/gfirst-index-equal/lib/ndarray.js | 78 ++++++ .../ext/base/gfirst-index-equal/package.json | 66 +++++ .../ext/base/gfirst-index-equal/test/test.js | 38 +++ .../base/gfirst-index-equal/test/test.main.js | 221 ++++++++++++++++ .../gfirst-index-equal/test/test.ndarray.js | 221 ++++++++++++++++ 15 files changed, 1693 insertions(+) create mode 100644 lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/README.md create mode 100644 lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/benchmark/benchmark.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/examples/index.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/lib/accessors.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/lib/index.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/lib/main.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/lib/ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/package.json create mode 100644 lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/test/test.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/test/test.main.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/test/test.ndarray.js diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/README.md b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/README.md new file mode 100644 index 000000000000..673c71de5595 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/README.md @@ -0,0 +1,201 @@ + + +# gfirstIndexEqual + +> Return the index of the first element in a strided array equal to an element in another strided array. + + + +
+ +
+ + + + + +
+ +## Usage + +```javascript +var gfirstIndexEqual = require( '@stdlib/blas/ext/base/gfirst-index-equal' ); +``` + +#### gfirstIndexEqual( N, x, strideX, y, strideY ) + +Returns the index of the first element in a strided array equal to an element in another strided array. + +```javascript +var x = [ 1.0, 2.0, 3.0, 4.0 ]; +var y = [ 0.0, 0.0, 3.0, 0.0 ]; + +var idx = gfirstIndexEqual( x.length, x, 1, y, 1 ); +// returns 2 +``` + +The function has the following parameters: + +- **N**: number of indexed elements. +- **x**: first input array. +- **strideX**: stride length for `x`. +- **y**: second input array. +- **strideY**: stride length for `y`. + +If the function is unable to find matching elements, the function returns `-1`. + +```javascript +var x = [ 1.0, 2.0, 3.0, 4.0 ]; +var y = [ 5.0, 6.0, 7.0, 8.0 ]; + +var idx = gfirstIndexEqual( x.length, x, 1, y, 1 ); +// returns -1 +``` + +The `N` and stride parameters determine which elements in the strided arrays are accessed at runtime. For example, to compare every other element: + +```javascript +var x = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ]; +var y = [ 0.0, 0.0, 3.0, 0.0, 0.0, 0.0 ]; + +var idx = gfirstIndexEqual( 3, x, 2, y, 2 ); +// returns 1 +``` + +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 x0 = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); +var y0 = new Float64Array( [ 0.0, 0.0, 3.0, 0.0 ] ); + +// Create offset views... +var x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element +var y1 = new Float64Array( y0.buffer, y0.BYTES_PER_ELEMENT*1 ); // start at 2nd element + +// Find index... +var idx = gfirstIndexEqual( 2, x1, 1, y1, 1 ); +// returns 1 +``` + +#### gfirstIndexEqual.ndarray( N, x, strideX, offsetX, y, strideY, offsetY ) + +Returns the index of the first element in a strided array equal to an element in another strided array using alternative indexing semantics. + +```javascript +var x = [ 1.0, 2.0, 3.0, 4.0 ]; +var y = [ 0.0, 0.0, 3.0, 0.0 ]; + +var idx = gfirstIndexEqual.ndarray( x.length, x, 1, 0, y, 1, 0 ); +// returns 2 +``` + +The function has the following additional parameters: + +- **offsetX**: starting index for `x`. +- **offsetY**: starting index for `y`. + +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, to access only the last three elements of each strided array: + +```javascript +var x = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ]; +var y = [ 0.0, 0.0, 0.0, 4.0, 5.0, 6.0 ]; + +var idx = gfirstIndexEqual.ndarray( 3, x, 1, x.length-3, y, 1, y.length-3 ); +// returns 0 +``` + +
+ + + + + +
+ +## Notes + +- When comparing elements, the function checks for equality using the strict equality operator `===`. As a consequence, `NaN` values are considered distinct, and `-0` and `+0` are considered the same. +- Both functions support array-like objects having getter and setter accessors for array element access (e.g., [`@stdlib/array/base/accessor`][@stdlib/array/base/accessor]). + +
+ + + + + +
+ +## Examples + + + +```javascript +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var gfirstIndexEqual = require( '@stdlib/blas/ext/base/gfirst-index-equal' ); + +var x = discreteUniform( 10, -100, 100, { + 'dtype': 'generic' +}); +console.log( x ); + +var y = discreteUniform( 10, -100, 100, { + 'dtype': 'generic' +}); +console.log( y ); + +var idx = gfirstIndexEqual( x.length, x, 1, y, 1 ); +console.log( idx ); +``` + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/benchmark/benchmark.js new file mode 100644 index 000000000000..7bdb57c00288 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/benchmark/benchmark.js @@ -0,0 +1,99 @@ +/** +* @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 pow = require( '@stdlib/math/base/special/pow' ); +var isInteger = require( '@stdlib/assert/is-integer' ).isPrimitive; +var oneTo = require( '@stdlib/array/one-to' ); +var zeros = require( '@stdlib/array/zeros' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; +var gfirstIndexEqual = require( './../lib' ); + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( len ) { + var x = oneTo( len, 'float64' ); + var y = zeros( len, 'float64' ); + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var out; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = gfirstIndexEqual( x.length, x, 1, y, 1 ); + if ( out !== out ) { + b.fail( 'should return an integer' ); + } + } + b.toc(); + if ( !isInteger( out ) ) { + b.fail( 'should return an integer' ); + } + 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( format( '%s:len=%d', pkg, len ), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/benchmark/benchmark.ndarray.js new file mode 100644 index 000000000000..62c17322655f --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/benchmark/benchmark.ndarray.js @@ -0,0 +1,99 @@ +/** +* @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 pow = require( '@stdlib/math/base/special/pow' ); +var isInteger = require( '@stdlib/assert/is-integer' ).isPrimitive; +var oneTo = require( '@stdlib/array/one-to' ); +var zeros = require( '@stdlib/array/zeros' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; +var gfirstIndexEqual = require( './../lib/ndarray.js' ); + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( len ) { + var x = oneTo( len, 'float64' ); + var y = zeros( len, 'float64' ); + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var out; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = gfirstIndexEqual( x.length, x, 1, 0, y, 1, 0 ); + if ( out !== out ) { + b.fail( 'should return an integer' ); + } + } + b.toc(); + if ( !isInteger( out ) ) { + b.fail( 'should return an integer' ); + } + 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( format( '%s:ndarray:len=%d', pkg, len ), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/docs/repl.txt b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/docs/repl.txt new file mode 100644 index 000000000000..3b2e1532c31d --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/docs/repl.txt @@ -0,0 +1,88 @@ + +{{alias}}( N, x, strideX, y, strideY ) + Returns the index of the first element in a strided array equal to an + element in another strided array. + + The `N` and stride parameters determine which elements in the strided arrays + are accessed at runtime. + + Indexing is relative to the first index. To introduce an offset, use a typed + array view. + + If `N <= 0`, the function returns `-1`. + + Parameters + ---------- + N: integer + Number of indexed elements. + + x: Array|TypedArray + First input array. + + strideX: integer + Stride length for `x`. + + y: Array|TypedArray + Second input array. + + strideY: integer + Stride length for `y`. + + Returns + ------- + idx: integer + Index. + + Examples + -------- + > var x = [ 1.0, 2.0, 3.0, 4.0 ]; + > var y = [ 0.0, 0.0, 3.0, 0.0 ]; + > var idx = {{alias}}( x.length, x, 1, y, 1 ) + 2 + + +{{alias}}.ndarray( N, x, strideX, offsetX, y, strideY, offsetY ) + Returns the index of the first element in a strided array equal to an + element in another strided array 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 + ---------- + N: integer + Number of indexed elements. + + x: Array|TypedArray + First input array. + + strideX: integer + Stride length for `x`. + + offsetX: integer + Starting index for `x`. + + y: Array|TypedArray + Second input array. + + strideY: integer + Stride length for `y`. + + offsetY: integer + Starting index for `y`. + + Returns + ------- + idx: integer + Index. + + Examples + -------- + > var x = [ 1.0, 2.0, 3.0, 4.0 ]; + > var y = [ 0.0, 0.0, 3.0, 0.0 ]; + > var idx = {{alias}}.ndarray( x.length, x, 1, 0, y, 1, 0 ) + 2 + + See Also + -------- diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/docs/types/index.d.ts new file mode 100644 index 000000000000..5b0fdf393238 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/docs/types/index.d.ts @@ -0,0 +1,116 @@ +/* +* @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 { Collection, AccessorArrayLike } from '@stdlib/types/array'; + +/** +* Input array. +*/ +type InputArray = Collection | AccessorArrayLike; + +/** +* Interface describing `gfirstIndexEqual`. +*/ +interface Routine { + /** + * Returns the index of the first element in a strided array equal to an element in another strided array. + * + * ## Notes + * + * - If the function is unable to find matching elements, the function returns `-1`. + * + * @param N - number of indexed elements + * @param x - first input array + * @param strideX - stride length for `x` + * @param y - second input array + * @param strideY - stride length for `y` + * @returns index + * + * @example + * var x = [ 1.0, 2.0, 3.0, 4.0 ]; + * var y = [ 0.0, 0.0, 3.0, 0.0 ]; + * + * var idx = gfirstIndexEqual( x.length, x, 1, y, 1 ); + * // returns 2 + */ + ( N: number, x: InputArray, strideX: number, y: InputArray, strideY: number ): number; + + /** + * Returns the index of the first element in a strided array equal to an element in another strided array using alternative indexing semantics. + * + * ## Notes + * + * - If the function is unable to find matching elements, the function returns `-1`. + * + * @param N - number of indexed elements + * @param x - first input array + * @param strideX - stride length for `x` + * @param offsetX - starting index for `x` + * @param y - second input array + * @param strideY - stride length for `y` + * @param offsetY - starting index for `y` + * @returns index + * + * @example + * var x = [ 1.0, 2.0, 3.0, 4.0 ]; + * var y = [ 0.0, 0.0, 3.0, 0.0 ]; + * + * var idx = gfirstIndexEqual.ndarray( x.length, x, 1, 0, y, 1, 0 ); + * // returns 2 + */ + ndarray( N: number, x: InputArray, strideX: number, offsetX: number, y: InputArray, strideY: number, offsetY: number ): number; +} + +/** +* Returns the index of the first element in a strided array equal to an element in another strided array. +* +* ## Notes +* +* - If the function is unable to find matching elements, the function returns `-1`. +* +* @param N - number of indexed elements +* @param x - first input array +* @param strideX - stride length for `x` +* @param y - second input array +* @param strideY - stride length for `y` +* @returns index +* +* @example +* var x = [ 1.0, 2.0, 3.0, 4.0 ]; +* var y = [ 0.0, 0.0, 3.0, 0.0 ]; +* +* var idx = gfirstIndexEqual( x.length, x, 1, y, 1 ); +* // returns 2 +* +* @example +* var x = [ 1.0, 2.0, 3.0, 4.0 ]; +* var y = [ 0.0, 0.0, 3.0, 0.0 ]; +* +* var idx = gfirstIndexEqual.ndarray( x.length, x, 1, 0, y, 1, 0 ); +* // returns 2 +*/ +declare var gfirstIndexEqual: Routine; + + +// EXPORTS // + +export = gfirstIndexEqual; diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/docs/types/test.ts b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/docs/types/test.ts new file mode 100644 index 000000000000..8da76e28001e --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/docs/types/test.ts @@ -0,0 +1,237 @@ +/* +* @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. +*/ + +import AccessorArray = require( '@stdlib/array/base/accessor' ); +import gfirstIndexEqual = require( './index' ); + + +// TESTS // + +// The function returns a number... +{ + var x = [ 1.0, 2.0, 3.0 ]; + var y = [ 1.0, 2.0, 3.0 ]; + + gfirstIndexEqual( x.length, x, 1, y, 1 ); // $ExpectType number + gfirstIndexEqual( x.length, new AccessorArray( x ), 1, new AccessorArray( y ), 1 ); // $ExpectType number +} + +// The compiler throws an error if the function is provided a first argument which is not a number... +{ + var x = [ 1.0, 2.0, 3.0 ]; + var y = [ 1.0, 2.0, 3.0 ]; + + gfirstIndexEqual( '1', x, 1, y, 1 ); // $ExpectError + gfirstIndexEqual( true, x, 1, y, 1 ); // $ExpectError + gfirstIndexEqual( false, x, 1, y, 1 ); // $ExpectError + gfirstIndexEqual( null, x, 1, y, 1 ); // $ExpectError + gfirstIndexEqual( undefined, x, 1, y, 1 ); // $ExpectError + gfirstIndexEqual( [], x, 1, y, 1 ); // $ExpectError + gfirstIndexEqual( {}, x, 1, y, 1 ); // $ExpectError + gfirstIndexEqual( ( x: number ): number => x, x, 1, y, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a second argument which is not a collection... +{ + var y = [ 1.0, 2.0, 3.0 ]; + + gfirstIndexEqual( 3, 10, 1, y, 1 ); // $ExpectError + gfirstIndexEqual( 3, true, 1, y, 1 ); // $ExpectError + gfirstIndexEqual( 3, false, 1, y, 1 ); // $ExpectError + gfirstIndexEqual( 3, null, 1, y, 1 ); // $ExpectError + gfirstIndexEqual( 3, undefined, 1, y, 1 ); // $ExpectError + gfirstIndexEqual( 3, {}, 1, y, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a third argument which is not a number... +{ + var x = [ 1.0, 2.0, 3.0 ]; + var y = [ 1.0, 2.0, 3.0 ]; + + gfirstIndexEqual( x.length, x, '1', y, 1 ); // $ExpectError + gfirstIndexEqual( x.length, x, true, y, 1 ); // $ExpectError + gfirstIndexEqual( x.length, x, false, y, 1 ); // $ExpectError + gfirstIndexEqual( x.length, x, null, y, 1 ); // $ExpectError + gfirstIndexEqual( x.length, x, undefined, y, 1 ); // $ExpectError + gfirstIndexEqual( x.length, x, [], y, 1 ); // $ExpectError + gfirstIndexEqual( x.length, x, {}, y, 1 ); // $ExpectError + gfirstIndexEqual( x.length, x, ( x: number ): number => x, y, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fourth argument which is not a collection... +{ + var x = [ 1.0, 2.0, 3.0 ]; + + gfirstIndexEqual( x.length, x, 1, 10, 1 ); // $ExpectError + gfirstIndexEqual( x.length, x, 1, true, 1 ); // $ExpectError + gfirstIndexEqual( x.length, x, 1, false, 1 ); // $ExpectError + gfirstIndexEqual( x.length, x, 1, null, 1 ); // $ExpectError + gfirstIndexEqual( x.length, x, 1, undefined, 1 ); // $ExpectError + gfirstIndexEqual( x.length, x, 1, {}, 1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fifth argument which is not a number... +{ + var x = [ 1.0, 2.0, 3.0 ]; + var y = [ 1.0, 2.0, 3.0 ]; + + gfirstIndexEqual( x.length, x, 1, y, '1' ); // $ExpectError + gfirstIndexEqual( x.length, x, 1, y, true ); // $ExpectError + gfirstIndexEqual( x.length, x, 1, y, false ); // $ExpectError + gfirstIndexEqual( x.length, x, 1, y, null ); // $ExpectError + gfirstIndexEqual( x.length, x, 1, y, undefined ); // $ExpectError + gfirstIndexEqual( x.length, x, 1, y, [] ); // $ExpectError + gfirstIndexEqual( x.length, x, 1, y, {} ); // $ExpectError + gfirstIndexEqual( x.length, x, 1, y, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + var x = [ 1.0, 2.0, 3.0 ]; + var y = [ 1.0, 2.0, 3.0 ]; + + gfirstIndexEqual(); // $ExpectError + gfirstIndexEqual( 3 ); // $ExpectError + gfirstIndexEqual( 3, x ); // $ExpectError + gfirstIndexEqual( 3, x, 1 ); // $ExpectError + gfirstIndexEqual( 3, x, 1, y ); // $ExpectError + gfirstIndexEqual( 3, x, 1, y, 1, 0 ); // $ExpectError +} + +// Attached to main export is an `ndarray` method which returns a number... +{ + var x = [ 1.0, 2.0, 3.0 ]; + var y = [ 1.0, 2.0, 3.0 ]; + + gfirstIndexEqual.ndarray( x.length, x, 1, 0, y, 1, 0 ); // $ExpectType number + gfirstIndexEqual.ndarray( x.length, new AccessorArray( x ), 1, 0, new AccessorArray( y ), 1, 0 ); // $ExpectType number +} + +// The compiler throws an error if the `ndarray` method is provided a first argument which is not a number... +{ + var x = [ 1.0, 2.0, 3.0 ]; + var y = [ 1.0, 2.0, 3.0 ]; + + gfirstIndexEqual.ndarray( '1', x, 1, 0, y, 1, 0 ); // $ExpectError + gfirstIndexEqual.ndarray( true, x, 1, 0, y, 1, 0 ); // $ExpectError + gfirstIndexEqual.ndarray( false, x, 1, 0, y, 1, 0 ); // $ExpectError + gfirstIndexEqual.ndarray( null, x, 1, 0, y, 1, 0 ); // $ExpectError + gfirstIndexEqual.ndarray( undefined, x, 1, 0, y, 1, 0 ); // $ExpectError + gfirstIndexEqual.ndarray( [], x, 1, 0, y, 1, 0 ); // $ExpectError + gfirstIndexEqual.ndarray( {}, x, 1, 0, y, 1, 0 ); // $ExpectError + gfirstIndexEqual.ndarray( ( x: number ): number => x, x, 1, 0, y, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a second argument which is not a collection... +{ + var y = [ 1.0, 2.0, 3.0 ]; + + gfirstIndexEqual.ndarray( 3, 10, 1, 0, y, 1, 0 ); // $ExpectError + gfirstIndexEqual.ndarray( 3, true, 1, 0, y, 1, 0 ); // $ExpectError + gfirstIndexEqual.ndarray( 3, false, 1, 0, y, 1, 0 ); // $ExpectError + gfirstIndexEqual.ndarray( 3, null, 1, 0, y, 1, 0 ); // $ExpectError + gfirstIndexEqual.ndarray( 3, undefined, 1, 0, y, 1, 0 ); // $ExpectError + gfirstIndexEqual.ndarray( 3, {}, 1, 0, y, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a third argument which is not a number... +{ + var x = [ 1.0, 2.0, 3.0 ]; + var y = [ 1.0, 2.0, 3.0 ]; + + gfirstIndexEqual.ndarray( x.length, x, '1', 0, y, 1, 0 ); // $ExpectError + gfirstIndexEqual.ndarray( x.length, x, true, 0, y, 1, 0 ); // $ExpectError + gfirstIndexEqual.ndarray( x.length, x, false, 0, y, 1, 0 ); // $ExpectError + gfirstIndexEqual.ndarray( x.length, x, null, 0, y, 1, 0 ); // $ExpectError + gfirstIndexEqual.ndarray( x.length, x, undefined, 0, y, 1, 0 ); // $ExpectError + gfirstIndexEqual.ndarray( x.length, x, [], 0, y, 1, 0 ); // $ExpectError + gfirstIndexEqual.ndarray( x.length, x, {}, 0, y, 1, 0 ); // $ExpectError + gfirstIndexEqual.ndarray( x.length, x, ( x: number ): number => x, 0, y, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a fourth argument which is not a number... +{ + var x = [ 1.0, 2.0, 3.0 ]; + var y = [ 1.0, 2.0, 3.0 ]; + + gfirstIndexEqual.ndarray( x.length, x, 1, '1', y, 1, 0 ); // $ExpectError + gfirstIndexEqual.ndarray( x.length, x, 1, true, y, 1, 0 ); // $ExpectError + gfirstIndexEqual.ndarray( x.length, x, 1, false, y, 1, 0 ); // $ExpectError + gfirstIndexEqual.ndarray( x.length, x, 1, null, y, 1, 0 ); // $ExpectError + gfirstIndexEqual.ndarray( x.length, x, 1, undefined, y, 1, 0 ); // $ExpectError + gfirstIndexEqual.ndarray( x.length, x, 1, [], y, 1, 0 ); // $ExpectError + gfirstIndexEqual.ndarray( x.length, x, 1, {}, y, 1, 0 ); // $ExpectError + gfirstIndexEqual.ndarray( x.length, x, 1, ( x: number ): number => x, y, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a fifth argument which is not a collection... +{ + var x = [ 1.0, 2.0, 3.0 ]; + + gfirstIndexEqual.ndarray( x.length, x, 1, 0, 10, 1, 0 ); // $ExpectError + gfirstIndexEqual.ndarray( x.length, x, 1, 0, true, 1, 0 ); // $ExpectError + gfirstIndexEqual.ndarray( x.length, x, 1, 0, false, 1, 0 ); // $ExpectError + gfirstIndexEqual.ndarray( x.length, x, 1, 0, null, 1, 0 ); // $ExpectError + gfirstIndexEqual.ndarray( x.length, x, 1, 0, undefined, 1, 0 ); // $ExpectError + gfirstIndexEqual.ndarray( x.length, x, 1, 0, {}, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a sixth argument which is not a number... +{ + var x = [ 1.0, 2.0, 3.0 ]; + var y = [ 1.0, 2.0, 3.0 ]; + + gfirstIndexEqual.ndarray( x.length, x, 1, 0, y, '1', 0 ); // $ExpectError + gfirstIndexEqual.ndarray( x.length, x, 1, 0, y, true, 0 ); // $ExpectError + gfirstIndexEqual.ndarray( x.length, x, 1, 0, y, false, 0 ); // $ExpectError + gfirstIndexEqual.ndarray( x.length, x, 1, 0, y, null, 0 ); // $ExpectError + gfirstIndexEqual.ndarray( x.length, x, 1, 0, y, undefined, 0 ); // $ExpectError + gfirstIndexEqual.ndarray( x.length, x, 1, 0, y, [], 0 ); // $ExpectError + gfirstIndexEqual.ndarray( x.length, x, 1, 0, y, {}, 0 ); // $ExpectError + gfirstIndexEqual.ndarray( x.length, x, 1, 0, y, ( x: number ): number => x, 0 ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided a seventh argument which is not a number... +{ + var x = [ 1.0, 2.0, 3.0 ]; + var y = [ 1.0, 2.0, 3.0 ]; + + gfirstIndexEqual.ndarray( x.length, x, 1, 0, y, 1, '1' ); // $ExpectError + gfirstIndexEqual.ndarray( x.length, x, 1, 0, y, 1, true ); // $ExpectError + gfirstIndexEqual.ndarray( x.length, x, 1, 0, y, 1, false ); // $ExpectError + gfirstIndexEqual.ndarray( x.length, x, 1, 0, y, 1, null ); // $ExpectError + gfirstIndexEqual.ndarray( x.length, x, 1, 0, y, 1, undefined ); // $ExpectError + gfirstIndexEqual.ndarray( x.length, x, 1, 0, y, 1, [] ); // $ExpectError + gfirstIndexEqual.ndarray( x.length, x, 1, 0, y, 1, {} ); // $ExpectError + gfirstIndexEqual.ndarray( x.length, x, 1, 0, y, 1, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided an unsupported number of arguments... +{ + var x = [ 1.0, 2.0, 3.0 ]; + var y = [ 1.0, 2.0, 3.0 ]; + + gfirstIndexEqual.ndarray(); // $ExpectError + gfirstIndexEqual.ndarray( 3 ); // $ExpectError + gfirstIndexEqual.ndarray( 3, x ); // $ExpectError + gfirstIndexEqual.ndarray( 3, x, 1 ); // $ExpectError + gfirstIndexEqual.ndarray( 3, x, 1, 0 ); // $ExpectError + gfirstIndexEqual.ndarray( 3, x, 1, 0, y ); // $ExpectError + gfirstIndexEqual.ndarray( 3, x, 1, 0, y, 1 ); // $ExpectError + gfirstIndexEqual.ndarray( 3, x, 1, 0, y, 1, 0, 10 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/examples/index.js b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/examples/index.js new file mode 100644 index 000000000000..f2b2589ddf6c --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/examples/index.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'; + +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var gfirstIndexEqual = require( './../lib' ); + +var x = discreteUniform( 10, -100, 100, { + 'dtype': 'generic' +}); +console.log( x ); + +var y = discreteUniform( 10, -100, 100, { + 'dtype': 'generic' +}); +console.log( y ); + +var idx = gfirstIndexEqual( x.length, x, 1, y, 1 ); +console.log( idx ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/lib/accessors.js b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/lib/accessors.js new file mode 100644 index 000000000000..7316cee19939 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/lib/accessors.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'; + +// MAIN // + +/** +* Returns the index of the first element in a strided array equal to an element in another strided array. +* +* @private +* @param {PositiveInteger} N - number of indexed elements +* @param {Object} x - first input array object +* @param {Collection} x.data - first input array data +* @param {Array} x.accessors - first array element accessors +* @param {integer} strideX - stride length for `x` +* @param {NonNegativeInteger} offsetX - starting index for `x` +* @param {Object} y - second input array object +* @param {Collection} y.data - second input array data +* @param {Array} y.accessors - second array element accessors +* @param {integer} strideY - stride length for `y` +* @param {NonNegativeInteger} offsetY - starting index for `y` +* @returns {integer} index +* +* @example +* var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' ); +* var arraylike2object = require( '@stdlib/array/base/arraylike2object' ); +* +* var x = [ 1.0, 2.0, 3.0, 4.0 ]; +* var y = [ 0.0, 0.0, 3.0, 0.0 ]; +* +* var idx = gfirstIndexEqual( x.length, arraylike2object( toAccessorArray( x ) ), 1, 0, arraylike2object( toAccessorArray( y ) ), 1, 0 ); +* // returns 2 +*/ +function gfirstIndexEqual( N, x, strideX, offsetX, y, strideY, offsetY ) { + var xbuf; + var ybuf; + var xget; + var yget; + var ix; + var iy; + var i; + + // Cache reference to array data: + xbuf = x.data; + ybuf = y.data; + + // Cache a reference to the element accessors: + xget = x.accessors[ 0 ]; + yget = y.accessors[ 0 ]; + + ix = offsetX; + iy = offsetY; + for ( i = 0; i < N; i++ ) { + if ( xget( xbuf, ix ) === yget( ybuf, iy ) ) { + return i; + } + ix += strideX; + iy += strideY; + } + return -1; +} + + +// EXPORTS // + +module.exports = gfirstIndexEqual; diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/lib/index.js b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/lib/index.js new file mode 100644 index 000000000000..e39cd3ea7a62 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/lib/index.js @@ -0,0 +1,59 @@ +/** +* @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'; + +/** +* Return the index of the first element in a strided array equal to an element in another strided array. +* +* @module @stdlib/blas/ext/base/gfirst-index-equal +* +* @example +* var gfirstIndexEqual = require( '@stdlib/blas/ext/base/gfirst-index-equal' ); +* +* var x = [ 1.0, 2.0, 3.0, 4.0, 5.0 ]; +* var y = [ 5.0, 4.0, 3.0, 2.0, 1.0 ]; +* +* var idx = gfirstIndexEqual( x.length, x, 1, y, 1 ); +* // returns 2 +* +* @example +* var gfirstIndexEqual = require( '@stdlib/blas/ext/base/gfirst-index-equal' ); +* +* var x = [ 1.0, 2.0, 3.0, 4.0, 5.0 ]; +* var y = [ 5.0, 4.0, 3.0, 2.0, 1.0 ]; +* +* var idx = gfirstIndexEqual.ndarray( x.length, x, 1, 0, y, 1, 0 ); +* // returns 2 +*/ + +// MODULES // + +var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var main = require( './main.js' ); +var ndarray = require( './ndarray.js' ); + + +// MAIN // + +setReadOnly( main, 'ndarray', ndarray ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/lib/main.js b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/lib/main.js new file mode 100644 index 000000000000..20d0f641ccc3 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/lib/main.js @@ -0,0 +1,53 @@ +/** +* @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 stride2offset = require( '@stdlib/strided/base/stride2offset' ); +var ndarray = require( './ndarray.js' ); + + +// MAIN // + +/** +* Returns the index of the first element in a strided array equal to an element in another strided array. +* +* @param {PositiveInteger} N - number of indexed elements +* @param {Collection} x - first input array +* @param {integer} strideX - stride length for `x` +* @param {Collection} y - second input array +* @param {integer} strideY - stride length for `y` +* @returns {integer} index +* +* @example +* var x = [ 1.0, 2.0, 3.0, 4.0 ]; +* var y = [ 0.0, 0.0, 3.0, 0.0 ]; +* +* var idx = gfirstIndexEqual( x.length, x, 1, y, 1 ); +* // returns 2 +*/ +function gfirstIndexEqual( N, x, strideX, y, strideY ) { + return ndarray( N, x, strideX, stride2offset( N, strideX ), y, strideY, stride2offset( N, strideY ) ); // eslint-disable-line max-len +} + + +// EXPORTS // + +module.exports = gfirstIndexEqual; diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/lib/ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/lib/ndarray.js new file mode 100644 index 000000000000..3f4878b01568 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/lib/ndarray.js @@ -0,0 +1,78 @@ +/** +* @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 arraylike2object = require( '@stdlib/array/base/arraylike2object' ); +var accessors = require( './accessors.js' ); + + +// MAIN // + +/** +* Returns the index of the first element in a strided array equal to an element in another strided array using alternative indexing semantics. +* +* @param {PositiveInteger} N - number of indexed elements +* @param {Collection} x - first input array +* @param {integer} strideX - stride length for `x` +* @param {NonNegativeInteger} offsetX - starting index for `x` +* @param {Collection} y - second input array +* @param {integer} strideY - stride length for `y` +* @param {NonNegativeInteger} offsetY - starting index for `y` +* @returns {integer} index +* +* @example +* var x = [ 1.0, 2.0, 3.0, 4.0 ]; +* var y = [ 0.0, 0.0, 3.0, 0.0 ]; +* +* var idx = gfirstIndexEqual( x.length, x, 1, 0, y, 1, 0 ); +* // returns 2 +*/ +function gfirstIndexEqual( N, x, strideX, offsetX, y, strideY, offsetY ) { + var ix; + var iy; + var ox; + var oy; + var i; + + if ( N <= 0 ) { + return -1; + } + ox = arraylike2object( x ); + oy = arraylike2object( y ); + if ( ox.accessorProtocol || oy.accessorProtocol ) { + return accessors( N, ox, strideX, offsetX, oy, strideY, offsetY ); + } + ix = offsetX; + iy = offsetY; + for ( i = 0; i < N; i++ ) { + if ( x[ ix ] === y[ iy ] ) { + return i; + } + ix += strideX; + iy += strideY; + } + return -1; +} + + +// EXPORTS // + +module.exports = gfirstIndexEqual; diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/package.json b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/package.json new file mode 100644 index 000000000000..ddc13f083bf8 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/package.json @@ -0,0 +1,66 @@ +{ + "name": "@stdlib/blas/ext/base/gfirst-index-equal", + "version": "0.0.0", + "description": "Return the index of the first element in a strided array equal to an element in another strided array.", + "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", + "blas", + "extended", + "equal", + "index", + "compare", + "strided", + "array", + "ndarray" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/test/test.js b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/test/test.js new file mode 100644 index 000000000000..39d2e573b87a --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/test/test.js @@ -0,0 +1,38 @@ +/** +* @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 gfirstIndexEqual = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof gfirstIndexEqual, '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 gfirstIndexEqual.ndarray, 'function', 'method is a function' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/test/test.main.js b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/test/test.main.js new file mode 100644 index 000000000000..bf1a836349d9 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/test/test.main.js @@ -0,0 +1,221 @@ +/** +* @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 toAccessorArray = require( '@stdlib/array/base/to-accessor-array' ); +var gfirstIndexEqual = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof gfirstIndexEqual, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 5', function test( t ) { + t.strictEqual( gfirstIndexEqual.length, 5, 'has expected arity' ); + t.end(); +}); + +tape( 'the function returns the first index of an element which equals a corresponding element in another array', function test( t ) { + var actual; + var x; + var y; + + x = [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ]; + y = [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0 ]; + + // Nonnegative stride... + actual = gfirstIndexEqual( x.length, x, 1, y, 1 ); + t.strictEqual( actual, 0, 'returns expected value' ); + + x = [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ]; + y = [ 0.0, 0.0, 2.0, 0.0, 3.0, 0.0 ]; + + actual = gfirstIndexEqual( x.length, x, 1, y, 1 ); + t.strictEqual( actual, 2, 'returns expected value' ); + + x = [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ]; + y = [ 0.0, 0.0, 0.0, 0.0, 3.0, 0.0 ]; + + actual = gfirstIndexEqual( x.length, x, 1, y, 1 ); + t.strictEqual( actual, 4, 'returns expected value' ); + + x = [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ]; + y = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]; + + actual = gfirstIndexEqual( x.length, x, 1, y, 1 ); + t.strictEqual( actual, -1, 'returns expected value' ); + + x = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ]; + y = [ 0.0, 0.0, 3.0, 0.0, 0.0, 0.0 ]; + + actual = gfirstIndexEqual( 3, x, 2, y, 2 ); + t.strictEqual( actual, 1, 'returns expected value' ); + + // Negative stride... + x = [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ]; + y = [ 0.0, 1.0, 0.0, 0.0, 0.0, 0.0 ]; + + actual = gfirstIndexEqual( x.length, x, -1, y, -1 ); + t.strictEqual( actual, 4, 'returns expected value' ); + + x = [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ]; + y = [ 0.0, 0.0, 0.0, 2.0, 0.0, 0.0 ]; + + actual = gfirstIndexEqual( x.length, x, -1, y, -1 ); + t.strictEqual( actual, 2, 'returns expected value' ); + + x = [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ]; + y = [ 0.0, 0.0, 0.0, 0.0, 0.0, 3.0 ]; + + actual = gfirstIndexEqual( x.length, x, -1, y, -1 ); + t.strictEqual( actual, 0, 'returns expected value' ); + + x = [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ]; + y = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]; + + actual = gfirstIndexEqual( x.length, x, -1, y, -1 ); + t.strictEqual( actual, -1, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns the first index of an element which equals a corresponding element in another array (accessors)', function test( t ) { + var actual; + var x; + var y; + + x = toAccessorArray( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ] ); + y = toAccessorArray( [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0 ] ); + + // Nonnegative stride... + actual = gfirstIndexEqual( x.length, x, 1, y, 1 ); + t.strictEqual( actual, 0, 'returns expected value' ); + + x = toAccessorArray( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ] ); + y = toAccessorArray( [ 0.0, 0.0, 2.0, 0.0, 3.0, 0.0 ] ); + + actual = gfirstIndexEqual( x.length, x, 1, y, 1 ); + t.strictEqual( actual, 2, 'returns expected value' ); + + x = toAccessorArray( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ] ); + y = toAccessorArray( [ 0.0, 0.0, 0.0, 0.0, 3.0, 0.0 ] ); + + actual = gfirstIndexEqual( x.length, x, 1, y, 1 ); + t.strictEqual( actual, 4, 'returns expected value' ); + + x = toAccessorArray( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ] ); + y = toAccessorArray( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + + actual = gfirstIndexEqual( x.length, x, 1, y, 1 ); + t.strictEqual( actual, -1, 'returns expected value' ); + + // Negative stride... + x = toAccessorArray( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ] ); + y = toAccessorArray( [ 0.0, 1.0, 0.0, 0.0, 0.0, 0.0 ] ); + + actual = gfirstIndexEqual( x.length, x, -1, y, -1 ); + t.strictEqual( actual, 4, 'returns expected value' ); + + x = toAccessorArray( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ] ); + y = toAccessorArray( [ 0.0, 0.0, 0.0, 2.0, 0.0, 0.0 ] ); + + actual = gfirstIndexEqual( x.length, x, -1, y, -1 ); + t.strictEqual( actual, 2, 'returns expected value' ); + + x = toAccessorArray( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ] ); + y = toAccessorArray( [ 0.0, 0.0, 0.0, 0.0, 0.0, 3.0 ] ); + + actual = gfirstIndexEqual( x.length, x, -1, y, -1 ); + t.strictEqual( actual, 0, 'returns expected value' ); + + x = toAccessorArray( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ] ); + y = toAccessorArray( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + + actual = gfirstIndexEqual( x.length, x, -1, y, -1 ); + t.strictEqual( actual, -1, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns `-1` if provided `N` parameter is less than or equal to zero', function test( t ) { + var actual; + + actual = gfirstIndexEqual( 0, [ 1.0, 2.0, 3.0 ], 1, [ 1.0, 2.0, 3.0 ], 1 ); + t.strictEqual( actual, -1, 'returns expected value' ); + + actual = gfirstIndexEqual( -1, [ 1.0, 2.0, 3.0 ], 1, [ 1.0, 2.0, 3.0 ], 1 ); + t.strictEqual( actual, -1, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns `-1` if provided `N` parameter is less than or equal to zero (accessors)', function test( t ) { + var actual; + + actual = gfirstIndexEqual( 0, toAccessorArray( [ 1.0, 2.0, 3.0 ] ), 1, toAccessorArray( [ 1.0, 2.0, 3.0 ] ), 1 ); + t.strictEqual( actual, -1, 'returns expected value' ); + + actual = gfirstIndexEqual( -1, toAccessorArray( [ 1.0, 2.0, 3.0 ] ), 1, toAccessorArray( [ 1.0, 2.0, 3.0 ] ), 1 ); + t.strictEqual( actual, -1, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns `-1` if provided a search element equal to `NaN`', function test( t ) { + var actual; + + actual = gfirstIndexEqual( 1, [ NaN ], 1, [ NaN ], 1 ); + t.strictEqual( actual, -1, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns `-1` if provided a search element equal to `NaN` (accessors)', function test( t ) { + var actual; + + actual = gfirstIndexEqual( 1, toAccessorArray( [ NaN ] ), 1, toAccessorArray( [ NaN ] ), 1 ); + t.strictEqual( actual, -1, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function treats -0 and +0 as equal', function test( t ) { + var actual; + + actual = gfirstIndexEqual( 1, [ -0.0 ], 1, [ 0.0 ], 1 ); + t.strictEqual( actual, 0, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function treats -0 and +0 as equal (accessors)', function test( t ) { + var actual; + + actual = gfirstIndexEqual( 1, toAccessorArray( [ -0.0 ] ), 1, toAccessorArray( [ 0.0 ] ), 1 ); + t.strictEqual( actual, 0, 'returns expected value' ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/test/test.ndarray.js new file mode 100644 index 000000000000..7e8e671d0c52 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/test/test.ndarray.js @@ -0,0 +1,221 @@ +/** +* @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 toAccessorArray = require( '@stdlib/array/base/to-accessor-array' ); +var gfirstIndexEqual = require( './../lib/ndarray.js' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof gfirstIndexEqual, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 7', function test( t ) { + t.strictEqual( gfirstIndexEqual.length, 7, 'has expected arity' ); + t.end(); +}); + +tape( 'the function returns the first index of an element which equals a corresponding element in another array', function test( t ) { + var actual; + var x; + var y; + + x = [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ]; + y = [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0 ]; + + // Nonnegative stride... + actual = gfirstIndexEqual( x.length, x, 1, 0, y, 1, 0 ); + t.strictEqual( actual, 0, 'returns expected value' ); + + x = [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ]; + y = [ 0.0, 0.0, 2.0, 0.0, 3.0, 0.0 ]; + + actual = gfirstIndexEqual( x.length-1, x, 1, 1, y, 1, 1 ); + t.strictEqual( actual, 1, 'returns expected value' ); + + x = [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ]; + y = [ 0.0, 0.0, 0.0, 0.0, 3.0, 0.0 ]; + + actual = gfirstIndexEqual( x.length-2, x, 1, 2, y, 1, 2 ); + t.strictEqual( actual, 2, 'returns expected value' ); + + x = [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ]; + y = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]; + + actual = gfirstIndexEqual( x.length-2, x, 1, 2, y, 1, 2 ); + t.strictEqual( actual, -1, 'returns expected value' ); + + x = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ]; + y = [ 0.0, 0.0, 3.0, 0.0, 0.0, 0.0 ]; + + actual = gfirstIndexEqual( 3, x, 2, 0, y, 2, 0 ); + t.strictEqual( actual, 1, 'returns expected value' ); + + // Negative stride... + x = [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ]; + y = [ 0.0, 1.0, 0.0, 0.0, 0.0, 0.0 ]; + + actual = gfirstIndexEqual( x.length, x, -1, x.length-1, y, -1, y.length-1 ); + t.strictEqual( actual, 4, 'returns expected value' ); + + x = [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ]; + y = [ 0.0, 0.0, 0.0, 2.0, 0.0, 0.0 ]; + + actual = gfirstIndexEqual( 3, x, -2, x.length-1, y, -2, y.length-1 ); + t.strictEqual( actual, 1, 'returns expected value' ); + + x = [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ]; + y = [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]; + + actual = gfirstIndexEqual( 3, x, -2, x.length-2, y, -2, y.length-2 ); + t.strictEqual( actual, 2, 'returns expected value' ); + + x = [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ]; + y = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ]; + + actual = gfirstIndexEqual( x.length, x, -1, x.length-1, y, -1, y.length-1 ); + t.strictEqual( actual, -1, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns the first index of an element which equals a corresponding element in another array (accessors)', function test( t ) { + var actual; + var x; + var y; + + x = toAccessorArray( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ] ); + y = toAccessorArray( [ 1.0, 0.0, 2.0, 0.0, 3.0, 0.0 ] ); + + // Nonnegative stride... + actual = gfirstIndexEqual( x.length, x, 1, 0, y, 1, 0 ); + t.strictEqual( actual, 0, 'returns expected value' ); + + x = toAccessorArray( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ] ); + y = toAccessorArray( [ 0.0, 0.0, 2.0, 0.0, 3.0, 0.0 ] ); + + actual = gfirstIndexEqual( x.length, x, 1, 1, y, 1, 1 ); + t.strictEqual( actual, 1, 'returns expected value' ); + + x = toAccessorArray( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ] ); + y = toAccessorArray( [ 0.0, 0.0, 0.0, 0.0, 3.0, 0.0 ] ); + + actual = gfirstIndexEqual( x.length, x, 1, 2, y, 1, 2 ); + t.strictEqual( actual, 2, 'returns expected value' ); + + x = toAccessorArray( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ] ); + y = toAccessorArray( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + + actual = gfirstIndexEqual( x.length-2, x, 1, 2, y, 1, 2 ); + t.strictEqual( actual, -1, 'returns expected value' ); + + // Negative stride... + x = toAccessorArray( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ] ); + y = toAccessorArray( [ 0.0, 1.0, 0.0, 0.0, 0.0, 0.0 ] ); + + actual = gfirstIndexEqual( x.length, x, -1, x.length-1, y, -1, y.length-1 ); + t.strictEqual( actual, 4, 'returns expected value' ); + + x = toAccessorArray( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ] ); + y = toAccessorArray( [ 0.0, 0.0, 0.0, 2.0, 0.0, 0.0 ] ); + + actual = gfirstIndexEqual( 3, x, -2, x.length-1, y, -2, y.length-1 ); + t.strictEqual( actual, 1, 'returns expected value' ); + + x = toAccessorArray( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ] ); + y = toAccessorArray( [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); + + actual = gfirstIndexEqual( 3, x, -2, x.length-2, y, -2, y.length-2 ); + t.strictEqual( actual, 2, 'returns expected value' ); + + x = toAccessorArray( [ 1.0, 2.0, 3.0, 4.0 ] ); + y = toAccessorArray( [ 5.0, 6.0, 7.0, 8.0 ] ); + + actual = gfirstIndexEqual( x.length, x, -1, x.length-1, y, -1, y.length-1 ); + t.strictEqual( actual, -1, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns `-1` if provided an `N` parameter is less than or equal to zero', function test( t ) { + var actual; + + actual = gfirstIndexEqual( 0, [ 1.0, 2.0, 3.0 ], 1, 0, [ 1.0, 2.0, 3.0 ], 1, 0 ); + t.strictEqual( actual, -1, 'returns expected value' ); + + actual = gfirstIndexEqual( -1, [ 1.0, 2.0, 3.0 ], 1, 0, [ 1.0, 2.0, 3.0 ], 1, 0 ); + t.strictEqual( actual, -1, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns `-1` if provided an `N` parameter is less than or equal to zero (accessors)', function test( t ) { + var actual; + + actual = gfirstIndexEqual( 0, toAccessorArray( [ 1.0, 2.0, 3.0 ] ), 1, 0, toAccessorArray( [ 1.0, 2.0, 3.0 ] ), 1, 0 ); + t.strictEqual( actual, -1, 'returns expected value' ); + + actual = gfirstIndexEqual( -1, toAccessorArray( [ 1.0, 2.0, 3.0 ] ), 1, 0, toAccessorArray( [ 1.0, 2.0, 3.0 ] ), 1, 0 ); + t.strictEqual( actual, -1, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns `-1` if provided a search element equal to `NaN`', function test( t ) { + var actual; + + actual = gfirstIndexEqual( 1, [ NaN ], 1, 0, [ NaN ], 1, 0 ); + t.strictEqual( actual, -1, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns `-1` if provided a search element equal to `NaN` (accessors)', function test( t ) { + var actual; + + actual = gfirstIndexEqual( 1, toAccessorArray( [ NaN ] ), 1, 0, toAccessorArray( [ NaN ] ), 1, 0 ); + t.strictEqual( actual, -1, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function treats -0 and +0 as equal', function test( t ) { + var actual; + + actual = gfirstIndexEqual( 1, [ -0.0 ], 1, 0, [ 0.0 ], 1, 0 ); + t.strictEqual( actual, 0, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function treats -0 and +0 as equal (accessors)', function test( t ) { + var actual; + + actual = gfirstIndexEqual( 1, toAccessorArray( [ -0.0 ] ), 1, 0, toAccessorArray( [ 0.0 ] ), 1, 0 ); + t.strictEqual( actual, 0, 'returns expected value' ); + + t.end(); +}); From 3b6eb5b67d207ea72da5fda5955c64477e1c48ea Mon Sep 17 00:00:00 2001 From: headlessNode Date: Sun, 5 Jul 2026 14:22:55 +0500 Subject: [PATCH 2/7] fix: cleanup --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown_pkg_readmes status: na - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: 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: na - task: lint_license_headers status: passed --- --- .../ext/base/gfirst-index-equal/docs/repl.txt | 22 ++ .../base/gfirst-index-equal/test/test.main.js | 219 ++++++++++++++++++ .../gfirst-index-equal/test/test.ndarray.js | 184 +++++++++++++++ 3 files changed, 425 insertions(+) diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/docs/repl.txt b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/docs/repl.txt index 3b2e1532c31d..1b3c2d54936b 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/docs/repl.txt @@ -35,11 +35,26 @@ Examples -------- + // Standard usage: > var x = [ 1.0, 2.0, 3.0, 4.0 ]; > var y = [ 0.0, 0.0, 3.0, 0.0 ]; > var idx = {{alias}}( x.length, x, 1, y, 1 ) 2 + // Using `N` and stride parameters: + > x = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ]; + > y = [ 0.0, 0.0, 3.0, 0.0, 0.0, 0.0 ]; + > idx = {{alias}}( 3, x, 2, y, 2 ) + 1 + + // Using view offsets: + > var x0 = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); + > var y0 = new {{alias:@stdlib/array/float64}}( [ 0.0, 0.0, 3.0, 0.0, 0.0, 0.0 ] ); + > var x1 = new {{alias:@stdlib/array/float64}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); + > var y1 = new {{alias:@stdlib/array/float64}}( y0.buffer, y0.BYTES_PER_ELEMENT*2 ); + > idx = {{alias}}( 3, x1, 2, y1, 2 ) + -1 + {{alias}}.ndarray( N, x, strideX, offsetX, y, strideY, offsetY ) Returns the index of the first element in a strided array equal to an @@ -79,10 +94,17 @@ Examples -------- + // Standard usage: > var x = [ 1.0, 2.0, 3.0, 4.0 ]; > var y = [ 0.0, 0.0, 3.0, 0.0 ]; > var idx = {{alias}}.ndarray( x.length, x, 1, 0, y, 1, 0 ) 2 + // Using offsets: + > x = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ]; + > y = [ 0.0, 0.0, 3.0, 0.0, 0.0, 0.0 ]; + > idx = {{alias}}.ndarray( 3, x, 2, 1, y, 2, 2 ) + -1 + See Also -------- diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/test/test.main.js b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/test/test.main.js index bf1a836349d9..3b92d93ee8a2 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/test/test.main.js +++ b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/test/test.main.js @@ -21,6 +21,7 @@ // MODULES // var tape = require( 'tape' ); +var Float64Array = require( '@stdlib/array/float64' ); var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' ); var gfirstIndexEqual = require( './../lib' ); @@ -219,3 +220,221 @@ tape( 'the function treats -0 and +0 as equal (accessors)', function test( t ) { t.end(); }); + +tape( 'the function supports an `x` stride', function test( t ) { + var actual; + var x; + var y; + + x = [ + 1.0, // 0 + 2.0, + 3.0, // 1 + 4.0, + 5.0 // 2 + ]; + y = [ + 0.0, // 0 + 3.0, // 1 + 0.0, // 2 + 0.0, + 0.0 + ]; + + actual = gfirstIndexEqual( 3, x, 2, y, 1 ); + + t.strictEqual( actual, 1, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports an `x` stride (accessors)', function test( t ) { + var actual; + var x; + var y; + + x = [ + 1.0, // 0 + 2.0, + 3.0, // 1 + 4.0, + 5.0 // 2 + ]; + y = [ + 0.0, // 0 + 3.0, // 1 + 0.0, // 2 + 0.0, + 0.0 + ]; + + actual = gfirstIndexEqual( 3, toAccessorArray( x ), 2, toAccessorArray( y ), 1 ); + + t.strictEqual( actual, 1, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports a `y` stride', function test( t ) { + var actual; + var x; + var y; + + x = [ + 1.0, // 0 + 2.0, // 1 + 3.0, // 2 + 4.0, + 5.0 + ]; + y = [ + 0.0, // 0 + 0.0, + 2.0, // 1 + 0.0, + 0.0 // 2 + ]; + + actual = gfirstIndexEqual( 3, x, 1, y, 2 ); + + t.strictEqual( actual, 1, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports a `y` stride (accessors)', function test( t ) { + var actual; + var x; + var y; + + x = [ + 1.0, // 0 + 2.0, // 1 + 3.0, // 2 + 4.0, + 5.0 + ]; + y = [ + 0.0, // 0 + 0.0, + 2.0, // 1 + 0.0, + 0.0 // 2 + ]; + + actual = gfirstIndexEqual( 3, toAccessorArray( x ), 1, toAccessorArray( y ), 2 ); + + t.strictEqual( actual, 1, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports negative strides', function test( t ) { + var actual; + var x; + var y; + + x = [ + 1.0, // 2 + 2.0, + 3.0, // 1 + 4.0, + 5.0 // 0 + ]; + y = [ + 0.0, // 2 + 3.0, // 1 + 0.0, // 0 + 0.0, + 0.0 + ]; + + actual = gfirstIndexEqual( 3, x, -2, y, -1 ); + + t.strictEqual( actual, 1, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports negative strides (accessors)', function test( t ) { + var actual; + var x; + var y; + + x = [ + 1.0, // 2 + 2.0, + 3.0, // 1 + 4.0, + 5.0 // 0 + ]; + y = [ + 0.0, // 2 + 3.0, // 1 + 0.0, // 0 + 0.0, + 0.0 + ]; + + actual = gfirstIndexEqual( 3, toAccessorArray( x ), -2, toAccessorArray( y ), -1 ); + + t.strictEqual( actual, 1, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports complex access patterns', function test( t ) { + var actual; + var x; + var y; + + x = [ + 1.0, // 0 + 2.0, + 3.0, // 1 + 4.0, + 5.0, // 2 + 6.0 + ]; + y = [ + 5.0, // 0 + 0.0, // 1 + 0.0, // 2 + 0.0, + 0.0, + 0.0 + ]; + + actual = gfirstIndexEqual( 3, x, 2, y, -1 ); + + t.strictEqual( actual, 2, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports view offsets', function test( t ) { + var actual; + var x0; + var y0; + var x1; + var y1; + + // Initial arrays... + x0 = new Float64Array([ + 1.0, + 2.0, // 2 + 3.0, + 4.0, // 1 + 5.0, + 6.0 // 0 + ]); + y0 = new Float64Array([ + 0.0, + 0.0, + 0.0, + 0.0, // 0 + 4.0, // 1 + 0.0 // 2 + ]); + + // Create offset views... + x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // begin at 2nd element + y1 = new Float64Array( y0.buffer, y0.BYTES_PER_ELEMENT*3 ); // begin at the 4th element + + actual = gfirstIndexEqual( 3, x1, -2, y1, 1 ); + t.strictEqual( actual, 1, 'returns expected value' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/test/test.ndarray.js index 7e8e671d0c52..a0a6b7675b9a 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/test/test.ndarray.js @@ -219,3 +219,187 @@ tape( 'the function treats -0 and +0 as equal (accessors)', function test( t ) { t.end(); }); + +tape( 'the function supports an `x` stride', function test( t ) { + var actual; + var x; + var y; + + x = [ + 1.0, // 0 + 2.0, + 3.0, // 1 + 4.0, + 5.0 // 2 + ]; + y = [ + 0.0, // 0 + 3.0, // 1 + 0.0, // 2 + 0.0, + 0.0 + ]; + + actual = gfirstIndexEqual( 3, x, 2, 0, y, 1, 0 ); + + t.strictEqual( actual, 1, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports an `x` stride (accessors)', function test( t ) { + var actual; + var x; + var y; + + x = [ + 1.0, // 0 + 2.0, + 3.0, // 1 + 4.0, + 5.0 // 2 + ]; + y = [ + 0.0, // 0 + 3.0, // 1 + 0.0, // 2 + 0.0, + 0.0 + ]; + + actual = gfirstIndexEqual( 3, toAccessorArray( x ), 2, 0, toAccessorArray( y ), 1, 0 ); + + t.strictEqual( actual, 1, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports a `y` stride', function test( t ) { + var actual; + var x; + var y; + + x = [ + 1.0, // 0 + 2.0, // 1 + 3.0, // 2 + 4.0, + 5.0 + ]; + y = [ + 0.0, // 0 + 0.0, + 2.0, // 1 + 0.0, + 0.0 // 2 + ]; + + actual = gfirstIndexEqual( 3, x, 1, 0, y, 2, 0 ); + + t.strictEqual( actual, 1, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports a `y` stride (accessors)', function test( t ) { + var actual; + var x; + var y; + + x = [ + 1.0, // 0 + 2.0, // 1 + 3.0, // 2 + 4.0, + 5.0 + ]; + y = [ + 0.0, // 0 + 0.0, + 2.0, // 1 + 0.0, + 0.0 // 2 + ]; + + actual = gfirstIndexEqual( 3, toAccessorArray( x ), 1, 0, toAccessorArray( y ), 2, 0 ); + + t.strictEqual( actual, 1, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports negative strides', function test( t ) { + var actual; + var x; + var y; + + x = [ + 1.0, // 2 + 2.0, + 3.0, // 1 + 4.0, + 5.0 // 0 + ]; + y = [ + 0.0, // 2 + 3.0, // 1 + 0.0, // 0 + 0.0, + 0.0 + ]; + + actual = gfirstIndexEqual( 3, x, -2, 4, y, -1, 2 ); + + t.strictEqual( actual, 1, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports negative strides (accessors)', function test( t ) { + var actual; + var x; + var y; + + x = [ + 1.0, // 2 + 2.0, + 3.0, // 1 + 4.0, + 5.0 // 0 + ]; + y = [ + 0.0, // 2 + 3.0, // 1 + 0.0, // 0 + 0.0, + 0.0 + ]; + + actual = gfirstIndexEqual( 3, toAccessorArray( x ), -2, 4, toAccessorArray( y ), -1, 2 ); + + t.strictEqual( actual, 1, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports complex access patterns', function test( t ) { + var actual; + var x; + var y; + + x = [ + 1.0, // 0 + 2.0, + 3.0, // 1 + 4.0, + 5.0, // 2 + 6.0 + ]; + y = [ + 5.0, // 0 + 0.0, // 1 + 0.0, // 2 + 0.0, + 0.0, + 0.0 + ]; + + actual = gfirstIndexEqual( 3, x, 2, 0, y, -1, 2 ); + + t.strictEqual( actual, 2, 'returns expected value' ); + t.end(); +}); From 3dde834e08ce5506f9c347584d8b8f8ba3310faa Mon Sep 17 00:00:00 2001 From: Athan Date: Sun, 5 Jul 2026 04:26:32 -0700 Subject: [PATCH 3/7] Apply suggestions from code review Co-authored-by: Athan Signed-off-by: Athan --- .../@stdlib/blas/ext/base/gfirst-index-equal/README.md | 6 +++--- .../blas/ext/base/gfirst-index-equal/docs/repl.txt | 9 +++++---- .../ext/base/gfirst-index-equal/docs/types/index.d.ts | 6 +++--- .../blas/ext/base/gfirst-index-equal/examples/index.js | 4 ++-- .../blas/ext/base/gfirst-index-equal/lib/accessors.js | 2 +- .../blas/ext/base/gfirst-index-equal/lib/index.js | 2 +- .../@stdlib/blas/ext/base/gfirst-index-equal/lib/main.js | 2 +- .../blas/ext/base/gfirst-index-equal/lib/ndarray.js | 2 +- .../blas/ext/base/gfirst-index-equal/package.json | 2 +- 9 files changed, 18 insertions(+), 17 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/README.md b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/README.md index 673c71de5595..f5927edf4a16 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/README.md +++ b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/README.md @@ -20,7 +20,7 @@ limitations under the License. # gfirstIndexEqual -> Return the index of the first element in a strided array equal to an element in another strided array. +> Return the index of the first element in a strided array equal to a corresponding element in another strided array. @@ -42,7 +42,7 @@ var gfirstIndexEqual = require( '@stdlib/blas/ext/base/gfirst-index-equal' ); #### gfirstIndexEqual( N, x, strideX, y, strideY ) -Returns the index of the first element in a strided array equal to an element in another strided array. +Returns the index of the first element in a strided array equal to a corresponding element in another strided array. ```javascript var x = [ 1.0, 2.0, 3.0, 4.0 ]; @@ -100,7 +100,7 @@ var idx = gfirstIndexEqual( 2, x1, 1, y1, 1 ); #### gfirstIndexEqual.ndarray( N, x, strideX, offsetX, y, strideY, offsetY ) -Returns the index of the first element in a strided array equal to an element in another strided array using alternative indexing semantics. +Returns the index of the first element in a strided array equal to a corresponding element in another strided array using alternative indexing semantics. ```javascript var x = [ 1.0, 2.0, 3.0, 4.0 ]; diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/docs/repl.txt b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/docs/repl.txt index 1b3c2d54936b..8af16549ed83 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/docs/repl.txt @@ -1,7 +1,7 @@ {{alias}}( N, x, strideX, y, strideY ) - Returns the index of the first element in a strided array equal to an - element in another strided array. + Returns the index of the first element in a strided array equal to a + corresponding element in another strided array. The `N` and stride parameters determine which elements in the strided arrays are accessed at runtime. @@ -57,8 +57,9 @@ {{alias}}.ndarray( N, x, strideX, offsetX, y, strideY, offsetY ) - Returns the index of the first element in a strided array equal to an - element in another strided array using alternative indexing semantics. + Returns the index of the first element in a strided array equal to a + corresponding element in another strided array 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 diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/docs/types/index.d.ts index 5b0fdf393238..39894631667c 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/docs/types/index.d.ts @@ -32,7 +32,7 @@ type InputArray = Collection | AccessorArrayLike; */ interface Routine { /** - * Returns the index of the first element in a strided array equal to an element in another strided array. + * Returns the index of the first element in a strided array equal to a corresponding element in another strided array. * * ## Notes * @@ -55,7 +55,7 @@ interface Routine { ( N: number, x: InputArray, strideX: number, y: InputArray, strideY: number ): number; /** - * Returns the index of the first element in a strided array equal to an element in another strided array using alternative indexing semantics. + * Returns the index of the first element in a strided array equal to a corresponding element in another strided array using alternative indexing semantics. * * ## Notes * @@ -81,7 +81,7 @@ interface Routine { } /** -* Returns the index of the first element in a strided array equal to an element in another strided array. +* Returns the index of the first element in a strided array equal to a corresponding element in another strided array. * * ## Notes * diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/examples/index.js b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/examples/index.js index f2b2589ddf6c..a6d1d1dec38c 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/examples/index.js +++ b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/examples/index.js @@ -21,12 +21,12 @@ var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); var gfirstIndexEqual = require( './../lib' ); -var x = discreteUniform( 10, -100, 100, { +var x = discreteUniform( 10, 0, 10, { 'dtype': 'generic' }); console.log( x ); -var y = discreteUniform( 10, -100, 100, { +var y = discreteUniform( 10, 0, 10, { 'dtype': 'generic' }); console.log( y ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/lib/accessors.js b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/lib/accessors.js index 7316cee19939..e9b7d1895c24 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/lib/accessors.js +++ b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/lib/accessors.js @@ -21,7 +21,7 @@ // MAIN // /** -* Returns the index of the first element in a strided array equal to an element in another strided array. +* Returns the index of the first element in a strided array equal to a corresponding element in another strided array. * * @private * @param {PositiveInteger} N - number of indexed elements diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/lib/index.js b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/lib/index.js index e39cd3ea7a62..2cd4f1690a06 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/lib/index.js +++ b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/lib/index.js @@ -19,7 +19,7 @@ 'use strict'; /** -* Return the index of the first element in a strided array equal to an element in another strided array. +* Return the index of the first element in a strided array equal to a corresponding element in another strided array. * * @module @stdlib/blas/ext/base/gfirst-index-equal * diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/lib/main.js b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/lib/main.js index 20d0f641ccc3..6880c0cef142 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/lib/main.js +++ b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/lib/main.js @@ -27,7 +27,7 @@ var ndarray = require( './ndarray.js' ); // MAIN // /** -* Returns the index of the first element in a strided array equal to an element in another strided array. +* Returns the index of the first element in a strided array equal to a corresponding element in another strided array. * * @param {PositiveInteger} N - number of indexed elements * @param {Collection} x - first input array diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/lib/ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/lib/ndarray.js index 3f4878b01568..d835f9601dbb 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/lib/ndarray.js +++ b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/lib/ndarray.js @@ -27,7 +27,7 @@ var accessors = require( './accessors.js' ); // MAIN // /** -* Returns the index of the first element in a strided array equal to an element in another strided array using alternative indexing semantics. +* Returns the index of the first element in a strided array equal to a corresponding element in another strided array using alternative indexing semantics. * * @param {PositiveInteger} N - number of indexed elements * @param {Collection} x - first input array diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/package.json b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/package.json index ddc13f083bf8..3dbcb361165c 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/package.json +++ b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/package.json @@ -1,7 +1,7 @@ { "name": "@stdlib/blas/ext/base/gfirst-index-equal", "version": "0.0.0", - "description": "Return the index of the first element in a strided array equal to an element in another strided array.", + "description": "Return the index of the first element in a strided array equal to a corresponding element in another strided array.", "license": "Apache-2.0", "author": { "name": "The Stdlib Authors", From ea1b9511a4f8751e3cb717d8c3f6fb4567f6ba7e Mon Sep 17 00:00:00 2001 From: Athan Date: Sun, 5 Jul 2026 04:29:05 -0700 Subject: [PATCH 4/7] Apply suggestions from code review Co-authored-by: Athan Signed-off-by: Athan --- .../@stdlib/blas/ext/base/gfirst-index-equal/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/README.md b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/README.md index f5927edf4a16..e3e72fdbac37 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/README.md +++ b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/README.md @@ -154,12 +154,12 @@ var idx = gfirstIndexEqual.ndarray( 3, x, 1, x.length-3, y, 1, y.length-3 ); var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); var gfirstIndexEqual = require( '@stdlib/blas/ext/base/gfirst-index-equal' ); -var x = discreteUniform( 10, -100, 100, { +var x = discreteUniform( 10, 0, 10, { 'dtype': 'generic' }); console.log( x ); -var y = discreteUniform( 10, -100, 100, { +var y = discreteUniform( 10, 0, 10, { 'dtype': 'generic' }); console.log( y ); From 12e852ff55bd9265f4930d862c1d734c0dc2297b Mon Sep 17 00:00:00 2001 From: Athan Date: Sun, 5 Jul 2026 04:33:23 -0700 Subject: [PATCH 5/7] Apply suggestions from code review Co-authored-by: Athan Signed-off-by: Athan --- .../@stdlib/blas/ext/base/gfirst-index-equal/test/test.main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/test/test.main.js b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/test/test.main.js index 3b92d93ee8a2..ad2311740455 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/test/test.main.js +++ b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/test/test.main.js @@ -432,7 +432,7 @@ tape( 'the function supports view offsets', function test( t ) { // Create offset views... x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // begin at 2nd element - y1 = new Float64Array( y0.buffer, y0.BYTES_PER_ELEMENT*3 ); // begin at the 4th element + y1 = new Float64Array( y0.buffer, y0.BYTES_PER_ELEMENT*3 ); // begin at 4th element actual = gfirstIndexEqual( 3, x1, -2, y1, 1 ); t.strictEqual( actual, 1, 'returns expected value' ); From 254da4ad843c92f2a47720384462092719cd7339 Mon Sep 17 00:00:00 2001 From: Athan Date: Sun, 5 Jul 2026 04:35:16 -0700 Subject: [PATCH 6/7] Apply suggestions from code review Co-authored-by: Athan Signed-off-by: Athan --- .../blas/ext/base/gfirst-index-equal/test/test.ndarray.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/test/test.ndarray.js index a0a6b7675b9a..4df7c78da65f 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/test/test.ndarray.js @@ -390,9 +390,9 @@ tape( 'the function supports complex access patterns', function test( t ) { 6.0 ]; y = [ - 5.0, // 0 + 5.0, // 2 0.0, // 1 - 0.0, // 2 + 0.0, // 0 0.0, 0.0, 0.0 From 974a9852fc6e9856cc9f9f0235138d33ac187489 Mon Sep 17 00:00:00 2001 From: Athan Date: Sun, 5 Jul 2026 04:35:48 -0700 Subject: [PATCH 7/7] Apply suggestions from code review Co-authored-by: Athan Signed-off-by: Athan --- .../blas/ext/base/gfirst-index-equal/test/test.main.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/test/test.main.js b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/test/test.main.js index ad2311740455..5e9f6b51d7ec 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/test/test.main.js +++ b/lib/node_modules/@stdlib/blas/ext/base/gfirst-index-equal/test/test.main.js @@ -391,9 +391,9 @@ tape( 'the function supports complex access patterns', function test( t ) { 6.0 ]; y = [ - 5.0, // 0 + 5.0, // 2 0.0, // 1 - 0.0, // 2 + 0.0, // 0 0.0, 0.0, 0.0