From 1f2531b29f72bd4ac3f17c6bad174ae72462e376 Mon Sep 17 00:00:00 2001
From: Muhammad Haris <101793258+headlessNode@users.noreply.github.com>
Date: Wed, 23 Jul 2025 20:20:34 +0000
Subject: [PATCH 01/12] feat: add blas/ext/base/gfind-index
---
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
---
---
.../blas/ext/base/gfind-index/README.md | 229 ++++++++++++++++++
.../base/gfind-index/benchmark/benchmark.js | 96 ++++++++
.../benchmark/benchmark.ndarray.js | 96 ++++++++
.../blas/ext/base/gfind-index/docs/repl.txt | 105 ++++++++
.../base/gfind-index/docs/types/index.d.ts | 199 +++++++++++++++
.../ext/base/gfind-index/docs/types/test.ts | 191 +++++++++++++++
.../ext/base/gfind-index/examples/index.js | 34 +++
.../ext/base/gfind-index/lib/accessors.js | 75 ++++++
.../blas/ext/base/gfind-index/lib/index.js | 65 +++++
.../blas/ext/base/gfind-index/lib/main.js | 56 +++++
.../blas/ext/base/gfind-index/lib/ndarray.js | 75 ++++++
.../blas/ext/base/gfind-index/package.json | 67 +++++
.../blas/ext/base/gfind-index/test/test.js | 38 +++
.../ext/base/gfind-index/test/test.main.js | 145 +++++++++++
.../ext/base/gfind-index/test/test.ndarray.js | 145 +++++++++++
15 files changed, 1616 insertions(+)
create mode 100644 lib/node_modules/@stdlib/blas/ext/base/gfind-index/README.md
create mode 100644 lib/node_modules/@stdlib/blas/ext/base/gfind-index/benchmark/benchmark.js
create mode 100644 lib/node_modules/@stdlib/blas/ext/base/gfind-index/benchmark/benchmark.ndarray.js
create mode 100644 lib/node_modules/@stdlib/blas/ext/base/gfind-index/docs/repl.txt
create mode 100644 lib/node_modules/@stdlib/blas/ext/base/gfind-index/docs/types/index.d.ts
create mode 100644 lib/node_modules/@stdlib/blas/ext/base/gfind-index/docs/types/test.ts
create mode 100644 lib/node_modules/@stdlib/blas/ext/base/gfind-index/examples/index.js
create mode 100644 lib/node_modules/@stdlib/blas/ext/base/gfind-index/lib/accessors.js
create mode 100644 lib/node_modules/@stdlib/blas/ext/base/gfind-index/lib/index.js
create mode 100644 lib/node_modules/@stdlib/blas/ext/base/gfind-index/lib/main.js
create mode 100644 lib/node_modules/@stdlib/blas/ext/base/gfind-index/lib/ndarray.js
create mode 100644 lib/node_modules/@stdlib/blas/ext/base/gfind-index/package.json
create mode 100644 lib/node_modules/@stdlib/blas/ext/base/gfind-index/test/test.js
create mode 100644 lib/node_modules/@stdlib/blas/ext/base/gfind-index/test/test.main.js
create mode 100644 lib/node_modules/@stdlib/blas/ext/base/gfind-index/test/test.ndarray.js
diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfind-index/README.md b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/README.md
new file mode 100644
index 000000000000..958b5b98383a
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/README.md
@@ -0,0 +1,229 @@
+
+
+# gfindIndex
+
+> Return the index of the first element which passes a test implemented by a predicate function.
+
+
+
+## Usage
+
+```javascript
+var gfindIndex = require( '@stdlib/blas/ext/base/gfind-index' );
+```
+
+#### gfindIndex( N, x, strideX, clbk\[, thisArg] )
+
+Returns the index of the first element which passes a test implemented by a predicate function.
+
+```javascript
+function isEven( v ) {
+ return v % 2.0 === 0.0;
+}
+
+var x = [ 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ];
+
+var idx = gfindIndex( x.length, x, 1, isEven );
+// returns 3
+```
+
+If the function is unable to find an element, the function returns `-1`.
+
+```javascript
+function isEven( v ) {
+ return v % 2.0 === 0.0;
+}
+
+var x = [ 1.0, 3.0, 5.0, 7.0, 9.0 ];
+
+var idx = gfindIndex( x.length, x, 1, isEven );
+// returns -1
+```
+
+The function has the following parameters:
+
+- **N**: number of indexed elements.
+- **x**: input array.
+- **strideX**: stride length.
+- **predicate**: predicate function.
+- **thisArg**: execution context (_optional_).
+
+The callback function is provided the following arguments:
+
+- **value**: current array element.
+- **aidx**: array index.
+- **sidx**: strided index (`offset + aidx*stride`).
+- **array**: the input array.
+
+To set the callback execution context, provide a `thisArg`.
+
+```javascript
+function isEven( v ) {
+ this.count += 1;
+ return v % 2.0 === 0.0;
+}
+
+var x = [ 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ];
+
+var ctx = {
+ 'count': 0
+};
+
+var idx = gfindIndex( x.length, x, 1, isEven, ctx );
+// returns 3
+
+var count = ctx.count;
+// returns 4
+```
+
+The `N` and stride parameters determine which elements in the strided array are accessed at runtime. For example, to check every other element:
+
+```javascript
+function isEven( v ) {
+ return v % 2.0 === 0.0;
+}
+
+var x = [ 1.0, 3.0, -5.0, 0.0, 4.0, -1.0, -3.0 ];
+
+var idx = gfindIndex( 4, x, 2, isEven );
+// returns 2
+```
+
+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' );
+
+function isEven( v ) {
+ return v % 2.0 === 0.0;
+}
+
+// Initial array...
+var x0 = new Float64Array( [ 1.0, 3.0, 4.0, -5.0, 7.0, 6.0 ] );
+
+// Create an offset view...
+var x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
+
+var idx = gfindIndex( 3, x1, 2, isEven );
+// returns 2
+```
+
+#### gfindIndex.ndarray( N, x, strideX, offsetX, clbk\[, thisArg] )
+
+Returns the index of the first element which passes a test implemented by a predicate function using alternative indexing semantics.
+
+```javascript
+function isEven( v ) {
+ return v % 2.0 === 0.0;
+}
+
+var x = [ 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ];
+
+var idx = gfindIndex.ndarray( x.length, x, 1, 0, isEven );
+// returns 3
+```
+
+The function has the following additional parameters:
+
+- **offsetX**: starting index.
+
+While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameter supports indexing semantics based on a starting index. For example, to access only the last three elements:
+
+```javascript
+function isEven( v ) {
+ return v % 2.0 === 0.0;
+}
+
+var x = [ 1.0, -2.0, -4.0, 5.0, -7.0, 6.0 ];
+
+var idx = gfindIndex.ndarray( 3, x, 1, x.length-3, isEven );
+// returns 2
+```
+
+
+
+
+
+
+
+## Notes
+
+- If `N <= 0`, both functions return `-1`.
+- 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 gfindIndex = require( '@stdlib/blas/ext/base/gfind-index' );
+
+function isEven( v ) {
+ return v % 2.0 === 0.0;
+}
+
+var x = discreteUniform( 10, -100, 100, {
+ 'dtype': 'generic'
+});
+console.log( x );
+
+var idx = gfindIndex( x.length, x, 1, isEven );
+console.log( idx );
+```
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+[mdn-typed-array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray
+
+[@stdlib/array/base/accessor]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/base/accessor
+
+
+
+
diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfind-index/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/benchmark/benchmark.js
new file mode 100644
index 000000000000..b0893a7cfd1d
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/benchmark/benchmark.js
@@ -0,0 +1,96 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2025 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+// MODULES //
+
+var bench = require( '@stdlib/bench' );
+var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
+var isInteger = require( '@stdlib/math/base/assert/is-integer' );
+var pow = require( '@stdlib/math/base/special/pow' );
+var pkg = require( './../package.json' ).name;
+var gfindIndex = require( './../lib' );
+
+
+// FUNCTIONS //
+
+/**
+* Callback function.
+*
+* @param {*} v - array element
+* @returns {boolean} result
+*/
+function isEven( v ) {
+ return v % 2 === 0;
+}
+
+/**
+* Create a benchmark function.
+*
+* @private
+* @param {PositiveInteger} len - array length
+* @returns {Function} benchmark function
+*/
+function createBenchmark( len ) {
+ var x = discreteUniform( len, -100.0, 100.0, {
+ 'dtype': 'generic'
+ });
+ return benchmark;
+
+ function benchmark( b ) {
+ var idx;
+ var i;
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ idx = gfindIndex( x.length, x, 1, isEven );
+ if ( !isInteger( idx ) ) {
+ b.fail( 'should return an integer' );
+ }
+ }
+ b.toc();
+ if ( !isInteger( idx ) ) {
+ b.fail( 'should return an integer' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+ }
+}
+
+
+// MAIN //
+
+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/blas/ext/base/gfind-index/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/benchmark/benchmark.ndarray.js
new file mode 100644
index 000000000000..622b687e02bf
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/benchmark/benchmark.ndarray.js
@@ -0,0 +1,96 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2025 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+// MODULES //
+
+var bench = require( '@stdlib/bench' );
+var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
+var isInteger = require( '@stdlib/math/base/assert/is-integer' );
+var pow = require( '@stdlib/math/base/special/pow' );
+var pkg = require( './../package.json' ).name;
+var gfindIndex = require( './../lib' ).ndarray;
+
+
+// FUNCTIONS //
+
+/**
+* Callback function.
+*
+* @param {*} v - array element
+* @returns {boolean} result
+*/
+function isEven( v ) {
+ return v % 2 === 0;
+}
+
+/**
+* Create a benchmark function.
+*
+* @private
+* @param {PositiveInteger} len - array length
+* @returns {Function} benchmark function
+*/
+function createBenchmark( len ) {
+ var x = discreteUniform( len, -100.0, 100.0, {
+ 'dtype': 'generic'
+ });
+ return benchmark;
+
+ function benchmark( b ) {
+ var idx;
+ var i;
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ idx = gfindIndex( x.length, x, 1, 0, isEven );
+ if ( !isInteger( idx ) ) {
+ b.fail( 'should return an integer' );
+ }
+ }
+ b.toc();
+ if ( !isInteger( idx ) ) {
+ b.fail( 'should return an integer' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+ }
+}
+
+
+// MAIN //
+
+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+':ndarray:len='+len, f );
+ }
+}
+
+main();
diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfind-index/docs/repl.txt b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/docs/repl.txt
new file mode 100644
index 000000000000..50dc5cacfb0e
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/docs/repl.txt
@@ -0,0 +1,105 @@
+
+{{alias}}( N, x, strideX, clbk[, thisArg] )
+ Returns the index of the first element which passes a test implemented by a
+ predicate function.
+
+ The `N` and stride parameters determine which elements in the strided array
+ are accessed at runtime.
+
+ Indexing is relative to the first index. To introduce an offset, use typed
+ array views.
+
+ If `N <= 0`, the function returns `-1`.
+
+ The callback function is provided the following arguments:
+
+ - value: current array element.
+ - aidx: array index.
+ - sidx: strided index (offset + aidx*stride).
+ - array: the input array.
+
+ Parameters
+ ----------
+ N: integer
+ Number of indexed elements.
+
+ x: ArrayLikeObject
+ Input array.
+
+ strideX: integer
+ Stride length.
+
+ clbk: Function
+ Callback function.
+
+ thisArg: any (optional)
+ Execution context.
+
+ Returns
+ -------
+ idx: integer
+ Index.
+
+ Examples
+ --------
+ // Standard Usage:
+ > function isEven( v ) { return v % 2.0 === 0.0; };
+ > var x = [ 1.0, 3.0, -5.0, 4.0, -1.0, -3.0 ];
+ > {{alias}}( x.length, x, 1, isEven )
+ 3
+
+ // Using `N` and stride parameters:
+ > x = [ 1.0, 3.0, 4.0, -5.0, -1.0, -3.0 ];
+ > {{alias}}( x.length, x, 2, isEven )
+ 1
+
+ // Using view offsets:
+ > var x0 = new {{alias:@stdlib/array/float64}}( [ 1.0, 3.0, -4.0, 5.0, -6.0 ] );
+ > var x1 = new {{alias:@stdlib/array/float64}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 );
+ > {{alias}}( 3, x1, 1, isEven )
+ 1
+
+
+{{alias}}.ndarray( N, x, strideX, offsetX, clbk[, thisArg] )
+ Returns the index of the first element which passes a test implemented by a
+ predicate function using alternative indexing semantics.
+
+ While typed array views mandate a view offset based on the underlying
+ buffer, the offset parameter supports indexing semantics based on a starting
+ index.
+
+ Parameters
+ ----------
+ N: integer
+ Number of indexed elements.
+
+ x: ArrayLikeObject
+ Input array.
+
+ strideX: integer
+ Stride length.
+
+ offsetX: integer
+ Starting index.
+
+ clbk: Function
+ Callback function.
+
+ thisArg: any (optional)
+ Execution context.
+
+ Returns
+ -------
+ idx: integer
+ Index.
+
+ Examples
+ --------
+ // Standard Usage:
+ > function isEven( v ) { return v % 2.0 === 0.0; };
+ > var x = [ 1.0, 3.0, -5.0, 4.0, -1.0, -3.0 ];
+ > {{alias}}.ndarray( x.length, x, 1, 2, isEven )
+ 1
+
+ See Also
+ --------
diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfind-index/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/docs/types/index.d.ts
new file mode 100644
index 000000000000..8615614a1971
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/docs/types/index.d.ts
@@ -0,0 +1,199 @@
+/*
+* @license Apache-2.0
+*
+* Copyright (c) 2025 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+// TypeScript Version: 4.1
+
+///
+
+import { Collection, AccessorArrayLike } from '@stdlib/types/array';
+
+/**
+* Input array.
+*/
+type InputArray = Collection | AccessorArrayLike;
+
+/**
+* Returns a boolean indicating whether an element passes a test.
+*
+* @returns boolean indicating whether an element passes a test
+*/
+type Nullary = ( this: U ) => boolean;
+
+/**
+* Returns a boolean indicating whether an element passes a test.
+*
+* @param value - array element
+* @returns boolean indicating whether an element passes a test
+*/
+type Unary = ( this: U, value: T ) => boolean;
+
+/**
+* Returns a boolean indicating whether an element passes a test.
+*
+* @param value - array element
+* @param aidx - array index
+* @returns boolean indicating whether an element passes a test
+*/
+type Binary = ( this: U, value: T, aidx: number ) => boolean;
+
+/**
+* Returns a boolean indicating whether an element passes a test.
+*
+* @param value - array element
+* @param aidx - array index
+* @param sidx - strided index (offset + aidx*stride)
+* @returns boolean indicating whether an element passes a test
+*/
+type Ternary = ( this: U, value: T, aidx: number, sidx: number ) => boolean;
+
+/**
+* Returns a boolean indicating whether an element passes a test.
+*
+* @param value - array element
+* @param aidx - array index
+* @param sidx - strided index (offset + aidx*stride)
+* @param array - input array
+* @returns boolean indicating whether an element passes a test
+*/
+type Quaternary = ( this: U, value: T, aidx: number, sidx: number, array: InputArray ) => boolean;
+
+/**
+* Returns a boolean indicating whether an element passes a test.
+*
+* @param value - array element
+* @param aidx - array index
+* @param sidx - strided index (offset + aidx*stride)
+* @param array - input array
+* @returns boolean indicating whether an element passes a test
+*/
+type Callback = Nullary | Unary | Binary | Ternary | Quaternary;
+
+/**
+* Interface describing `gfindIndex`.
+*/
+interface Routine {
+ /**
+ * Returns the index of the first element which passes a test implemented by a predicate function.
+ *
+ * ## Notes
+ *
+ * - The callback function is provided the following arguments:
+ *
+ * - `value`: array element
+ * - `aidx`: array index
+ * - `sidx`: strided index (offset + aidx*stride)
+ * - `array`: input array
+ *
+ * @param N - number of indexed elements
+ * @param x - input array
+ * @param strideX - stride length
+ * @param clbk - callback function
+ * @param thisArg - execution context
+ * @returns `index`
+ *
+ * @example
+ * function isEven( v ) {
+ * return v % 2.0 === 0.0;
+ * }
+ *
+ * var x = [ 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ];
+ *
+ * var idx = gfindIndex( x.length, x, 1, isEven );
+ * // returns 3
+ */
+ ( N: number, x: InputArray, strideX: number, clbk: Callback, thisArg?: ThisParameterType> ): number;
+
+ /**
+ * Returns the index of the first element which passes a test implemented by a predicate function using alternative indexing semantics.
+ *
+ * ## Notes
+ *
+ * - The callback function is provided the following arguments:
+ *
+ * - `value`: array element
+ * - `aidx`: array index
+ * - `sidx`: strided index (offset + aidx*stride)
+ * - `array`: input array
+ *
+ * @param N - number of indexed elements
+ * @param x - input array
+ * @param strideX - stride length
+ * @param offsetX - starting index
+ * @param clbk - callback function
+ * @param thisArg - execution context
+ * @returns `index`
+ *
+ * @example
+ *
+ * function isEven( v ) {
+ * return v % 2.0 === 0.0;
+ * }
+ *
+ * var x = [ 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ];
+ *
+ * var idx = gfindIndex.ndarray( x.length, x, 1, 0, isEven );
+ * // returns 3
+ */
+ ndarray( N: number, x: InputArray, strideX: number, offsetX: number, clbk: Callback, thisArg?: ThisParameterType> ): number;
+}
+
+/**
+* Returns the index of the first element which passes a test implemented by a predicate function.
+*
+* ## Notes
+*
+* - The callback function is provided the following arguments:
+*
+* - `value`: array element
+* - `aidx`: array index
+* - `sidx`: strided index (offset + aidx*stride)
+* - `array`: input array
+*
+* @param N - number of indexed elements
+* @param x - input array
+* @param strideX - stride length
+* @param clbk - callback function
+* @param thisArg - execution context
+* @returns `index`
+*
+* @example
+* function isEven( v ) {
+* return v % 2.0 === 0.0;
+* }
+*
+* var x = [ 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ];
+*
+* var idx = gfindIndex( x.length, x, 1, isEven );
+* // returns 3
+*
+* @example
+* function isEven( v ) {
+* return v % 2.0 === 0.0;
+* }
+*
+* var x = [ 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ];
+*
+* var idx = gfindIndex.ndarray( x.length, x, 1, 0, isEven );
+* // returns 3
+*/
+declare var gfindIndex: Routine;
+
+
+// EXPORTS //
+
+export = gfindIndex;
diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfind-index/docs/types/test.ts b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/docs/types/test.ts
new file mode 100644
index 000000000000..77fdf2f20160
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/docs/types/test.ts
@@ -0,0 +1,191 @@
+/*
+* @license Apache-2.0
+*
+* Copyright (c) 2025 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+import gfindIndex = require( './index' );
+
+/**
+* Predicate function.
+*
+* @param v - ndarray element
+* @returns result
+*/
+function isEven( v: any ): boolean {
+ return v % 2.0 === 0.0;
+}
+
+
+// TESTS //
+
+// The function returns an integer...
+{
+ const x = new Float64Array( 10 );
+
+ gfindIndex( x.length, x, 1, isEven ); // $ExpectType number
+ gfindIndex( x.length, x, 1, isEven, {} ); // $ExpectType number
+}
+
+// The compiler throws an error if the function is provided a first argument which is not a number...
+{
+ const x = new Float64Array( 10 );
+
+ gfindIndex( '10', x, 1, isEven ); // $ExpectError
+ gfindIndex( true, x, 1, isEven ); // $ExpectError
+ gfindIndex( false, x, 1, isEven ); // $ExpectError
+ gfindIndex( null, x, 1, isEven ); // $ExpectError
+ gfindIndex( undefined, x, 1, isEven ); // $ExpectError
+ gfindIndex( [], x, 1, isEven ); // $ExpectError
+ gfindIndex( {}, x, 1, isEven ); // $ExpectError
+ gfindIndex( ( x: number ): number => x, x, 1, isEven ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided a second argument which is not a collection...
+{
+ const x = new Float64Array( 10 );
+
+ gfindIndex( x.length, 10, 1, isEven ); // $ExpectError
+ gfindIndex( x.length, true, 1, isEven ); // $ExpectError
+ gfindIndex( x.length, false, 1, isEven ); // $ExpectError
+ gfindIndex( x.length, null, 1, isEven ); // $ExpectError
+ gfindIndex( x.length, undefined, 1, isEven ); // $ExpectError
+ gfindIndex( x.length, {}, 1, isEven ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided a third argument which is not a number...
+{
+ const x = new Float64Array( 10 );
+
+ gfindIndex( x.length, x, '10', isEven ); // $ExpectError
+ gfindIndex( x.length, x, true, isEven ); // $ExpectError
+ gfindIndex( x.length, x, false, isEven ); // $ExpectError
+ gfindIndex( x.length, x, null, isEven ); // $ExpectError
+ gfindIndex( x.length, x, undefined, isEven ); // $ExpectError
+ gfindIndex( x.length, x, [], isEven ); // $ExpectError
+ gfindIndex( x.length, x, {}, isEven ); // $ExpectError
+ gfindIndex( x.length, x, ( x: number ): number => x, isEven ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided a fourth argument which is not a function...
+{
+ const x = new Float64Array( 10 );
+
+ gfindIndex( x.length, x, 1, '10' ); // $ExpectError
+ gfindIndex( x.length, x, 1, true ); // $ExpectError
+ gfindIndex( x.length, x, 1, false ); // $ExpectError
+ gfindIndex( x.length, x, 1, null ); // $ExpectError
+ gfindIndex( x.length, x, 1, undefined ); // $ExpectError
+ gfindIndex( x.length, x, 1, [] ); // $ExpectError
+ gfindIndex( x.length, x, 1, {} ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided an unsupported number of arguments...
+{
+ const x = new Float64Array( 10 );
+
+ gfindIndex(); // $ExpectError
+ gfindIndex( x.length ); // $ExpectError
+ gfindIndex( x.length, x ); // $ExpectError
+ gfindIndex( x.length, x, 1 ); // $ExpectError
+ gfindIndex( x.length, x, 1, isEven, {}, 10 ); // $ExpectError
+}
+
+// Attached to main export is an `ndarray` method which returns a number...
+{
+ const x = new Float64Array( 10 );
+
+ gfindIndex.ndarray( x.length, x, 1, 0, isEven ); // $ExpectType number
+ gfindIndex.ndarray( x.length, x, 1, 0, isEven, {} ); // $ExpectType number
+}
+
+// The compiler throws an error if the `ndarray` method is provided a first argument which is not a number...
+{
+ const x = new Float64Array( 10 );
+
+ gfindIndex.ndarray( '10', x, 1, 0, isEven ); // $ExpectError
+ gfindIndex.ndarray( true, x, 1, 0, isEven ); // $ExpectError
+ gfindIndex.ndarray( false, x, 1, 0, isEven ); // $ExpectError
+ gfindIndex.ndarray( null, x, 1, 0, isEven ); // $ExpectError
+ gfindIndex.ndarray( undefined, x, 1, 0, isEven ); // $ExpectError
+ gfindIndex.ndarray( [], x, 1, 0, isEven ); // $ExpectError
+ gfindIndex.ndarray( {}, x, 1, 0, isEven ); // $ExpectError
+ gfindIndex.ndarray( ( x: number ): number => x, x, 1, 0, isEven ); // $ExpectError
+}
+
+// The compiler throws an error if the `ndarray` method is provided a second argument which is not a collection...
+{
+ const x = new Float64Array( 10 );
+
+ gfindIndex.ndarray( x.length, 10, 1, 0, isEven ); // $ExpectError
+ gfindIndex.ndarray( x.length, true, 1, 0, isEven ); // $ExpectError
+ gfindIndex.ndarray( x.length, false, 1, 0, isEven ); // $ExpectError
+ gfindIndex.ndarray( x.length, null, 1, 0, isEven ); // $ExpectError
+ gfindIndex.ndarray( x.length, undefined, 1, 0, isEven ); // $ExpectError
+ gfindIndex.ndarray( x.length, {}, 1, 0, isEven ); // $ExpectError
+}
+
+// The compiler throws an error if the `ndarray` method is provided a third argument which is not a number...
+{
+ const x = new Float64Array( 10 );
+
+ gfindIndex.ndarray( x.length, x, '10', 0, isEven ); // $ExpectError
+ gfindIndex.ndarray( x.length, x, true, 0, isEven ); // $ExpectError
+ gfindIndex.ndarray( x.length, x, false, 0, isEven ); // $ExpectError
+ gfindIndex.ndarray( x.length, x, null, 0, isEven ); // $ExpectError
+ gfindIndex.ndarray( x.length, x, undefined, 0, isEven ); // $ExpectError
+ gfindIndex.ndarray( x.length, x, [], 0, isEven ); // $ExpectError
+ gfindIndex.ndarray( x.length, x, {}, 0, isEven ); // $ExpectError
+ gfindIndex.ndarray( x.length, x, ( x: number ): number => x, 0, isEven ); // $ExpectError
+}
+
+// The compiler throws an error if the `ndarray` method is provided a fourth argument which is not a number...
+{
+ const x = new Float64Array( 10 );
+
+ gfindIndex.ndarray( x.length, x, 1, '10', isEven ); // $ExpectError
+ gfindIndex.ndarray( x.length, x, 1, true, isEven ); // $ExpectError
+ gfindIndex.ndarray( x.length, x, 1, false, isEven ); // $ExpectError
+ gfindIndex.ndarray( x.length, x, 1, null, isEven ); // $ExpectError
+ gfindIndex.ndarray( x.length, x, 1, undefined, isEven ); // $ExpectError
+ gfindIndex.ndarray( x.length, x, 1, [], isEven ); // $ExpectError
+ gfindIndex.ndarray( x.length, x, 1, {}, isEven ); // $ExpectError
+ gfindIndex.ndarray( x.length, x, 1, ( x: number ): number => x, isEven ); // $ExpectError
+}
+
+// The compiler throws an error if the `ndarray` method is provided a fifth argument which is not a function...
+{
+ const x = new Float64Array( 10 );
+
+ gfindIndex.ndarray( x.length, x, 1, 0, '10' ); // $ExpectError
+ gfindIndex.ndarray( x.length, x, 1, 0, true ); // $ExpectError
+ gfindIndex.ndarray( x.length, x, 1, 0, false ); // $ExpectError
+ gfindIndex.ndarray( x.length, x, 1, 0, null ); // $ExpectError
+ gfindIndex.ndarray( x.length, x, 1, 0, undefined ); // $ExpectError
+ gfindIndex.ndarray( x.length, x, 1, 0, [] ); // $ExpectError
+ gfindIndex.ndarray( x.length, x, 1, 0, {} ); // $ExpectError
+}
+
+// The compiler throws an error if the `ndarray` method is provided an unsupported number of arguments...
+{
+ const x = new Float64Array( 10 );
+
+ gfindIndex.ndarray(); // $ExpectError
+ gfindIndex.ndarray( x.length ); // $ExpectError
+ gfindIndex.ndarray( x.length, x ); // $ExpectError
+ gfindIndex.ndarray( x.length, x, 1 ); // $ExpectError
+ gfindIndex.ndarray( x.length, x, 1, 0 ); // $ExpectError
+ gfindIndex.ndarray( x.length, x, 1, 0, isEven, {}, 10 ); // $ExpectError
+}
diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfind-index/examples/index.js b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/examples/index.js
new file mode 100644
index 000000000000..4c47d328a7f4
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/examples/index.js
@@ -0,0 +1,34 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2025 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
+var gfindIndex = require( './../lib' );
+
+function isEven( v ) {
+ return v % 2.0 === 0.0;
+}
+
+var x = discreteUniform( 10, -100, 100, {
+ 'dtype': 'generic'
+});
+console.log( x );
+
+var idx = gfindIndex( x.length, x, 1, isEven );
+console.log( idx );
diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfind-index/lib/accessors.js b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/lib/accessors.js
new file mode 100644
index 000000000000..aed2ab332433
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/lib/accessors.js
@@ -0,0 +1,75 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2025 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+// MAIN //
+
+/**
+* Returns the index of the first element which passes a test implemented by a predicate function.
+*
+* @private
+* @param {PositiveInteger} N - number of indexed elements
+* @param {Object} x - input array object
+* @param {Collection} x.data - input array data
+* @param {Array} x.accessors - array element accessors
+* @param {integer} strideX - stride length
+* @param {NonNegativeInteger} offsetX - starting index
+* @param {Callback} clbk - callback function
+* @param {*} thisArg - execution context
+* @returns {Object} input array object
+*
+* @example
+* var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' );
+* var arraylike2object = require( '@stdlib/array/base/arraylike2object' );
+*
+* function isEven( v ) {
+* return v % 2.0 === 0.0;
+* }
+*
+* var x = [ 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ];
+*
+* var idx = gfindIndex( x.length, arraylike2object( toAccessorArray( x ) ), 1, 0, isEven );
+* // returns 3
+*/
+function gfindIndex( N, x, strideX, offsetX, clbk, thisArg ) {
+ var xbuf;
+ var get;
+ var ix;
+ var i;
+
+ // Cache reference to array data:
+ xbuf = x.data;
+
+ // Cache a reference to the element accessors:
+ get = x.accessors[ 0 ];
+
+ ix = offsetX;
+ for ( i = 0; i < N; i++ ) {
+ if ( clbk.call( thisArg, get( xbuf, ix ), i, ix, x ) ) {
+ return i;
+ }
+ ix += strideX;
+ }
+ return -1;
+}
+
+
+// EXPORTS //
+
+module.exports = gfindIndex;
diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfind-index/lib/index.js b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/lib/index.js
new file mode 100644
index 000000000000..05602320cbe5
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/lib/index.js
@@ -0,0 +1,65 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2025 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+/**
+* Return the index of the first element which passes a test implemented by a predicate function.
+*
+* @module @stdlib/blas/ext/base/gfind-index
+*
+* @example
+* var gfindIndex = require( '@stdlib/blas/ext/base/gfind-index' );
+*
+* function isEven( v ) {
+* return v % 2.0 === 0.0;
+* }
+*
+* var x = [ 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ];
+*
+* var idx = gfindIndex( x.length, x, 1, isEven );
+* // returns 3
+*
+* @example
+* var gfindIndex = require( '@stdlib/blas/ext/base/gfind-index' );
+*
+* function isEven( x ) {
+* return v % 2.0 === 0.0;
+* }
+*
+* var x = [ 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ];
+*
+* var idx = gfindIndex.ndarray( x.length, x, 1, 0, isEven );
+* // returns 3
+*/
+
+// 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/gfind-index/lib/main.js b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/lib/main.js
new file mode 100644
index 000000000000..5e57611fc1d4
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/lib/main.js
@@ -0,0 +1,56 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2025 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+// MODULES //
+
+var stride2offset = require( '@stdlib/strided/base/stride2offset' );
+var ndarray = require( './ndarray.js' );
+
+
+// MAIN //
+
+/**
+* Returns the index of the first element which passes a test implemented by a predicate function.
+*
+* @param {PositiveInteger} N - number of indexed elements
+* @param {Collection} x - input array
+* @param {integer} strideX - stride length
+* @param {Callback} clbk - callback function
+* @param {*} [thisArg] - execution context
+* @returns {Collection} input array
+*
+* @example
+* function isEven( v ) {
+* return v % 2.0 === 0.0;
+* }
+*
+* var x = [ 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ];
+*
+* var idx = gfindIndex( x.length, x, 1, isEven );
+* // returns 3
+*/
+function gfindIndex( N, x, strideX, clbk, thisArg ) {
+ return ndarray( N, x, strideX, stride2offset( N, strideX ), clbk, thisArg );
+}
+
+
+// EXPORTS //
+
+module.exports = gfindIndex;
diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfind-index/lib/ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/lib/ndarray.js
new file mode 100644
index 000000000000..46c58ac2d65e
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/lib/ndarray.js
@@ -0,0 +1,75 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2025 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+// MODULES //
+
+var arraylike2object = require( '@stdlib/array/base/arraylike2object' );
+var accessors = require( './accessors.js' );
+
+
+// MAIN //
+
+/**
+* Returns the index of the first element which passes a test implemented by a predicate function.
+*
+* @param {PositiveInteger} N - number of indexed elements
+* @param {Collection} x - input array
+* @param {integer} strideX - stride length
+* @param {NonNegativeInteger} offsetX - starting index
+* @param {Callback} clbk - callback function
+* @param {*} [thisArg] - execution context
+* @returns {Collection} input array
+*
+* @example
+* function isEven( v ) {
+* return v % 2.0 === 0.0;
+* }
+*
+* var x = [ 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ];
+*
+* var idx = gfindIndex( x.length, x, 1, 0, isEven );
+* // returns 3
+*/
+function gfindIndex( N, x, strideX, offsetX, clbk, thisArg ) {
+ var ix;
+ var o;
+ var i;
+
+ if ( N <= 0 ) {
+ return -1;
+ }
+ o = arraylike2object( x );
+ if ( o.accessorProtocol ) {
+ return accessors( N, o, strideX, offsetX, clbk, thisArg );
+ }
+ ix = offsetX;
+ for ( i = 0; i < N; i++ ) {
+ if ( clbk.call( thisArg, x[ ix ], i, ix, x ) ) {
+ return i;
+ }
+ ix += strideX;
+ }
+ return -1;
+}
+
+
+// EXPORTS //
+
+module.exports = gfindIndex;
diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfind-index/package.json b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/package.json
new file mode 100644
index 000000000000..9a39164037d5
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/package.json
@@ -0,0 +1,67 @@
+{
+ "name": "@stdlib/blas/ext/base/gfind-index",
+ "version": "0.0.0",
+ "description": "Return the index of the first element which passes a test implemented by a predicate function.",
+ "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",
+ "find",
+ "index",
+ "get",
+ "search",
+ "strided",
+ "array",
+ "ndarray"
+ ],
+ "__stdlib__": {}
+}
diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfind-index/test/test.js b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/test/test.js
new file mode 100644
index 000000000000..4b2ce7715e21
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/test/test.js
@@ -0,0 +1,38 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2025 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+// MODULES //
+
+var tape = require( 'tape' );
+var gfindIndex = require( '@stdlib/blas/ext/base/gfind-index/lib' );
+
+
+// TESTS //
+
+tape( 'main export is a function', function test( t ) {
+ t.ok( true, __filename );
+ t.strictEqual( typeof gfindIndex, '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 gfindIndex.ndarray, 'function', 'method is a function' );
+ t.end();
+});
diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfind-index/test/test.main.js b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/test/test.main.js
new file mode 100644
index 000000000000..ac541aaf69c9
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/test/test.main.js
@@ -0,0 +1,145 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2025 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+// MODULES //
+
+var tape = require( 'tape' );
+var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' );
+var gfindIndex = require( './../lib' );
+
+
+// TESTS //
+
+tape( 'main export is a function', function test( t ) {
+ t.ok( true, __filename );
+ t.strictEqual( typeof gfindIndex, 'function', 'main export is a function' );
+ t.end();
+});
+
+tape( 'the function has an arity of 5', function test( t ) {
+ t.strictEqual( gfindIndex.length, 5, 'has expected arity' );
+ t.end();
+});
+
+tape( 'the function returns the index of the first element which passes a test implemented by a predicate function', function test( t ) {
+ var actual;
+ var x;
+
+ x = [ 1.0, 1.0, 2.0, 3.0, 2.0, 3.0 ];
+
+ // Nonnegative stride...
+ actual = gfindIndex( x.length, x, 1, clbk );
+ t.strictEqual( actual, 2, 'returns expected value' );
+
+ // Negative stride...
+ actual = gfindIndex( x.length, x, -1, clbk );
+ t.strictEqual( actual, 1, 'returns expected value' );
+
+ t.end();
+
+ function clbk( v ) {
+ return v % 2.0 === 0.0;
+ }
+});
+
+tape( 'the function returns the index of the first element which passes a test implemented by a predicate function (accessors)', function test( t ) {
+ var actual;
+ var x;
+
+ x = toAccessorArray( [ 1.0, 1.0, 2.0, 3.0, 2.0, 3.0 ] );
+
+ // Nonnegative stride...
+ actual = gfindIndex( x.length, x, 1, clbk );
+ t.strictEqual( actual, 2, 'returns expected value' );
+
+ // Negative stride...
+ actual = gfindIndex( x.length, x, -1, clbk );
+ t.strictEqual( actual, 1, 'returns expected value' );
+
+ t.end();
+
+ function clbk( v ) {
+ return v % 2.0 === 0.0;
+ }
+});
+
+tape( 'the function returns `-1` if provided `N` parameter is less than or equal to zero', function test( t ) {
+ var actual;
+
+ actual = gfindIndex( 0, [ 1.0, 2.0, 3.0 ], 1, clbk );
+ t.strictEqual( actual, -1, 'returns expected value' );
+
+ actual = gfindIndex( -1, [ 1.0, 2.0, 3.0 ], 1, clbk );
+ t.strictEqual( actual, -1, 'returns expected value' );
+
+ t.end();
+
+ function clbk( v ) {
+ return v % 2.0 === 0.0;
+ }
+});
+
+tape( 'the function returns `-1` if provided `N` parameter is less than or equal to zero (accessors)', function test( t ) {
+ var actual;
+
+ actual = gfindIndex( 0, toAccessorArray( [ 1.0, 2.0, 3.0 ] ), 1, clbk );
+ t.strictEqual( actual, -1, 'returns expected value' );
+
+ actual = gfindIndex( -1, toAccessorArray( [ 1.0, 2.0, 3.0 ] ), 1, clbk );
+ t.strictEqual( actual, -1, 'returns expected value' );
+
+ t.end();
+
+ function clbk( v ) {
+ return v % 2.0 === 0.0;
+ }
+});
+
+tape( 'the function returns `-1` if no element passes the test implemented by a predicate function', function test( t ) {
+ var actual;
+ var x;
+
+ x = [ 1.0, 1.0, 3.0, 3.0, 5.0, 5.0 ];
+
+ actual = gfindIndex( x.length, x, 1, clbk );
+ t.strictEqual( actual, -1, 'returns expected value' );
+
+ t.end();
+
+ function clbk( v ) {
+ return v % 2.0 === 0.0;
+ }
+});
+
+tape( 'the function returns `-1` if no element passes the test implemented by a predicate function (accessors)', function test( t ) {
+ var actual;
+ var x;
+
+ x = toAccessorArray( [ 1.0, 1.0, 3.0, 3.0, 5.0, 5.0 ] );
+
+ actual = gfindIndex( x.length, x, 1, clbk );
+ t.strictEqual( actual, -1, 'returns expected value' );
+
+ t.end();
+
+ function clbk( v ) {
+ return v % 2.0 === 0.0;
+ }
+});
diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfind-index/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/test/test.ndarray.js
new file mode 100644
index 000000000000..85af5366f6b5
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/test/test.ndarray.js
@@ -0,0 +1,145 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2025 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+// MODULES //
+
+var tape = require( 'tape' );
+var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' );
+var gfindIndex = require( './../lib/ndarray.js' );
+
+
+// TESTS //
+
+tape( 'main export is a function', function test( t ) {
+ t.ok( true, __filename );
+ t.strictEqual( typeof gfindIndex, 'function', 'main export is a function' );
+ t.end();
+});
+
+tape( 'the function has an arity of 6', function test( t ) {
+ t.strictEqual( gfindIndex.length, 6, 'has expected arity' );
+ t.end();
+});
+
+tape( 'the function returns the index of the first element which passes a test implemented by a predicate function', function test( t ) {
+ var actual;
+ var x;
+
+ x = [ 1.0, 1.0, 2.0, 3.0, 2.0, 3.0 ];
+
+ // Nonnegative stride...
+ actual = gfindIndex( x.length, x, 1, 3, clbk );
+ t.strictEqual( actual, 1, 'returns expected value' );
+
+ // Negative stride...
+ actual = gfindIndex( x.length, x, -1, 3, clbk );
+ t.strictEqual( actual, 1, 'returns expected value' );
+
+ t.end();
+
+ function clbk( v ) {
+ return v % 2.0 === 0.0;
+ }
+});
+
+tape( 'the function returns the index of the first element which passes a test implemented by a predicate function (accessors)', function test( t ) {
+ var actual;
+ var x;
+
+ x = toAccessorArray( [ 1.0, 1.0, 2.0, 3.0, 2.0, 3.0 ] );
+
+ // Nonnegative stride...
+ actual = gfindIndex( x.length, x, 1, 3, clbk );
+ t.strictEqual( actual, 1, 'returns expected value' );
+
+ // Negative stride...
+ actual = gfindIndex( x.length, x, -1, 3, clbk );
+ t.strictEqual( actual, 1, 'returns expected value' );
+
+ t.end();
+
+ function clbk( v ) {
+ return v % 2.0 === 0.0;
+ }
+});
+
+tape( 'the function returns `-1` if provided `N` parameter is less than or equal to zero', function test( t ) {
+ var actual;
+
+ actual = gfindIndex( 0, [ 1.0, 2.0, 3.0 ], 1, 0, clbk );
+ t.strictEqual( actual, -1, 'returns expected value' );
+
+ actual = gfindIndex( -1, [ 1.0, 2.0, 3.0 ], 1, 2, clbk );
+ t.strictEqual( actual, -1, 'returns expected value' );
+
+ t.end();
+
+ function clbk( v ) {
+ return v % 2.0 === 0.0;
+ }
+});
+
+tape( 'the function returns `-1` if provided `N` parameter is less than or equal to zero (accessors)', function test( t ) {
+ var actual;
+
+ actual = gfindIndex( 0, toAccessorArray( [ 1.0, 2.0, 3.0 ] ), 1, 0, clbk );
+ t.strictEqual( actual, -1, 'returns expected value' );
+
+ actual = gfindIndex( -1, toAccessorArray( [ 1.0, 2.0, 3.0 ] ), 1, 2, clbk );
+ t.strictEqual( actual, -1, 'returns expected value' );
+
+ t.end();
+
+ function clbk( v ) {
+ return v % 2.0 === 0.0;
+ }
+});
+
+tape( 'the function returns `-1` if no element passes the test implemented by a predicate function', function test( t ) {
+ var actual;
+ var x;
+
+ x = [ 1.0, 1.0, 3.0, 3.0, 5.0, 5.0 ];
+
+ actual = gfindIndex( x.length, x, 1, 0, clbk );
+ t.strictEqual( actual, -1, 'returns expected value' );
+
+ t.end();
+
+ function clbk( v ) {
+ return v % 2.0 === 0.0;
+ }
+});
+
+tape( 'the function returns `-1` if no element passes the test implemented by a predicate function (accessors)', function test( t ) {
+ var actual;
+ var x;
+
+ x = toAccessorArray( [ 1.0, 1.0, 3.0, 3.0, 5.0, 5.0 ] );
+
+ actual = gfindIndex( x.length, x, 1, 0, clbk );
+ t.strictEqual( actual, -1, 'returns expected value' );
+
+ t.end();
+
+ function clbk( v ) {
+ return v % 2.0 === 0.0;
+ }
+});
From b0f7e777d0cb64278b25a3e42f425e9cdc560201 Mon Sep 17 00:00:00 2001
From: Muhammad Haris <101793258+headlessNode@users.noreply.github.com>
Date: Sat, 26 Jul 2025 00:16:42 +0500
Subject: [PATCH 02/12] docs: apply suggestions from code review
Signed-off-by: Muhammad Haris <101793258+headlessNode@users.noreply.github.com>
---
lib/node_modules/@stdlib/blas/ext/base/gfind-index/README.md | 2 +-
.../@stdlib/blas/ext/base/gfind-index/docs/repl.txt | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfind-index/README.md b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/README.md
index 958b5b98383a..db7cc04e0881 100644
--- a/lib/node_modules/@stdlib/blas/ext/base/gfind-index/README.md
+++ b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/README.md
@@ -63,7 +63,7 @@ The function has the following parameters:
- **N**: number of indexed elements.
- **x**: input array.
- **strideX**: stride length.
-- **predicate**: predicate function.
+- **clbk**: callback function.
- **thisArg**: execution context (_optional_).
The callback function is provided the following arguments:
diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfind-index/docs/repl.txt b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/docs/repl.txt
index 50dc5cacfb0e..fba6e9f5f35c 100644
--- a/lib/node_modules/@stdlib/blas/ext/base/gfind-index/docs/repl.txt
+++ b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/docs/repl.txt
@@ -33,7 +33,7 @@
Callback function.
thisArg: any (optional)
- Execution context.
+ Callback execution context.
Returns
-------
@@ -86,7 +86,7 @@
Callback function.
thisArg: any (optional)
- Execution context.
+ Callback execution context.
Returns
-------
From 594f7e8edb504b61ee46d08234699ddccaf2b672 Mon Sep 17 00:00:00 2001
From: Muhammad Haris <101793258+headlessNode@users.noreply.github.com>
Date: Sat, 26 Jul 2025 00:30:56 +0500
Subject: [PATCH 03/12] docs: apply suggestions from code review
Signed-off-by: Muhammad Haris <101793258+headlessNode@users.noreply.github.com>
---
.../@stdlib/blas/ext/base/gfind-index/lib/accessors.js | 2 +-
lib/node_modules/@stdlib/blas/ext/base/gfind-index/lib/main.js | 2 +-
.../@stdlib/blas/ext/base/gfind-index/lib/ndarray.js | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfind-index/lib/accessors.js b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/lib/accessors.js
index aed2ab332433..160a1c50f30a 100644
--- a/lib/node_modules/@stdlib/blas/ext/base/gfind-index/lib/accessors.js
+++ b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/lib/accessors.js
@@ -32,7 +32,7 @@
* @param {NonNegativeInteger} offsetX - starting index
* @param {Callback} clbk - callback function
* @param {*} thisArg - execution context
-* @returns {Object} input array object
+* @returns {integer} index
*
* @example
* var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' );
diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfind-index/lib/main.js b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/lib/main.js
index 5e57611fc1d4..30f2c7f3db78 100644
--- a/lib/node_modules/@stdlib/blas/ext/base/gfind-index/lib/main.js
+++ b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/lib/main.js
@@ -34,7 +34,7 @@ var ndarray = require( './ndarray.js' );
* @param {integer} strideX - stride length
* @param {Callback} clbk - callback function
* @param {*} [thisArg] - execution context
-* @returns {Collection} input array
+* @returns {integer} index
*
* @example
* function isEven( v ) {
diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfind-index/lib/ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/lib/ndarray.js
index 46c58ac2d65e..e528e3d7201c 100644
--- a/lib/node_modules/@stdlib/blas/ext/base/gfind-index/lib/ndarray.js
+++ b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/lib/ndarray.js
@@ -35,7 +35,7 @@ var accessors = require( './accessors.js' );
* @param {NonNegativeInteger} offsetX - starting index
* @param {Callback} clbk - callback function
* @param {*} [thisArg] - execution context
-* @returns {Collection} input array
+* @returns {integer} index
*
* @example
* function isEven( v ) {
From ded03f1598235618df3d6cc368f24435249c55e0 Mon Sep 17 00:00:00 2001
From: Athan
Date: Tue, 29 Jul 2025 03:17:59 -0700
Subject: [PATCH 04/12] Apply suggestions from code review
Signed-off-by: Athan
---
.../@stdlib/blas/ext/base/gfind-index/README.md | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfind-index/README.md b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/README.md
index db7cc04e0881..d19d7efb767c 100644
--- a/lib/node_modules/@stdlib/blas/ext/base/gfind-index/README.md
+++ b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/README.md
@@ -45,7 +45,7 @@ var idx = gfindIndex( x.length, x, 1, isEven );
// returns 3
```
-If the function is unable to find an element, the function returns `-1`.
+If no element passes a test implemented by a predicate function, the function returns `-1`.
```javascript
function isEven( v ) {
@@ -94,7 +94,7 @@ var count = ctx.count;
// returns 4
```
-The `N` and stride parameters determine which elements in the strided array are accessed at runtime. For example, to check every other element:
+The `N` and stride parameters determine which elements in the strided array are accessed at runtime. For example, to test every other element:
```javascript
function isEven( v ) {
@@ -116,10 +116,10 @@ function isEven( v ) {
return v % 2.0 === 0.0;
}
-// Initial array...
+// Initial array:
var x0 = new Float64Array( [ 1.0, 3.0, 4.0, -5.0, 7.0, 6.0 ] );
-// Create an offset view...
+// Create an offset view:
var x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
var idx = gfindIndex( 3, x1, 2, isEven );
From 5d1a351d0776a2675d736b61f75afc043b39beb7 Mon Sep 17 00:00:00 2001
From: Athan
Date: Tue, 29 Jul 2025 03:24:22 -0700
Subject: [PATCH 05/12] style: remove empty line
Signed-off-by: Athan
---
.../@stdlib/blas/ext/base/gfind-index/docs/types/index.d.ts | 1 -
1 file changed, 1 deletion(-)
diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfind-index/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/docs/types/index.d.ts
index 8615614a1971..7033de80b49e 100644
--- a/lib/node_modules/@stdlib/blas/ext/base/gfind-index/docs/types/index.d.ts
+++ b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/docs/types/index.d.ts
@@ -139,7 +139,6 @@ interface Routine {
* @returns `index`
*
* @example
- *
* function isEven( v ) {
* return v % 2.0 === 0.0;
* }
From e2ae0b75e97437ceff30da9c35cd4bc95b1af3d4 Mon Sep 17 00:00:00 2001
From: Athan
Date: Tue, 29 Jul 2025 03:29:18 -0700
Subject: [PATCH 06/12] test: update descriptions
Signed-off-by: Athan
---
.../@stdlib/blas/ext/base/gfind-index/test/test.main.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfind-index/test/test.main.js b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/test/test.main.js
index ac541aaf69c9..9eb9e8d8bc27 100644
--- a/lib/node_modules/@stdlib/blas/ext/base/gfind-index/test/test.main.js
+++ b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/test/test.main.js
@@ -80,7 +80,7 @@ tape( 'the function returns the index of the first element which passes a test i
}
});
-tape( 'the function returns `-1` if provided `N` parameter is less than or equal to zero', function test( t ) {
+tape( 'the function returns `-1` if the provided `N` parameter is less than or equal to zero', function test( t ) {
var actual;
actual = gfindIndex( 0, [ 1.0, 2.0, 3.0 ], 1, clbk );
@@ -96,7 +96,7 @@ tape( 'the function returns `-1` if provided `N` parameter is less than or equal
}
});
-tape( 'the function returns `-1` if provided `N` parameter is less than or equal to zero (accessors)', function test( t ) {
+tape( 'the function returns `-1` if the provided `N` parameter is less than or equal to zero (accessors)', function test( t ) {
var actual;
actual = gfindIndex( 0, toAccessorArray( [ 1.0, 2.0, 3.0 ] ), 1, clbk );
From bab6b028befbd49e3cfdc9160594cc80b9d18a4f Mon Sep 17 00:00:00 2001
From: Athan
Date: Tue, 29 Jul 2025 03:29:35 -0700
Subject: [PATCH 07/12] docs: update comment
Signed-off-by: Athan
---
.../@stdlib/blas/ext/base/gfind-index/lib/accessors.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfind-index/lib/accessors.js b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/lib/accessors.js
index 160a1c50f30a..f24bce7b73ba 100644
--- a/lib/node_modules/@stdlib/blas/ext/base/gfind-index/lib/accessors.js
+++ b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/lib/accessors.js
@@ -56,7 +56,7 @@ function gfindIndex( N, x, strideX, offsetX, clbk, thisArg ) {
// Cache reference to array data:
xbuf = x.data;
- // Cache a reference to the element accessors:
+ // Cache a reference to the element accessor:
get = x.accessors[ 0 ];
ix = offsetX;
From 0723d54cc3dd16f3b1d80ec07549de598b0abfae Mon Sep 17 00:00:00 2001
From: Athan
Date: Tue, 29 Jul 2025 03:30:02 -0700
Subject: [PATCH 08/12] docs: update comment
Signed-off-by: Athan
---
.../@stdlib/blas/ext/base/gfind-index/docs/types/test.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfind-index/docs/types/test.ts b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/docs/types/test.ts
index 77fdf2f20160..427e6bb2785b 100644
--- a/lib/node_modules/@stdlib/blas/ext/base/gfind-index/docs/types/test.ts
+++ b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/docs/types/test.ts
@@ -31,7 +31,7 @@ function isEven( v: any ): boolean {
// TESTS //
-// The function returns an integer...
+// The function returns a number...
{
const x = new Float64Array( 10 );
From 6b8e3fa6c387a8956c1a131e7a055df02a01f437 Mon Sep 17 00:00:00 2001
From: Athan
Date: Tue, 29 Jul 2025 03:32:48 -0700
Subject: [PATCH 09/12] test: update descriptions
Signed-off-by: Athan
---
.../@stdlib/blas/ext/base/gfind-index/test/test.ndarray.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfind-index/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/test/test.ndarray.js
index 85af5366f6b5..6a17a75d1564 100644
--- a/lib/node_modules/@stdlib/blas/ext/base/gfind-index/test/test.ndarray.js
+++ b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/test/test.ndarray.js
@@ -80,7 +80,7 @@ tape( 'the function returns the index of the first element which passes a test i
}
});
-tape( 'the function returns `-1` if provided `N` parameter is less than or equal to zero', function test( t ) {
+tape( 'the function returns `-1` if the provided `N` parameter is less than or equal to zero', function test( t ) {
var actual;
actual = gfindIndex( 0, [ 1.0, 2.0, 3.0 ], 1, 0, clbk );
@@ -96,7 +96,7 @@ tape( 'the function returns `-1` if provided `N` parameter is less than or equal
}
});
-tape( 'the function returns `-1` if provided `N` parameter is less than or equal to zero (accessors)', function test( t ) {
+tape( 'the function returns `-1` if the provided `N` parameter is less than or equal to zero (accessors)', function test( t ) {
var actual;
actual = gfindIndex( 0, toAccessorArray( [ 1.0, 2.0, 3.0 ] ), 1, 0, clbk );
From ed598de23cd38a8c13fdf6dfcbfe9ef4bf9a090f Mon Sep 17 00:00:00 2001
From: Muhammad Haris <101793258+headlessNode@users.noreply.github.com>
Date: Wed, 30 Jul 2025 05:14:43 +0000
Subject: [PATCH 10/12] fix: benchmarks
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
- task: lint_filenames
status: passed
- task: lint_editorconfig
status: passed
- task: lint_markdown
status: na
- task: lint_package_json
status: 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: na
- task: lint_typescript_tests
status: na
- task: lint_license_headers
status: passed
---
---
.../blas/ext/base/gfind-index/benchmark/benchmark.js | 6 +++---
.../ext/base/gfind-index/benchmark/benchmark.ndarray.js | 6 +++---
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfind-index/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/benchmark/benchmark.js
index b0893a7cfd1d..637723bdbed5 100644
--- a/lib/node_modules/@stdlib/blas/ext/base/gfind-index/benchmark/benchmark.js
+++ b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/benchmark/benchmark.js
@@ -36,8 +36,8 @@ var gfindIndex = require( './../lib' );
* @param {*} v - array element
* @returns {boolean} result
*/
-function isEven( v ) {
- return v % 2 === 0;
+function clbk( v ) {
+ return v > 999.0;
}
/**
@@ -59,7 +59,7 @@ function createBenchmark( len ) {
b.tic();
for ( i = 0; i < b.iterations; i++ ) {
- idx = gfindIndex( x.length, x, 1, isEven );
+ idx = gfindIndex( x.length, x, 1, clbk );
if ( !isInteger( idx ) ) {
b.fail( 'should return an integer' );
}
diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfind-index/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/benchmark/benchmark.ndarray.js
index 622b687e02bf..f4c69cea8cf5 100644
--- a/lib/node_modules/@stdlib/blas/ext/base/gfind-index/benchmark/benchmark.ndarray.js
+++ b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/benchmark/benchmark.ndarray.js
@@ -36,8 +36,8 @@ var gfindIndex = require( './../lib' ).ndarray;
* @param {*} v - array element
* @returns {boolean} result
*/
-function isEven( v ) {
- return v % 2 === 0;
+function clbk( v ) {
+ return v > 999.0;
}
/**
@@ -59,7 +59,7 @@ function createBenchmark( len ) {
b.tic();
for ( i = 0; i < b.iterations; i++ ) {
- idx = gfindIndex( x.length, x, 1, 0, isEven );
+ idx = gfindIndex( x.length, x, 1, 0, clbk );
if ( !isInteger( idx ) ) {
b.fail( 'should return an integer' );
}
From 643b8da73d14f789323f9a55915271c278d1160c Mon Sep 17 00:00:00 2001
From: Muhammad Haris <101793258+headlessNode@users.noreply.github.com>
Date: Wed, 30 Jul 2025 05:21:30 +0000
Subject: [PATCH 11/12] docs: fix repl docs
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
- task: lint_filenames
status: passed
- task: lint_editorconfig
status: passed
- task: lint_markdown
status: na
- task: lint_package_json
status: na
- task: lint_repl_help
status: passed
- task: lint_javascript_src
status: na
- task: lint_javascript_cli
status: na
- task: lint_javascript_examples
status: na
- task: lint_javascript_tests
status: na
- task: lint_javascript_benchmarks
status: na
- task: lint_python
status: na
- task: lint_r
status: na
- task: lint_c_src
status: na
- task: lint_c_examples
status: na
- task: lint_c_benchmarks
status: na
- task: lint_c_tests_fixtures
status: na
- task: lint_shell
status: na
- task: lint_typescript_declarations
status: passed
- task: lint_typescript_tests
status: na
- task: lint_license_headers
status: passed
---
---
.../@stdlib/blas/ext/base/gfind-index/docs/repl.txt | 3 ++-
.../@stdlib/blas/ext/base/gfind-index/docs/types/index.d.ts | 6 +++---
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfind-index/docs/repl.txt b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/docs/repl.txt
index fba6e9f5f35c..aa9ec246b289 100644
--- a/lib/node_modules/@stdlib/blas/ext/base/gfind-index/docs/repl.txt
+++ b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/docs/repl.txt
@@ -9,7 +9,8 @@
Indexing is relative to the first index. To introduce an offset, use typed
array views.
- If `N <= 0`, the function returns `-1`.
+ If `N <= 0` or no element passes a test implemented by a predicate function,
+ the function returns `-1`.
The callback function is provided the following arguments:
diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfind-index/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/docs/types/index.d.ts
index 7033de80b49e..510d04d0e76a 100644
--- a/lib/node_modules/@stdlib/blas/ext/base/gfind-index/docs/types/index.d.ts
+++ b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/docs/types/index.d.ts
@@ -104,7 +104,7 @@ interface Routine {
* @param strideX - stride length
* @param clbk - callback function
* @param thisArg - execution context
- * @returns `index`
+ * @returns index
*
* @example
* function isEven( v ) {
@@ -136,7 +136,7 @@ interface Routine {
* @param offsetX - starting index
* @param clbk - callback function
* @param thisArg - execution context
- * @returns `index`
+ * @returns index
*
* @example
* function isEven( v ) {
@@ -168,7 +168,7 @@ interface Routine {
* @param strideX - stride length
* @param clbk - callback function
* @param thisArg - execution context
-* @returns `index`
+* @returns index
*
* @example
* function isEven( v ) {
From 52ded3823b5d43d908e02f13057226a88ef48bc3 Mon Sep 17 00:00:00 2001
From: Muhammad Haris <101793258+headlessNode@users.noreply.github.com>
Date: Wed, 30 Jul 2025 05:25:04 +0000
Subject: [PATCH 12/12] test: fix incorrect offsets
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
- task: lint_filenames
status: passed
- task: lint_editorconfig
status: passed
- task: lint_markdown
status: na
- task: lint_package_json
status: na
- task: lint_repl_help
status: na
- task: lint_javascript_src
status: na
- task: lint_javascript_cli
status: na
- task: lint_javascript_examples
status: na
- task: lint_javascript_tests
status: passed
- task: lint_javascript_benchmarks
status: na
- task: lint_python
status: na
- task: lint_r
status: na
- task: lint_c_src
status: na
- task: lint_c_examples
status: na
- task: lint_c_benchmarks
status: na
- task: lint_c_tests_fixtures
status: na
- task: lint_shell
status: na
- task: lint_typescript_declarations
status: na
- task: lint_typescript_tests
status: na
- task: lint_license_headers
status: passed
---
---
.../blas/ext/base/gfind-index/test/test.ndarray.js | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/node_modules/@stdlib/blas/ext/base/gfind-index/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/test/test.ndarray.js
index 6a17a75d1564..fc88ed59e9fc 100644
--- a/lib/node_modules/@stdlib/blas/ext/base/gfind-index/test/test.ndarray.js
+++ b/lib/node_modules/@stdlib/blas/ext/base/gfind-index/test/test.ndarray.js
@@ -45,11 +45,11 @@ tape( 'the function returns the index of the first element which passes a test i
x = [ 1.0, 1.0, 2.0, 3.0, 2.0, 3.0 ];
// Nonnegative stride...
- actual = gfindIndex( x.length, x, 1, 3, clbk );
+ actual = gfindIndex( 3, x, 1, 3, clbk );
t.strictEqual( actual, 1, 'returns expected value' );
// Negative stride...
- actual = gfindIndex( x.length, x, -1, 3, clbk );
+ actual = gfindIndex( 3, x, -1, 3, clbk );
t.strictEqual( actual, 1, 'returns expected value' );
t.end();
@@ -66,11 +66,11 @@ tape( 'the function returns the index of the first element which passes a test i
x = toAccessorArray( [ 1.0, 1.0, 2.0, 3.0, 2.0, 3.0 ] );
// Nonnegative stride...
- actual = gfindIndex( x.length, x, 1, 3, clbk );
+ actual = gfindIndex( 3, x, 1, 3, clbk );
t.strictEqual( actual, 1, 'returns expected value' );
// Negative stride...
- actual = gfindIndex( x.length, x, -1, 3, clbk );
+ actual = gfindIndex( 3, x, -1, 3, clbk );
t.strictEqual( actual, 1, 'returns expected value' );
t.end();