From 375578ae0e337ed16aa1a07084bdaea3c8a6a994 Mon Sep 17 00:00:00 2001
From: Muhammad Haris <101793258+headlessNode@users.noreply.github.com>
Date: Tue, 15 Jul 2025 08:02:46 +0000
Subject: [PATCH 01/41] feat: add blas/ext/last-index-of
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
- task: lint_filenames
status: passed
- task: lint_editorconfig
status: passed
- task: lint_markdown
status: passed
- task: lint_package_json
status: passed
- task: lint_repl_help
status: passed
- task: lint_javascript_src
status: passed
- task: lint_javascript_cli
status: na
- task: lint_javascript_examples
status: passed
- task: lint_javascript_tests
status: passed
- task: lint_javascript_benchmarks
status: passed
- task: lint_python
status: na
- task: lint_r
status: na
- task: lint_c_src
status: na
- task: lint_c_examples
status: na
- task: lint_c_benchmarks
status: na
- task: lint_c_tests_fixtures
status: na
- task: lint_shell
status: na
- task: lint_typescript_declarations
status: passed
- task: lint_typescript_tests
status: passed
- task: lint_license_headers
status: passed
---
---
.../@stdlib/blas/ext/last-index-of/README.md | 260 +++
.../benchmark/benchmark.assign.js | 113 ++
.../ext/last-index-of/benchmark/benchmark.js | 105 ++
.../blas/ext/last-index-of/docs/repl.txt | 132 ++
.../ext/last-index-of/docs/types/index.d.ts | 250 +++
.../blas/ext/last-index-of/docs/types/test.ts | 460 ++++++
.../blas/ext/last-index-of/examples/index.js | 41 +
.../blas/ext/last-index-of/lib/assign.js | 223 +++
.../blas/ext/last-index-of/lib/base.js | 120 ++
.../blas/ext/last-index-of/lib/index.js | 71 +
.../blas/ext/last-index-of/lib/main.js | 202 +++
.../ext/last-index-of/lib/non_core_shape.js | 50 +
.../blas/ext/last-index-of/package.json | 65 +
.../ext/last-index-of/test/test.assign.js | 1433 +++++++++++++++++
.../blas/ext/last-index-of/test/test.js | 39 +
.../blas/ext/last-index-of/test/test.main.js | 1275 +++++++++++++++
16 files changed, 4839 insertions(+)
create mode 100644 lib/node_modules/@stdlib/blas/ext/last-index-of/README.md
create mode 100644 lib/node_modules/@stdlib/blas/ext/last-index-of/benchmark/benchmark.assign.js
create mode 100644 lib/node_modules/@stdlib/blas/ext/last-index-of/benchmark/benchmark.js
create mode 100644 lib/node_modules/@stdlib/blas/ext/last-index-of/docs/repl.txt
create mode 100644 lib/node_modules/@stdlib/blas/ext/last-index-of/docs/types/index.d.ts
create mode 100644 lib/node_modules/@stdlib/blas/ext/last-index-of/docs/types/test.ts
create mode 100644 lib/node_modules/@stdlib/blas/ext/last-index-of/examples/index.js
create mode 100644 lib/node_modules/@stdlib/blas/ext/last-index-of/lib/assign.js
create mode 100644 lib/node_modules/@stdlib/blas/ext/last-index-of/lib/base.js
create mode 100644 lib/node_modules/@stdlib/blas/ext/last-index-of/lib/index.js
create mode 100644 lib/node_modules/@stdlib/blas/ext/last-index-of/lib/main.js
create mode 100644 lib/node_modules/@stdlib/blas/ext/last-index-of/lib/non_core_shape.js
create mode 100644 lib/node_modules/@stdlib/blas/ext/last-index-of/package.json
create mode 100644 lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.assign.js
create mode 100644 lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.js
create mode 100644 lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.main.js
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/README.md b/lib/node_modules/@stdlib/blas/ext/last-index-of/README.md
new file mode 100644
index 000000000000..772ad2204205
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/README.md
@@ -0,0 +1,260 @@
+
+
+# lastIndexOf
+
+> Return the last index of a specified search element along an [ndarray][@stdlib/ndarray/ctor] dimension.
+
+
+
+## Usage
+
+```javascript
+var lastIndexOf = require( '@stdlib/blas/ext/last-index-of' );
+```
+
+#### lastIndexOf( x, searchElement\[, fromIndex]\[, options] )
+
+Returns the last index of a specified search element along an [ndarray][@stdlib/ndarray/ctor] dimension.
+
+```javascript
+var array = require( '@stdlib/ndarray/array' );
+
+// Create an input ndarray:
+var x = array( [ 1.0, 2.0, 3.0, 2.0, 5.0, 6.0 ] );
+// returns
+
+// Perform operation:
+var out = lastIndexOf( x, 2.0 );
+// returns
+
+var idx = out.get();
+// returns 3
+```
+
+The function has the following parameters:
+
+- **x**: input [ndarray][@stdlib/ndarray/ctor]. Must have at least one dimension.
+- **searchElement**: search element. May be either a scalar value or an [ndarray][@stdlib/ndarray/ctor]. If provided a scalar value, the value is cast to the data type of the input [ndarray][@stdlib/ndarray/ctor]. If provided an [ndarray][@stdlib/ndarray/ctor], the value must have a shape which is [broadcast-compatible][@stdlib/ndarray/base/broadcast-shapes] with the non-reduced dimensions of the input [ndarray][@stdlib/ndarray/ctor]. For example, given the input shape `[2, 3, 4]` and `options.dim=0`, the search element [ndarray][@stdlib/ndarray/ctor] must have a shape which is [broadcast-compatible][@stdlib/ndarray/base/broadcast-shapes] with the shape `[3, 4]`.
+- **fromIndex**: index from which to begin searching (_optional_). May be either a scalar value or an [ndarray][@stdlib/ndarray/ctor] having an integer index or "generic" [data type][@stdlib/ndarray/dtypes]. If provided an [ndarray][@stdlib/ndarray/ctor], the value must have a shape which is [broadcast-compatible][@stdlib/ndarray/base/broadcast-shapes] with the non-reduced dimensions of the input [ndarray][@stdlib/ndarray/ctor]. For example, given the input shape `[2, 3, 4]` and `options.dim=0`, a provided [ndarray][@stdlib/ndarray/ctor] must have a shape which is [broadcast-compatible][@stdlib/ndarray/base/broadcast-shapes] with the shape `[3, 4]`. If provided a negative integer, the index at which to begin searching along a dimension is determined by counting backward from the last element (where `-1` refers to the last element). Default: `0`.
+- **options**: function options (_optional_).
+
+The function accepts the following options:
+
+- **dtype**: output ndarray [data type][@stdlib/ndarray/dtypes]. Must be an integer index or generic [data type][@stdlib/ndarray/dtypes].
+- **dim**: dimension over which to perform operation. If provided a negative integer, the dimension along which to perform the operation is determined by counting backward from the last dimension (where `-1` refers to the last dimension). Default: `-1`.
+- **keepdims**: boolean indicating whether the reduced dimensions should be included in the returned [ndarray][@stdlib/ndarray/ctor] as singleton dimensions. Default: `false`.
+
+If the function is unable to find a search element along an [ndarray][@stdlib/ndarray/ctor], the corresponding element in the returned [ndarray][@stdlib/ndarray/ctor] is `-1`.
+
+```javascript
+var array = require( '@stdlib/ndarray/array' );
+
+// Create an input ndarray:
+var x = array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
+// returns
+
+// Perform operation:
+var out = lastIndexOf( x, 10.0 );
+// returns
+
+var idx = out.get();
+// returns -1
+```
+
+By default, the function begins searching from the first element along the reduction dimension. To begin searching from a different index, provide a `fromIndex` argument.
+
+```javascript
+var array = require( '@stdlib/ndarray/array' );
+
+// Create an input ndarray:
+var x = array( [ 1.0, 2.0, 3.0, 4.0, 2.0, 6.0 ] );
+// returns
+
+// Perform operation:
+var out = lastIndexOf( x, 2.0, 3 );
+// returns
+
+var idx = out.get();
+// returns 4
+```
+
+By default, the function performs the operation over elements in the last dimension. To perform the operation over a different dimension, provide a `dim` option.
+
+```javascript
+var ndarray2array = require( '@stdlib/ndarray/to-array' );
+var array = require( '@stdlib/ndarray/array' );
+
+var x = array( [ [ -3.0, 2.0 ], [ -3.0, 4.0 ] ] );
+
+var out = lastIndexOf( x, -3.0, {
+ 'dim': 0
+});
+// returns
+
+var idx = ndarray2array( out );
+// returns [ 1, -1 ]
+```
+
+By default, the function excludes reduced dimensions from the output [ndarray][@stdlib/ndarray/ctor]. To include the reduced dimensions as singleton dimensions, set the `keepdims` option to `true`.
+
+```javascript
+var array = require( '@stdlib/ndarray/array' );
+var ndarray2array = require( '@stdlib/ndarray/to-array' );
+
+var x = array( [ [ -3.0, 2.0 ], [ -3.0, 4.0 ] ] );
+
+var opts = {
+ 'dim': 0,
+ 'keepdims': true
+};
+
+var out = lastIndexOf( x, -3.0, opts );
+// returns
+
+var idx = ndarray2array( out );
+// returns [ [ 1, -1 ] ]
+```
+
+By default, the function returns an [ndarray][@stdlib/ndarray/ctor] having a [data type][@stdlib/ndarray/dtypes] determined by the function's output data type [policy][@stdlib/ndarray/output-dtype-policies]. To override the default behavior, set the `dtype` option.
+
+```javascript
+var ndarray2array = require( '@stdlib/ndarray/to-array' );
+var dtype = require( '@stdlib/ndarray/dtype' );
+var array = require( '@stdlib/ndarray/array' );
+
+var x = array( [ 1.0, 2.0, 3.0, 4.0 ] );
+
+var idx = lastIndexOf( x, 2.0, {
+ 'dtype': 'generic'
+});
+// returns
+
+var dt = dtype( idx );
+// returns 'generic'
+```
+
+#### lastIndexOf.assign( x, searchElement\[, fromIndex], out\[, options] )
+
+Returns the last index of a specified search element along an [ndarray][@stdlib/ndarray/ctor] dimension and assigns results to a provided output [ndarray][@stdlib/ndarray/ctor].
+
+```javascript
+var array = require( '@stdlib/ndarray/array' );
+var zeros = require( '@stdlib/ndarray/zeros' );
+
+var x = array( [ 1.0, 2.0, 3.0, 2.0, 5.0, 6.0 ] );
+var y = zeros( [], {
+ 'dtype': 'int32'
+});
+
+var out = lastIndexOf.assign( x, 2.0, y );
+// returns
+
+var idx = out.get();
+// returns 3
+
+var bool = ( out === y );
+// returns true
+```
+
+The method has the following parameters:
+
+- **x**: input [ndarray][@stdlib/ndarray/ctor]. Must have at least one dimension.
+- **searchElement**: search element. May be either a scalar value or an [ndarray][@stdlib/ndarray/ctor]. If provided a scalar value, the value is cast to the data type of the input [ndarray][@stdlib/ndarray/ctor]. If provided an [ndarray][@stdlib/ndarray/ctor], the value must have a shape which is [broadcast-compatible][@stdlib/ndarray/base/broadcast-shapes] with the non-reduced dimensions of the input [ndarray][@stdlib/ndarray/ctor]. For example, given the input shape `[2, 3, 4]` and `options.dim=0`, the search element [ndarray][@stdlib/ndarray/ctor] must have a shape which is [broadcast-compatible][@stdlib/ndarray/base/broadcast-shapes] with the shape `[3, 4]`.
+- **fromIndex**: index from which to begin searching (_optional_). May be either a scalar value or an [ndarray][@stdlib/ndarray/ctor] having an integer index or "generic" [data type][@stdlib/ndarray/dtypes]. If provided an [ndarray][@stdlib/ndarray/ctor], the value must have a shape which is [broadcast-compatible][@stdlib/ndarray/base/broadcast-shapes] with the non-reduced dimensions of the input [ndarray][@stdlib/ndarray/ctor]. For example, given the input shape `[2, 3, 4]` and `options.dim=0`, a provided [ndarray][@stdlib/ndarray/ctor] must have a shape which is [broadcast-compatible][@stdlib/ndarray/base/broadcast-shapes] with the shape `[3, 4]`. If provided a negative integer, the index at which to begin searching along a dimension is determined by counting backward from the last element (where `-1` refers to the last element). Default: `0`.
+- **out**: output [ndarray][@stdlib/ndarray/ctor].
+- **options**: function options (_optional_).
+
+The method accepts the following options:
+
+- **dim**: dimension over which to perform operation. If provided a negative integer, the dimension along which to perform the operation is determined by counting backward from the last dimension (where `-1` refers to the last dimension). Default: `-1`.
+
+
+
+
+
+
+
+## Notes
+
+- Setting the `keepdims` option to `true` can be useful when wanting to ensure that the output [ndarray][@stdlib/ndarray/ctor] is [broadcast-compatible][@stdlib/ndarray/base/broadcast-shapes] with ndarrays having the same shape as the input [ndarray][@stdlib/ndarray/ctor].
+- The output data type [policy][@stdlib/ndarray/output-dtype-policies] only applies to the main function and specifies that, by default, the function must return an [ndarray][@stdlib/ndarray/ctor] having an integer index or "generic" [data type][@stdlib/ndarray/dtypes]. For the `assign` method, the output [ndarray][@stdlib/ndarray/ctor] is allowed to have any supported output [data type][@stdlib/ndarray/dtypes].
+
+
+
+
+
+
+
+## Examples
+
+
+
+```javascript
+var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
+var ndarray2array = require( '@stdlib/ndarray/to-array' );
+var ndarray = require( '@stdlib/ndarray/ctor' );
+var lastIndexOf = require( '@stdlib/blas/ext/last-index-of' );
+
+// Generate an array of random numbers:
+var xbuf = discreteUniform( 10, 0, 20, {
+ 'dtype': 'float64'
+});
+
+// Wrap in an ndarray:
+var x = new ndarray( 'float64', xbuf, [ 5, 2 ], [ 2, 1 ], 0, 'row-major' );
+console.log( ndarray2array( x ) );
+
+// Perform operation:
+var idx = lastIndexOf( x, 10.0, {
+ 'dim': 0
+});
+
+// Print the results:
+console.log( ndarray2array( idx ) );
+```
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+[@stdlib/ndarray/ctor]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/ctor
+
+[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/dtypes
+
+[@stdlib/ndarray/output-dtype-policies]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/output-dtype-policies
+
+[@stdlib/ndarray/base/broadcast-shapes]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/broadcast-shapes
+
+
+
+
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/benchmark/benchmark.assign.js b/lib/node_modules/@stdlib/blas/ext/last-index-of/benchmark/benchmark.assign.js
new file mode 100644
index 000000000000..9367c4b482a5
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/benchmark/benchmark.assign.js
@@ -0,0 +1,113 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2025 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+// MODULES //
+
+var bench = require( '@stdlib/bench' );
+var isnan = require( '@stdlib/math/base/assert/is-nan' );
+var pow = require( '@stdlib/math/base/special/pow' );
+var uniform = require( '@stdlib/random/array/uniform' );
+var zeros = require( '@stdlib/ndarray/zeros' );
+var ndarray = require( '@stdlib/ndarray/base/ctor' );
+var pkg = require( './../package.json' ).name;
+var lastIndexOf = require( './../lib' );
+
+
+// VARIABLES //
+
+var options = {
+ 'dtype': 'float64'
+};
+
+
+// FUNCTIONS //
+
+/**
+* Creates a benchmark function.
+*
+* @private
+* @param {PositiveInteger} len - array length
+* @returns {Function} benchmark function
+*/
+function createBenchmark( len ) {
+ var out;
+ var x;
+
+ x = uniform( len, -50.0, 50.0, options );
+ x = new ndarray( options.dtype, x, [ len ], [ 1 ], 0, 'row-major' );
+
+ out = zeros( [], {
+ 'dtype': 'int32'
+ });
+
+ return benchmark;
+
+ /**
+ * Benchmark function.
+ *
+ * @private
+ * @param {Benchmark} b - benchmark instance
+ */
+ function benchmark( b ) {
+ var o;
+ var i;
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ o = lastIndexOf.assign( x, 10.0, out );
+ if ( typeof o !== 'object' ) {
+ b.fail( 'should return an ndarray' );
+ }
+ }
+ b.toc();
+ if ( isnan( o.get() ) ) {
+ b.fail( 'should not return NaN' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+ }
+}
+
+
+// MAIN //
+
+/**
+* Main execution sequence.
+*
+* @private
+*/
+function main() {
+ var len;
+ var min;
+ var max;
+ var f;
+ var i;
+
+ min = 1; // 10^min
+ max = 6; // 10^max
+
+ for ( i = min; i <= max; i++ ) {
+ len = pow( 10, i );
+ f = createBenchmark( len );
+ bench( pkg+':assign:dtype='+options.dtype+',len='+len, f );
+ }
+}
+
+main();
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/ext/last-index-of/benchmark/benchmark.js
new file mode 100644
index 000000000000..f878c4157776
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/benchmark/benchmark.js
@@ -0,0 +1,105 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2025 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+// MODULES //
+
+var bench = require( '@stdlib/bench' );
+var isnan = require( '@stdlib/math/base/assert/is-nan' );
+var pow = require( '@stdlib/math/base/special/pow' );
+var uniform = require( '@stdlib/random/array/uniform' );
+var ndarray = require( '@stdlib/ndarray/base/ctor' );
+var pkg = require( './../package.json' ).name;
+var lastIndexOf = require( './../lib' );
+
+
+// VARIABLES //
+
+var options = {
+ 'dtype': 'float64'
+};
+
+
+// FUNCTIONS //
+
+/**
+* Creates a benchmark function.
+*
+* @private
+* @param {PositiveInteger} len - array length
+* @returns {Function} benchmark function
+*/
+function createBenchmark( len ) {
+ var x = uniform( len, -50.0, 50.0, options );
+ x = new ndarray( options.dtype, x, [ len ], [ 1 ], 0, 'row-major' );
+
+ return benchmark;
+
+ /**
+ * Benchmark function.
+ *
+ * @private
+ * @param {Benchmark} b - benchmark instance
+ */
+ function benchmark( b ) {
+ var o;
+ var i;
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ o = lastIndexOf( x, 10.0 );
+ if ( typeof o !== 'object' ) {
+ b.fail( 'should return an ndarray' );
+ }
+ }
+ b.toc();
+ if ( isnan( o.get() ) ) {
+ b.fail( 'should not return NaN' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+ }
+}
+
+
+// MAIN //
+
+/**
+* Main execution sequence.
+*
+* @private
+*/
+function main() {
+ var len;
+ var min;
+ var max;
+ var f;
+ var i;
+
+ min = 1; // 10^min
+ max = 6; // 10^max
+
+ for ( i = min; i <= max; i++ ) {
+ len = pow( 10, i );
+ f = createBenchmark( len );
+ bench( pkg+':dtype='+options.dtype+',len='+len, f );
+ }
+}
+
+main();
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/docs/repl.txt b/lib/node_modules/@stdlib/blas/ext/last-index-of/docs/repl.txt
new file mode 100644
index 000000000000..496401917a9a
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/docs/repl.txt
@@ -0,0 +1,132 @@
+
+{{alias}}( x, searchElement[, fromIndex][, options] )
+ Returns the last index of a specified search element along an ndarray
+ dimension.
+
+ When searching for a search element, 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.
+
+ If unable to find a search element along an ndarray dimension, the
+ corresponding element in the returned ndarray is `-1`.
+
+ Parameters
+ ----------
+ x: ndarray
+ Input array. Must have at least one dimension.
+
+ searchElement: ndarray|any
+ Search element. May be either a scalar value or an ndarray. If provided
+ a scalar value, the value is cast to the data type of the input ndarray.
+ If provided an ndarray, the value must have a shape which is broadcast
+ compatible with the non-reduced dimensions of the input ndarray. For
+ example, given the input shape `[2, 3, 4]` and `options.dim=0`, the
+ search element ndarray must have a shape which is broadcast-compatible
+ with the shape `[3, 4]`.
+
+ fromIndex: ndarray|integer (optional)
+ Index from which to begin searching. May be either a scalar value or an
+ ndarray having an integer or "generic" data type. If provided an ndarray
+ the value must have a shape which is broadcast compatible with the non-
+ reduced dimensions of the input ndarray. For example, given the input
+ shape `[2, 3, 4]` and `options.dim=0`, a provided ndarray must have a
+ shape which is broadcast-compatible with the shape `[3, 4]`. If provided
+ a negative integer, the index at which to begin searching along a
+ dimension is determined by counting backward from the last element
+ (where -1 refers to the last element). Default: 0.
+
+ options: Object (optional)
+ Function options.
+
+ options.dtype: string (optional)
+ Output array data type. Must be an integer index or "generic" data type.
+
+ options.dim: integer (optional)
+ Dimension over which to perform a reduction. If provided a negative
+ integer, the dimension along which to perform the operation is
+ determined by counting backward from the last dimension (where -1 refers
+ to the last dimension). Default: -1.
+
+ options.keepdims: boolean (optional)
+ Boolean indicating whether the reduced dimensions should be included in
+ the returned ndarray as singleton dimensions. Default: false.
+
+ Returns
+ -------
+ out: ndarray
+ Output array.
+
+ Examples
+ --------
+ > var x = {{alias:@stdlib/ndarray/array}}( [ -1.0, 2.0, -3.0, 2.0 ] );
+ > var y = {{alias}}( x, 2.0 );
+ > var v = y.get()
+ 3
+
+
+{{alias}}.assign( x, searchElement[, fromIndex], out[, options] )
+ Returns the last index of a specified search element along an ndarray
+ dimension and assigns results to a provided output ndarray.
+
+ When searching for a search element, 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.
+
+ If unable to find a search element along an ndarray dimension, the
+ corresponding element in the returned ndarray is `-1`.
+
+ Parameters
+ ----------
+ x: ndarray
+ Input array. Must have at least one dimension.
+
+ searchElement: ndarray|any
+ Search element. May be either a scalar value or an ndarray. If provided
+ a scalar value, the value is cast to the data type of the input ndarray.
+ If provided an ndarray, the value must have a shape which is broadcast
+ compatible with the non-reduced dimensions of the input ndarray. For
+ example, given the input shape `[2, 3, 4]` and `options.dim=0`, the
+ search element ndarray must have a shape which is broadcast-compatible
+ with the shape `[3, 4]`.
+
+ fromIndex: ndarray|integer (optional)
+ Index from which to begin searching. May be either a scalar value or an
+ ndarray having an integer or "generic" data type. If provided an ndarray
+ the value must have a shape which is broadcast compatible with the non-
+ reduced dimensions of the input ndarray. For example, given the input
+ shape `[2, 3, 4]` and `options.dim=0`, a provided ndarray must have a
+ shape which is broadcast-compatible with the shape `[3, 4]`. If provided
+ a negative integer, the index at which to begin searching along a
+ dimension is determined by counting backward from the last element
+ (where -1 refers to the last element). Default: 0.
+
+ out: ndarray
+ Output array.
+
+ options: Object (optional)
+ Function options.
+
+ options.dim: integer (optional)
+ Dimension over which to perform a reduction. If provided a negative
+ integer, the dimension along which to perform the operation is
+ determined by counting backward from the last dimension (where -1 refers
+ to the last dimension). Default: -1.
+
+ Returns
+ -------
+ out: ndarray
+ Output array.
+
+ Examples
+ --------
+ > var x = {{alias:@stdlib/ndarray/array}}( [ -1.0, 2.0, -3.0, 2.0 ] );
+ > var out = {{alias:@stdlib/ndarray/zeros}}( [], { 'dtype': 'int32' } );
+ > var y = {{alias}}.assign( x, 2.0, out )
+
+ > var bool = ( out === y )
+ true
+ > var v = out.get()
+ 3
+
+ See Also
+ --------
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/ext/last-index-of/docs/types/index.d.ts
new file mode 100644
index 000000000000..0dabe33c3600
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/docs/types/index.d.ts
@@ -0,0 +1,250 @@
+/*
+* @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 { IntegerIndexAndGenericDataType as DataType, typedndarray } from '@stdlib/types/ndarray';
+
+/**
+* Input array.
+*/
+type InputArray = typedndarray;
+
+/**
+* Search element.
+*/
+type SearchElement = typedndarray | T;
+
+/**
+* From index.
+*/
+type FromIndex = typedndarray | number;
+
+/**
+* Output array.
+*/
+type OutputArray = typedndarray;
+
+/**
+* Interface defining "base" options.
+*/
+interface BaseOptions {
+ /**
+ * Dimension over which to perform operation. Default: `-1`.
+ *
+ * ## Notes
+ *
+ * - If provided a negative integer, the dimension along which to perform the operation is determined by counting backward from the last dimension (where `-1` refers to the last dimension).
+ */
+ dim?: number;
+}
+
+/**
+* Interface defining options.
+*/
+interface Options extends BaseOptions {
+ /**
+ * Output array data type.
+ */
+ dtype?: DataType;
+
+ /**
+ * Boolean indicating whether the reduced dimensions should be included in the returned array as singleton dimensions. Default: `false`.
+ */
+ keepdims?: boolean;
+}
+
+
+/**
+* Interface describing `lastIndexOf`.
+*/
+interface lastIndexOf {
+ /**
+ * Returns the last index of a specified search element along an ndarray dimension.
+ *
+ * ## Notes
+ *
+ * - When searching for a search element, 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.
+ * - If unable to find a search element along an ndarray dimension, the corresponding element in the returned ndarray is `-1`.
+ *
+ * @param x - input ndarray
+ * @param searchElement - search element
+ * @param options - function options
+ * @returns output ndarray
+ *
+ * @example
+ * var array = require( '@stdlib/ndarray/array' );
+ *
+ * var x = array( [ -1.0, 2.0, -3.0, 2.0 ] );
+ *
+ * var y = lastIndexOf( x, 2.0 );
+ * // returns
+ *
+ * var idx = y.get();
+ * // returns 3
+ */
+ ( x: InputArray, searchElement: SearchElement, options?: Options ): OutputArray;
+
+ /**
+ * Returns the last index of a specified search element along an ndarray dimension.
+ *
+ * ## Notes
+ *
+ * - When searching for a search element, 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.
+ * - If unable to find a search element along an ndarray dimension, the corresponding element in the returned ndarray is `-1`.
+ *
+ * @param x - input ndarray
+ * @param searchElement - search element
+ * @param fromIndex - index from which to begin searching
+ * @param options - function options
+ * @returns output ndarray
+ *
+ * @example
+ * var array = require( '@stdlib/ndarray/array' );
+ *
+ * var x = array( [ -1.0, 2.0, -3.0, 2.0, -5.0, 6.0 ] );
+ *
+ * var y = lastIndexOf( x, 2.0, 2 );
+ * // returns
+ *
+ * var idx = y.get();
+ * // returns 3
+ */
+ ( x: InputArray, searchElement: SearchElement, fromIndex: FromIndex, options?: Options ): OutputArray;
+
+ /**
+ * Returns the last index of a specified search element along an ndarray dimension and assigns results to a provided output ndarray.
+ *
+ * ## Notes
+ *
+ * - When searching for a search element, 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.
+ * - If unable to find a search element along an ndarray dimension, the corresponding element in the returned ndarray is `-1`.
+ *
+ * @param x - input ndarray
+ * @param searchElement - search element
+ * @param out - output ndarray
+ * @param options - function options
+ * @returns output ndarray
+ *
+ * @example
+ * var zeros = require( '@stdlib/ndarray/zeros' );
+ * var array = require( '@stdlib/ndarray/array' );
+ *
+ * var x = array( [ -1.0, 2.0, -3.0, 2.0 ] );
+ * var y = zeros( [], {
+ * 'dtype': 'int32'
+ * } );
+ *
+ * var out = lastIndexOf.assign( x, 2.0, y );
+ * // returns
+ *
+ * var bool = ( out === y );
+ * // returns true
+ *
+ * var idx = out.get();
+ * // returns 3
+ */
+ assign( x: InputArray, searchElement: SearchElement, out: U, options?: BaseOptions ): U;
+
+ /**
+ * Returns the last index of a specified search element along an ndarray dimension and assigns results to a provided output ndarray.
+ *
+ * ## Notes
+ *
+ * - When searching for a search element, 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.
+ * - If unable to find a search element along an ndarray dimension, the corresponding element in the returned ndarray is `-1`.
+ *
+ * @param x - input ndarray
+ * @param searchElement - search element
+ * @param fromIndex - index from which to begin searching
+ * @param out - output ndarray
+ * @param options - function options
+ * @returns output ndarray
+ *
+ * @example
+ * var zeros = require( '@stdlib/ndarray/zeros' );
+ * var array = require( '@stdlib/ndarray/array' );
+ *
+ * var x = array( [ -1.0, 2.0, -3.0, 2.0, -5.0, 6.0 ] );
+ * var y = zeros( [], {
+ * 'dtype': 'int32'
+ * } );
+ *
+ * var out = lastIndexOf.assign( x, 2.0, 2, y );
+ * // returns
+ *
+ * var bool = ( out === y );
+ * // returns true
+ *
+ * var idx = out.get();
+ * // returns 3
+ */
+ assign( x: InputArray, searchElement: SearchElement, fromIndex: FromIndex, out: U, options?: BaseOptions ): U;
+}
+
+/**
+* Returns the last index of a specified search element along an ndarray dimension.
+*
+* ## Notes
+*
+* - When searching for a search element, 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.
+* - If unable to find a search element along an ndarray dimension, the corresponding element in the returned ndarray is `-1`.
+*
+* @param x - input ndarray
+* @param searchElement - search element
+* @param fromIndex - index from which to begin searching
+* @param options - function options
+* @returns output ndarray
+*
+* @example
+* var array = require( '@stdlib/ndarray/array' );
+*
+* var x = array( [ -1.0, 2.0, -3.0, 2.0 ] );
+*
+* var y = lastIndexOf( x, 2.0 );
+* // returns
+*
+* var idx = y.get();
+* // returns 3
+*
+* @example
+* var zeros = require( '@stdlib/ndarray/zeros' );
+* var array = require( '@stdlib/ndarray/array' );
+*
+* var x = array( [ -1.0, 2.0, -3.0, 2.0 ] );
+* var y = zeros( x, {
+* 'dtype': 'int32'
+* } );
+*
+* var out = lastIndexOf.assign( x, 2.0, y );
+* // returns
+*
+* var bool = ( out === y );
+* // returns true
+*
+* var idx = out.get();
+* // returns 3
+*/
+declare const lastIndexOf: lastIndexOf;
+
+
+// EXPORTS //
+
+export = lastIndexOf;
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/docs/types/test.ts b/lib/node_modules/@stdlib/blas/ext/last-index-of/docs/types/test.ts
new file mode 100644
index 000000000000..f9223c78524c
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/docs/types/test.ts
@@ -0,0 +1,460 @@
+/*
+* @license Apache-2.0
+*
+* Copyright (c) 2025 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+/* eslint-disable @typescript-eslint/no-unused-expressions, space-in-parens */
+
+///
+
+import zeros = require( '@stdlib/ndarray/zeros' );
+import lastIndexOf = require( './index' );
+
+
+// TESTS //
+
+// The function returns an ndarray...
+{
+ const x = zeros( [ 2, 2 ], {
+ 'dtype': 'float64'
+ });
+
+ lastIndexOf( x, 0.0 ); // $ExpectType OutputArray
+ lastIndexOf( x, 0.0, 1 ); // $ExpectType OutputArray
+ lastIndexOf( x, 0.0, {} ); // $ExpectType OutputArray
+ lastIndexOf( x, 0.0, 1, {} ); // $ExpectType OutputArray
+}
+
+// The compiler throws an error if the function is provided a first argument which is not an ndarray...
+{
+ lastIndexOf( '5', 0.0 ); // $ExpectError
+ lastIndexOf( 5, 0.0 ); // $ExpectError
+ lastIndexOf( true, 0.0 ); // $ExpectError
+ lastIndexOf( false, 0.0 ); // $ExpectError
+ lastIndexOf( null, 0.0 ); // $ExpectError
+ lastIndexOf( void 0, 0.0 ); // $ExpectError
+ lastIndexOf( {}, 0.0 ); // $ExpectError
+ lastIndexOf( ( x: number ): number => x, 0.0 ); // $ExpectError
+
+ lastIndexOf( '5', 0.0, 0 ); // $ExpectError
+ lastIndexOf( 5, 0.0, 0 ); // $ExpectError
+ lastIndexOf( true, 0.0, 0 ); // $ExpectError
+ lastIndexOf( false, 0.0, 0 ); // $ExpectError
+ lastIndexOf( null, 0.0, 0 ); // $ExpectError
+ lastIndexOf( void 0, 0.0, 0 ); // $ExpectError
+ lastIndexOf( {}, 0.0, 0 ); // $ExpectError
+ lastIndexOf( ( x: number ): number => x, 0.0, 0 ); // $ExpectError
+
+ lastIndexOf( '5', 0.0, {} ); // $ExpectError
+ lastIndexOf( 5, 0.0, {} ); // $ExpectError
+ lastIndexOf( true, 0.0, {} ); // $ExpectError
+ lastIndexOf( false, 0.0, {} ); // $ExpectError
+ lastIndexOf( null, 0.0, {} ); // $ExpectError
+ lastIndexOf( void 0, 0.0, {} ); // $ExpectError
+ lastIndexOf( {}, 0.0, {} ); // $ExpectError
+ lastIndexOf( ( x: number ): number => x, 0.0, {} ); // $ExpectError
+
+ lastIndexOf( '5', 0.0, 0, {} ); // $ExpectError
+ lastIndexOf( 5, 0.0, 0, {} ); // $ExpectError
+ lastIndexOf( true, 0.0, 0, {} ); // $ExpectError
+ lastIndexOf( false, 0.0, 0, {} ); // $ExpectError
+ lastIndexOf( null, 0.0, 0, {} ); // $ExpectError
+ lastIndexOf( void 0, 0.0, 0, {} ); // $ExpectError
+ lastIndexOf( {}, 0.0, 0, {} ); // $ExpectError
+ lastIndexOf( ( x: number ): number => x, 0.0, 0, {} ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided a search element argument which is not an ndarray or scalar value having the same "type"...
+{
+ const x = zeros( [ 2, 2 ], {
+ 'dtype': 'float64'
+ });
+
+ lastIndexOf( x, '5' ); // $ExpectError
+ lastIndexOf( x, true ); // $ExpectError
+ lastIndexOf( x, false ); // $ExpectError
+ lastIndexOf( x, [] ); // $ExpectError
+ lastIndexOf( x, ( x: number ): number => x ); // $ExpectError
+
+ lastIndexOf( x, '5', 0 ); // $ExpectError
+ lastIndexOf( x, true, 0 ); // $ExpectError
+ lastIndexOf( x, false, 0 ); // $ExpectError
+ lastIndexOf( x, [], 0 ); // $ExpectError
+ lastIndexOf( x, ( x: number ): number => x, 0 ); // $ExpectError
+
+ lastIndexOf( x, '5', {} ); // $ExpectError
+ lastIndexOf( x, true, {} ); // $ExpectError
+ lastIndexOf( x, false, {} ); // $ExpectError
+ lastIndexOf( x, [], {} ); // $ExpectError
+ lastIndexOf( x, ( x: number ): number => x, {} ); // $ExpectError
+
+ lastIndexOf( x, '5', 0, {} ); // $ExpectError
+ lastIndexOf( x, true, 0, {} ); // $ExpectError
+ lastIndexOf( x, false, 0, {} ); // $ExpectError
+ lastIndexOf( x, [], 0, {} ); // $ExpectError
+ lastIndexOf( x, ( x: number ): number => x, 0, {} ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided a from index argument which is not an ndarray or an integer value...
+{
+ const x = zeros( [ 2, 2 ], {
+ 'dtype': 'float64'
+ });
+
+ lastIndexOf( x, 0.0, '5' ); // $ExpectError
+ lastIndexOf( x, 0.0, true ); // $ExpectError
+ lastIndexOf( x, 0.0, false ); // $ExpectError
+ lastIndexOf( x, 0.0, [] ); // $ExpectError
+ lastIndexOf( x, 0.0, ( x: number ): number => x ); // $ExpectError
+
+ lastIndexOf( x, 0.0, '5' ); // $ExpectError
+ lastIndexOf( x, 0.0, true ); // $ExpectError
+ lastIndexOf( x, 0.0, false ); // $ExpectError
+ lastIndexOf( x, 0.0, [] ); // $ExpectError
+ lastIndexOf( x, 0.0, ( x: number ): number => x ); // $ExpectError
+
+ lastIndexOf( x, 0.0, '5', {} ); // $ExpectError
+ lastIndexOf( x, 0.0, true, {} ); // $ExpectError
+ lastIndexOf( x, 0.0, false, {} ); // $ExpectError
+ lastIndexOf( x, 0.0, [], {} ); // $ExpectError
+ lastIndexOf( x, 0.0, ( x: number ): number => x, {} ); // $ExpectError
+
+ lastIndexOf( x, 0.0, '5', {} ); // $ExpectError
+ lastIndexOf( x, 0.0, true, {} ); // $ExpectError
+ lastIndexOf( x, 0.0, false, {} ); // $ExpectError
+ lastIndexOf( x, 0.0, [], {} ); // $ExpectError
+ lastIndexOf( x, 0.0, ( x: number ): number => x, {} ); // $ExpectError
+}
+
+
+// The compiler throws an error if the function is provided a options argument which is not an object...
+{
+ const x = zeros( [ 2, 2 ], {
+ 'dtype': 'float64'
+ });
+
+ lastIndexOf( x, 0.0, '5' ); // $ExpectError
+ lastIndexOf( x, 0.0, true ); // $ExpectError
+ lastIndexOf( x, 0.0, false ); // $ExpectError
+ lastIndexOf( x, 0.0, [] ); // $ExpectError
+ lastIndexOf( x, 0.0, ( x: number ): number => x ); // $ExpectError
+
+ lastIndexOf( x, 0.0, 0, '5' ); // $ExpectError
+ lastIndexOf( x, 0.0, 0, true ); // $ExpectError
+ lastIndexOf( x, 0.0, 0, false ); // $ExpectError
+ lastIndexOf( x, 0.0, 0, null ); // $ExpectError
+ lastIndexOf( x, 0.0, 0, [] ); // $ExpectError
+ lastIndexOf( x, 0.0, 0, ( x: number ): number => x ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided an invalid `dtype` option...
+{
+ const x = zeros( [ 2, 2 ], {
+ 'dtype': 'float64'
+ });
+
+ lastIndexOf( x, 0.0, { 'dtype': '5' } ); // $ExpectError
+ lastIndexOf( x, 0.0, { 'dtype': 5 } ); // $ExpectError
+ lastIndexOf( x, 0.0, { 'dtype': true } ); // $ExpectError
+ lastIndexOf( x, 0.0, { 'dtype': false } ); // $ExpectError
+ lastIndexOf( x, 0.0, { 'dtype': null } ); // $ExpectError
+ lastIndexOf( x, 0.0, { 'dtype': [] } ); // $ExpectError
+ lastIndexOf( x, 0.0, { 'dtype': {} } ); // $ExpectError
+ lastIndexOf( x, 0.0, { 'dtype': ( x: number ): number => x } ); // $ExpectError
+
+ lastIndexOf( x, 0.0, 0, { 'dtype': '5' } ); // $ExpectError
+ lastIndexOf( x, 0.0, 0, { 'dtype': 5 } ); // $ExpectError
+ lastIndexOf( x, 0.0, 0, { 'dtype': true } ); // $ExpectError
+ lastIndexOf( x, 0.0, 0, { 'dtype': false } ); // $ExpectError
+ lastIndexOf( x, 0.0, 0, { 'dtype': null } ); // $ExpectError
+ lastIndexOf( x, 0.0, 0, { 'dtype': [] } ); // $ExpectError
+ lastIndexOf( x, 0.0, 0, { 'dtype': {} } ); // $ExpectError
+ lastIndexOf( x, 0.0, 0, { 'dtype': ( x: number ): number => x } ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided an invalid `dim` option...
+{
+ const x = zeros( [ 2, 2 ], {
+ 'dtype': 'float64'
+ });
+
+ lastIndexOf( x, 0.0, { 'dim': '5' } ); // $ExpectError
+ lastIndexOf( x, 0.0, { 'dim': true } ); // $ExpectError
+ lastIndexOf( x, 0.0, { 'dim': false } ); // $ExpectError
+ lastIndexOf( x, 0.0, { 'dim': null } ); // $ExpectError
+ lastIndexOf( x, 0.0, { 'dim': [] } ); // $ExpectError
+ lastIndexOf( x, 0.0, { 'dim': {} } ); // $ExpectError
+ lastIndexOf( x, 0.0, { 'dim': ( x: number ): number => x } ); // $ExpectError
+
+ lastIndexOf( x, 0.0, 0, { 'dim': '5' } ); // $ExpectError
+ lastIndexOf( x, 0.0, 0, { 'dim': true } ); // $ExpectError
+ lastIndexOf( x, 0.0, 0, { 'dim': false } ); // $ExpectError
+ lastIndexOf( x, 0.0, 0, { 'dim': null } ); // $ExpectError
+ lastIndexOf( x, 0.0, 0, { 'dim': [] } ); // $ExpectError
+ lastIndexOf( x, 0.0, 0, { 'dim': {} } ); // $ExpectError
+ lastIndexOf( x, 0.0, 0, { 'dim': ( x: number ): number => x } ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided an invalid `keepdims` option...
+{
+ const x = zeros( [ 2, 2 ], {
+ 'dtype': 'float64'
+ });
+
+ lastIndexOf( x, 0.0, { 'keepdims': '5' } ); // $ExpectError
+ lastIndexOf( x, 0.0, { 'keepdims': 5 } ); // $ExpectError
+ lastIndexOf( x, 0.0, { 'keepdims': null } ); // $ExpectError
+ lastIndexOf( x, 0.0, { 'keepdims': {} } ); // $ExpectError
+ lastIndexOf( x, 0.0, { 'keepdims': ( x: number ): number => x } ); // $ExpectError
+
+ lastIndexOf( x, 0.0, 0, { 'keepdims': '5' } ); // $ExpectError
+ lastIndexOf( x, 0.0, 0, { 'keepdims': 5 } ); // $ExpectError
+ lastIndexOf( x, 0.0, 0, { 'keepdims': null } ); // $ExpectError
+ lastIndexOf( x, 0.0, 0, { 'keepdims': {} } ); // $ExpectError
+ lastIndexOf( x, 0.0, 0, { 'keepdims': ( x: number ): number => x } ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided an unsupported number of arguments...
+{
+ const x = zeros( [ 2, 2 ], {
+ 'dtype': 'float64'
+ });
+
+ lastIndexOf(); // $ExpectError
+ lastIndexOf( x, 0.0, 0, {}, {} ); // $ExpectError
+}
+
+// Attached to the function is an `assign` method which returns an ndarray...
+{
+ const x = zeros( [ 2, 2 ], {
+ 'dtype': 'float64'
+ });
+ const y = zeros( [], {
+ 'dtype': 'int32'
+ });
+
+ lastIndexOf.assign( x, 0.0, y ); // $ExpectType int32ndarray
+ lastIndexOf.assign( x, 0.0, y, {} ); // $ExpectType int32ndarray
+ lastIndexOf.assign( x, 0.0, 1, y ); // $ExpectType int32ndarray
+ lastIndexOf.assign( x, 0.0, 1, y, {} ); // $ExpectType int32ndarray
+}
+
+// The compiler throws an error if the `assign` method is provided a first argument which is not an ndarray...
+{
+ const y = zeros( [], {
+ 'dtype': 'int32'
+ });
+
+ lastIndexOf.assign( '5', 0.0, y ); // $ExpectError
+ lastIndexOf.assign( 5, 0.0, y ); // $ExpectError
+ lastIndexOf.assign( true, 0.0, y ); // $ExpectError
+ lastIndexOf.assign( false, 0.0, y ); // $ExpectError
+ lastIndexOf.assign( null, 0.0, y ); // $ExpectError
+ lastIndexOf.assign( void 0, 0.0, y ); // $ExpectError
+ lastIndexOf.assign( {}, 0.0, y ); // $ExpectError
+ lastIndexOf.assign( ( x: number ): number => x, 0.0, y ); // $ExpectError
+
+ lastIndexOf.assign( '5', 0.0, 0, y ); // $ExpectError
+ lastIndexOf.assign( 5, 0.0, 0, y ); // $ExpectError
+ lastIndexOf.assign( true, 0.0, 0, y ); // $ExpectError
+ lastIndexOf.assign( false, 0.0, 0, y ); // $ExpectError
+ lastIndexOf.assign( null, 0.0, 0, y ); // $ExpectError
+ lastIndexOf.assign( void 0, 0.0, 0, y ); // $ExpectError
+ lastIndexOf.assign( {}, 0.0, 0, y ); // $ExpectError
+ lastIndexOf.assign( ( x: number ): number => x, 0.0, 0, y ); // $ExpectError
+
+ lastIndexOf.assign( '5', 0.0, y, {} ); // $ExpectError
+ lastIndexOf.assign( 5, 0.0, y, {} ); // $ExpectError
+ lastIndexOf.assign( true, 0.0, y, {} ); // $ExpectError
+ lastIndexOf.assign( false, 0.0, y, {} ); // $ExpectError
+ lastIndexOf.assign( null, 0.0, y, {} ); // $ExpectError
+ lastIndexOf.assign( void 0, 0.0, y, {} ); // $ExpectError
+ lastIndexOf.assign( {}, 0.0, y, {} ); // $ExpectError
+ lastIndexOf.assign( ( x: number ): number => x, 0.0, y, {} ); // $ExpectError
+
+ lastIndexOf.assign( '5', 0.0, 0, y, {} ); // $ExpectError
+ lastIndexOf.assign( 5, 0.0, 0, y, {} ); // $ExpectError
+ lastIndexOf.assign( true, 0.0, 0, y, {} ); // $ExpectError
+ lastIndexOf.assign( false, 0.0, 0, y, {} ); // $ExpectError
+ lastIndexOf.assign( null, 0.0, 0, y, {} ); // $ExpectError
+ lastIndexOf.assign( void 0, 0.0, 0, y, {} ); // $ExpectError
+ lastIndexOf.assign( {}, 0.0, 0, y, {} ); // $ExpectError
+ lastIndexOf.assign( ( x: number ): number => x, 0.0, 0, y, {} ); // $ExpectError
+}
+
+// The compiler throws an error if the `assign` method is provided a search element argument which is not an ndarray or scalar value having the same "type"...
+{
+ const x = zeros( [ 2, 2 ], {
+ 'dtype': 'float64'
+ });
+ const y = zeros( [], {
+ 'dtype': 'int32'
+ });
+
+ lastIndexOf.assign( x, '5', y ); // $ExpectError
+ lastIndexOf.assign( x, true, y ); // $ExpectError
+ lastIndexOf.assign( x, false, y ); // $ExpectError
+ lastIndexOf.assign( x, {}, y ); // $ExpectError
+ lastIndexOf.assign( x, ( x: number ): number => x, y ); // $ExpectError
+
+ lastIndexOf.assign( x, '5', 0, y ); // $ExpectError
+ lastIndexOf.assign( x, true, 0, y ); // $ExpectError
+ lastIndexOf.assign( x, false, 0, y ); // $ExpectError
+ lastIndexOf.assign( x, {}, 0, y ); // $ExpectError
+ lastIndexOf.assign( x, ( x: number ): number => x, 0, y ); // $ExpectError
+
+ lastIndexOf.assign( x, '5', y, {} ); // $ExpectError
+ lastIndexOf.assign( x, true, y, {} ); // $ExpectError
+ lastIndexOf.assign( x, false, y, {} ); // $ExpectError
+ lastIndexOf.assign( x, {}, y, {} ); // $ExpectError
+ lastIndexOf.assign( x, ( x: number ): number => x, y, {} ); // $ExpectError
+
+ lastIndexOf.assign( x, '5', 0, y, {} ); // $ExpectError
+ lastIndexOf.assign( x, true, 0, y, {} ); // $ExpectError
+ lastIndexOf.assign( x, false, 0, y, {} ); // $ExpectError
+ lastIndexOf.assign( x, {}, 0, y, {} ); // $ExpectError
+ lastIndexOf.assign( x, ( x: number ): number => x, 0, y, {} ); // $ExpectError
+}
+
+// The compiler throws an error if the `assign` method is provided a from index argument which is not an ndarray or an integer value...
+{
+ const x = zeros( [ 2, 2 ], {
+ 'dtype': 'float64'
+ });
+ const y = zeros( [], {
+ 'dtype': 'int32'
+ });
+
+ lastIndexOf.assign( x, 0.0, '5', y ); // $ExpectError
+ lastIndexOf.assign( x, 0.0, true, y ); // $ExpectError
+ lastIndexOf.assign( x, 0.0, false, y ); // $ExpectError
+ lastIndexOf.assign( x, 0.0, null, y ); // $ExpectError
+ lastIndexOf.assign( x, 0.0, void 0, y ); // $ExpectError
+ lastIndexOf.assign( x, 0.0, {}, y ); // $ExpectError
+ lastIndexOf.assign( x, 0.0, ( x: number ): number => x, y ); // $ExpectError
+
+ lastIndexOf.assign( x, 0.0, '5', y, {} ); // $ExpectError
+ lastIndexOf.assign( x, 0.0, true, y, {} ); // $ExpectError
+ lastIndexOf.assign( x, 0.0, false, y, {} ); // $ExpectError
+ lastIndexOf.assign( x, 0.0, null, y, {} ); // $ExpectError
+ lastIndexOf.assign( x, 0.0, void 0, y, {} ); // $ExpectError
+ lastIndexOf.assign( x, 0.0, {}, y, {} ); // $ExpectError
+ lastIndexOf.assign( x, 0.0, ( x: number ): number => x, y, {} ); // $ExpectError
+}
+
+// The compiler throws an error if the `assign` method is provided a output argument which is not an ndarray...
+{
+ const x = zeros( [ 2, 2 ], {
+ 'dtype': 'float64'
+ });
+
+ lastIndexOf.assign( x, 0.0, '5' ); // $ExpectError
+ lastIndexOf.assign( x, 0.0, 5 ); // $ExpectError
+ lastIndexOf.assign( x, 0.0, true ); // $ExpectError
+ lastIndexOf.assign( x, 0.0, false ); // $ExpectError
+ lastIndexOf.assign( x, 0.0, null ); // $ExpectError
+ lastIndexOf.assign( x, 0.0, void 0 ); // $ExpectError
+ lastIndexOf.assign( x, 0.0, ( x: number ): number => x ); // $ExpectError
+
+ lastIndexOf.assign( x, 0.0, '5', {} ); // $ExpectError
+ lastIndexOf.assign( x, 0.0, 5, {} ); // $ExpectError
+ lastIndexOf.assign( x, 0.0, true, {} ); // $ExpectError
+ lastIndexOf.assign( x, 0.0, false, {} ); // $ExpectError
+ lastIndexOf.assign( x, 0.0, null, {} ); // $ExpectError
+ lastIndexOf.assign( x, 0.0, void 0, {} ); // $ExpectError
+ lastIndexOf.assign( x, 0.0, ( x: number ): number => x, {} ); // $ExpectError
+
+ lastIndexOf.assign( x, 0.0, 1, '5' ); // $ExpectError
+ lastIndexOf.assign( x, 0.0, 1, 5 ); // $ExpectError
+ lastIndexOf.assign( x, 0.0, 1, true ); // $ExpectError
+ lastIndexOf.assign( x, 0.0, 1, false ); // $ExpectError
+ lastIndexOf.assign( x, 0.0, 1, null ); // $ExpectError
+ lastIndexOf.assign( x, 0.0, 1, void 0 ); // $ExpectError
+ lastIndexOf.assign( x, 0.0, 1, ( x: number ): number => x ); // $ExpectError
+
+ lastIndexOf.assign( x, 0.0, 1, '5', {} ); // $ExpectError
+ lastIndexOf.assign( x, 0.0, 1, 5, {} ); // $ExpectError
+ lastIndexOf.assign( x, 0.0, 1, true, {} ); // $ExpectError
+ lastIndexOf.assign( x, 0.0, 1, false, {} ); // $ExpectError
+ lastIndexOf.assign( x, 0.0, 1, null, {} ); // $ExpectError
+ lastIndexOf.assign( x, 0.0, 1, void 0, {} ); // $ExpectError
+ lastIndexOf.assign( x, 0.0, 1, ( x: number ): number => x, {} ); // $ExpectError
+}
+
+// The compiler throws an error if the `assign` method is provided a options argument which is not an object...
+{
+ const x = zeros( [ 2, 2 ], {
+ 'dtype': 'float64'
+ });
+ const y = zeros( [], {
+ 'dtype': 'int32'
+ });
+
+ lastIndexOf.assign( x, 0.0, y, '5' ); // $ExpectError
+ lastIndexOf.assign( x, 0.0, y, true ); // $ExpectError
+ lastIndexOf.assign( x, 0.0, y, false ); // $ExpectError
+ lastIndexOf.assign( x, 0.0, y, null ); // $ExpectError
+ lastIndexOf.assign( x, 0.0, y, [] ); // $ExpectError
+ lastIndexOf.assign( x, 0.0, y, ( x: number ): number => x ); // $ExpectError
+
+ lastIndexOf.assign( x, 0.0, 1, y, '5' ); // $ExpectError
+ lastIndexOf.assign( x, 0.0, 1, y, true ); // $ExpectError
+ lastIndexOf.assign( x, 0.0, 1, y, false ); // $ExpectError
+ lastIndexOf.assign( x, 0.0, 1, y, null ); // $ExpectError
+ lastIndexOf.assign( x, 0.0, 1, y, [] ); // $ExpectError
+ lastIndexOf.assign( x, 0.0, 1, y, ( x: number ): number => x ); // $ExpectError
+}
+
+// The compiler throws an error if the `assign` method is provided an invalid `dim` option...
+{
+ const x = zeros( [ 2, 2 ], {
+ 'dtype': 'float64'
+ });
+ const y = zeros( [], {
+ 'dtype': 'int32'
+ });
+
+ lastIndexOf.assign( x, 0.0, y, { 'dim': '5' } ); // $ExpectError
+ lastIndexOf.assign( x, 0.0, y, { 'dim': true } ); // $ExpectError
+ lastIndexOf.assign( x, 0.0, y, { 'dim': false } ); // $ExpectError
+ lastIndexOf.assign( x, 0.0, y, { 'dim': null } ); // $ExpectError
+ lastIndexOf.assign( x, 0.0, y, { 'dim': [] } ); // $ExpectError
+ lastIndexOf.assign( x, 0.0, y, { 'dim': {} } ); // $ExpectError
+ lastIndexOf.assign( x, 0.0, y, { 'dim': ( x: number ): number => x } ); // $ExpectError
+
+ lastIndexOf.assign( x, 0.0, 1, y, { 'dim': '5' } ); // $ExpectError
+ lastIndexOf.assign( x, 0.0, 1, y, { 'dim': true } ); // $ExpectError
+ lastIndexOf.assign( x, 0.0, 1, y, { 'dim': false } ); // $ExpectError
+ lastIndexOf.assign( x, 0.0, 1, y, { 'dim': null } ); // $ExpectError
+ lastIndexOf.assign( x, 0.0, 1, y, { 'dim': [] } ); // $ExpectError
+ lastIndexOf.assign( x, 0.0, 1, y, { 'dim': {} } ); // $ExpectError
+ lastIndexOf.assign( x, 0.0, 1, y, { 'dim': ( x: number ): number => x } ); // $ExpectError
+}
+
+// The compiler throws an error if the `assign` method is provided an unsupported number of arguments...
+{
+ const x = zeros( [ 2, 2 ], {
+ 'dtype': 'float64'
+ });
+ const y = zeros( [], {
+ 'dtype': 'int32'
+ });
+
+ lastIndexOf.assign(); // $ExpectError
+ lastIndexOf.assign( x ); // $ExpectError
+ lastIndexOf.assign( x, 0.0 ); // $ExpectError
+ lastIndexOf.assign( x, 0.0, 1, y, {}, {} ); // $ExpectError
+}
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/examples/index.js b/lib/node_modules/@stdlib/blas/ext/last-index-of/examples/index.js
new file mode 100644
index 000000000000..8902d4a187e0
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/examples/index.js
@@ -0,0 +1,41 @@
+/**
+* @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 ndarray2array = require( '@stdlib/ndarray/to-array' );
+var ndarray = require( '@stdlib/ndarray/ctor' );
+var lastIndexOf = require( './../lib' );
+
+// Generate an array of random numbers:
+var xbuf = discreteUniform( 10, 0, 20, {
+ 'dtype': 'float64'
+});
+
+// Wrap in an ndarray:
+var x = new ndarray( 'float64', xbuf, [ 5, 2 ], [ 2, 1 ], 0, 'row-major' );
+console.log( ndarray2array( x ) );
+
+// Perform operation:
+var idx = lastIndexOf( x, 10.0, {
+ 'dim': 0
+});
+
+// Print the results:
+console.log( ndarray2array( idx ) );
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/assign.js b/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/assign.js
new file mode 100644
index 000000000000..a7b2c213e4c1
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/assign.js
@@ -0,0 +1,223 @@
+/**
+* @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 hasOwnProp = require( '@stdlib/assert/has-own-property' );
+var isPlainObject = require( '@stdlib/assert/is-plain-object' );
+var isInteger = require( '@stdlib/assert/is-integer' ).isPrimitive;
+var isndarrayLike = require( '@stdlib/assert/is-ndarray-like' );
+var broadcastScalar = require( '@stdlib/ndarray/base/broadcast-scalar' );
+var maybeBroadcastArray = require( '@stdlib/ndarray/base/maybe-broadcast-array' );
+var getDType = require( '@stdlib/ndarray/dtype' );
+var getShape = require( '@stdlib/ndarray/shape' );
+var getOrder = require( '@stdlib/ndarray/order' );
+var format = require( '@stdlib/string/format' );
+var defaults = require( '@stdlib/ndarray/defaults' );
+var nonCoreShape = require( './non_core_shape.js' );
+var base = require( './base.js' ).assign;
+
+
+// VARIABLES //
+
+var DEFAULT_DTYPE = defaults.get( 'dtypes.integer_index' );
+
+
+// MAIN //
+
+/**
+* Returns the last index of a specified search element along an ndarray dimension and assigns the results to a provided output ndarray.
+*
+* @param {ndarrayLike} x - input ndarray
+* @param {(ndarrayLike|*)} searchElement - search element
+* @param {(ndarrayLike|integer)} [fromIndex] - index from which to begin searching
+* @param {ndarrayLike} out - output ndarray
+* @param {Options} [options] - function options
+* @param {IntegerArray} [options.dim=-1] - dimension over which to perform operation
+* @throws {TypeError} function must be provided at least three arguments
+* @throws {TypeError} first argument must be an ndarray-like object
+* @throws {TypeError} third argument must be either an ndarray-like object or an integer
+* @throws {TypeError} output argument must be an ndarray-like object
+* @throws {TypeError} options argument must be an object
+* @throws {RangeError} dimension dimension index must not exceed input ndarray bounds
+* @throws {RangeError} first argument must have at least one dimension
+* @throws {Error} must provide valid options
+* @returns {ndarray} output ndarray
+*
+* @example
+* var Float64Array = require( '@stdlib/array/float64' );
+* var zeros = require( '@stdlib/ndarray/zeros' );
+* var ndarray2array = require( '@stdlib/ndarray/to-array' );
+* var ndarray = require( '@stdlib/ndarray/ctor' );
+*
+* // Create data buffers:
+* var xbuf = new Float64Array( [ 1.0, 2.0, -3.0, 2.0, -5.0, 6.0 ] );
+*
+* // Define the shape of the input array:
+* var shape = [ 2, 3 ];
+*
+* // Define the array strides:
+* var strides = [ 3, 1 ];
+*
+* // Define the index offset:
+* var offset = 0;
+*
+* // Create an input ndarray:
+* var x = new ndarray( 'float64', xbuf, shape, strides, offset, 'row-major' );
+*
+* // Create an output ndarray:
+* var y = zeros( [ 2 ], {
+* 'dtype': 'int32'
+* });
+*
+* // Perform operation:
+* var out = assign( x, 2.0, y );
+* // returns
+*
+* var bool = ( out === y );
+* // returns true
+*
+* var arr = ndarray2array( out );
+* // returns [ 1, 0 ]
+*/
+function assign( x, searchElement, fromIndex, out ) {
+ var hasOptions;
+ var options;
+ var nargs;
+ var opts;
+ var fidx;
+ var iflg;
+ var ord;
+ var dt;
+ var sh;
+ var v;
+ var o;
+
+ nargs = arguments.length;
+ if ( !isndarrayLike( x ) ) {
+ throw new TypeError( format( 'invalid argument. The first argument must be an ndarray. Value: `%s`.', x ) );
+ }
+ if ( nargs < 2 ) {
+ throw new TypeError( format( 'invalid argument. Second argument must be either an ndarray or a scalar value. Value: `%s`.', searchElement ) );
+ }
+ if ( nargs < 3 ) {
+ throw new TypeError( format( 'invalid argument. Third argument must be an ndarray. Value: `%s`.', fromIndex ) );
+ }
+ // Resolve input ndarray meta data:
+ dt = getDType( x );
+ ord = getOrder( x );
+
+ // Initialize an options object:
+ opts = {
+ 'dims': [ -1 ] // default behavior is to perform a reduction over the last dimension
+ };
+
+ // Initialize the `fromIndex` to the first element along a dimension:
+ fidx = 0;
+
+ // Initialize a flag indicating whether the `fromIndex` argument is a scalar:
+ iflg = true;
+
+ // Initialize a flag indicating whether an `options` argument was provided:
+ hasOptions = false;
+
+ // Case: assign( x, search_element, out )
+ if ( nargs === 3 ) {
+ o = fromIndex;
+ }
+ // Case: assign( x, search_element, ???, ??? )
+ else if ( nargs === 4 ) {
+ // Case: assign( x, search_element, from_index, out )
+ if ( isndarrayLike( out ) ) {
+ o = out;
+
+ // Case: assign( x, search_element, from_index_scalar, out )
+ if ( isInteger( fromIndex ) ) {
+ fidx = fromIndex;
+ }
+ // Case: assign( x, search_element, from_index_ndarray, out )
+ else if ( isndarrayLike( fromIndex ) ) {
+ fidx = fromIndex;
+ iflg = false;
+ }
+ // Case: assign( x, search_element, ???, out )
+ else {
+ throw new TypeError( format( 'invalid argument. Third argument must be either an ndarray or an integer. Value: `%s`.', fromIndex ) );
+ }
+ }
+ // Case: assign( x, search_element, out, options )
+ else {
+ o = fromIndex;
+ options = out;
+ hasOptions = true;
+ }
+ }
+ // Case: assign( x, search_element, from_index, out, options )
+ else { // nargs > 4
+ // Case: assign( x, search_element, from_index_scalar, out, options )
+ if ( isInteger( fromIndex ) ) {
+ fidx = fromIndex;
+ }
+ // Case: assign( x, search_element, from_index_ndarray, out, options )
+ else if ( isndarrayLike( fromIndex ) ) {
+ fidx = fromIndex;
+ iflg = false;
+ }
+ // Case: assign( x, search_element, ???, out, options )
+ else {
+ throw new TypeError( format( 'invalid argument. Third argument must be either an ndarray or an integer. Value: `%s`.', fromIndex ) );
+ }
+ o = out;
+ options = arguments[ 4 ];
+ hasOptions = true;
+ }
+ if ( hasOptions && !isPlainObject( options ) ) {
+ throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );
+ }
+ // Resolve provided options...
+ if ( hasOwnProp( options, 'dim' ) ) {
+ opts.dims[ 0 ] = options.dim;
+ }
+ // Resolve the list of non-reduced dimensions:
+ sh = getShape( x );
+ if ( sh.length < 1 ) {
+ throw new RangeError( 'invalid argument. First argument must have at least one dimension.' );
+ }
+ sh = nonCoreShape( sh, opts.dims );
+
+ // Broadcast the search element to match the shape of the non-reduced dimensions...
+ if ( isndarrayLike( searchElement ) ) {
+ v = maybeBroadcastArray( searchElement, sh );
+ } else {
+ v = broadcastScalar( searchElement, dt, sh, ord ); // WARNING: potential for undesired value casting (e.g., if `searchElement` is `null` and cast to `float64`, the broadcasted scalar will be `0`, not `null`!)
+ }
+ // Broadcast the `fromIndex` to match the shape of the non-reduced dimensions...
+ if ( iflg ) {
+ fidx = broadcastScalar( fidx, DEFAULT_DTYPE, sh, ord );
+ } else {
+ fidx = maybeBroadcastArray( fidx, sh );
+ }
+ return base( x, v, fidx, o, opts );
+}
+
+
+// EXPORTS //
+
+module.exports = assign;
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/base.js b/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/base.js
new file mode 100644
index 000000000000..f37a1df6d9c1
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/base.js
@@ -0,0 +1,120 @@
+/**
+* @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 dtypes = require( '@stdlib/ndarray/dtypes' );
+var glastIndexOf = require( '@stdlib/blas/ext/base/ndarray/glast-index-of' );
+var dlastIndexOf = require( '@stdlib/blas/ext/base/ndarray/dlast-index-of' );
+var slastIndexOf = require( '@stdlib/blas/ext/base/ndarray/slast-index-of' );
+var factory = require( '@stdlib/ndarray/base/unary-reduce-strided1d-dispatch-factory' );
+
+
+// VARIABLES //
+
+var idtypes0 = dtypes( 'all' ); // input ndarray
+var idtypes1 = dtypes( 'all' ); // search element ndarray
+var idtypes2 = dtypes( 'integer_index_and_generic' ); // from index ndarray
+var odtypes = dtypes( 'integer_index_and_generic' );
+var policies = {
+ 'output': 'integer_index_and_generic',
+ 'casting': 'none'
+};
+var table = {
+ 'types': [
+ 'float64',
+ 'float32'
+
+ // FIXME: add specialized support for `clastIndexOf` and `zlastIndexOf` once the corresponding packages are implemented
+ ],
+ 'fcns': [
+ dlastIndexOf,
+ slastIndexOf
+ ],
+ 'default': glastIndexOf
+};
+
+
+// MAIN //
+
+/**
+* Returns the last index of a specified search element along an ndarray dimension.
+*
+* @private
+* @name lastIndexOf
+* @type {Function}
+* @param {ndarrayLike} x - input ndarray
+* @param {ndarrayLike} searchElement - search element
+* @param {ndarrayLike} fromIndex - indices from which to begin searching
+* @param {Options} [options] - function options
+* @param {IntegerArray} [options.dims] - list of dimensions over which to perform operation
+* @param {string} [options.dtype] - output ndarray data type
+* @throws {TypeError} first argument must be an ndarray-like object
+* @throws {TypeError} second argument must be either an ndarray-like object
+* @throws {TypeError} third argument must be either an ndarray-like object
+* @throws {TypeError} options argument must be an object
+* @throws {RangeError} dimension indices must not exceed input ndarray bounds
+* @throws {RangeError} number of dimension indices must not exceed the number of input ndarray dimensions
+* @throws {Error} must provide valid options
+* @returns {ndarray} output ndarray
+*
+* @example
+* var Float64Array = require( '@stdlib/array/float64' );
+* var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' );
+* var ndarray = require( '@stdlib/ndarray/ctor' );
+*
+* // Create a data buffer:
+* var xbuf = new Float64Array( [ 1.0, 2.0, -3.0, 2.0, -5.0, 6.0 ] );
+*
+* // Define the shape of the input array:
+* var sh = [ 6 ];
+*
+* // Define the array strides:
+* var sx = [ 1 ];
+*
+* // Define the index offset:
+* var ox = 0;
+*
+* // Create an input ndarray:
+* var x = new ndarray( 'float64', xbuf, sh, sx, ox, 'row-major' );
+*
+* // Create a search element ndarray:
+* var searchElement = scalar2ndarray( 2.0, {
+* 'dtype': 'float64'
+* })
+*
+* // Create a from index ndarray:
+* var fromIndex = scalar2ndarray( 0, {
+* 'dtype': 'int32'
+* })
+*
+* // Perform operation:
+* var out = lastIndexOf( x, searchElement, fromIndex );
+* // returns
+*
+* var idx = out.get();
+* // returns 3
+*/
+var lastIndexOf = factory( table, [ idtypes0, idtypes1, idtypes2 ], odtypes, policies ); // eslint-disable-line max-len
+
+
+// EXPORTS //
+
+module.exports = lastIndexOf;
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/index.js b/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/index.js
new file mode 100644
index 000000000000..094c1eaaa42a
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/index.js
@@ -0,0 +1,71 @@
+/**
+* @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 last index of a specified search element along an ndarray dimension.
+*
+* @module @stdlib/blas/ext/last-index-of
+*
+* @example
+* var Float64Array = require( '@stdlib/array/float64' );
+* var ndarray2array = require( '@stdlib/ndarray/to-array' );
+* var ndarray = require( '@stdlib/ndarray/ctor' );
+* var lastIndexOf = require( '@stdlib/blas/ext/last-index-of' );
+*
+* // Create a data buffer:
+* var xbuf = new Float64Array( [ 1.0, 2.0, -3.0, 2.0, -5.0, 6.0 ] );
+*
+* // Define the shape of the input array:
+* var sh = [ 2, 3 ];
+*
+* // Define the array strides:
+* var sx = [ 3, 1 ];
+*
+* // Define the index offset:
+* var ox = 0;
+*
+* // Create an input ndarray:
+* var x = new ndarray( 'float64', xbuf, sh, sx, ox, 'row-major' );
+*
+* // Perform operation:
+* var out = lastIndexOf( x, 2.0 );
+* // returns
+*
+* var arr = ndarray2array( out );
+* // returns [ 1, 0 ]
+*/
+
+// MODULES //
+
+var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' );
+var main = require( './main.js' );
+var assign = require( './assign.js' );
+
+
+// MAIN //
+
+setReadOnly( main, 'assign', assign );
+
+
+// EXPORTS //
+
+module.exports = main;
+
+// exports: { "assign": "main.assign" }
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/main.js b/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/main.js
new file mode 100644
index 000000000000..5f75e994c517
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/main.js
@@ -0,0 +1,202 @@
+/**
+* @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 hasOwnProp = require( '@stdlib/assert/has-own-property' );
+var isPlainObject = require( '@stdlib/assert/is-plain-object' );
+var isInteger = require( '@stdlib/assert/is-integer' ).isPrimitive;
+var isndarrayLike = require( '@stdlib/assert/is-ndarray-like' );
+var broadcastScalar = require( '@stdlib/ndarray/base/broadcast-scalar' );
+var maybeBroadcastArray = require( '@stdlib/ndarray/base/maybe-broadcast-array' );
+var getDType = require( '@stdlib/ndarray/dtype' );
+var getShape = require( '@stdlib/ndarray/shape' );
+var getOrder = require( '@stdlib/ndarray/order' );
+var format = require( '@stdlib/string/format' );
+var defaults = require( '@stdlib/ndarray/defaults' );
+var nonCoreShape = require( './non_core_shape.js' );
+var base = require( './base.js' );
+
+
+// VARIABLES //
+
+var DEFAULT_DTYPE = defaults.get( 'dtypes.integer_index' );
+
+
+// MAIN //
+
+/**
+* Returns the last index of a specified search element along an ndarray dimension.
+*
+* @param {ndarrayLike} x - input ndarray
+* @param {(ndarrayLike|*)} searchElement - search element
+* @param {(ndarrayLike|integer)} [fromIndex] - index from which to begin searching
+* @param {Options} [options] - function options
+* @param {IntegerArray} [options.dim=-1] - dimension over which to perform operation
+* @param {boolean} [options.keepdims=false] - boolean indicating whether the reduced dimensions should be included in the returned ndarray as singleton dimensions
+* @param {string} [options.dtype] - output ndarray data type
+* @throws {TypeError} first argument must be an ndarray-like object
+* @throws {TypeError} the function must be provided at least two arguments
+* @throws {TypeError} third argument must be either an ndarray-like object or an integer
+* @throws {TypeError} options argument must be an object
+* @throws {RangeError} dimension index must not exceed input ndarray bounds
+* @throws {RangeError} first argument must have at least one dimension
+* @throws {Error} must provide valid options
+* @returns {ndarray} output ndarray
+*
+* @example
+* var Float64Array = require( '@stdlib/array/float64' );
+* var ndarray2array = require( '@stdlib/ndarray/to-array' );
+* var ndarray = require( '@stdlib/ndarray/ctor' );
+*
+* // Create a data buffer:
+* var xbuf = new Float64Array( [ 1.0, 2.0, -3.0, 2.0, -5.0, 6.0 ] );
+*
+* // Define the shape of the input array:
+* var sh = [ 2, 3 ];
+*
+* // Define the array strides:
+* var sx = [ 3, 1 ];
+*
+* // Define the index offset:
+* var ox = 0;
+*
+* // Create an input ndarray:
+* var x = new ndarray( 'float64', xbuf, sh, sx, ox, 'row-major' );
+*
+* // Perform operation:
+* var out = lastIndexOf( x, 2.0 );
+* // returns
+*
+* var arr = ndarray2array( out );
+* // returns [ 1, 0 ]
+*/
+function lastIndexOf( x, searchElement, fromIndex ) {
+ var hasOptions;
+ var options;
+ var nargs;
+ var opts;
+ var fidx;
+ var iflg;
+ var ord;
+ var dt;
+ var sh;
+ var v;
+
+ nargs = arguments.length;
+ if ( !isndarrayLike( x ) ) {
+ throw new TypeError( format( 'invalid argument. First argument must be an ndarray. Value: `%s`.', x ) );
+ }
+ if ( nargs < 2 ) {
+ throw new TypeError( format( 'invalid argument. Second argument must be either an ndarray or a scalar value. Value: `%s`.', searchElement ) );
+ }
+ // Resolve input ndarray meta data:
+ dt = getDType( x );
+ ord = getOrder( x );
+
+ // Initialize an options object:
+ opts = {
+ 'dims': [ -1 ], // default behavior is to perform a reduction over the last dimension
+ 'keepdims': false
+ };
+
+ // Initialize the `fromIndex` to the first element along a dimension:
+ fidx = 0;
+
+ // Initialize a flag indicating whether the `fromIndex` argument is a scalar:
+ iflg = true;
+
+ // Initialize a flag indicating whether an `options` argument was provided:
+ hasOptions = false;
+
+ // Case: lastIndexOf( x, search_element, ??? )
+ if ( nargs === 3 ) {
+ // Case: lastIndexOf( x, search_element, from_index_scalar )
+ if ( isInteger( fromIndex ) ) {
+ fidx = fromIndex;
+ }
+ // Case: lastIndexOf( x, search_element, from_index_ndarray )
+ else if ( isndarrayLike( fromIndex ) ) {
+ fidx = fromIndex;
+ iflg = false;
+ }
+ // Case: lastIndexOf( x, search_element, options )
+ else {
+ options = fromIndex;
+ hasOptions = true;
+ }
+ }
+ // Case: lastIndexOf( x, search_element, from_index, options )
+ else if ( nargs > 3 ) {
+ // Case: lastIndexOf( x, search_element, from_index_scalar, options )
+ if ( isInteger( fromIndex ) ) {
+ fidx = fromIndex;
+ }
+ // Case: lastIndexOf( x, search_element, from_index_ndarray, options )
+ else if ( isndarrayLike( fromIndex ) ) {
+ fidx = fromIndex;
+ iflg = false;
+ }
+ // Case: lastIndexOf( x, search_element, ???, options )
+ else {
+ throw new TypeError( format( 'invalid argument. Third argument must be either an ndarray or an integer. Value: `%s`.', fromIndex ) );
+ }
+ options = arguments[ 3 ];
+ hasOptions = true;
+ }
+ if ( hasOptions && !isPlainObject( options ) ) {
+ throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );
+ }
+ // Resolve provided options...
+ if ( hasOwnProp( options, 'dim' ) ) {
+ opts.dims[ 0 ] = options.dim;
+ }
+ if ( hasOwnProp( options, 'keepdims' ) ) {
+ opts.keepdims = options.keepdims;
+ }
+ if ( hasOwnProp( options, 'dtype' ) ) {
+ opts.dtype = options.dtype;
+ }
+ // Resolve the list of non-reduced dimensions:
+ sh = getShape( x );
+ if ( sh.length < 1 ) {
+ throw new RangeError( 'invalid argument. First argument must have at least one dimension.' );
+ }
+ sh = nonCoreShape( sh, opts.dims );
+
+ // Broadcast the search element to match the shape of the non-reduced dimensions...
+ if ( isndarrayLike( searchElement ) ) {
+ v = maybeBroadcastArray( searchElement, sh );
+ } else {
+ v = broadcastScalar( searchElement, dt, sh, ord ); // WARNING: potential for undesired value casting (e.g., if `searchElement` is `null` and cast to `float64`, the broadcasted scalar will be `0`, not `null`!)
+ }
+ // Broadcast the `fromIndex` to match the shape of the non-reduced dimensions...
+ if ( iflg ) {
+ fidx = broadcastScalar( fidx, DEFAULT_DTYPE, sh, ord );
+ } else {
+ fidx = maybeBroadcastArray( fidx, sh );
+ }
+ return base( x, v, fidx, opts );
+}
+
+
+// EXPORTS //
+
+module.exports = lastIndexOf;
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/non_core_shape.js b/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/non_core_shape.js
new file mode 100644
index 000000000000..07e99731e89f
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/non_core_shape.js
@@ -0,0 +1,50 @@
+/**
+* @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 normalizeIndices = require( '@stdlib/ndarray/base/to-unique-normalized-indices' );
+var indicesComplement = require( '@stdlib/array/base/indices-complement' );
+var takeIndexed = require( '@stdlib/array/base/take-indexed' );
+
+
+// MAIN //
+
+/**
+* Returns the shape defined by the dimensions which are **not** included in a list of dimensions.
+*
+* @private
+* @param {NonNegativeIntegerArray} shape - input ndarray
+* @param {IntegerArray} dims - list of dimensions
+* @returns {NonNegativeIntegerArray} shape
+*/
+function nonCoreShape( shape, dims ) { // TODO: consider moving to a `@stdlib/ndarray/base` utility
+ var ind = normalizeIndices( dims, shape.length-1 );
+ if ( ind === null ) {
+ // Note: this is an error condition, as `null` is returned when provided out-of-bounds indices...
+ return [];
+ }
+ return takeIndexed( shape, indicesComplement( shape.length, ind ) );
+}
+
+
+// EXPORTS //
+
+module.exports = nonCoreShape;
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/package.json b/lib/node_modules/@stdlib/blas/ext/last-index-of/package.json
new file mode 100644
index 000000000000..44abb267a895
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/package.json
@@ -0,0 +1,65 @@
+{
+ "name": "@stdlib/blas/ext/last-index-of",
+ "version": "0.0.0",
+ "description": "Return the last index of a specified search element along an ndarray dimension.",
+ "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",
+ "blas",
+ "find",
+ "findlast",
+ "index",
+ "lastindex",
+ "search",
+ "searchlast",
+ "element",
+ "array",
+ "ndarray"
+ ],
+ "__stdlib__": {}
+}
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.assign.js b/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.assign.js
new file mode 100644
index 000000000000..070e838bcfb8
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.assign.js
@@ -0,0 +1,1433 @@
+/**
+* @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 isndarrayLike = require( '@stdlib/assert/is-ndarray-like' );
+var isSameArray = require( '@stdlib/assert/is-same-array' );
+var ndarray = require( '@stdlib/ndarray/ctor' );
+var zeros = require( '@stdlib/ndarray/zeros' );
+var ndarray2array = require( '@stdlib/ndarray/to-array' );
+var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' );
+var getDType = require( '@stdlib/ndarray/dtype' );
+var getShape = require( '@stdlib/ndarray/shape' );
+var getOrder = require( '@stdlib/ndarray/order' );
+var getData = require( '@stdlib/ndarray/data-buffer' );
+var lastIndexOf = require( './../lib' ).assign;
+
+
+// TESTS //
+
+tape( 'main export is a function', function test( t ) {
+ t.ok( true, __filename );
+ t.strictEqual( typeof lastIndexOf, 'function', 'main export is a function' );
+ t.end();
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_scalar)', function test( t ) {
+ var values;
+ var i;
+ var y;
+
+ y = zeros( [], {
+ 'dtype': 'generic'
+ });
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ lastIndexOf( value, 2.0, y );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_ndarray)', function test( t ) {
+ var values;
+ var i;
+ var y;
+
+ y = zeros( [], {
+ 'dtype': 'generic'
+ });
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ lastIndexOf( value, scalar2ndarray( 2.0 ), y );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_scalar, fromIndex_scalar)', function test( t ) {
+ var values;
+ var i;
+ var y;
+
+ y = zeros( [], {
+ 'dtype': 'generic'
+ });
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ lastIndexOf( value, 2.0, 0, y );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_ndarray, fromIndex_scalar)', function test( t ) {
+ var values;
+ var i;
+ var y;
+
+ y = zeros( [], {
+ 'dtype': 'generic'
+ });
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ lastIndexOf( value, scalar2ndarray( 2.0 ), 0, y );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_scalar, fromIndex_ndarray)', function test( t ) {
+ var values;
+ var opts;
+ var i;
+ var y;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+
+ y = zeros( [], opts );
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ lastIndexOf( value, 2.0, scalar2ndarray( 0, opts ), y );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_ndarray, fromIndex_ndarray)', function test( t ) {
+ var values;
+ var opts;
+ var i;
+ var y;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+
+ y = zeros( [], opts );
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ lastIndexOf( value, scalar2ndarray( 2.0 ), scalar2ndarray( 0, opts ), y ); // eslint-disable-line max-len
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_scalar, options)', function test( t ) {
+ var values;
+ var opts;
+ var i;
+ var y;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+
+ y = zeros( [], opts );
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ lastIndexOf( value, 2.0, y, {} );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_ndarray, options)', function test( t ) {
+ var values;
+ var opts;
+ var i;
+ var y;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+
+ y = zeros( [], opts );
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ lastIndexOf( value, scalar2ndarray( 2.0 ), y, {} );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_scalar, fromIndex_scalar, options)', function test( t ) {
+ var values;
+ var opts;
+ var i;
+ var y;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+
+ y = zeros( [], opts );
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ lastIndexOf( value, 2.0, 0, y, {} );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_ndarray, fromIndex_scalar, options)', function test( t ) {
+ var values;
+ var opts;
+ var i;
+ var y;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+
+ y = zeros( [], opts );
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ lastIndexOf( value, scalar2ndarray( 2.0 ), 0, y, {} );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_scalar, fromIndex_ndarray, options)', function test( t ) {
+ var values;
+ var opts;
+ var i;
+ var y;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+
+ y = zeros( [], opts );
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ lastIndexOf( value, 2.0, scalar2ndarray( 0, opts ), y, {} );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_ndarray, fromIndex_ndarray, options)', function test( t ) {
+ var values;
+ var opts;
+ var i;
+ var y;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+
+ y = zeros( [], opts );
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ lastIndexOf( value, scalar2ndarray( 2.0 ), scalar2ndarray( 0, opts ), y, {} ); // eslint-disable-line max-len
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a third argument which is not an ndarray-like object, integer or an object', function test( t ) {
+ var values;
+ var i;
+ var x;
+ var y;
+
+ x = zeros( [ 2, 2 ], {
+ 'dtype': 'float64'
+ });
+ y = zeros( [], {
+ 'dtype': 'generic'
+ });
+ values = [
+ '5',
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ lastIndexOf( x, scalar2ndarray( 2.0 ), value, y, {} );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided insufficient number of arguments', function test( t ) {
+ var x;
+
+ x = zeros( [ 2, 2 ], {
+ 'dtype': 'generic'
+ });
+
+ function badValue1() {
+ return function badValue() {
+ lastIndexOf( x );
+ };
+ }
+
+ function badValue2() {
+ return function badValue() {
+ lastIndexOf( x, 10.0 );
+ };
+ }
+
+ function badValue3() {
+ return function badValue() {
+ lastIndexOf();
+ };
+ }
+
+ t.throws( badValue1(), TypeError, 'throws an error when provided insufficient arguments' );
+ t.throws( badValue2(), TypeError, 'throws an error when provided insufficient arguments' );
+ t.throws( badValue3(), TypeError, 'throws an error when provided insufficient arguments' );
+ t.end();
+});
+
+tape( 'the function throws an error if provided a search element which is not broadcast-compatible', function test( t ) {
+ var values;
+ var opts;
+ var x;
+ var y;
+ var i;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+ x = zeros( [ 2, 2 ], opts );
+ y = zeros( [], opts );
+
+ values = [
+ zeros( [ 4 ], opts ),
+ zeros( [ 2, 2, 2 ], opts ),
+ zeros( [ 0 ], opts )
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ lastIndexOf( x, value, y );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided an search element which is not broadcast-compatible (options)', function test( t ) {
+ var values;
+ var opts;
+ var x;
+ var y;
+ var i;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+ x = zeros( [ 2, 2 ], opts );
+ y = zeros( [], opts );
+
+ values = [
+ zeros( [ 4 ], opts ),
+ zeros( [ 2, 2, 2 ], opts ),
+ zeros( [ 0 ], opts )
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ lastIndexOf( x, value, y, {} );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a from index which is not broadcast-compatible', function test( t ) {
+ var values;
+ var opts;
+ var x;
+ var y;
+ var i;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+ x = zeros( [ 2, 2 ], opts );
+ y = zeros( [], opts );
+
+ values = [
+ zeros( [ 4 ], opts ),
+ zeros( [ 2, 2, 2 ], opts ),
+ zeros( [ 0 ], opts )
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ lastIndexOf( x, scalar2ndarray( 0 ), value, y );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a from index which is not broadcast-compatible (options)', function test( t ) {
+ var values;
+ var opts;
+ var x;
+ var y;
+ var i;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+ x = zeros( [ 2, 2 ], opts );
+ y = zeros( [], opts );
+
+ values = [
+ zeros( [ 4 ], opts ),
+ zeros( [ 2, 2, 2 ], opts ),
+ zeros( [ 0 ], opts )
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ lastIndexOf( x, scalar2ndarray( 0 ), value, y, {} );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided an options argument which is not an object (searchElement_scalar)', function test( t ) {
+ var values;
+ var opts;
+ var x;
+ var y;
+ var i;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+
+ x = zeros( [ 2, 2 ], opts );
+ y = zeros( [], opts );
+
+ values = [
+ '5',
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ lastIndexOf( x, 10.0, y, value );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided an options argument which is not an object (searchElement_ndarray)', function test( t ) {
+ var values;
+ var opts;
+ var x;
+ var y;
+ var i;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+
+ x = zeros( [ 2, 2 ], opts );
+ y = zeros( [], opts );
+
+ values = [
+ '5',
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ lastIndexOf( x, scalar2ndarray( 10.0, opts ), y, value );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided an options argument which is not an object (searchElement_scalar, fromIndex_scalar)', function test( t ) {
+ var values;
+ var opts;
+ var x;
+ var y;
+ var i;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+
+ x = zeros( [ 2, 2 ], opts );
+ y = zeros( [], opts );
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ lastIndexOf( x, 10.0, 0, y, value );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided an options argument which is not an object (searchElement_ndarray, fromIndex_ndarray)', function test( t ) {
+ var values;
+ var opts;
+ var x;
+ var y;
+ var i;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+
+ x = zeros( [ 2, 2 ], opts );
+ y = zeros( [], opts );
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ lastIndexOf( x, scalar2ndarray( 10.0, opts ), scalar2ndarray( 0, opts ), y, value ); // eslint-disable-line max-len
+ };
+ }
+});
+
+tape( 'the function throws an error if provided an options argument which is not an object (searchElement_scalar, fromIndex_ndarray)', function test( t ) {
+ var values;
+ var opts;
+ var x;
+ var y;
+ var i;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+
+ x = zeros( [ 2, 2 ], opts );
+ y = zeros( [], opts );
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ lastIndexOf( x, 10.0, scalar2ndarray( 0, opts ), y, value );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided an options argument which is not an object (searchElement_ndarray, fromIndex_scalar)', function test( t ) {
+ var values;
+ var opts;
+ var x;
+ var y;
+ var i;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+
+ x = zeros( [ 2, 2 ], opts );
+ y = zeros( [], opts );
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ lastIndexOf( x, scalar2ndarray( 10.0, opts ), 0, y, value );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a `dim` option which is not an integer', function test( t ) {
+ var values;
+ var opts;
+ var x;
+ var y;
+ var i;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+
+ x = zeros( [ 2, 2 ], opts );
+ y = zeros( [], opts );
+
+ values = [
+ '5',
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [ 'a' ],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ lastIndexOf( x, 10.0, y, {
+ 'dim': value
+ });
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a `dims` option which contains too many indices', function test( t ) {
+ var values;
+ var opts;
+ var x;
+ var y;
+ var i;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+
+ x = zeros( [ 2, 2 ], opts );
+ y = zeros( [], opts );
+
+ values = [
+ [ 0, 1 ],
+ [ 0, 1, 2 ],
+ [ 0, 1, 2, 3 ]
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ lastIndexOf( x, 10.0, y, {
+ 'dim': value
+ });
+ };
+ }
+});
+
+tape( 'the function returns the first index of a specified search element in an ndarray (row-major)', function test( t ) {
+ var expected;
+ var actual;
+ var xbuf;
+ var x;
+ var y;
+
+ xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+ y = zeros( [ 2 ], {
+ 'dtype': 'generic'
+ });
+
+ actual = lastIndexOf( x, 2.0, y );
+ expected = [ 1, 1 ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.strictEqual( isSameArray( getData( actual ), expected ), true, 'returns expected value' );
+ t.strictEqual( ( y === actual ), true, 'returns expected value' );
+
+ actual = lastIndexOf( x, 2.0, 0, y );
+ expected = [ 1, 1 ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.strictEqual( isSameArray( getData( actual ), expected ), true, 'returns expected value' );
+ t.strictEqual( ( y === actual ), true, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function returns the first index of a specified search element in an ndarray (column-major)', function test( t ) {
+ var expected;
+ var actual;
+ var xbuf;
+ var x;
+ var y;
+
+ xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+ y = zeros( [ 2 ], {
+ 'dtype': 'generic',
+ 'order': 'column-major'
+ });
+
+ actual = lastIndexOf( x, 2.0, y );
+ expected = [ -1, 1 ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+ t.strictEqual( ( y === actual ), true, 'returns expected value' );
+
+ actual = lastIndexOf( x, 2.0, 0, y );
+ expected = [ -1, 1 ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+ t.strictEqual( ( y === actual ), true, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports specifying operation dimensions (row-major)', function test( t ) {
+ var expected;
+ var actual;
+ var xbuf;
+ var x;
+ var y;
+
+ xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+ y = zeros( [ 2 ], {
+ 'dtype': 'generic'
+ });
+
+ actual = lastIndexOf( x, 2.0, y, {
+ 'dim': 0
+ });
+ expected = [ -1, 1 ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+ t.strictEqual( ( y === actual ), true, 'returns expected value' );
+
+ actual = lastIndexOf( x, 2.0, 0, y, {
+ 'dim': 0
+ });
+ expected = [ -1, 1 ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+ t.strictEqual( ( y === actual ), true, 'returns expected value' );
+
+ xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+ y = zeros( [ 2 ], {
+ 'dtype': 'generic'
+ });
+
+ actual = lastIndexOf( x, 2.0, y, {
+ 'dim': 1
+ });
+ expected = [ 1, 1 ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+ t.strictEqual( ( y === actual ), true, 'returns expected value' );
+
+ actual = lastIndexOf( x, 2.0, 0, y, {
+ 'dim': 1
+ });
+ expected = [ 1, 1 ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+ t.strictEqual( ( y === actual ), true, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports specifying operation dimensions (column-major)', function test( t ) {
+ var expected;
+ var actual;
+ var xbuf;
+ var x;
+ var y;
+
+ xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+ y = zeros( [ 2 ], {
+ 'dtype': 'generic',
+ 'order': 'column-major'
+ });
+
+ actual = lastIndexOf( x, 2.0, y, {
+ 'dim': 0
+ });
+ expected = [ 1, 1 ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+ t.strictEqual( ( y === actual ), true, 'returns expected value' );
+
+ actual = lastIndexOf( x, 2.0, 0, y, {
+ 'dim': 0
+ });
+ expected = [ 1, 1 ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+ t.strictEqual( ( y === actual ), true, 'returns expected value' );
+
+ xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+ y = zeros( [ 2 ], {
+ 'dtype': 'generic',
+ 'order': 'column-major'
+ });
+
+ actual = lastIndexOf( x, 2.0, y, {
+ 'dim': 1
+ });
+ expected = [ -1, 1 ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+ t.strictEqual( ( y === actual ), true, 'returns expected value' );
+
+ actual = lastIndexOf( x, 2.0, 0, y, {
+ 'dim': 1
+ });
+ expected = [ -1, 1 ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+ t.strictEqual( ( y === actual ), true, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports providing a from index (scalar)', function test( t ) {
+ var expected;
+ var actual;
+ var xbuf;
+ var x;
+ var y;
+
+ xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+ y = zeros( [ 2 ], {
+ 'dtype': 'generic'
+ });
+
+ actual = lastIndexOf( x, 2.0, 0, y );
+ expected = [ 1, 1 ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+ t.strictEqual( ( y === actual ), true, 'returns expected value' );
+
+ xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+ y = zeros( [ 2 ], {
+ 'dtype': 'generic',
+ 'order': 'column-major'
+ });
+
+ actual = lastIndexOf( x, 2.0, 0, y );
+ expected = [ -1, 1 ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+ t.strictEqual( ( y === actual ), true, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports providing a from index (scalar, options)', function test( t ) {
+ var expected;
+ var actual;
+ var xbuf;
+ var x;
+ var y;
+
+ xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+ y = zeros( [ 2 ], {
+ 'dtype': 'generic'
+ });
+
+ actual = lastIndexOf( x, 2.0, 0, y, {} );
+ expected = [ 1, 1 ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+ t.strictEqual( ( y === actual ), true, 'returns expected value' );
+
+ xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+ y = zeros( [ 2 ], {
+ 'dtype': 'generic',
+ 'order': 'column-major'
+ });
+
+ actual = lastIndexOf( x, 2.0, 0, y, {} );
+ expected = [ -1, 1 ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+ t.strictEqual( ( y === actual ), true, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports providing a from index (0d ndarray)', function test( t ) {
+ var expected;
+ var fromIdx;
+ var actual;
+ var xbuf;
+ var x;
+ var y;
+
+ xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+ y = zeros( [ 2 ], {
+ 'dtype': 'generic'
+ });
+
+ fromIdx = scalar2ndarray( 0, {
+ 'dtype': 'generic'
+ });
+ actual = lastIndexOf( x, 2.0, fromIdx, y );
+ expected = [ 1, 1 ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+ t.strictEqual( ( y === actual ), true, 'returns expected value' );
+
+ xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+ y = zeros( [ 2 ], {
+ 'dtype': 'generic',
+ 'order': 'column-major'
+ });
+
+ actual = lastIndexOf( x, 2.0, fromIdx, y );
+ expected = [ -1, 1 ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+ t.strictEqual( ( y === actual ), true, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports providing a from index (0d ndarray, options)', function test( t ) {
+ var expected;
+ var fromIdx;
+ var actual;
+ var xbuf;
+ var x;
+ var y;
+
+ xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+ y = zeros( [ 2 ], {
+ 'dtype': 'generic'
+ });
+
+ fromIdx = scalar2ndarray( 0, {
+ 'dtype': 'generic'
+ });
+ actual = lastIndexOf( x, 2.0, fromIdx, y, {} );
+ expected = [ 1, 1 ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+ t.strictEqual( ( y === actual ), true, 'returns expected value' );
+
+ xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+ y = zeros( [ 2 ], {
+ 'dtype': 'generic',
+ 'order': 'column-major'
+ });
+
+ actual = lastIndexOf( x, 2.0, fromIdx, y, {} );
+ expected = [ -1, 1 ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+ t.strictEqual( ( y === actual ), true, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports providing a from index (scalar, broadcasted)', function test( t ) {
+ var expected;
+ var actual;
+ var xbuf;
+ var x;
+ var y;
+
+ xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+ y = zeros( [ 2 ], {
+ 'dtype': 'generic'
+ });
+
+ actual = lastIndexOf( x, 2.0, 0, y, {
+ 'dim': 0
+ });
+ expected = [ -1, 1 ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+ t.strictEqual( ( y === actual ), true, 'returns expected value' );
+
+ xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+ y = zeros( [ 2 ], {
+ 'dtype': 'generic',
+ 'order': 'column-major'
+ });
+
+ actual = lastIndexOf( x, 2.0, 0, y, {
+ 'dim': 0
+ });
+ expected = [ 1, 1 ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+ t.strictEqual( ( y === actual ), true, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports providing a from index (0d ndarray, broadcasted)', function test( t ) {
+ var expected;
+ var fromIdx;
+ var actual;
+ var xbuf;
+ var x;
+ var y;
+
+ xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+ y = zeros( [ 2 ], {
+ 'dtype': 'generic'
+ });
+
+ fromIdx = scalar2ndarray( 0, {
+ 'dtype': 'int32'
+ });
+ actual = lastIndexOf( x, 2.0, fromIdx, y, {
+ 'dim': 0
+ });
+ expected = [ -1, 1 ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+ t.strictEqual( ( y === actual ), true, 'returns expected value' );
+
+ xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+ y = zeros( [ 2 ], {
+ 'dtype': 'generic',
+ 'order': 'column-major'
+ });
+
+ actual = lastIndexOf( x, 2.0, fromIdx, y, {
+ 'dim': 0
+ });
+ expected = [ 1, 1 ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+ t.strictEqual( ( y === actual ), true, 'returns expected value' );
+
+ t.end();
+});
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.js b/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.js
new file mode 100644
index 000000000000..4fe1c767f746
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.js
@@ -0,0 +1,39 @@
+/**
+* @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 isMethod = require( '@stdlib/assert/is-method' );
+var lastIndexOf = require( './../lib' );
+
+
+// TESTS //
+
+tape( 'main export is a function', function test( t ) {
+ t.ok( true, __filename );
+ t.strictEqual( typeof lastIndexOf, 'function', 'main export is a function' );
+ t.end();
+});
+
+tape( 'attached to the main export is an `assign` method', function test( t ) {
+ t.strictEqual( isMethod( lastIndexOf, 'assign' ), true, 'returns expected value' );
+ t.end();
+});
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.main.js b/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.main.js
new file mode 100644
index 000000000000..d021086d140f
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.main.js
@@ -0,0 +1,1275 @@
+/**
+* @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 isndarrayLike = require( '@stdlib/assert/is-ndarray-like' );
+var ndarray = require( '@stdlib/ndarray/ctor' );
+var zeros = require( '@stdlib/ndarray/zeros' );
+var ndarray2array = require( '@stdlib/ndarray/to-array' );
+var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' );
+var getDType = require( '@stdlib/ndarray/dtype' );
+var getShape = require( '@stdlib/ndarray/shape' );
+var getOrder = require( '@stdlib/ndarray/order' );
+var lastIndexOf = require( './../lib' );
+
+
+// TESTS //
+
+tape( 'main export is a function', function test( t ) {
+ t.ok( true, __filename );
+ t.strictEqual( typeof lastIndexOf, 'function', 'main export is a function' );
+ t.end();
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_scalar)', function test( t ) {
+ var values;
+ var i;
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ lastIndexOf( value, 2.0 );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_ndarray)', function test( t ) {
+ var values;
+ var i;
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ lastIndexOf( value, scalar2ndarray( 2.0 ) );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_scalar, fromIndex_scalar)', function test( t ) {
+ var values;
+ var i;
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ lastIndexOf( value, 2.0, 0 );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_ndarray, fromIndex_scalar)', function test( t ) {
+ var values;
+ var i;
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ lastIndexOf( value, scalar2ndarray( 2.0 ), 0 );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_scalar, fromIndex_ndarray)', function test( t ) {
+ var values;
+ var i;
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ lastIndexOf( value, 2.0, scalar2ndarray( 0, {
+ 'dtype': 'generic'
+ }));
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_ndarray, fromIndex_ndarray)', function test( t ) {
+ var values;
+ var i;
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ lastIndexOf( value, scalar2ndarray( 2.0 ), scalar2ndarray( 0, {
+ 'dtype': 'generic'
+ }));
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_scalar, options)', function test( t ) {
+ var values;
+ var i;
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ lastIndexOf( value, 2.0, {} );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_ndarray, options)', function test( t ) {
+ var values;
+ var i;
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ lastIndexOf( value, scalar2ndarray( 2.0 ), {} );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_scalar, fromIndex_scalar, options)', function test( t ) {
+ var values;
+ var i;
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ lastIndexOf( value, 2.0, 0, {} );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_ndarray, fromIndex_scalar, options)', function test( t ) {
+ var values;
+ var i;
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ lastIndexOf( value, scalar2ndarray( 2.0 ), 0, {} );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_scalar, fromIndex_ndarray, options)', function test( t ) {
+ var values;
+ var i;
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ lastIndexOf( value, 2.0, scalar2ndarray( 0, {
+ 'dtype': 'generic'
+ }), {} );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_ndarray, fromIndex_ndarray, options)', function test( t ) {
+ var values;
+ var i;
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ lastIndexOf( value, scalar2ndarray( 2.0 ), scalar2ndarray( 0, {
+ 'dtype': 'generic'
+ }), {} );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a third argument which is not an ndarray-like object, integer or an object', function test( t ) {
+ var values;
+ var x;
+ var i;
+
+ x = zeros( [ 2, 2 ], {
+ 'dtype': 'float64'
+ });
+ values = [
+ '5',
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ lastIndexOf( x, scalar2ndarray( 2.0 ), value, {} );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided insufficient number of arguments', function test( t ) {
+ var x;
+
+ x = zeros( [ 2, 2 ], {
+ 'dtype': 'generic'
+ });
+
+ function badValue1() {
+ return function badValue() {
+ lastIndexOf( x );
+ };
+ }
+
+ function badValue2() {
+ return function badValue() {
+ lastIndexOf();
+ };
+ }
+
+ t.throws( badValue1(), TypeError, 'throws an error when provided insufficient arguments' );
+ t.throws( badValue2(), TypeError, 'throws an error when provided insufficient arguments' );
+ t.end();
+});
+
+tape( 'the function throws an error if provided a search element which is not broadcast-compatible', function test( t ) {
+ var values;
+ var opts;
+ var x;
+ var i;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+ x = zeros( [ 2, 2 ], opts );
+
+ values = [
+ zeros( [ 4 ], opts ),
+ zeros( [ 2, 2, 2 ], opts ),
+ zeros( [ 0 ], opts )
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ lastIndexOf( x, value );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided an search element which is not broadcast-compatible (options)', function test( t ) {
+ var values;
+ var opts;
+ var x;
+ var i;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+ x = zeros( [ 2, 2 ], opts );
+
+ values = [
+ zeros( [ 4 ], opts ),
+ zeros( [ 2, 2, 2 ], opts ),
+ zeros( [ 0 ], opts )
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ lastIndexOf( x, value, {} );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a from index which is not broadcast-compatible', function test( t ) {
+ var values;
+ var opts;
+ var x;
+ var i;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+ x = zeros( [ 2, 2 ], opts );
+
+ values = [
+ zeros( [ 4 ], opts ),
+ zeros( [ 2, 2, 2 ], opts ),
+ zeros( [ 0 ], opts )
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ lastIndexOf( x, scalar2ndarray( 0 ), value );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a from index which is not broadcast-compatible (options)', function test( t ) {
+ var values;
+ var opts;
+ var x;
+ var i;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+ x = zeros( [ 2, 2 ], opts );
+
+ values = [
+ zeros( [ 4 ], opts ),
+ zeros( [ 2, 2, 2 ], opts ),
+ zeros( [ 0 ], opts )
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ lastIndexOf( x, scalar2ndarray( 0 ), value, {} );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided an options argument which is not an object (searchElement_scalar)', function test( t ) {
+ var values;
+ var x;
+ var i;
+
+ x = zeros( [ 2, 2 ], {
+ 'dtype': 'generic'
+ });
+
+ values = [
+ '5',
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ lastIndexOf( x, 10.0, value );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided an options argument which is not an object (searchElement_ndarray)', function test( t ) {
+ var values;
+ var opts;
+ var x;
+ var i;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+ x = zeros( [ 2, 2 ], opts );
+
+ values = [
+ '5',
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ lastIndexOf( x, scalar2ndarray( 10.0, opts ), value );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided an options argument which is not an object (searchElement_scalar, fromIndex_scalar)', function test( t ) {
+ var values;
+ var x;
+ var i;
+
+ x = zeros( [ 2, 2 ], {
+ 'dtype': 'generic'
+ });
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ lastIndexOf( x, 10.0, 0, value );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided an options argument which is not an object (searchElement_ndarray, fromIndex_ndarray)', function test( t ) {
+ var values;
+ var opts;
+ var x;
+ var i;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+ x = zeros( [ 2, 2 ], opts );
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ lastIndexOf( x, scalar2ndarray( 10.0, opts ), scalar2ndarray( 0, opts ), value ); // eslint-disable-line max-len
+ };
+ }
+});
+
+tape( 'the function throws an error if provided an options argument which is not an object (searchElement_scalar, fromIndex_ndarray)', function test( t ) {
+ var values;
+ var opts;
+ var x;
+ var i;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+
+ x = zeros( [ 2, 2 ], opts );
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ lastIndexOf( x, 10.0, scalar2ndarray( 0, opts ), value );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided an options argument which is not an object (searchElement_ndarray, fromIndex_scalar)', function test( t ) {
+ var values;
+ var opts;
+ var x;
+ var i;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+
+ x = zeros( [ 2, 2 ], opts );
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ lastIndexOf( x, scalar2ndarray( 10.0, opts ), 0, value );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a `dtype` option which is not a supported data type', function test( t ) {
+ var values;
+ var x;
+ var i;
+
+ x = zeros( [ 2, 2 ], {
+ 'dtype': 'generic'
+ });
+
+ values = [
+ 'bool',
+ 'float64',
+ 'float32',
+ 'boop'
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ lastIndexOf( x, 10.0, {
+ 'dtype': value
+ });
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a `dim` option which is not an integer', function test( t ) {
+ var values;
+ var x;
+ var i;
+
+ x = zeros( [ 2, 2 ], {
+ 'dtype': 'generic'
+ });
+
+ values = [
+ '5',
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [ 'a' ],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ lastIndexOf( x, 10.0, {
+ 'dim': value
+ });
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a `dims` option which contains too many indices', function test( t ) {
+ var values;
+ var x;
+ var i;
+
+ x = zeros( [ 2, 2 ], {
+ 'dtype': 'generic'
+ });
+
+ values = [
+ [ 0, 1 ],
+ [ 0, 1, 2 ],
+ [ 0, 1, 2, 3 ]
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ lastIndexOf( x, 10.0, {
+ 'dim': value
+ });
+ };
+ }
+});
+
+tape( 'the function returns the last index of a specified search element in an ndarray (row-major)', function test( t ) {
+ var expected;
+ var actual;
+ var xbuf;
+ var x;
+
+ xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+
+ actual = lastIndexOf( x, 2.0 );
+ expected = [ 1, 1 ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+
+ actual = lastIndexOf( x, 2.0, 0 );
+ expected = [ 1, 1 ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function returns the last index of a specified search element in an ndarray (column-major)', function test( t ) {
+ var expected;
+ var actual;
+ var xbuf;
+ var x;
+
+ xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+
+ actual = lastIndexOf( x, 2.0 );
+ expected = [ -1, 1 ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+
+ actual = lastIndexOf( x, 2.0, 0 );
+ expected = [ -1, 1 ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports specifying operation dimensions (row-major)', function test( t ) {
+ var expected;
+ var actual;
+ var xbuf;
+ var x;
+
+ xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+
+ actual = lastIndexOf( x, 2.0, {
+ 'dim': 0
+ });
+ expected = [ -1, 1 ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+
+ actual = lastIndexOf( x, 2.0, 0, {
+ 'dim': 0
+ });
+ expected = [ -1, 1 ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+
+ xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+
+ actual = lastIndexOf( x, 2.0, {
+ 'dim': 1
+ });
+ expected = [ 1, 1 ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+
+ actual = lastIndexOf( x, 2.0, 0, {
+ 'dim': 1
+ });
+ expected = [ 1, 1 ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports specifying operation dimensions (column-major)', function test( t ) {
+ var expected;
+ var actual;
+ var xbuf;
+ var x;
+
+ xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+
+ actual = lastIndexOf( x, 2.0, {
+ 'dim': 0
+ });
+ expected = [ 1, 1 ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+
+ actual = lastIndexOf( x, 2.0, 0, {
+ 'dim': 0
+ });
+ expected = [ 1, 1 ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+
+ xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+
+ actual = lastIndexOf( x, 2.0, {
+ 'dim': 1
+ });
+ expected = [ -1, 1 ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+
+ actual = lastIndexOf( x, 2.0, 0, {
+ 'dim': 1
+ });
+ expected = [ -1, 1 ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports specifying the output array data type', function test( t ) {
+ var expected;
+ var actual;
+ var xbuf;
+ var x;
+
+ xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+
+ actual = lastIndexOf( x, 2.0, {
+ 'dtype': 'int32'
+ });
+ expected = [ 1, 1 ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'int32', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+
+ xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+
+ actual = lastIndexOf( x, 2.0, 0, {
+ 'dtype': 'int32'
+ });
+ expected = [ -1, 1 ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'int32', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports providing a from index (scalar)', function test( t ) {
+ var expected;
+ var actual;
+ var xbuf;
+ var x;
+
+ xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+
+ actual = lastIndexOf( x, 2.0, 0 );
+ expected = [ 1, 1 ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+
+ xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+
+ actual = lastIndexOf( x, 2.0, 0 );
+ expected = [ -1, 1 ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports providing a from index (scalar, options)', function test( t ) {
+ var expected;
+ var actual;
+ var xbuf;
+ var x;
+
+ xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+
+ actual = lastIndexOf( x, 2.0, 0, {} );
+ expected = [ 1, 1 ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+
+ xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+
+ actual = lastIndexOf( x, 2.0, 0, {} );
+ expected = [ -1, 1 ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports providing a from index (0d ndarray)', function test( t ) {
+ var expected;
+ var fromIdx;
+ var actual;
+ var xbuf;
+ var x;
+
+ xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+
+ fromIdx = scalar2ndarray( 0, {
+ 'dtype': 'generic'
+ });
+ actual = lastIndexOf( x, 2.0, fromIdx );
+ expected = [ 1, 1 ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+
+ xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+
+ actual = lastIndexOf( x, 2.0, fromIdx );
+ expected = [ -1, 1 ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports providing a from index (0d ndarray, options)', function test( t ) {
+ var expected;
+ var fromIdx;
+ var actual;
+ var xbuf;
+ var x;
+
+ xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+
+ fromIdx = scalar2ndarray( 0, {
+ 'dtype': 'generic'
+ });
+ actual = lastIndexOf( x, 2.0, fromIdx, {} );
+ expected = [ 1, 1 ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+
+ xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+
+ actual = lastIndexOf( x, 2.0, fromIdx, {} );
+ expected = [ -1, 1 ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports providing a from index (scalar, broadcasted)', function test( t ) {
+ var expected;
+ var actual;
+ var xbuf;
+ var x;
+
+ xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+
+ actual = lastIndexOf( x, 2.0, 0, {
+ 'dims': 0
+ });
+ expected = [ 1, 1 ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+
+ xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+
+ actual = lastIndexOf( x, 2.0, 0, {
+ 'dims': 0
+ });
+ expected = [ -1, 1 ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports providing a from index (0d ndarray, broadcasted)', function test( t ) {
+ var expected;
+ var fromIdx;
+ var actual;
+ var xbuf;
+ var x;
+
+ xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+
+ fromIdx = scalar2ndarray( 0, {
+ 'dtype': 'int32'
+ });
+ actual = lastIndexOf( x, 2.0, fromIdx, {
+ 'dim': 0
+ });
+ expected = [ -1, 1 ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+
+ xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+
+ actual = lastIndexOf( x, 2.0, fromIdx, {
+ 'dim': 0
+ });
+ expected = [ 1, 1 ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+
+ t.end();
+});
From 5f6e0b911465a5694626e729ddcd34f895af5f91 Mon Sep 17 00:00:00 2001
From: Muhammad Haris <101793258+headlessNode@users.noreply.github.com>
Date: Thu, 17 Jul 2025 04:56:19 +0000
Subject: [PATCH 02/41] docs: refactor the example
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
- task: lint_filenames
status: passed
- task: lint_editorconfig
status: passed
- task: lint_markdown
status: passed
- task: lint_package_json
status: na
- task: lint_repl_help
status: na
- task: lint_javascript_src
status: na
- task: lint_javascript_cli
status: na
- task: lint_javascript_examples
status: na
- task: lint_javascript_tests
status: na
- task: lint_javascript_benchmarks
status: na
- task: lint_python
status: na
- task: lint_r
status: na
- task: lint_c_src
status: na
- task: lint_c_examples
status: na
- task: lint_c_benchmarks
status: na
- task: lint_c_tests_fixtures
status: na
- task: lint_shell
status: na
- task: lint_typescript_declarations
status: passed
- task: lint_typescript_tests
status: na
- task: lint_license_headers
status: passed
---
---
.../@stdlib/blas/ext/last-index-of/README.md | 4 ++--
.../blas/ext/last-index-of/docs/types/index.d.ts | 12 ++++++------
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/README.md b/lib/node_modules/@stdlib/blas/ext/last-index-of/README.md
index 772ad2204205..38adbe37214d 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/README.md
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/README.md
@@ -89,11 +89,11 @@ var x = array( [ 1.0, 2.0, 3.0, 4.0, 2.0, 6.0 ] );
// returns
// Perform operation:
-var out = lastIndexOf( x, 2.0, 3 );
+var out = lastIndexOf( x, 1.0, 3 );
// returns
var idx = out.get();
-// returns 4
+// returns -1
```
By default, the function performs the operation over elements in the last dimension. To perform the operation over a different dimension, provide a `dim` option.
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/ext/last-index-of/docs/types/index.d.ts
index 0dabe33c3600..4faf8a87f1fa 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/docs/types/index.d.ts
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/docs/types/index.d.ts
@@ -119,13 +119,13 @@ interface lastIndexOf {
* @example
* var array = require( '@stdlib/ndarray/array' );
*
- * var x = array( [ -1.0, 2.0, -3.0, 2.0, -5.0, 6.0 ] );
+ * var x = array( [ 1.0, 2.0, -3.0, 2.0, -5.0, 6.0 ] );
*
- * var y = lastIndexOf( x, 2.0, 2 );
+ * var y = lastIndexOf( x, 1.0, 2 );
* // returns
*
* var idx = y.get();
- * // returns 3
+ * // returns -1
*/
( x: InputArray, searchElement: SearchElement, fromIndex: FromIndex, options?: Options ): OutputArray;
@@ -182,19 +182,19 @@ interface lastIndexOf {
* var zeros = require( '@stdlib/ndarray/zeros' );
* var array = require( '@stdlib/ndarray/array' );
*
- * var x = array( [ -1.0, 2.0, -3.0, 2.0, -5.0, 6.0 ] );
+ * var x = array( [ 1.0, 2.0, -3.0, 2.0, -5.0, 6.0 ] );
* var y = zeros( [], {
* 'dtype': 'int32'
* } );
*
- * var out = lastIndexOf.assign( x, 2.0, 2, y );
+ * var out = lastIndexOf.assign( x, 1.0, 2, y );
* // returns
*
* var bool = ( out === y );
* // returns true
*
* var idx = out.get();
- * // returns 3
+ * // returns -1
*/
assign( x: InputArray, searchElement: SearchElement, fromIndex: FromIndex, out: U, options?: BaseOptions ): U;
}
From ea398df4be8a3ffc26576e2ecabb7a4a9d6e7b1b Mon Sep 17 00:00:00 2001
From: Muhammad Haris <101793258+headlessNode@users.noreply.github.com>
Date: Wed, 23 Jul 2025 17:38:05 +0000
Subject: [PATCH 03/41] refactor: apply suggestions from code review
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
- task: lint_filenames
status: passed
- task: lint_editorconfig
status: passed
- task: lint_markdown
status: na
- task: lint_package_json
status: na
- task: lint_repl_help
status: na
- task: lint_javascript_src
status: passed
- task: lint_javascript_cli
status: na
- task: lint_javascript_examples
status: na
- task: lint_javascript_tests
status: passed
- task: lint_javascript_benchmarks
status: 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: passed
- task: lint_license_headers
status: passed
---
---
.../benchmark/benchmark.assign.js | 2 +-
.../ext/last-index-of/benchmark/benchmark.js | 2 +-
.../blas/ext/last-index-of/docs/types/test.ts | 6 +-
.../blas/ext/last-index-of/lib/assign.js | 2 +-
.../blas/ext/last-index-of/lib/main.js | 2 +-
.../ext/last-index-of/test/test.assign.js | 458 +++++++++++++-----
.../blas/ext/last-index-of/test/test.main.js | 278 ++++++-----
7 files changed, 512 insertions(+), 238 deletions(-)
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/benchmark/benchmark.assign.js b/lib/node_modules/@stdlib/blas/ext/last-index-of/benchmark/benchmark.assign.js
index 9367c4b482a5..a53989ce157d 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/benchmark/benchmark.assign.js
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/benchmark/benchmark.assign.js
@@ -71,7 +71,7 @@ function createBenchmark( len ) {
b.tic();
for ( i = 0; i < b.iterations; i++ ) {
- o = lastIndexOf.assign( x, 10.0, out );
+ o = lastIndexOf.assign( x, 100.0, out );
if ( typeof o !== 'object' ) {
b.fail( 'should return an ndarray' );
}
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/ext/last-index-of/benchmark/benchmark.js
index f878c4157776..5a2c3761fccd 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/benchmark/benchmark.js
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/benchmark/benchmark.js
@@ -63,7 +63,7 @@ function createBenchmark( len ) {
b.tic();
for ( i = 0; i < b.iterations; i++ ) {
- o = lastIndexOf( x, 10.0 );
+ o = lastIndexOf( x, 100.0 );
if ( typeof o !== 'object' ) {
b.fail( 'should return an ndarray' );
}
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/docs/types/test.ts b/lib/node_modules/@stdlib/blas/ext/last-index-of/docs/types/test.ts
index f9223c78524c..f62571f0617a 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/docs/types/test.ts
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/docs/types/test.ts
@@ -140,7 +140,7 @@ import lastIndexOf = require( './index' );
}
-// The compiler throws an error if the function is provided a options argument which is not an object...
+// The compiler throws an error if the function is provided an options argument which is not an object...
{
const x = zeros( [ 2, 2 ], {
'dtype': 'float64'
@@ -355,7 +355,7 @@ import lastIndexOf = require( './index' );
lastIndexOf.assign( x, 0.0, ( x: number ): number => x, y, {} ); // $ExpectError
}
-// The compiler throws an error if the `assign` method is provided a output argument which is not an ndarray...
+// The compiler throws an error if the `assign` method is provided an output argument which is not an ndarray...
{
const x = zeros( [ 2, 2 ], {
'dtype': 'float64'
@@ -394,7 +394,7 @@ import lastIndexOf = require( './index' );
lastIndexOf.assign( x, 0.0, 1, ( x: number ): number => x, {} ); // $ExpectError
}
-// The compiler throws an error if the `assign` method is provided a options argument which is not an object...
+// The compiler throws an error if the `assign` method is provided an options argument which is not an object...
{
const x = zeros( [ 2, 2 ], {
'dtype': 'float64'
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/assign.js b/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/assign.js
index a7b2c213e4c1..6979947749a0 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/assign.js
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/assign.js
@@ -56,7 +56,7 @@ var DEFAULT_DTYPE = defaults.get( 'dtypes.integer_index' );
* @throws {TypeError} third argument must be either an ndarray-like object or an integer
* @throws {TypeError} output argument must be an ndarray-like object
* @throws {TypeError} options argument must be an object
-* @throws {RangeError} dimension dimension index must not exceed input ndarray bounds
+* @throws {RangeError} dimension index must not exceed input ndarray bounds
* @throws {RangeError} first argument must have at least one dimension
* @throws {Error} must provide valid options
* @returns {ndarray} output ndarray
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/main.js b/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/main.js
index 5f75e994c517..34cf4886b6c8 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/main.js
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/main.js
@@ -53,7 +53,7 @@ var DEFAULT_DTYPE = defaults.get( 'dtypes.integer_index' );
* @param {boolean} [options.keepdims=false] - boolean indicating whether the reduced dimensions should be included in the returned ndarray as singleton dimensions
* @param {string} [options.dtype] - output ndarray data type
* @throws {TypeError} first argument must be an ndarray-like object
-* @throws {TypeError} the function must be provided at least two arguments
+* @throws {TypeError} second argument must be either an ndarray-like object or a scalar value
* @throws {TypeError} third argument must be either an ndarray-like object or an integer
* @throws {TypeError} options argument must be an object
* @throws {RangeError} dimension index must not exceed input ndarray bounds
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.assign.js b/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.assign.js
index 070e838bcfb8..0a4d7c2b25e6 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.assign.js
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.assign.js
@@ -42,7 +42,7 @@ tape( 'main export is a function', function test( t ) {
t.end();
});
-tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_scalar)', function test( t ) {
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement=scalar)', function test( t ) {
var values;
var i;
var y;
@@ -75,7 +75,7 @@ tape( 'the function throws an error if provided a first argument which is not an
}
});
-tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_ndarray)', function test( t ) {
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement=ndarray)', function test( t ) {
var values;
var i;
var y;
@@ -108,7 +108,7 @@ tape( 'the function throws an error if provided a first argument which is not an
}
});
-tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_scalar, fromIndex_scalar)', function test( t ) {
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement=scalar, fromIndex=scalar)', function test( t ) {
var values;
var i;
var y;
@@ -141,7 +141,7 @@ tape( 'the function throws an error if provided a first argument which is not an
}
});
-tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_ndarray, fromIndex_scalar)', function test( t ) {
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement=ndarray, fromIndex=scalar)', function test( t ) {
var values;
var i;
var y;
@@ -174,7 +174,7 @@ tape( 'the function throws an error if provided a first argument which is not an
}
});
-tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_scalar, fromIndex_ndarray)', function test( t ) {
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement=scalar, fromIndex=ndarray)', function test( t ) {
var values;
var opts;
var i;
@@ -210,7 +210,7 @@ tape( 'the function throws an error if provided a first argument which is not an
}
});
-tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_ndarray, fromIndex_ndarray)', function test( t ) {
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement=ndarray, fromIndex=ndarray)', function test( t ) {
var values;
var opts;
var i;
@@ -246,7 +246,7 @@ tape( 'the function throws an error if provided a first argument which is not an
}
});
-tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_scalar, options)', function test( t ) {
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement=scalar, options)', function test( t ) {
var values;
var opts;
var i;
@@ -282,7 +282,7 @@ tape( 'the function throws an error if provided a first argument which is not an
}
});
-tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_ndarray, options)', function test( t ) {
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement=ndarray, options)', function test( t ) {
var values;
var opts;
var i;
@@ -318,7 +318,7 @@ tape( 'the function throws an error if provided a first argument which is not an
}
});
-tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_scalar, fromIndex_scalar, options)', function test( t ) {
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement=scalar, fromIndex=scalar, options)', function test( t ) {
var values;
var opts;
var i;
@@ -354,7 +354,7 @@ tape( 'the function throws an error if provided a first argument which is not an
}
});
-tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_ndarray, fromIndex_scalar, options)', function test( t ) {
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement=ndarray, fromIndex=scalar, options)', function test( t ) {
var values;
var opts;
var i;
@@ -390,7 +390,7 @@ tape( 'the function throws an error if provided a first argument which is not an
}
});
-tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_scalar, fromIndex_ndarray, options)', function test( t ) {
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement=scalar, fromIndex=ndarray, options)', function test( t ) {
var values;
var opts;
var i;
@@ -426,7 +426,7 @@ tape( 'the function throws an error if provided a first argument which is not an
}
});
-tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_ndarray, fromIndex_ndarray, options)', function test( t ) {
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement=ndarray, fromIndex=ndarray, options)', function test( t ) {
var values;
var opts;
var i;
@@ -462,7 +462,7 @@ tape( 'the function throws an error if provided a first argument which is not an
}
});
-tape( 'the function throws an error if provided a third argument which is not an ndarray-like object, integer or an object', function test( t ) {
+tape( 'the function throws an error if provided a third argument which is not an ndarray-like object, an integer, or an object', function test( t ) {
var values;
var i;
var x;
@@ -496,38 +496,176 @@ tape( 'the function throws an error if provided a third argument which is not an
}
});
-tape( 'the function throws an error if provided insufficient number of arguments', function test( t ) {
+tape( 'the function throws an error if provided an output argument which is not an ndarray-like object', function test( t ) {
+ var values;
+ var opts;
+ var i;
var x;
- x = zeros( [ 2, 2 ], {
+ opts = {
'dtype': 'generic'
- });
+ };
- function badValue1() {
+ x = zeros( [ 2, 2 ], opts );
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
return function badValue() {
- lastIndexOf( x );
+ lastIndexOf( x, 2.0, value );
};
}
+});
- function badValue2() {
+tape( 'the function throws an error if provided an output argument which is not an ndarray-like object (options)', function test( t ) {
+ var values;
+ var opts;
+ var i;
+ var x;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+
+ x = zeros( [ 2, 2 ], opts );
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ lastIndexOf( x, 2.0, value, {} );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided an output argument which is not an ndarray-like object (fromIndex)', function test( t ) {
+ var values;
+ var opts;
+ var i;
+ var x;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+
+ x = zeros( [ 2, 2 ], opts );
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
return function badValue() {
- lastIndexOf( x, 10.0 );
+ lastIndexOf( x, 2.0, 2, value );
};
}
+});
- function badValue3() {
+tape( 'the function throws an error if provided an output argument which is not an ndarray-like object (fromIndex, options)', function test( t ) {
+ var values;
+ var opts;
+ var i;
+ var x;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+
+ x = zeros( [ 2, 2 ], opts );
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
return function badValue() {
- lastIndexOf();
+ lastIndexOf( x, 2.0, 2, value, {} );
};
}
+});
+
+tape( 'the function throws an error if provided insufficient number of arguments', function test( t ) {
+ var x;
+
+ x = zeros( [ 2, 2 ], {
+ 'dtype': 'generic'
+ });
- t.throws( badValue1(), TypeError, 'throws an error when provided insufficient arguments' );
- t.throws( badValue2(), TypeError, 'throws an error when provided insufficient arguments' );
- t.throws( badValue3(), TypeError, 'throws an error when provided insufficient arguments' );
+ t.throws( badValue1, TypeError, 'throws an error when provided insufficient arguments' );
+ t.throws( badValue2, TypeError, 'throws an error when provided insufficient arguments' );
+ t.throws( badValue3, TypeError, 'throws an error when provided insufficient arguments' );
t.end();
+
+ function badValue1() {
+ lastIndexOf( x );
+ }
+
+ function badValue2() {
+ lastIndexOf( x, 10.0 );
+ }
+
+ function badValue3() {
+ lastIndexOf();
+ }
});
-tape( 'the function throws an error if provided a search element which is not broadcast-compatible', function test( t ) {
+tape( 'the function throws an error if provided a search element which is not broadcast-compatible with the first argument', function test( t ) {
var values;
var opts;
var x;
@@ -557,7 +695,7 @@ tape( 'the function throws an error if provided a search element which is not br
}
});
-tape( 'the function throws an error if provided an search element which is not broadcast-compatible (options)', function test( t ) {
+tape( 'the function throws an error if provided an search element which is not broadcast-compatible with the first argument (options)', function test( t ) {
var values;
var opts;
var x;
@@ -587,7 +725,7 @@ tape( 'the function throws an error if provided an search element which is not b
}
});
-tape( 'the function throws an error if provided a from index which is not broadcast-compatible', function test( t ) {
+tape( 'the function throws an error if provided a from index which is not broadcast-compatible with the first argument', function test( t ) {
var values;
var opts;
var x;
@@ -617,7 +755,7 @@ tape( 'the function throws an error if provided a from index which is not broadc
}
});
-tape( 'the function throws an error if provided a from index which is not broadcast-compatible (options)', function test( t ) {
+tape( 'the function throws an error if provided a from index which is not broadcast-compatible with the first argument (options)', function test( t ) {
var values;
var opts;
var x;
@@ -647,7 +785,7 @@ tape( 'the function throws an error if provided a from index which is not broadc
}
});
-tape( 'the function throws an error if provided an options argument which is not an object (searchElement_scalar)', function test( t ) {
+tape( 'the function throws an error if provided an options argument which is not an object (searchElement=scalar)', function test( t ) {
var values;
var opts;
var x;
@@ -683,7 +821,7 @@ tape( 'the function throws an error if provided an options argument which is not
}
});
-tape( 'the function throws an error if provided an options argument which is not an object (searchElement_ndarray)', function test( t ) {
+tape( 'the function throws an error if provided an options argument which is not an object (searchElement=ndarray)', function test( t ) {
var values;
var opts;
var x;
@@ -719,7 +857,7 @@ tape( 'the function throws an error if provided an options argument which is not
}
});
-tape( 'the function throws an error if provided an options argument which is not an object (searchElement_scalar, fromIndex_scalar)', function test( t ) {
+tape( 'the function throws an error if provided an options argument which is not an object (searchElement=scalar, fromIndex=scalar)', function test( t ) {
var values;
var opts;
var x;
@@ -756,7 +894,7 @@ tape( 'the function throws an error if provided an options argument which is not
}
});
-tape( 'the function throws an error if provided an options argument which is not an object (searchElement_ndarray, fromIndex_ndarray)', function test( t ) {
+tape( 'the function throws an error if provided an options argument which is not an object (searchElement=ndarray, fromIndex=ndarray)', function test( t ) {
var values;
var opts;
var x;
@@ -793,7 +931,7 @@ tape( 'the function throws an error if provided an options argument which is not
}
});
-tape( 'the function throws an error if provided an options argument which is not an object (searchElement_scalar, fromIndex_ndarray)', function test( t ) {
+tape( 'the function throws an error if provided an options argument which is not an object (searchElement=scalar, fromIndex=ndarray)', function test( t ) {
var values;
var opts;
var x;
@@ -830,7 +968,7 @@ tape( 'the function throws an error if provided an options argument which is not
}
});
-tape( 'the function throws an error if provided an options argument which is not an object (searchElement_ndarray, fromIndex_scalar)', function test( t ) {
+tape( 'the function throws an error if provided an options argument which is not an object (searchElement=ndarray, fromIndex=scalar)', function test( t ) {
var values;
var opts;
var x;
@@ -906,39 +1044,6 @@ tape( 'the function throws an error if provided a `dim` option which is not an i
}
});
-tape( 'the function throws an error if provided a `dims` option which contains too many indices', function test( t ) {
- var values;
- var opts;
- var x;
- var y;
- var i;
-
- opts = {
- 'dtype': 'generic'
- };
-
- x = zeros( [ 2, 2 ], opts );
- y = zeros( [], opts );
-
- values = [
- [ 0, 1 ],
- [ 0, 1, 2 ],
- [ 0, 1, 2, 3 ]
- ];
- for ( i = 0; i < values.length; i++ ) {
- t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
- }
- t.end();
-
- function badValue( value ) {
- return function badValue() {
- lastIndexOf( x, 10.0, y, {
- 'dim': value
- });
- };
- }
-});
-
tape( 'the function returns the first index of a specified search element in an ndarray (row-major)', function test( t ) {
var expected;
var actual;
@@ -949,7 +1054,8 @@ tape( 'the function returns the first index of a specified search element in an
xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
y = zeros( [ 2 ], {
- 'dtype': 'generic'
+ 'dtype': 'generic',
+ 'order': 'row-major'
});
actual = lastIndexOf( x, 2.0, y );
@@ -962,6 +1068,11 @@ tape( 'the function returns the first index of a specified search element in an
t.strictEqual( isSameArray( getData( actual ), expected ), true, 'returns expected value' );
t.strictEqual( ( y === actual ), true, 'returns expected value' );
+ y = zeros( [ 2 ], {
+ 'dtype': 'generic',
+ 'order': 'row-major'
+ });
+
actual = lastIndexOf( x, 2.0, 0, y );
expected = [ 1, 1 ];
@@ -999,6 +1110,11 @@ tape( 'the function returns the first index of a specified search element in an
t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
t.strictEqual( ( y === actual ), true, 'returns expected value' );
+ y = zeros( [ 2 ], {
+ 'dtype': 'generic',
+ 'order': 'column-major'
+ });
+
actual = lastIndexOf( x, 2.0, 0, y );
expected = [ -1, 1 ];
@@ -1012,7 +1128,7 @@ tape( 'the function returns the first index of a specified search element in an
t.end();
});
-tape( 'the function supports specifying operation dimensions (row-major)', function test( t ) {
+tape( 'the function supports specifying an operation dimension (row-major)', function test( t ) {
var expected;
var actual;
var xbuf;
@@ -1022,7 +1138,8 @@ tape( 'the function supports specifying operation dimensions (row-major)', funct
xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
y = zeros( [ 2 ], {
- 'dtype': 'generic'
+ 'dtype': 'generic',
+ 'order': 'row-major'
});
actual = lastIndexOf( x, 2.0, y, {
@@ -1037,6 +1154,11 @@ tape( 'the function supports specifying operation dimensions (row-major)', funct
t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
t.strictEqual( ( y === actual ), true, 'returns expected value' );
+ y = zeros( [ 2 ], {
+ 'dtype': 'generic',
+ 'order': 'row-major'
+ });
+
actual = lastIndexOf( x, 2.0, 0, y, {
'dim': 0
});
@@ -1052,7 +1174,8 @@ tape( 'the function supports specifying operation dimensions (row-major)', funct
xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
y = zeros( [ 2 ], {
- 'dtype': 'generic'
+ 'dtype': 'generic',
+ 'order': 'row-major'
});
actual = lastIndexOf( x, 2.0, y, {
@@ -1067,6 +1190,11 @@ tape( 'the function supports specifying operation dimensions (row-major)', funct
t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
t.strictEqual( ( y === actual ), true, 'returns expected value' );
+ y = zeros( [ 2 ], {
+ 'dtype': 'generic',
+ 'order': 'row-major'
+ });
+
actual = lastIndexOf( x, 2.0, 0, y, {
'dim': 1
});
@@ -1082,7 +1210,7 @@ tape( 'the function supports specifying operation dimensions (row-major)', funct
t.end();
});
-tape( 'the function supports specifying operation dimensions (column-major)', function test( t ) {
+tape( 'the function supports specifying an operation dimension (column-major)', function test( t ) {
var expected;
var actual;
var xbuf;
@@ -1108,6 +1236,11 @@ tape( 'the function supports specifying operation dimensions (column-major)', fu
t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
t.strictEqual( ( y === actual ), true, 'returns expected value' );
+ y = zeros( [ 2 ], {
+ 'dtype': 'generic',
+ 'order': 'column-major'
+ });
+
actual = lastIndexOf( x, 2.0, 0, y, {
'dim': 0
});
@@ -1139,6 +1272,11 @@ tape( 'the function supports specifying operation dimensions (column-major)', fu
t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
t.strictEqual( ( y === actual ), true, 'returns expected value' );
+ y = zeros( [ 2 ], {
+ 'dtype': 'generic',
+ 'order': 'column-major'
+ });
+
actual = lastIndexOf( x, 2.0, 0, y, {
'dim': 1
});
@@ -1161,14 +1299,20 @@ tape( 'the function supports providing a from index (scalar)', function test( t
var x;
var y;
- xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
- x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+ /*
+ * [
+ * -1.0, 2.0, -3.0, 2.0, -5.0,
+ * 6.0, -7.0, 2.0, -8.0, 2.0
+ * ]
+ */
+ xbuf = [ -1.0, 2.0, -3.0, 2.0, -5.0, 6.0, -7.0, 2.0, -8.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 5 ], [ 5, 1 ], 0, 'row-major' );
y = zeros( [ 2 ], {
'dtype': 'generic'
});
- actual = lastIndexOf( x, 2.0, 0, y );
- expected = [ 1, 1 ];
+ actual = lastIndexOf( x, 2.0, 2, y );
+ expected = [ 3, 4 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1177,15 +1321,21 @@ tape( 'the function supports providing a from index (scalar)', function test( t
t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
t.strictEqual( ( y === actual ), true, 'returns expected value' );
- xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
- x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+ /*
+ * [
+ * -1.0, -3.0, -5.0, -7.0, -8.0,
+ * 2.0, 2.0, 6.0, 2.0, 2.0
+ * ]
+ */
+ xbuf = [ -1.0, 2.0, -3.0, 2.0, -5.0, 6.0, -7.0, 2.0, -8.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 5 ], [ 1, 2 ], 0, 'column-major' );
y = zeros( [ 2 ], {
'dtype': 'generic',
'order': 'column-major'
});
- actual = lastIndexOf( x, 2.0, 0, y );
- expected = [ -1, 1 ];
+ actual = lastIndexOf( x, 2.0, 2, y );
+ expected = [ -1, 4 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1204,14 +1354,20 @@ tape( 'the function supports providing a from index (scalar, options)', function
var x;
var y;
- xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
- x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+ /*
+ * [
+ * -1.0, 2.0, -3.0, 2.0, -5.0,
+ * 6.0, -7.0, 2.0, -8.0, 2.0
+ * ]
+ */
+ xbuf = [ -1.0, 2.0, -3.0, 2.0, -5.0, 6.0, -7.0, 2.0, -8.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 5 ], [ 5, 1 ], 0, 'row-major' );
y = zeros( [ 2 ], {
'dtype': 'generic'
});
- actual = lastIndexOf( x, 2.0, 0, y, {} );
- expected = [ 1, 1 ];
+ actual = lastIndexOf( x, 2.0, 2, y, {} );
+ expected = [ 3, 4 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1220,15 +1376,21 @@ tape( 'the function supports providing a from index (scalar, options)', function
t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
t.strictEqual( ( y === actual ), true, 'returns expected value' );
- xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
- x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+ /*
+ * [
+ * -1.0, -3.0, -5.0, -7.0, -8.0,
+ * 2.0, 2.0, 6.0, 2.0, 2.0
+ * ]
+ */
+ xbuf = [ -1.0, 2.0, -3.0, 2.0, -5.0, 6.0, -7.0, 2.0, -8.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 5 ], [ 1, 2 ], 0, 'column-major' );
y = zeros( [ 2 ], {
'dtype': 'generic',
'order': 'column-major'
});
- actual = lastIndexOf( x, 2.0, 0, y, {} );
- expected = [ -1, 1 ];
+ actual = lastIndexOf( x, 2.0, 2, y, {} );
+ expected = [ -1, 4 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1248,17 +1410,23 @@ tape( 'the function supports providing a from index (0d ndarray)', function test
var x;
var y;
- xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
- x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+ /*
+ * [
+ * -1.0, 2.0, -3.0, 2.0, -5.0,
+ * 6.0, -7.0, 2.0, -8.0, 2.0
+ * ]
+ */
+ xbuf = [ -1.0, 2.0, -3.0, 2.0, -5.0, 6.0, -7.0, 2.0, -8.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 5 ], [ 5, 1 ], 0, 'row-major' );
y = zeros( [ 2 ], {
'dtype': 'generic'
});
- fromIdx = scalar2ndarray( 0, {
+ fromIdx = scalar2ndarray( 2, {
'dtype': 'generic'
});
actual = lastIndexOf( x, 2.0, fromIdx, y );
- expected = [ 1, 1 ];
+ expected = [ 3, 4 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1267,15 +1435,21 @@ tape( 'the function supports providing a from index (0d ndarray)', function test
t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
t.strictEqual( ( y === actual ), true, 'returns expected value' );
- xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
- x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+ /*
+ * [
+ * -1.0, -3.0, -5.0, -7.0, -8.0,
+ * 2.0, 2.0, 6.0, 2.0, 2.0
+ * ]
+ */
+ xbuf = [ -1.0, 2.0, -3.0, 2.0, -5.0, 6.0, -7.0, 2.0, -8.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 5 ], [ 1, 2 ], 0, 'column-major' );
y = zeros( [ 2 ], {
'dtype': 'generic',
'order': 'column-major'
});
actual = lastIndexOf( x, 2.0, fromIdx, y );
- expected = [ -1, 1 ];
+ expected = [ -1, 4 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1295,17 +1469,23 @@ tape( 'the function supports providing a from index (0d ndarray, options)', func
var x;
var y;
- xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
- x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+ /*
+ * [
+ * -1.0, 2.0, -3.0, 2.0, -5.0,
+ * 6.0, -7.0, 2.0, -8.0, 2.0
+ * ]
+ */
+ xbuf = [ -1.0, 2.0, -3.0, 2.0, -5.0, 6.0, -7.0, 2.0, -8.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 5 ], [ 5, 1 ], 0, 'row-major' );
y = zeros( [ 2 ], {
'dtype': 'generic'
});
- fromIdx = scalar2ndarray( 0, {
+ fromIdx = scalar2ndarray( 2, {
'dtype': 'generic'
});
actual = lastIndexOf( x, 2.0, fromIdx, y, {} );
- expected = [ 1, 1 ];
+ expected = [ 3, 4 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1314,15 +1494,21 @@ tape( 'the function supports providing a from index (0d ndarray, options)', func
t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
t.strictEqual( ( y === actual ), true, 'returns expected value' );
- xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
- x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+ /*
+ * [
+ * -1.0, -3.0, -5.0, -7.0, -8.0,
+ * 2.0, 2.0, 6.0, 2.0, 2.0
+ * ]
+ */
+ xbuf = [ -1.0, 2.0, -3.0, 2.0, -5.0, 6.0, -7.0, 2.0, -8.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 5 ], [ 1, 2 ], 0, 'column-major' );
y = zeros( [ 2 ], {
'dtype': 'generic',
'order': 'column-major'
});
actual = lastIndexOf( x, 2.0, fromIdx, y, {} );
- expected = [ -1, 1 ];
+ expected = [ -1, 4 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1341,16 +1527,25 @@ tape( 'the function supports providing a from index (scalar, broadcasted)', func
var x;
var y;
- xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
- x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+ /*
+ * [
+ * -1.0, 2.0,
+ * -3.0, 2.0,
+ * -5.0, 6.0,
+ * -7.0, 2.0,
+ * -8.0, 2.0
+ * ]
+ */
+ xbuf = [ -1.0, 2.0, -3.0, 2.0, -5.0, 6.0, -7.0, 2.0, -8.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 5, 2 ], [ 2, 1 ], 0, 'row-major' );
y = zeros( [ 2 ], {
'dtype': 'generic'
});
- actual = lastIndexOf( x, 2.0, 0, y, {
+ actual = lastIndexOf( x, 2.0, 2, y, {
'dim': 0
});
- expected = [ -1, 1 ];
+ expected = [ -1, 4 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1359,17 +1554,26 @@ tape( 'the function supports providing a from index (scalar, broadcasted)', func
t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
t.strictEqual( ( y === actual ), true, 'returns expected value' );
- xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
- x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+ /*
+ * [
+ * -1.0, 6.0,
+ * 2.0, -7.0,
+ * -3.0, 2.0,
+ * 2.0, -8.0,
+ * -5.0, 2.0
+ * ]
+ */
+ xbuf = [ -1.0, 2.0, -3.0, 2.0, -5.0, 6.0, -7.0, 2.0, -8.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 5, 2 ], [ 1, 5 ], 0, 'column-major' );
y = zeros( [ 2 ], {
'dtype': 'generic',
'order': 'column-major'
});
- actual = lastIndexOf( x, 2.0, 0, y, {
+ actual = lastIndexOf( x, 2.0, 2, y, {
'dim': 0
});
- expected = [ 1, 1 ];
+ expected = [ 3, 4 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1389,19 +1593,28 @@ tape( 'the function supports providing a from index (0d ndarray, broadcasted)',
var x;
var y;
- xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
- x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+ /*
+ * [
+ * -1.0, 2.0,
+ * -3.0, 2.0,
+ * -5.0, 6.0,
+ * -7.0, 2.0,
+ * -8.0, 2.0
+ * ]
+ */
+ xbuf = [ -1.0, 2.0, -3.0, 2.0, -5.0, 6.0, -7.0, 2.0, -8.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 5, 2 ], [ 2, 1 ], 0, 'row-major' );
y = zeros( [ 2 ], {
'dtype': 'generic'
});
- fromIdx = scalar2ndarray( 0, {
+ fromIdx = scalar2ndarray( 2, {
'dtype': 'int32'
});
actual = lastIndexOf( x, 2.0, fromIdx, y, {
'dim': 0
});
- expected = [ -1, 1 ];
+ expected = [ -1, 4 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1410,8 +1623,17 @@ tape( 'the function supports providing a from index (0d ndarray, broadcasted)',
t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
t.strictEqual( ( y === actual ), true, 'returns expected value' );
- xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
- x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+ /*
+ * [
+ * -1.0, 6.0,
+ * 2.0, -7.0,
+ * -3.0, 2.0,
+ * 2.0, -8.0,
+ * -5.0, 2.0
+ * ]
+ */
+ xbuf = [ -1.0, 2.0, -3.0, 2.0, -5.0, 6.0, -7.0, 2.0, -8.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 5, 2 ], [ 1, 5 ], 0, 'column-major' );
y = zeros( [ 2 ], {
'dtype': 'generic',
'order': 'column-major'
@@ -1420,7 +1642,7 @@ tape( 'the function supports providing a from index (0d ndarray, broadcasted)',
actual = lastIndexOf( x, 2.0, fromIdx, y, {
'dim': 0
});
- expected = [ 1, 1 ];
+ expected = [ 3, 4 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.main.js b/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.main.js
index d021086d140f..1f907729b5b1 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.main.js
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.main.js
@@ -40,7 +40,7 @@ tape( 'main export is a function', function test( t ) {
t.end();
});
-tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_scalar)', function test( t ) {
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement=scalar)', function test( t ) {
var values;
var i;
@@ -68,7 +68,7 @@ tape( 'the function throws an error if provided a first argument which is not an
}
});
-tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_ndarray)', function test( t ) {
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement=ndarray)', function test( t ) {
var values;
var i;
@@ -96,7 +96,7 @@ tape( 'the function throws an error if provided a first argument which is not an
}
});
-tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_scalar, fromIndex_scalar)', function test( t ) {
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement=scalar, fromIndex=scalar)', function test( t ) {
var values;
var i;
@@ -124,7 +124,7 @@ tape( 'the function throws an error if provided a first argument which is not an
}
});
-tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_ndarray, fromIndex_scalar)', function test( t ) {
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement=ndarray, fromIndex=scalar)', function test( t ) {
var values;
var i;
@@ -152,7 +152,7 @@ tape( 'the function throws an error if provided a first argument which is not an
}
});
-tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_scalar, fromIndex_ndarray)', function test( t ) {
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement=scalar, fromIndex=ndarray)', function test( t ) {
var values;
var i;
@@ -182,7 +182,7 @@ tape( 'the function throws an error if provided a first argument which is not an
}
});
-tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_ndarray, fromIndex_ndarray)', function test( t ) {
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement=ndarray, fromIndex=ndarray)', function test( t ) {
var values;
var i;
@@ -212,7 +212,7 @@ tape( 'the function throws an error if provided a first argument which is not an
}
});
-tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_scalar, options)', function test( t ) {
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement=scalar, options)', function test( t ) {
var values;
var i;
@@ -240,7 +240,7 @@ tape( 'the function throws an error if provided a first argument which is not an
}
});
-tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_ndarray, options)', function test( t ) {
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement=ndarray, options)', function test( t ) {
var values;
var i;
@@ -268,7 +268,7 @@ tape( 'the function throws an error if provided a first argument which is not an
}
});
-tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_scalar, fromIndex_scalar, options)', function test( t ) {
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement=scalar, fromIndex=scalar, options)', function test( t ) {
var values;
var i;
@@ -296,7 +296,7 @@ tape( 'the function throws an error if provided a first argument which is not an
}
});
-tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_ndarray, fromIndex_scalar, options)', function test( t ) {
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement=ndarray, fromIndex=scalar, options)', function test( t ) {
var values;
var i;
@@ -324,7 +324,7 @@ tape( 'the function throws an error if provided a first argument which is not an
}
});
-tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_scalar, fromIndex_ndarray, options)', function test( t ) {
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement=scalar, fromIndex=ndarray, options)', function test( t ) {
var values;
var i;
@@ -354,7 +354,7 @@ tape( 'the function throws an error if provided a first argument which is not an
}
});
-tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_ndarray, fromIndex_ndarray, options)', function test( t ) {
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement=ndarray, fromIndex=ndarray, options)', function test( t ) {
var values;
var i;
@@ -384,7 +384,7 @@ tape( 'the function throws an error if provided a first argument which is not an
}
});
-tape( 'the function throws an error if provided a third argument which is not an ndarray-like object, integer or an object', function test( t ) {
+tape( 'the function throws an error if provided a third argument which is not an ndarray-like object, an integer or an object', function test( t ) {
var values;
var x;
var i;
@@ -421,24 +421,20 @@ tape( 'the function throws an error if provided insufficient number of arguments
'dtype': 'generic'
});
+ t.throws( badValue1, TypeError, 'throws an error when provided insufficient arguments' );
+ t.throws( badValue2, TypeError, 'throws an error when provided insufficient arguments' );
+ t.end();
+
function badValue1() {
- return function badValue() {
- lastIndexOf( x );
- };
+ lastIndexOf( x );
}
function badValue2() {
- return function badValue() {
- lastIndexOf();
- };
+ lastIndexOf();
}
-
- t.throws( badValue1(), TypeError, 'throws an error when provided insufficient arguments' );
- t.throws( badValue2(), TypeError, 'throws an error when provided insufficient arguments' );
- t.end();
});
-tape( 'the function throws an error if provided a search element which is not broadcast-compatible', function test( t ) {
+tape( 'the function throws an error if provided a search element which is not broadcast-compatible with the first argument', function test( t ) {
var values;
var opts;
var x;
@@ -466,7 +462,7 @@ tape( 'the function throws an error if provided a search element which is not br
}
});
-tape( 'the function throws an error if provided an search element which is not broadcast-compatible (options)', function test( t ) {
+tape( 'the function throws an error if provided an search element which is not broadcast-compatible with the first argument (options)', function test( t ) {
var values;
var opts;
var x;
@@ -494,7 +490,7 @@ tape( 'the function throws an error if provided an search element which is not b
}
});
-tape( 'the function throws an error if provided a from index which is not broadcast-compatible', function test( t ) {
+tape( 'the function throws an error if provided a from index which is not broadcast-compatible with the first argument', function test( t ) {
var values;
var opts;
var x;
@@ -522,7 +518,7 @@ tape( 'the function throws an error if provided a from index which is not broadc
}
});
-tape( 'the function throws an error if provided a from index which is not broadcast-compatible (options)', function test( t ) {
+tape( 'the function throws an error if provided a from index which is not broadcast-compatible with the first argument (options)', function test( t ) {
var values;
var opts;
var x;
@@ -550,7 +546,7 @@ tape( 'the function throws an error if provided a from index which is not broadc
}
});
-tape( 'the function throws an error if provided an options argument which is not an object (searchElement_scalar)', function test( t ) {
+tape( 'the function throws an error if provided an options argument which is not an object (searchElement=scalar)', function test( t ) {
var values;
var x;
var i;
@@ -581,7 +577,7 @@ tape( 'the function throws an error if provided an options argument which is not
}
});
-tape( 'the function throws an error if provided an options argument which is not an object (searchElement_ndarray)', function test( t ) {
+tape( 'the function throws an error if provided an options argument which is not an object (searchElement=ndarray)', function test( t ) {
var values;
var opts;
var x;
@@ -614,7 +610,7 @@ tape( 'the function throws an error if provided an options argument which is not
}
});
-tape( 'the function throws an error if provided an options argument which is not an object (searchElement_scalar, fromIndex_scalar)', function test( t ) {
+tape( 'the function throws an error if provided an options argument which is not an object (searchElement=scalar, fromIndex=scalar)', function test( t ) {
var values;
var x;
var i;
@@ -646,7 +642,7 @@ tape( 'the function throws an error if provided an options argument which is not
}
});
-tape( 'the function throws an error if provided an options argument which is not an object (searchElement_ndarray, fromIndex_ndarray)', function test( t ) {
+tape( 'the function throws an error if provided an options argument which is not an object (searchElement=ndarray, fromIndex=ndarray)', function test( t ) {
var values;
var opts;
var x;
@@ -680,7 +676,7 @@ tape( 'the function throws an error if provided an options argument which is not
}
});
-tape( 'the function throws an error if provided an options argument which is not an object (searchElement_scalar, fromIndex_ndarray)', function test( t ) {
+tape( 'the function throws an error if provided an options argument which is not an object (searchElement=scalar, fromIndex=ndarray)', function test( t ) {
var values;
var opts;
var x;
@@ -715,7 +711,7 @@ tape( 'the function throws an error if provided an options argument which is not
}
});
-tape( 'the function throws an error if provided an options argument which is not an object (searchElement_ndarray, fromIndex_scalar)', function test( t ) {
+tape( 'the function throws an error if provided an options argument which is not an object (searchElement=ndarray, fromIndex=scalar)', function test( t ) {
var values;
var opts;
var x;
@@ -813,34 +809,6 @@ tape( 'the function throws an error if provided a `dim` option which is not an i
}
});
-tape( 'the function throws an error if provided a `dims` option which contains too many indices', function test( t ) {
- var values;
- var x;
- var i;
-
- x = zeros( [ 2, 2 ], {
- 'dtype': 'generic'
- });
-
- values = [
- [ 0, 1 ],
- [ 0, 1, 2 ],
- [ 0, 1, 2, 3 ]
- ];
- for ( i = 0; i < values.length; i++ ) {
- t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
- }
- t.end();
-
- function badValue( value ) {
- return function badValue() {
- lastIndexOf( x, 10.0, {
- 'dim': value
- });
- };
- }
-});
-
tape( 'the function returns the last index of a specified search element in an ndarray (row-major)', function test( t ) {
var expected;
var actual;
@@ -901,7 +869,7 @@ tape( 'the function returns the last index of a specified search element in an n
t.end();
});
-tape( 'the function supports specifying operation dimensions (row-major)', function test( t ) {
+tape( 'the function supports specifying the operation dimension (row-major)', function test( t ) {
var expected;
var actual;
var xbuf;
@@ -960,7 +928,7 @@ tape( 'the function supports specifying operation dimensions (row-major)', funct
t.end();
});
-tape( 'the function supports specifying operation dimensions (column-major)', function test( t ) {
+tape( 'the function supports specifying the operation dimension (column-major)', function test( t ) {
var expected;
var actual;
var xbuf;
@@ -1062,11 +1030,17 @@ tape( 'the function supports providing a from index (scalar)', function test( t
var xbuf;
var x;
- xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
- x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+ /*
+ * [
+ * -1.0, 2.0, -3.0, 2.0, -5.0,
+ * 6.0, -7.0, 2.0, -8.0, 2.0
+ * ]
+ */
+ xbuf = [ -1.0, 2.0, -3.0, 2.0, -5.0, 6.0, -7.0, 2.0, -8.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 5 ], [ 5, 1 ], 0, 'row-major' );
- actual = lastIndexOf( x, 2.0, 0 );
- expected = [ 1, 1 ];
+ actual = lastIndexOf( x, 2.0, 2 );
+ expected = [ 3, 4 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1074,11 +1048,17 @@ tape( 'the function supports providing a from index (scalar)', function test( t
t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
- xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
- x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+ /*
+ * [
+ * -1.0, -3.0, -5.0, -7.0, -8.0,
+ * 2.0, 2.0, 6.0, 2.0, 2.0
+ * ]
+ */
+ xbuf = [ -1.0, 2.0, -3.0, 2.0, -5.0, 6.0, -7.0, 2.0, -8.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 5 ], [ 1, 2 ], 0, 'column-major' );
- actual = lastIndexOf( x, 2.0, 0 );
- expected = [ -1, 1 ];
+ actual = lastIndexOf( x, 2.0, 2 );
+ expected = [ -1, 4 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1095,11 +1075,17 @@ tape( 'the function supports providing a from index (scalar, options)', function
var xbuf;
var x;
- xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
- x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+ /*
+ * [
+ * -1.0, 2.0, -3.0, 2.0, -5.0,
+ * 6.0, -7.0, 2.0, -8.0, 2.0
+ * ]
+ */
+ xbuf = [ -1.0, 2.0, -3.0, 2.0, -5.0, 6.0, -7.0, 2.0, -8.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 5 ], [ 5, 1 ], 0, 'row-major' );
- actual = lastIndexOf( x, 2.0, 0, {} );
- expected = [ 1, 1 ];
+ actual = lastIndexOf( x, 2.0, 2, {} );
+ expected = [ 3, 4 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1107,11 +1093,17 @@ tape( 'the function supports providing a from index (scalar, options)', function
t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
- xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
- x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+ /*
+ * [
+ * -1.0, -3.0, -5.0, -7.0, -8.0,
+ * 2.0, 2.0, 6.0, 2.0, 2.0
+ * ]
+ */
+ xbuf = [ -1.0, 2.0, -3.0, 2.0, -5.0, 6.0, -7.0, 2.0, -8.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 5 ], [ 1, 2 ], 0, 'column-major' );
- actual = lastIndexOf( x, 2.0, 0, {} );
- expected = [ -1, 1 ];
+ actual = lastIndexOf( x, 2.0, 2, {} );
+ expected = [ -1, 4 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1129,14 +1121,20 @@ tape( 'the function supports providing a from index (0d ndarray)', function test
var xbuf;
var x;
- xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
- x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+ /*
+ * [
+ * -1.0, 2.0, -3.0, 2.0, -5.0,
+ * 6.0, -7.0, 2.0, -8.0, 2.0
+ * ]
+ */
+ xbuf = [ -1.0, 2.0, -3.0, 2.0, -5.0, 6.0, -7.0, 2.0, -8.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 5 ], [ 5, 1 ], 0, 'row-major' );
- fromIdx = scalar2ndarray( 0, {
+ fromIdx = scalar2ndarray( 2, {
'dtype': 'generic'
});
actual = lastIndexOf( x, 2.0, fromIdx );
- expected = [ 1, 1 ];
+ expected = [ 3, 4 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1144,11 +1142,17 @@ tape( 'the function supports providing a from index (0d ndarray)', function test
t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
- xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
- x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+ /*
+ * [
+ * -1.0, -3.0, -5.0, -7.0, -8.0,
+ * 2.0, 2.0, 6.0, 2.0, 2.0
+ * ]
+ */
+ xbuf = [ -1.0, 2.0, -3.0, 2.0, -5.0, 6.0, -7.0, 2.0, -8.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 5 ], [ 1, 2 ], 0, 'column-major' );
actual = lastIndexOf( x, 2.0, fromIdx );
- expected = [ -1, 1 ];
+ expected = [ -1, 4 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1166,14 +1170,20 @@ tape( 'the function supports providing a from index (0d ndarray, options)', func
var xbuf;
var x;
- xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
- x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+ /*
+ * [
+ * -1.0, 2.0, -3.0, 2.0, -5.0,
+ * 6.0, -7.0, 2.0, -8.0, 2.0
+ * ]
+ */
+ xbuf = [ -1.0, 2.0, -3.0, 2.0, -5.0, 6.0, -7.0, 2.0, -8.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 5 ], [ 5, 1 ], 0, 'row-major' );
- fromIdx = scalar2ndarray( 0, {
+ fromIdx = scalar2ndarray( 2, {
'dtype': 'generic'
});
actual = lastIndexOf( x, 2.0, fromIdx, {} );
- expected = [ 1, 1 ];
+ expected = [ 3, 4 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1181,11 +1191,17 @@ tape( 'the function supports providing a from index (0d ndarray, options)', func
t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
- xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
- x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+ /*
+ * [
+ * -1.0, -3.0, -5.0, -7.0, -8.0,
+ * 2.0, 2.0, 6.0, 2.0, 2.0
+ * ]
+ */
+ xbuf = [ -1.0, 2.0, -3.0, 2.0, -5.0, 6.0, -7.0, 2.0, -8.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 5 ], [ 1, 2 ], 0, 'column-major' );
actual = lastIndexOf( x, 2.0, fromIdx, {} );
- expected = [ -1, 1 ];
+ expected = [ -1, 4 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1202,13 +1218,22 @@ tape( 'the function supports providing a from index (scalar, broadcasted)', func
var xbuf;
var x;
- xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
- x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
-
- actual = lastIndexOf( x, 2.0, 0, {
- 'dims': 0
+ /*
+ * [
+ * -1.0, 2.0,
+ * -3.0, 2.0,
+ * -5.0, 6.0,
+ * -7.0, 2.0,
+ * -8.0, 2.0
+ * ]
+ */
+ xbuf = [ -1.0, 2.0, -3.0, 2.0, -5.0, 6.0, -7.0, 2.0, -8.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 5, 2 ], [ 2, 1 ], 0, 'row-major' );
+
+ actual = lastIndexOf( x, 2.0, 2, {
+ 'dim': 0
});
- expected = [ 1, 1 ];
+ expected = [ -1, 4 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1216,13 +1241,22 @@ tape( 'the function supports providing a from index (scalar, broadcasted)', func
t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
- xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
- x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
-
- actual = lastIndexOf( x, 2.0, 0, {
- 'dims': 0
+ /*
+ * [
+ * -1.0, 6.0,
+ * 2.0, -7.0,
+ * -3.0, 2.0,
+ * 2.0, -8.0,
+ * -5.0, 2.0
+ * ]
+ */
+ xbuf = [ -1.0, 2.0, -3.0, 2.0, -5.0, 6.0, -7.0, 2.0, -8.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 5, 2 ], [ 1, 5 ], 0, 'column-major' );
+
+ actual = lastIndexOf( x, 2.0, 2, {
+ 'dim': 0
});
- expected = [ -1, 1 ];
+ expected = [ 3, 4 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1240,16 +1274,25 @@ tape( 'the function supports providing a from index (0d ndarray, broadcasted)',
var xbuf;
var x;
- xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
- x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
-
- fromIdx = scalar2ndarray( 0, {
+ /*
+ * [
+ * -1.0, 2.0,
+ * -3.0, 2.0,
+ * -5.0, 6.0,
+ * -7.0, 2.0,
+ * -8.0, 2.0
+ * ]
+ */
+ xbuf = [ -1.0, 2.0, -3.0, 2.0, -5.0, 6.0, -7.0, 2.0, -8.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 5, 2 ], [ 2, 1 ], 0, 'row-major' );
+
+ fromIdx = scalar2ndarray( 2, {
'dtype': 'int32'
});
actual = lastIndexOf( x, 2.0, fromIdx, {
'dim': 0
});
- expected = [ -1, 1 ];
+ expected = [ -1, 4 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1257,13 +1300,22 @@ tape( 'the function supports providing a from index (0d ndarray, broadcasted)',
t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
- xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
- x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+ /*
+ * [
+ * -1.0, 6.0,
+ * 2.0, -7.0,
+ * -3.0, 2.0,
+ * 2.0, -8.0,
+ * -5.0, 2.0
+ * ]
+ */
+ xbuf = [ -1.0, 2.0, -3.0, 2.0, -5.0, 6.0, -7.0, 2.0, -8.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 5, 2 ], [ 1, 5 ], 0, 'column-major' );
actual = lastIndexOf( x, 2.0, fromIdx, {
'dim': 0
});
- expected = [ 1, 1 ];
+ expected = [ 3, 4 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
From 714033e285a3aa02c1f8902b83cb61405e4845f9 Mon Sep 17 00:00:00 2001
From: Muhammad Haris <101793258+headlessNode@users.noreply.github.com>
Date: Thu, 4 Sep 2025 06:41:01 +0000
Subject: [PATCH 04/41] fix: test cases
---
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/last-index-of/test/test.main.js | 52 +++++++++----------
1 file changed, 26 insertions(+), 26 deletions(-)
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.main.js b/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.main.js
index 1f907729b5b1..4639f577f51d 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.main.js
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.main.js
@@ -819,7 +819,7 @@ tape( 'the function returns the last index of a specified search element in an n
x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
actual = lastIndexOf( x, 2.0 );
- expected = [ 1, 1 ];
+ expected = [ -1, -1 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -828,7 +828,7 @@ tape( 'the function returns the last index of a specified search element in an n
t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
actual = lastIndexOf( x, 2.0, 0 );
- expected = [ 1, 1 ];
+ expected = [ -1, -1 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -849,7 +849,7 @@ tape( 'the function returns the last index of a specified search element in an n
x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
actual = lastIndexOf( x, 2.0 );
- expected = [ -1, 1 ];
+ expected = [ -1, 0 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -858,7 +858,7 @@ tape( 'the function returns the last index of a specified search element in an n
t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
actual = lastIndexOf( x, 2.0, 0 );
- expected = [ -1, 1 ];
+ expected = [ -1, 0 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -881,7 +881,7 @@ tape( 'the function supports specifying the operation dimension (row-major)', fu
actual = lastIndexOf( x, 2.0, {
'dim': 0
});
- expected = [ -1, 1 ];
+ expected = [ -1, 0 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -892,7 +892,7 @@ tape( 'the function supports specifying the operation dimension (row-major)', fu
actual = lastIndexOf( x, 2.0, 0, {
'dim': 0
});
- expected = [ -1, 1 ];
+ expected = [ -1, 0 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -906,7 +906,7 @@ tape( 'the function supports specifying the operation dimension (row-major)', fu
actual = lastIndexOf( x, 2.0, {
'dim': 1
});
- expected = [ 1, 1 ];
+ expected = [ -1, -1 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -917,7 +917,7 @@ tape( 'the function supports specifying the operation dimension (row-major)', fu
actual = lastIndexOf( x, 2.0, 0, {
'dim': 1
});
- expected = [ 1, 1 ];
+ expected = [ -1, -1 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -940,7 +940,7 @@ tape( 'the function supports specifying the operation dimension (column-major)',
actual = lastIndexOf( x, 2.0, {
'dim': 0
});
- expected = [ 1, 1 ];
+ expected = [ -1, -1 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -951,7 +951,7 @@ tape( 'the function supports specifying the operation dimension (column-major)',
actual = lastIndexOf( x, 2.0, 0, {
'dim': 0
});
- expected = [ 1, 1 ];
+ expected = [ -1, -1 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -965,7 +965,7 @@ tape( 'the function supports specifying the operation dimension (column-major)',
actual = lastIndexOf( x, 2.0, {
'dim': 1
});
- expected = [ -1, 1 ];
+ expected = [ -1, 0 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -976,7 +976,7 @@ tape( 'the function supports specifying the operation dimension (column-major)',
actual = lastIndexOf( x, 2.0, 0, {
'dim': 1
});
- expected = [ -1, 1 ];
+ expected = [ -1, 0 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -999,7 +999,7 @@ tape( 'the function supports specifying the output array data type', function te
actual = lastIndexOf( x, 2.0, {
'dtype': 'int32'
});
- expected = [ 1, 1 ];
+ expected = [ -1, -1 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'int32', 'returns expected value' );
@@ -1013,7 +1013,7 @@ tape( 'the function supports specifying the output array data type', function te
actual = lastIndexOf( x, 2.0, 0, {
'dtype': 'int32'
});
- expected = [ -1, 1 ];
+ expected = [ -1, 0 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'int32', 'returns expected value' );
@@ -1040,7 +1040,7 @@ tape( 'the function supports providing a from index (scalar)', function test( t
x = new ndarray( 'generic', xbuf, [ 2, 5 ], [ 5, 1 ], 0, 'row-major' );
actual = lastIndexOf( x, 2.0, 2 );
- expected = [ 3, 4 ];
+ expected = [ 1, 2 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1058,7 +1058,7 @@ tape( 'the function supports providing a from index (scalar)', function test( t
x = new ndarray( 'generic', xbuf, [ 2, 5 ], [ 1, 2 ], 0, 'column-major' );
actual = lastIndexOf( x, 2.0, 2 );
- expected = [ -1, 4 ];
+ expected = [ -1, 1 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1085,7 +1085,7 @@ tape( 'the function supports providing a from index (scalar, options)', function
x = new ndarray( 'generic', xbuf, [ 2, 5 ], [ 5, 1 ], 0, 'row-major' );
actual = lastIndexOf( x, 2.0, 2, {} );
- expected = [ 3, 4 ];
+ expected = [ 1, 2 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1103,7 +1103,7 @@ tape( 'the function supports providing a from index (scalar, options)', function
x = new ndarray( 'generic', xbuf, [ 2, 5 ], [ 1, 2 ], 0, 'column-major' );
actual = lastIndexOf( x, 2.0, 2, {} );
- expected = [ -1, 4 ];
+ expected = [ -1, 1 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1134,7 +1134,7 @@ tape( 'the function supports providing a from index (0d ndarray)', function test
'dtype': 'generic'
});
actual = lastIndexOf( x, 2.0, fromIdx );
- expected = [ 3, 4 ];
+ expected = [ 1, 2 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1152,7 +1152,7 @@ tape( 'the function supports providing a from index (0d ndarray)', function test
x = new ndarray( 'generic', xbuf, [ 2, 5 ], [ 1, 2 ], 0, 'column-major' );
actual = lastIndexOf( x, 2.0, fromIdx );
- expected = [ -1, 4 ];
+ expected = [ -1, 1 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1183,7 +1183,7 @@ tape( 'the function supports providing a from index (0d ndarray, options)', func
'dtype': 'generic'
});
actual = lastIndexOf( x, 2.0, fromIdx, {} );
- expected = [ 3, 4 ];
+ expected = [ 1, 2 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1201,7 +1201,7 @@ tape( 'the function supports providing a from index (0d ndarray, options)', func
x = new ndarray( 'generic', xbuf, [ 2, 5 ], [ 1, 2 ], 0, 'column-major' );
actual = lastIndexOf( x, 2.0, fromIdx, {} );
- expected = [ -1, 4 ];
+ expected = [ -1, 1 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1233,7 +1233,7 @@ tape( 'the function supports providing a from index (scalar, broadcasted)', func
actual = lastIndexOf( x, 2.0, 2, {
'dim': 0
});
- expected = [ -1, 4 ];
+ expected = [ -1, 1 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1256,7 +1256,7 @@ tape( 'the function supports providing a from index (scalar, broadcasted)', func
actual = lastIndexOf( x, 2.0, 2, {
'dim': 0
});
- expected = [ 3, 4 ];
+ expected = [ 1, 2 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1292,7 +1292,7 @@ tape( 'the function supports providing a from index (0d ndarray, broadcasted)',
actual = lastIndexOf( x, 2.0, fromIdx, {
'dim': 0
});
- expected = [ -1, 4 ];
+ expected = [ -1, 1 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1315,7 +1315,7 @@ tape( 'the function supports providing a from index (0d ndarray, broadcasted)',
actual = lastIndexOf( x, 2.0, fromIdx, {
'dim': 0
});
- expected = [ 3, 4 ];
+ expected = [ 1, 2 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
From 7261c9d164f844b396903a48507521d48989b549 Mon Sep 17 00:00:00 2001
From: Muhammad Haris <101793258+headlessNode@users.noreply.github.com>
Date: Thu, 4 Sep 2025 07:42:46 +0000
Subject: [PATCH 05/41] fix: apply suggestions from code review
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
- task: lint_filenames
status: passed
- task: lint_editorconfig
status: passed
- task: lint_markdown
status: passed
- task: lint_package_json
status: na
- task: lint_repl_help
status: passed
- task: lint_javascript_src
status: passed
- task: lint_javascript_cli
status: na
- task: lint_javascript_examples
status: na
- task: lint_javascript_tests
status: na
- task: lint_javascript_benchmarks
status: na
- task: lint_python
status: na
- task: lint_r
status: na
- task: lint_c_src
status: na
- task: lint_c_examples
status: na
- task: lint_c_benchmarks
status: na
- task: lint_c_tests_fixtures
status: na
- task: lint_shell
status: na
- task: lint_typescript_declarations
status: passed
- task: lint_typescript_tests
status: na
- task: lint_license_headers
status: passed
---
---
.../@stdlib/blas/ext/last-index-of/README.md | 12 ++++++------
.../@stdlib/blas/ext/last-index-of/docs/repl.txt | 4 ++--
.../blas/ext/last-index-of/docs/types/index.d.ts | 16 ++++++++--------
.../@stdlib/blas/ext/last-index-of/lib/assign.js | 2 +-
.../@stdlib/blas/ext/last-index-of/lib/base.js | 2 +-
.../@stdlib/blas/ext/last-index-of/lib/index.js | 2 +-
.../@stdlib/blas/ext/last-index-of/lib/main.js | 2 +-
7 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/README.md b/lib/node_modules/@stdlib/blas/ext/last-index-of/README.md
index 38adbe37214d..d61327bba236 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/README.md
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/README.md
@@ -46,7 +46,7 @@ var out = lastIndexOf( x, 2.0 );
// returns
var idx = out.get();
-// returns 3
+// returns -1
```
The function has the following parameters:
@@ -89,11 +89,11 @@ var x = array( [ 1.0, 2.0, 3.0, 4.0, 2.0, 6.0 ] );
// returns
// Perform operation:
-var out = lastIndexOf( x, 1.0, 3 );
+var out = lastIndexOf( x, 2.0, 5 );
// returns
var idx = out.get();
-// returns -1
+// returns 4
```
By default, the function performs the operation over elements in the last dimension. To perform the operation over a different dimension, provide a `dim` option.
@@ -110,7 +110,7 @@ var out = lastIndexOf( x, -3.0, {
// returns
var idx = ndarray2array( out );
-// returns [ 1, -1 ]
+// returns [ 0, -1 ]
```
By default, the function excludes reduced dimensions from the output [ndarray][@stdlib/ndarray/ctor]. To include the reduced dimensions as singleton dimensions, set the `keepdims` option to `true`.
@@ -130,7 +130,7 @@ var out = lastIndexOf( x, -3.0, opts );
// returns
var idx = ndarray2array( out );
-// returns [ [ 1, -1 ] ]
+// returns [ [ 0, -1 ] ]
```
By default, the function returns an [ndarray][@stdlib/ndarray/ctor] having a [data type][@stdlib/ndarray/dtypes] determined by the function's output data type [policy][@stdlib/ndarray/output-dtype-policies]. To override the default behavior, set the `dtype` option.
@@ -168,7 +168,7 @@ var out = lastIndexOf.assign( x, 2.0, y );
// returns
var idx = out.get();
-// returns 3
+// returns -1
var bool = ( out === y );
// returns true
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/docs/repl.txt b/lib/node_modules/@stdlib/blas/ext/last-index-of/docs/repl.txt
index 496401917a9a..0b8cb84f093d 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/docs/repl.txt
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/docs/repl.txt
@@ -59,7 +59,7 @@
Examples
--------
> var x = {{alias:@stdlib/ndarray/array}}( [ -1.0, 2.0, -3.0, 2.0 ] );
- > var y = {{alias}}( x, 2.0 );
+ > var y = {{alias}}( x, 2.0, 3 );
> var v = y.get()
3
@@ -121,7 +121,7 @@
--------
> var x = {{alias:@stdlib/ndarray/array}}( [ -1.0, 2.0, -3.0, 2.0 ] );
> var out = {{alias:@stdlib/ndarray/zeros}}( [], { 'dtype': 'int32' } );
- > var y = {{alias}}.assign( x, 2.0, out )
+ > var y = {{alias}}.assign( x, 2.0, 3, out )
> var bool = ( out === y )
true
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/ext/last-index-of/docs/types/index.d.ts
index 4faf8a87f1fa..cc1a36c0e7ea 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/docs/types/index.d.ts
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/docs/types/index.d.ts
@@ -98,7 +98,7 @@ interface lastIndexOf {
* // returns
*
* var idx = y.get();
- * // returns 3
+ * // returns -1
*/
( x: InputArray, searchElement: SearchElement, options?: Options ): OutputArray;
@@ -121,11 +121,11 @@ interface lastIndexOf {
*
* var x = array( [ 1.0, 2.0, -3.0, 2.0, -5.0, 6.0 ] );
*
- * var y = lastIndexOf( x, 1.0, 2 );
+ * var y = lastIndexOf( x, 2.0, 5 );
* // returns
*
* var idx = y.get();
- * // returns -1
+ * // returns 3
*/
( x: InputArray, searchElement: SearchElement, fromIndex: FromIndex, options?: Options ): OutputArray;
@@ -159,7 +159,7 @@ interface lastIndexOf {
* // returns true
*
* var idx = out.get();
- * // returns 3
+ * // returns -1
*/
assign( x: InputArray, searchElement: SearchElement, out: U, options?: BaseOptions ): U;
@@ -187,14 +187,14 @@ interface lastIndexOf {
* 'dtype': 'int32'
* } );
*
- * var out = lastIndexOf.assign( x, 1.0, 2, y );
+ * var out = lastIndexOf.assign( x, 1.0, 5, y );
* // returns
*
* var bool = ( out === y );
* // returns true
*
* var idx = out.get();
- * // returns -1
+ * // returns 3
*/
assign( x: InputArray, searchElement: SearchElement, fromIndex: FromIndex, out: U, options?: BaseOptions ): U;
}
@@ -222,7 +222,7 @@ interface lastIndexOf {
* // returns
*
* var idx = y.get();
-* // returns 3
+* // returns -1
*
* @example
* var zeros = require( '@stdlib/ndarray/zeros' );
@@ -240,7 +240,7 @@ interface lastIndexOf {
* // returns true
*
* var idx = out.get();
-* // returns 3
+* // returns -1
*/
declare const lastIndexOf: lastIndexOf;
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/assign.js b/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/assign.js
index 6979947749a0..f1ef54f4780f 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/assign.js
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/assign.js
@@ -95,7 +95,7 @@ var DEFAULT_DTYPE = defaults.get( 'dtypes.integer_index' );
* // returns true
*
* var arr = ndarray2array( out );
-* // returns [ 1, 0 ]
+* // returns [ -1, 0 ]
*/
function assign( x, searchElement, fromIndex, out ) {
var hasOptions;
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/base.js b/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/base.js
index f37a1df6d9c1..94a644634737 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/base.js
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/base.js
@@ -110,7 +110,7 @@ var table = {
* // returns
*
* var idx = out.get();
-* // returns 3
+* // returns -1
*/
var lastIndexOf = factory( table, [ idtypes0, idtypes1, idtypes2 ], odtypes, policies ); // eslint-disable-line max-len
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/index.js b/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/index.js
index 094c1eaaa42a..afc2bc95318a 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/index.js
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/index.js
@@ -49,7 +49,7 @@
* // returns
*
* var arr = ndarray2array( out );
-* // returns [ 1, 0 ]
+* // returns [ -1, 0 ]
*/
// MODULES //
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/main.js b/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/main.js
index 34cf4886b6c8..97fa692b3535 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/main.js
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/main.js
@@ -86,7 +86,7 @@ var DEFAULT_DTYPE = defaults.get( 'dtypes.integer_index' );
* // returns
*
* var arr = ndarray2array( out );
-* // returns [ 1, 0 ]
+* // returns [ -1, 0 ]
*/
function lastIndexOf( x, searchElement, fromIndex ) {
var hasOptions;
From 8612da33ef6a755dd804de36728533d3ec920213 Mon Sep 17 00:00:00 2001
From: Muhammad Haris <101793258+headlessNode@users.noreply.github.com>
Date: Thu, 4 Sep 2025 07:56:37 +0000
Subject: [PATCH 06/41] fix: apply suggestions form code review
---
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
---
---
.../ext/last-index-of/test/test.assign.js | 54 +++++++++----------
1 file changed, 26 insertions(+), 28 deletions(-)
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.assign.js b/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.assign.js
index 0a4d7c2b25e6..a0a5f2ee9141 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.assign.js
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.assign.js
@@ -22,7 +22,6 @@
var tape = require( 'tape' );
var isndarrayLike = require( '@stdlib/assert/is-ndarray-like' );
-var isSameArray = require( '@stdlib/assert/is-same-array' );
var ndarray = require( '@stdlib/ndarray/ctor' );
var zeros = require( '@stdlib/ndarray/zeros' );
var ndarray2array = require( '@stdlib/ndarray/to-array' );
@@ -30,7 +29,6 @@ var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' );
var getDType = require( '@stdlib/ndarray/dtype' );
var getShape = require( '@stdlib/ndarray/shape' );
var getOrder = require( '@stdlib/ndarray/order' );
-var getData = require( '@stdlib/ndarray/data-buffer' );
var lastIndexOf = require( './../lib' ).assign;
@@ -1059,13 +1057,13 @@ tape( 'the function returns the first index of a specified search element in an
});
actual = lastIndexOf( x, 2.0, y );
- expected = [ 1, 1 ];
+ expected = [ -1, -1 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
t.deepEqual( getShape( actual ), [ 2 ], 'returns expected value' );
t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
- t.strictEqual( isSameArray( getData( actual ), expected ), true, 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
t.strictEqual( ( y === actual ), true, 'returns expected value' );
y = zeros( [ 2 ], {
@@ -1074,13 +1072,13 @@ tape( 'the function returns the first index of a specified search element in an
});
actual = lastIndexOf( x, 2.0, 0, y );
- expected = [ 1, 1 ];
+ expected = [ -1, -1 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
t.deepEqual( getShape( actual ), [ 2 ], 'returns expected value' );
t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
- t.strictEqual( isSameArray( getData( actual ), expected ), true, 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
t.strictEqual( ( y === actual ), true, 'returns expected value' );
t.end();
@@ -1101,7 +1099,7 @@ tape( 'the function returns the first index of a specified search element in an
});
actual = lastIndexOf( x, 2.0, y );
- expected = [ -1, 1 ];
+ expected = [ -1, 0 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1116,7 +1114,7 @@ tape( 'the function returns the first index of a specified search element in an
});
actual = lastIndexOf( x, 2.0, 0, y );
- expected = [ -1, 1 ];
+ expected = [ -1, 0 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1145,7 +1143,7 @@ tape( 'the function supports specifying an operation dimension (row-major)', fun
actual = lastIndexOf( x, 2.0, y, {
'dim': 0
});
- expected = [ -1, 1 ];
+ expected = [ -1, 0 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1162,7 +1160,7 @@ tape( 'the function supports specifying an operation dimension (row-major)', fun
actual = lastIndexOf( x, 2.0, 0, y, {
'dim': 0
});
- expected = [ -1, 1 ];
+ expected = [ -1, 0 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1181,7 +1179,7 @@ tape( 'the function supports specifying an operation dimension (row-major)', fun
actual = lastIndexOf( x, 2.0, y, {
'dim': 1
});
- expected = [ 1, 1 ];
+ expected = [ -1, -1 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1198,7 +1196,7 @@ tape( 'the function supports specifying an operation dimension (row-major)', fun
actual = lastIndexOf( x, 2.0, 0, y, {
'dim': 1
});
- expected = [ 1, 1 ];
+ expected = [ -1, -1 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1227,7 +1225,7 @@ tape( 'the function supports specifying an operation dimension (column-major)',
actual = lastIndexOf( x, 2.0, y, {
'dim': 0
});
- expected = [ 1, 1 ];
+ expected = [ -1, -1 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1244,7 +1242,7 @@ tape( 'the function supports specifying an operation dimension (column-major)',
actual = lastIndexOf( x, 2.0, 0, y, {
'dim': 0
});
- expected = [ 1, 1 ];
+ expected = [ -1, -1 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1263,7 +1261,7 @@ tape( 'the function supports specifying an operation dimension (column-major)',
actual = lastIndexOf( x, 2.0, y, {
'dim': 1
});
- expected = [ -1, 1 ];
+ expected = [ -1, 0 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1280,7 +1278,7 @@ tape( 'the function supports specifying an operation dimension (column-major)',
actual = lastIndexOf( x, 2.0, 0, y, {
'dim': 1
});
- expected = [ -1, 1 ];
+ expected = [ -1, 0 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1312,7 +1310,7 @@ tape( 'the function supports providing a from index (scalar)', function test( t
});
actual = lastIndexOf( x, 2.0, 2, y );
- expected = [ 3, 4 ];
+ expected = [ 1, 2 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1335,7 +1333,7 @@ tape( 'the function supports providing a from index (scalar)', function test( t
});
actual = lastIndexOf( x, 2.0, 2, y );
- expected = [ -1, 4 ];
+ expected = [ -1, 1 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1367,7 +1365,7 @@ tape( 'the function supports providing a from index (scalar, options)', function
});
actual = lastIndexOf( x, 2.0, 2, y, {} );
- expected = [ 3, 4 ];
+ expected = [ 1, 2 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1390,7 +1388,7 @@ tape( 'the function supports providing a from index (scalar, options)', function
});
actual = lastIndexOf( x, 2.0, 2, y, {} );
- expected = [ -1, 4 ];
+ expected = [ -1, 1 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1426,7 +1424,7 @@ tape( 'the function supports providing a from index (0d ndarray)', function test
'dtype': 'generic'
});
actual = lastIndexOf( x, 2.0, fromIdx, y );
- expected = [ 3, 4 ];
+ expected = [ 1, 2 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1449,7 +1447,7 @@ tape( 'the function supports providing a from index (0d ndarray)', function test
});
actual = lastIndexOf( x, 2.0, fromIdx, y );
- expected = [ -1, 4 ];
+ expected = [ -1, 1 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1485,7 +1483,7 @@ tape( 'the function supports providing a from index (0d ndarray, options)', func
'dtype': 'generic'
});
actual = lastIndexOf( x, 2.0, fromIdx, y, {} );
- expected = [ 3, 4 ];
+ expected = [ 1, 2 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1508,7 +1506,7 @@ tape( 'the function supports providing a from index (0d ndarray, options)', func
});
actual = lastIndexOf( x, 2.0, fromIdx, y, {} );
- expected = [ -1, 4 ];
+ expected = [ -1, 1 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1545,7 +1543,7 @@ tape( 'the function supports providing a from index (scalar, broadcasted)', func
actual = lastIndexOf( x, 2.0, 2, y, {
'dim': 0
});
- expected = [ -1, 4 ];
+ expected = [ -1, 1 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1573,7 +1571,7 @@ tape( 'the function supports providing a from index (scalar, broadcasted)', func
actual = lastIndexOf( x, 2.0, 2, y, {
'dim': 0
});
- expected = [ 3, 4 ];
+ expected = [ 1, 2 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1614,7 +1612,7 @@ tape( 'the function supports providing a from index (0d ndarray, broadcasted)',
actual = lastIndexOf( x, 2.0, fromIdx, y, {
'dim': 0
});
- expected = [ -1, 4 ];
+ expected = [ -1, 1 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1642,7 +1640,7 @@ tape( 'the function supports providing a from index (0d ndarray, broadcasted)',
actual = lastIndexOf( x, 2.0, fromIdx, y, {
'dim': 0
});
- expected = [ 3, 4 ];
+ expected = [ 1, 2 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
From e842e22b2abecd605d243b76d8d6d2ce1e0c8fd7 Mon Sep 17 00:00:00 2001
From: Muhammad Haris <101793258+headlessNode@users.noreply.github.com>
Date: Thu, 4 Sep 2025 09:44:20 +0000
Subject: [PATCH 07/41] test: apply suggestions from code review
---
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
---
---
.../ext/last-index-of/test/test.assign.js | 46 ++++++++++++++++++-
.../blas/ext/last-index-of/test/test.main.js | 41 ++++++++++++++++-
2 files changed, 83 insertions(+), 4 deletions(-)
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.assign.js b/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.assign.js
index a0a5f2ee9141..0de0c7a49525 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.assign.js
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.assign.js
@@ -26,6 +26,7 @@ var ndarray = require( '@stdlib/ndarray/ctor' );
var zeros = require( '@stdlib/ndarray/zeros' );
var ndarray2array = require( '@stdlib/ndarray/to-array' );
var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' );
+var Int32Array = require( '@stdlib/array/int32' );
var getDType = require( '@stdlib/ndarray/dtype' );
var getShape = require( '@stdlib/ndarray/shape' );
var getOrder = require( '@stdlib/ndarray/order' );
@@ -1518,7 +1519,7 @@ tape( 'the function supports providing a from index (0d ndarray, options)', func
t.end();
});
-tape( 'the function supports providing a from index (scalar, broadcasted)', function test( t ) {
+tape( 'the function supports providing a from index and operation dimension', function test( t ) {
var expected;
var actual;
var xbuf;
@@ -1583,7 +1584,7 @@ tape( 'the function supports providing a from index (scalar, broadcasted)', func
t.end();
});
-tape( 'the function supports providing a from index (0d ndarray, broadcasted)', function test( t ) {
+tape( 'the function supports providing a from index and operation dimension (0d ndarray)', function test( t ) {
var expected;
var fromIdx;
var actual;
@@ -1651,3 +1652,44 @@ tape( 'the function supports providing a from index (0d ndarray, broadcasted)',
t.end();
});
+
+tape( 'the function supports providing an ndarray from index and search element with operation dimension (1d ndarray)', function test( t ) {
+ var searchElement;
+ var expected;
+ var fromIdx;
+ var actual;
+ var xbuf;
+ var x;
+ var y;
+
+ /*
+ * [
+ * 1.0, -2.0,
+ * 2.0, -3.0,
+ * 3.0, -4.0,
+ * 2.0, -3.0,
+ * 5.0, -6.0
+ * ]
+ */
+ xbuf = [ 1.0, -2.0, 2.0, -3.0, 3.0, -4.0, 2.0, -3.0, 5.0, -6.0 ];
+ x = new ndarray( 'generic', xbuf, [ 5, 2 ], [ 2, 1 ], 0, 'row-major' );
+ y = zeros( [ 2 ], {
+ 'dtype': 'generic'
+ });
+
+ fromIdx = new ndarray( 'int32', new Int32Array( [ 4, 4 ] ), [ 2 ], [ 1 ], 0, 'row-major' );
+ searchElement = new ndarray( 'generic', [ 2.0, -3.0 ], [ 2 ], [ 1 ], 0, 'row-major' );
+ actual = lastIndexOf( x, searchElement, fromIdx, y, {
+ 'dim': 0
+ });
+ expected = [ 3, 3 ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+ t.strictEqual( ( y === actual ), true, 'returns expected value' );
+
+ t.end();
+});
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.main.js b/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.main.js
index 4639f577f51d..eda8920e3b3c 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.main.js
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.main.js
@@ -24,6 +24,7 @@ var tape = require( 'tape' );
var isndarrayLike = require( '@stdlib/assert/is-ndarray-like' );
var ndarray = require( '@stdlib/ndarray/ctor' );
var zeros = require( '@stdlib/ndarray/zeros' );
+var Int32Array = require( '@stdlib/array/int32' );
var ndarray2array = require( '@stdlib/ndarray/to-array' );
var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' );
var getDType = require( '@stdlib/ndarray/dtype' );
@@ -1212,7 +1213,7 @@ tape( 'the function supports providing a from index (0d ndarray, options)', func
t.end();
});
-tape( 'the function supports providing a from index (scalar, broadcasted)', function test( t ) {
+tape( 'the function supports providing a from index and operation dimension', function test( t ) {
var expected;
var actual;
var xbuf;
@@ -1267,7 +1268,7 @@ tape( 'the function supports providing a from index (scalar, broadcasted)', func
t.end();
});
-tape( 'the function supports providing a from index (0d ndarray, broadcasted)', function test( t ) {
+tape( 'the function supports providing a from index and operation dimension (0d ndarray)', function test( t ) {
var expected;
var fromIdx;
var actual;
@@ -1325,3 +1326,39 @@ tape( 'the function supports providing a from index (0d ndarray, broadcasted)',
t.end();
});
+
+tape( 'the function supports providing an ndarray from index and search element with operation dimension (1d ndarray)', function test( t ) {
+ var searchElement;
+ var expected;
+ var fromIdx;
+ var actual;
+ var xbuf;
+ var x;
+
+ /*
+ * [
+ * 1.0, -2.0,
+ * 2.0, -3.0,
+ * 3.0, -4.0,
+ * 2.0, -3.0,
+ * 5.0, -6.0
+ * ]
+ */
+ xbuf = [ 1.0, -2.0, 2.0, -3.0, 3.0, -4.0, 2.0, -3.0, 5.0, -6.0 ];
+ x = new ndarray( 'generic', xbuf, [ 5, 2 ], [ 2, 1 ], 0, 'row-major' );
+
+ fromIdx = new ndarray( 'int32', new Int32Array( [ 4, 4 ] ), [ 2 ], [ 1 ], 0, 'row-major' );
+ searchElement = new ndarray( 'generic', [ 2.0, -3.0 ], [ 2 ], [ 1 ], 0, 'row-major' );
+ actual = lastIndexOf( x, searchElement, fromIdx, {
+ 'dim': 0
+ });
+ expected = [ 3, 3 ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+
+ t.end();
+});
From 947054f3a5a3a41095968910a4de94a36c354ca7 Mon Sep 17 00:00:00 2001
From: Muhammad Haris <101793258+headlessNode@users.noreply.github.com>
Date: Thu, 4 Sep 2025 10:11:34 +0000
Subject: [PATCH 08/41] test: add missing test cases
---
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
---
---
.../ext/last-index-of/test/test.assign.js | 63 +++++++++++++
.../blas/ext/last-index-of/test/test.main.js | 94 +++++++++++++++++++
2 files changed, 157 insertions(+)
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.assign.js b/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.assign.js
index 0de0c7a49525..d1004ef1e3df 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.assign.js
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.assign.js
@@ -461,6 +461,35 @@ tape( 'the function throws an error if provided a first argument which is not an
}
});
+tape( 'the function throws an error if provided a first argument which is a zero-dimensional ndarray', function test( t ) {
+ var values;
+ var opts;
+ var i;
+ var y;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+
+ y = zeros( [], opts );
+
+ values = [
+ scalar2ndarray( 10.0 ),
+ scalar2ndarray( -3.0 ),
+ scalar2ndarray( 0.0 )
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ lastIndexOf( value, scalar2ndarray( 2.0 ), scalar2ndarray( 0, opts ), y, {} ); // eslint-disable-line max-len
+ };
+ }
+});
+
tape( 'the function throws an error if provided a third argument which is not an ndarray-like object, an integer, or an object', function test( t ) {
var values;
var i;
@@ -495,6 +524,40 @@ tape( 'the function throws an error if provided a third argument which is not an
}
});
+tape( 'the function throws an error if provided a third argument which is not an ndarray-like object or an integer', function test( t ) {
+ var values;
+ var i;
+ var x;
+ var y;
+
+ x = zeros( [ 2, 2 ], {
+ 'dtype': 'float64'
+ });
+ y = zeros( [], {
+ 'dtype': 'generic'
+ });
+ values = [
+ '5',
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ lastIndexOf( x, scalar2ndarray( 2.0 ), value, y, {} );
+ };
+ }
+});
+
tape( 'the function throws an error if provided an output argument which is not an ndarray-like object', function test( t ) {
var values;
var opts;
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.main.js b/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.main.js
index eda8920e3b3c..dc95373c5917 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.main.js
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.main.js
@@ -385,6 +385,32 @@ tape( 'the function throws an error if provided a first argument which is not an
}
});
+tape( 'the function throws an error if provided a first argument which is a zero-dimensional ndarray', function test( t ) {
+ var values;
+ var opts;
+ var i;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+
+ values = [
+ scalar2ndarray( 10.0 ),
+ scalar2ndarray( -3.0 ),
+ scalar2ndarray( 0.0 )
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ lastIndexOf( value, scalar2ndarray( 2.0 ), scalar2ndarray( 0, opts ), {} ); // eslint-disable-line max-len
+ };
+ }
+});
+
tape( 'the function throws an error if provided a third argument which is not an ndarray-like object, an integer or an object', function test( t ) {
var values;
var x;
@@ -988,6 +1014,74 @@ tape( 'the function supports specifying the operation dimension (column-major)',
t.end();
});
+tape( 'the function supports specifying the `keepdims` option (row-major)', function test( t ) {
+ var expected;
+ var actual;
+ var xbuf;
+ var x;
+
+ xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+
+ actual = lastIndexOf( x, 2.0, {
+ 'keepdims': true
+ });
+ expected = [ [ -1 ], [ -1 ] ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2, 1 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+
+ actual = lastIndexOf( x, 2.0, 0, {
+ 'keepdims': true
+ });
+ expected = [ [ -1 ], [ -1 ] ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2, 1 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports specifying the `keepdims` option (column-major)', function test( t ) {
+ var expected;
+ var actual;
+ var xbuf;
+ var x;
+
+ xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'column-major' );
+
+ actual = lastIndexOf( x, 2.0, {
+ 'keepdims': true
+ });
+ expected = [ [ -1 ], [ -1 ] ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2, 1 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+
+ actual = lastIndexOf( x, 2.0, 0, {
+ 'keepdims': true
+ });
+ expected = [ [ -1 ], [ -1 ] ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2, 1 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+
+ t.end();
+});
+
tape( 'the function supports specifying the output array data type', function test( t ) {
var expected;
var actual;
From ef4f37b080e742411e1893dbdf70644b99d76f9d Mon Sep 17 00:00:00 2001
From: Muhammad Haris <101793258+headlessNode@users.noreply.github.com>
Date: Thu, 4 Sep 2025 15:22:46 +0500
Subject: [PATCH 09/41] fix: apply suggestions from code review
Signed-off-by: Muhammad Haris <101793258+headlessNode@users.noreply.github.com>
---
.../@stdlib/blas/ext/last-index-of/test/test.assign.js | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.assign.js b/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.assign.js
index d1004ef1e3df..3c5bb843c9cf 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.assign.js
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.assign.js
@@ -524,18 +524,14 @@ tape( 'the function throws an error if provided a third argument which is not an
}
});
-tape( 'the function throws an error if provided a third argument which is not an ndarray-like object or an integer', function test( t ) {
+tape( 'the function throws an error if provided an output argument which is not an ndarray-like object or an integer', function test( t ) {
var values;
var i;
var x;
- var y;
x = zeros( [ 2, 2 ], {
'dtype': 'float64'
});
- y = zeros( [], {
- 'dtype': 'generic'
- });
values = [
'5',
NaN,
@@ -553,7 +549,7 @@ tape( 'the function throws an error if provided a third argument which is not an
function badValue( value ) {
return function badValue() {
- lastIndexOf( x, scalar2ndarray( 2.0 ), value, y, {} );
+ lastIndexOf( x, scalar2ndarray( 2.0 ), scalar2ndarray( 0 ), value, {} );
};
}
});
From 7d03eec627a7afeb628ea9764e61214fd96668ab Mon Sep 17 00:00:00 2001
From: Athan
Date: Sun, 7 Sep 2025 13:47:41 -0700
Subject: [PATCH 10/41] docs: fix return value
Signed-off-by: Athan
---
lib/node_modules/@stdlib/blas/ext/last-index-of/README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/README.md b/lib/node_modules/@stdlib/blas/ext/last-index-of/README.md
index d61327bba236..538254e95b7d 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/README.md
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/README.md
@@ -46,7 +46,7 @@ var out = lastIndexOf( x, 2.0 );
// returns
var idx = out.get();
-// returns -1
+// returns 3
```
The function has the following parameters:
From 06bb5fdf2a72b991b7fbf2c4c5c689b514eb20d1 Mon Sep 17 00:00:00 2001
From: Athan
Date: Sun, 7 Sep 2025 13:47:52 -0700
Subject: [PATCH 11/41] docs: fix default
Signed-off-by: Athan
---
lib/node_modules/@stdlib/blas/ext/last-index-of/README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/README.md b/lib/node_modules/@stdlib/blas/ext/last-index-of/README.md
index 538254e95b7d..372d8896a7fd 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/README.md
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/README.md
@@ -53,7 +53,7 @@ The function has the following parameters:
- **x**: input [ndarray][@stdlib/ndarray/ctor]. Must have at least one dimension.
- **searchElement**: search element. May be either a scalar value or an [ndarray][@stdlib/ndarray/ctor]. If provided a scalar value, the value is cast to the data type of the input [ndarray][@stdlib/ndarray/ctor]. If provided an [ndarray][@stdlib/ndarray/ctor], the value must have a shape which is [broadcast-compatible][@stdlib/ndarray/base/broadcast-shapes] with the non-reduced dimensions of the input [ndarray][@stdlib/ndarray/ctor]. For example, given the input shape `[2, 3, 4]` and `options.dim=0`, the search element [ndarray][@stdlib/ndarray/ctor] must have a shape which is [broadcast-compatible][@stdlib/ndarray/base/broadcast-shapes] with the shape `[3, 4]`.
-- **fromIndex**: index from which to begin searching (_optional_). May be either a scalar value or an [ndarray][@stdlib/ndarray/ctor] having an integer index or "generic" [data type][@stdlib/ndarray/dtypes]. If provided an [ndarray][@stdlib/ndarray/ctor], the value must have a shape which is [broadcast-compatible][@stdlib/ndarray/base/broadcast-shapes] with the non-reduced dimensions of the input [ndarray][@stdlib/ndarray/ctor]. For example, given the input shape `[2, 3, 4]` and `options.dim=0`, a provided [ndarray][@stdlib/ndarray/ctor] must have a shape which is [broadcast-compatible][@stdlib/ndarray/base/broadcast-shapes] with the shape `[3, 4]`. If provided a negative integer, the index at which to begin searching along a dimension is determined by counting backward from the last element (where `-1` refers to the last element). Default: `0`.
+- **fromIndex**: index from which to begin searching (_optional_). May be either a scalar value or an [ndarray][@stdlib/ndarray/ctor] having an integer index or "generic" [data type][@stdlib/ndarray/dtypes]. If provided an [ndarray][@stdlib/ndarray/ctor], the value must have a shape which is [broadcast-compatible][@stdlib/ndarray/base/broadcast-shapes] with the non-reduced dimensions of the input [ndarray][@stdlib/ndarray/ctor]. For example, given the input shape `[2, 3, 4]` and `options.dim=0`, a provided [ndarray][@stdlib/ndarray/ctor] must have a shape which is [broadcast-compatible][@stdlib/ndarray/base/broadcast-shapes] with the shape `[3, 4]`. If provided a negative integer, the index at which to begin searching along a dimension is determined by counting backward from the last element (where `-1` refers to the last element). Default: `-1`.
- **options**: function options (_optional_).
The function accepts the following options:
From b98424355be487ac84ffb7ac319dcda34dd3f10c Mon Sep 17 00:00:00 2001
From: Athan
Date: Sun, 7 Sep 2025 13:48:02 -0700
Subject: [PATCH 12/41] docs: fix copy
Signed-off-by: Athan
---
lib/node_modules/@stdlib/blas/ext/last-index-of/README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/README.md b/lib/node_modules/@stdlib/blas/ext/last-index-of/README.md
index 372d8896a7fd..49507bb0c5d0 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/README.md
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/README.md
@@ -79,7 +79,7 @@ var idx = out.get();
// returns -1
```
-By default, the function begins searching from the first element along the reduction dimension. To begin searching from a different index, provide a `fromIndex` argument.
+By default, the function begins searching from the last element along the reduction dimension. To begin searching from a different index, provide a `fromIndex` argument.
```javascript
var array = require( '@stdlib/ndarray/array' );
From cf3d8887ea0a674bb77bec912460418cb27eb54e Mon Sep 17 00:00:00 2001
From: Athan
Date: Sun, 7 Sep 2025 13:48:14 -0700
Subject: [PATCH 13/41] docs: update example
Signed-off-by: Athan
---
lib/node_modules/@stdlib/blas/ext/last-index-of/README.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/README.md b/lib/node_modules/@stdlib/blas/ext/last-index-of/README.md
index 49507bb0c5d0..9edff8e83234 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/README.md
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/README.md
@@ -89,11 +89,11 @@ var x = array( [ 1.0, 2.0, 3.0, 4.0, 2.0, 6.0 ] );
// returns
// Perform operation:
-var out = lastIndexOf( x, 2.0, 5 );
+var out = lastIndexOf( x, 2.0, 3 );
// returns
var idx = out.get();
-// returns 4
+// returns 2
```
By default, the function performs the operation over elements in the last dimension. To perform the operation over a different dimension, provide a `dim` option.
From 79297da846f8c5c4414ebd6b901aa671cf46b7c3 Mon Sep 17 00:00:00 2001
From: Athan
Date: Sun, 7 Sep 2025 13:51:30 -0700
Subject: [PATCH 14/41] docs: fix return value
Signed-off-by: Athan
---
lib/node_modules/@stdlib/blas/ext/last-index-of/README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/README.md b/lib/node_modules/@stdlib/blas/ext/last-index-of/README.md
index 9edff8e83234..d6de15178e04 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/README.md
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/README.md
@@ -168,7 +168,7 @@ var out = lastIndexOf.assign( x, 2.0, y );
// returns
var idx = out.get();
-// returns -1
+// returns 3
var bool = ( out === y );
// returns true
From d678e89332de0db1ecfcaae5d51a5e9a02ec154a Mon Sep 17 00:00:00 2001
From: Athan
Date: Sun, 7 Sep 2025 13:51:57 -0700
Subject: [PATCH 15/41] docs: fix default
Signed-off-by: Athan
---
lib/node_modules/@stdlib/blas/ext/last-index-of/README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/README.md b/lib/node_modules/@stdlib/blas/ext/last-index-of/README.md
index d6de15178e04..f70d154604ee 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/README.md
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/README.md
@@ -178,7 +178,7 @@ The method has the following parameters:
- **x**: input [ndarray][@stdlib/ndarray/ctor]. Must have at least one dimension.
- **searchElement**: search element. May be either a scalar value or an [ndarray][@stdlib/ndarray/ctor]. If provided a scalar value, the value is cast to the data type of the input [ndarray][@stdlib/ndarray/ctor]. If provided an [ndarray][@stdlib/ndarray/ctor], the value must have a shape which is [broadcast-compatible][@stdlib/ndarray/base/broadcast-shapes] with the non-reduced dimensions of the input [ndarray][@stdlib/ndarray/ctor]. For example, given the input shape `[2, 3, 4]` and `options.dim=0`, the search element [ndarray][@stdlib/ndarray/ctor] must have a shape which is [broadcast-compatible][@stdlib/ndarray/base/broadcast-shapes] with the shape `[3, 4]`.
-- **fromIndex**: index from which to begin searching (_optional_). May be either a scalar value or an [ndarray][@stdlib/ndarray/ctor] having an integer index or "generic" [data type][@stdlib/ndarray/dtypes]. If provided an [ndarray][@stdlib/ndarray/ctor], the value must have a shape which is [broadcast-compatible][@stdlib/ndarray/base/broadcast-shapes] with the non-reduced dimensions of the input [ndarray][@stdlib/ndarray/ctor]. For example, given the input shape `[2, 3, 4]` and `options.dim=0`, a provided [ndarray][@stdlib/ndarray/ctor] must have a shape which is [broadcast-compatible][@stdlib/ndarray/base/broadcast-shapes] with the shape `[3, 4]`. If provided a negative integer, the index at which to begin searching along a dimension is determined by counting backward from the last element (where `-1` refers to the last element). Default: `0`.
+- **fromIndex**: index from which to begin searching (_optional_). May be either a scalar value or an [ndarray][@stdlib/ndarray/ctor] having an integer index or "generic" [data type][@stdlib/ndarray/dtypes]. If provided an [ndarray][@stdlib/ndarray/ctor], the value must have a shape which is [broadcast-compatible][@stdlib/ndarray/base/broadcast-shapes] with the non-reduced dimensions of the input [ndarray][@stdlib/ndarray/ctor]. For example, given the input shape `[2, 3, 4]` and `options.dim=0`, a provided [ndarray][@stdlib/ndarray/ctor] must have a shape which is [broadcast-compatible][@stdlib/ndarray/base/broadcast-shapes] with the shape `[3, 4]`. If provided a negative integer, the index at which to begin searching along a dimension is determined by counting backward from the last element (where `-1` refers to the last element). Default: `-1`.
- **out**: output [ndarray][@stdlib/ndarray/ctor].
- **options**: function options (_optional_).
From 0a41b7cadb3c02bc4d5009709ee8809ef1995be1 Mon Sep 17 00:00:00 2001
From: Athan
Date: Sun, 7 Sep 2025 13:58:25 -0700
Subject: [PATCH 16/41] fix: update default value
Signed-off-by: Athan
---
lib/node_modules/@stdlib/blas/ext/last-index-of/lib/main.js | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/main.js b/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/main.js
index 97fa692b3535..b7fe8342884d 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/main.js
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/main.js
@@ -118,7 +118,8 @@ function lastIndexOf( x, searchElement, fromIndex ) {
};
// Initialize the `fromIndex` to the first element along a dimension:
- fidx = 0;
+ // Initialize the `fromIndex` to the first element along a dimension:
+ fidx = -1;
// Initialize a flag indicating whether the `fromIndex` argument is a scalar:
iflg = true;
From 492a29ce340aa44bbddb4e4a1e278c39b72258a4 Mon Sep 17 00:00:00 2001
From: Athan
Date: Sun, 7 Sep 2025 13:59:08 -0700
Subject: [PATCH 17/41] docs: remove duplicate comment
Signed-off-by: Athan
---
lib/node_modules/@stdlib/blas/ext/last-index-of/lib/main.js | 1 -
1 file changed, 1 deletion(-)
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/main.js b/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/main.js
index b7fe8342884d..cb5b0340e402 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/main.js
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/main.js
@@ -117,7 +117,6 @@ function lastIndexOf( x, searchElement, fromIndex ) {
'keepdims': false
};
- // Initialize the `fromIndex` to the first element along a dimension:
// Initialize the `fromIndex` to the first element along a dimension:
fidx = -1;
From dab063a0cb41e765c0fcd0710e2c8ee4a302ca7b Mon Sep 17 00:00:00 2001
From: Athan
Date: Sun, 7 Sep 2025 13:59:35 -0700
Subject: [PATCH 18/41] docs: fix comment
Signed-off-by: Athan
---
lib/node_modules/@stdlib/blas/ext/last-index-of/lib/main.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/main.js b/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/main.js
index cb5b0340e402..8f120553c841 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/main.js
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/main.js
@@ -117,7 +117,7 @@ function lastIndexOf( x, searchElement, fromIndex ) {
'keepdims': false
};
- // Initialize the `fromIndex` to the first element along a dimension:
+ // Initialize the `fromIndex` to the last element along a dimension:
fidx = -1;
// Initialize a flag indicating whether the `fromIndex` argument is a scalar:
From 7f2feb32771a34a840f50e0bc11af839fe3f2537 Mon Sep 17 00:00:00 2001
From: Athan
Date: Sun, 7 Sep 2025 14:00:38 -0700
Subject: [PATCH 19/41] fix: update default value
Signed-off-by: Athan
---
lib/node_modules/@stdlib/blas/ext/last-index-of/lib/assign.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/assign.js b/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/assign.js
index f1ef54f4780f..0a0ee8ae7d4c 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/assign.js
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/assign.js
@@ -129,8 +129,8 @@ function assign( x, searchElement, fromIndex, out ) {
'dims': [ -1 ] // default behavior is to perform a reduction over the last dimension
};
- // Initialize the `fromIndex` to the first element along a dimension:
- fidx = 0;
+ // Initialize the `fromIndex` to the last element along a dimension:
+ fidx = -1;
// Initialize a flag indicating whether the `fromIndex` argument is a scalar:
iflg = true;
From d361d99ebf23a2748cb96f97ff92fbe7fb68a835 Mon Sep 17 00:00:00 2001
From: Athan
Date: Sun, 7 Sep 2025 14:01:08 -0700
Subject: [PATCH 20/41] docs: fix example
Signed-off-by: Athan
---
lib/node_modules/@stdlib/blas/ext/last-index-of/lib/base.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/base.js b/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/base.js
index 94a644634737..d33ecad136fc 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/base.js
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/base.js
@@ -101,7 +101,7 @@ var table = {
* })
*
* // Create a from index ndarray:
-* var fromIndex = scalar2ndarray( 0, {
+* var fromIndex = scalar2ndarray( -1, {
* 'dtype': 'int32'
* })
*
From 47061db22c265ffdb0955921535d5fb06dfa6f60 Mon Sep 17 00:00:00 2001
From: Athan
Date: Sun, 7 Sep 2025 14:01:24 -0700
Subject: [PATCH 21/41] docs: fix return value
Signed-off-by: Athan
---
lib/node_modules/@stdlib/blas/ext/last-index-of/lib/base.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/base.js b/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/base.js
index d33ecad136fc..0ba7efc0ad6a 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/base.js
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/base.js
@@ -110,7 +110,7 @@ var table = {
* // returns
*
* var idx = out.get();
-* // returns -1
+* // returns 3
*/
var lastIndexOf = factory( table, [ idtypes0, idtypes1, idtypes2 ], odtypes, policies ); // eslint-disable-line max-len
From d209b4f4ddeae3c79196ec67d5817d673fe54a8d Mon Sep 17 00:00:00 2001
From: Muhammad Haris <101793258+headlessNode@users.noreply.github.com>
Date: Mon, 8 Sep 2025 06:04:20 +0000
Subject: [PATCH 22/41] fix: refactor docs & tests
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
- task: lint_filenames
status: passed
- task: lint_editorconfig
status: passed
- task: lint_markdown
status: passed
- task: lint_package_json
status: na
- task: lint_repl_help
status: na
- task: lint_javascript_src
status: passed
- task: lint_javascript_cli
status: na
- task: lint_javascript_examples
status: na
- task: lint_javascript_tests
status: 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
---
---
.../@stdlib/blas/ext/last-index-of/README.md | 6 +++---
.../ext/last-index-of/docs/types/index.d.ts | 8 ++++----
.../blas/ext/last-index-of/lib/assign.js | 2 +-
.../@stdlib/blas/ext/last-index-of/lib/main.js | 2 +-
.../blas/ext/last-index-of/test/test.assign.js | 12 ++++++------
.../blas/ext/last-index-of/test/test.main.js | 18 +++++++++---------
6 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/README.md b/lib/node_modules/@stdlib/blas/ext/last-index-of/README.md
index f70d154604ee..f326ef068c19 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/README.md
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/README.md
@@ -93,7 +93,7 @@ var out = lastIndexOf( x, 2.0, 3 );
// returns
var idx = out.get();
-// returns 2
+// returns 1
```
By default, the function performs the operation over elements in the last dimension. To perform the operation over a different dimension, provide a `dim` option.
@@ -110,7 +110,7 @@ var out = lastIndexOf( x, -3.0, {
// returns
var idx = ndarray2array( out );
-// returns [ 0, -1 ]
+// returns [ 1, -1 ]
```
By default, the function excludes reduced dimensions from the output [ndarray][@stdlib/ndarray/ctor]. To include the reduced dimensions as singleton dimensions, set the `keepdims` option to `true`.
@@ -130,7 +130,7 @@ var out = lastIndexOf( x, -3.0, opts );
// returns
var idx = ndarray2array( out );
-// returns [ [ 0, -1 ] ]
+// returns [ [ 1, -1 ] ]
```
By default, the function returns an [ndarray][@stdlib/ndarray/ctor] having a [data type][@stdlib/ndarray/dtypes] determined by the function's output data type [policy][@stdlib/ndarray/output-dtype-policies]. To override the default behavior, set the `dtype` option.
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/ext/last-index-of/docs/types/index.d.ts
index cc1a36c0e7ea..20a66bb80e9f 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/docs/types/index.d.ts
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/docs/types/index.d.ts
@@ -98,7 +98,7 @@ interface lastIndexOf {
* // returns
*
* var idx = y.get();
- * // returns -1
+ * // returns 3
*/
( x: InputArray, searchElement: SearchElement, options?: Options ): OutputArray;
@@ -159,7 +159,7 @@ interface lastIndexOf {
* // returns true
*
* var idx = out.get();
- * // returns -1
+ * // returns 3
*/
assign( x: InputArray, searchElement: SearchElement, out: U, options?: BaseOptions ): U;
@@ -222,7 +222,7 @@ interface lastIndexOf {
* // returns
*
* var idx = y.get();
-* // returns -1
+* // returns 3
*
* @example
* var zeros = require( '@stdlib/ndarray/zeros' );
@@ -240,7 +240,7 @@ interface lastIndexOf {
* // returns true
*
* var idx = out.get();
-* // returns -1
+* // returns 3
*/
declare const lastIndexOf: lastIndexOf;
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/assign.js b/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/assign.js
index 0a0ee8ae7d4c..60f048eccd5c 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/assign.js
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/assign.js
@@ -95,7 +95,7 @@ var DEFAULT_DTYPE = defaults.get( 'dtypes.integer_index' );
* // returns true
*
* var arr = ndarray2array( out );
-* // returns [ -1, 0 ]
+* // returns [ 1, 0 ]
*/
function assign( x, searchElement, fromIndex, out ) {
var hasOptions;
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/main.js b/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/main.js
index 8f120553c841..acc78f1780d4 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/main.js
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/main.js
@@ -86,7 +86,7 @@ var DEFAULT_DTYPE = defaults.get( 'dtypes.integer_index' );
* // returns
*
* var arr = ndarray2array( out );
-* // returns [ -1, 0 ]
+* // returns [ 1, 0 ]
*/
function lastIndexOf( x, searchElement, fromIndex ) {
var hasOptions;
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.assign.js b/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.assign.js
index 3c5bb843c9cf..b8061bc6e3a6 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.assign.js
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.assign.js
@@ -1117,7 +1117,7 @@ tape( 'the function returns the first index of a specified search element in an
});
actual = lastIndexOf( x, 2.0, y );
- expected = [ -1, -1 ];
+ expected = [ 1, 1 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1159,7 +1159,7 @@ tape( 'the function returns the first index of a specified search element in an
});
actual = lastIndexOf( x, 2.0, y );
- expected = [ -1, 0 ];
+ expected = [ -1, 1 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1203,7 +1203,7 @@ tape( 'the function supports specifying an operation dimension (row-major)', fun
actual = lastIndexOf( x, 2.0, y, {
'dim': 0
});
- expected = [ -1, 0 ];
+ expected = [ -1, 1 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1239,7 +1239,7 @@ tape( 'the function supports specifying an operation dimension (row-major)', fun
actual = lastIndexOf( x, 2.0, y, {
'dim': 1
});
- expected = [ -1, -1 ];
+ expected = [ 1, 1 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1285,7 +1285,7 @@ tape( 'the function supports specifying an operation dimension (column-major)',
actual = lastIndexOf( x, 2.0, y, {
'dim': 0
});
- expected = [ -1, -1 ];
+ expected = [ 1, 1 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1321,7 +1321,7 @@ tape( 'the function supports specifying an operation dimension (column-major)',
actual = lastIndexOf( x, 2.0, y, {
'dim': 1
});
- expected = [ -1, 0 ];
+ expected = [ -1, 1 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.main.js b/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.main.js
index dc95373c5917..54fb584b2e49 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.main.js
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.main.js
@@ -846,7 +846,7 @@ tape( 'the function returns the last index of a specified search element in an n
x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
actual = lastIndexOf( x, 2.0 );
- expected = [ -1, -1 ];
+ expected = [ 1, 1 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -876,7 +876,7 @@ tape( 'the function returns the last index of a specified search element in an n
x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
actual = lastIndexOf( x, 2.0 );
- expected = [ -1, 0 ];
+ expected = [ -1, 1 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -908,7 +908,7 @@ tape( 'the function supports specifying the operation dimension (row-major)', fu
actual = lastIndexOf( x, 2.0, {
'dim': 0
});
- expected = [ -1, 0 ];
+ expected = [ -1, 1 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -933,7 +933,7 @@ tape( 'the function supports specifying the operation dimension (row-major)', fu
actual = lastIndexOf( x, 2.0, {
'dim': 1
});
- expected = [ -1, -1 ];
+ expected = [ 1, 1 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -967,7 +967,7 @@ tape( 'the function supports specifying the operation dimension (column-major)',
actual = lastIndexOf( x, 2.0, {
'dim': 0
});
- expected = [ -1, -1 ];
+ expected = [ 1, 1 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -992,7 +992,7 @@ tape( 'the function supports specifying the operation dimension (column-major)',
actual = lastIndexOf( x, 2.0, {
'dim': 1
});
- expected = [ -1, 0 ];
+ expected = [ -1, 1 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1026,7 +1026,7 @@ tape( 'the function supports specifying the `keepdims` option (row-major)', func
actual = lastIndexOf( x, 2.0, {
'keepdims': true
});
- expected = [ [ -1 ], [ -1 ] ];
+ expected = [ [ 1 ], [ 1 ] ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1060,7 +1060,7 @@ tape( 'the function supports specifying the `keepdims` option (column-major)', f
actual = lastIndexOf( x, 2.0, {
'keepdims': true
});
- expected = [ [ -1 ], [ -1 ] ];
+ expected = [ [ 1 ], [ 1 ] ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
@@ -1094,7 +1094,7 @@ tape( 'the function supports specifying the output array data type', function te
actual = lastIndexOf( x, 2.0, {
'dtype': 'int32'
});
- expected = [ -1, -1 ];
+ expected = [ 1, 1 ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'int32', 'returns expected value' );
From 651dbf138819d2019ef87313e2fda9b69a102451 Mon Sep 17 00:00:00 2001
From: Muhammad Haris <101793258+headlessNode@users.noreply.github.com>
Date: Mon, 8 Sep 2025 06:13:22 +0000
Subject: [PATCH 23/41] fix: lint error
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
- task: lint_filenames
status: passed
- task: lint_editorconfig
status: passed
- task: lint_markdown
status: na
- task: lint_package_json
status: na
- task: lint_repl_help
status: na
- task: lint_javascript_src
status: passed
- task: lint_javascript_cli
status: na
- task: lint_javascript_examples
status: na
- task: lint_javascript_tests
status: na
- task: lint_javascript_benchmarks
status: na
- task: lint_python
status: na
- task: lint_r
status: na
- task: lint_c_src
status: na
- task: lint_c_examples
status: na
- task: lint_c_benchmarks
status: na
- task: lint_c_tests_fixtures
status: na
- task: lint_shell
status: na
- task: lint_typescript_declarations
status: na
- task: lint_typescript_tests
status: na
- task: lint_license_headers
status: passed
---
---
lib/node_modules/@stdlib/blas/ext/last-index-of/lib/index.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/index.js b/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/index.js
index afc2bc95318a..094c1eaaa42a 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/index.js
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/index.js
@@ -49,7 +49,7 @@
* // returns
*
* var arr = ndarray2array( out );
-* // returns [ -1, 0 ]
+* // returns [ 1, 0 ]
*/
// MODULES //
From 8e883cca91dbf3fc82da5ac523157758bb5f2a72 Mon Sep 17 00:00:00 2001
From: Athan
Date: Sun, 7 Sep 2025 23:59:22 -0700
Subject: [PATCH 24/41] docs: fix default
Signed-off-by: Athan
---
lib/node_modules/@stdlib/blas/ext/last-index-of/docs/repl.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/docs/repl.txt b/lib/node_modules/@stdlib/blas/ext/last-index-of/docs/repl.txt
index 0b8cb84f093d..36c871c02cd8 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/docs/repl.txt
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/docs/repl.txt
@@ -33,7 +33,7 @@
shape which is broadcast-compatible with the shape `[3, 4]`. If provided
a negative integer, the index at which to begin searching along a
dimension is determined by counting backward from the last element
- (where -1 refers to the last element). Default: 0.
+ (where -1 refers to the last element). Default: -1.
options: Object (optional)
Function options.
From 71c823b4ac2e032704f8aa45394f52084dc5637f Mon Sep 17 00:00:00 2001
From: Athan
Date: Mon, 8 Sep 2025 00:00:23 -0700
Subject: [PATCH 25/41] docs: fix default
Signed-off-by: Athan
---
lib/node_modules/@stdlib/blas/ext/last-index-of/docs/repl.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/docs/repl.txt b/lib/node_modules/@stdlib/blas/ext/last-index-of/docs/repl.txt
index 36c871c02cd8..bb2f94849667 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/docs/repl.txt
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/docs/repl.txt
@@ -98,7 +98,7 @@
shape which is broadcast-compatible with the shape `[3, 4]`. If provided
a negative integer, the index at which to begin searching along a
dimension is determined by counting backward from the last element
- (where -1 refers to the last element). Default: 0.
+ (where -1 refers to the last element). Default: -1.
out: ndarray
Output array.
From f2bc030967c6fbed18e6116a8e225f40223404eb Mon Sep 17 00:00:00 2001
From: Athan
Date: Mon, 8 Sep 2025 00:03:14 -0700
Subject: [PATCH 26/41] docs: add default
Signed-off-by: Athan
---
lib/node_modules/@stdlib/blas/ext/last-index-of/lib/assign.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/assign.js b/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/assign.js
index 60f048eccd5c..b78df0202189 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/assign.js
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/assign.js
@@ -47,7 +47,7 @@ var DEFAULT_DTYPE = defaults.get( 'dtypes.integer_index' );
*
* @param {ndarrayLike} x - input ndarray
* @param {(ndarrayLike|*)} searchElement - search element
-* @param {(ndarrayLike|integer)} [fromIndex] - index from which to begin searching
+* @param {(ndarrayLike|integer)} [fromIndex=-1] - index from which to begin searching
* @param {ndarrayLike} out - output ndarray
* @param {Options} [options] - function options
* @param {IntegerArray} [options.dim=-1] - dimension over which to perform operation
From 5865962db76894b2c0064c9315c6304f112dba51 Mon Sep 17 00:00:00 2001
From: Athan
Date: Mon, 8 Sep 2025 00:06:24 -0700
Subject: [PATCH 27/41] fix: update error message
Signed-off-by: Athan
---
lib/node_modules/@stdlib/blas/ext/last-index-of/lib/assign.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/assign.js b/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/assign.js
index b78df0202189..15f3b076cb61 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/assign.js
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/assign.js
@@ -112,7 +112,7 @@ function assign( x, searchElement, fromIndex, out ) {
nargs = arguments.length;
if ( !isndarrayLike( x ) ) {
- throw new TypeError( format( 'invalid argument. The first argument must be an ndarray. Value: `%s`.', x ) );
+ throw new TypeError( format( 'invalid argument. First argument must be an ndarray. Value: `%s`.', x ) );
}
if ( nargs < 2 ) {
throw new TypeError( format( 'invalid argument. Second argument must be either an ndarray or a scalar value. Value: `%s`.', searchElement ) );
From 9a16c482d14d16815b02c299b2e21f013f36d571 Mon Sep 17 00:00:00 2001
From: Muhammad Haris <101793258+headlessNode@users.noreply.github.com>
Date: Mon, 8 Sep 2025 12:08:12 +0500
Subject: [PATCH 28/41] fix: parameter description
Signed-off-by: Muhammad Haris <101793258+headlessNode@users.noreply.github.com>
---
lib/node_modules/@stdlib/blas/ext/last-index-of/lib/main.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/main.js b/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/main.js
index acc78f1780d4..07b2ffabb2d4 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/main.js
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/main.js
@@ -49,7 +49,7 @@ var DEFAULT_DTYPE = defaults.get( 'dtypes.integer_index' );
* @param {(ndarrayLike|*)} searchElement - search element
* @param {(ndarrayLike|integer)} [fromIndex] - index from which to begin searching
* @param {Options} [options] - function options
-* @param {IntegerArray} [options.dim=-1] - dimension over which to perform operation
+* @param {Integer} [options.dim=-1] - dimension over which to perform operation
* @param {boolean} [options.keepdims=false] - boolean indicating whether the reduced dimensions should be included in the returned ndarray as singleton dimensions
* @param {string} [options.dtype] - output ndarray data type
* @throws {TypeError} first argument must be an ndarray-like object
From ecc61ddca59ee412ace6b0691c23856b0a87d219 Mon Sep 17 00:00:00 2001
From: Muhammad Haris <101793258+headlessNode@users.noreply.github.com>
Date: Mon, 8 Sep 2025 12:08:34 +0500
Subject: [PATCH 29/41] fix: parameter description
Signed-off-by: Muhammad Haris <101793258+headlessNode@users.noreply.github.com>
---
lib/node_modules/@stdlib/blas/ext/last-index-of/lib/assign.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/assign.js b/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/assign.js
index 15f3b076cb61..43772c7bf506 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/assign.js
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/assign.js
@@ -50,7 +50,7 @@ var DEFAULT_DTYPE = defaults.get( 'dtypes.integer_index' );
* @param {(ndarrayLike|integer)} [fromIndex=-1] - index from which to begin searching
* @param {ndarrayLike} out - output ndarray
* @param {Options} [options] - function options
-* @param {IntegerArray} [options.dim=-1] - dimension over which to perform operation
+* @param {Integer} [options.dim=-1] - dimension over which to perform operation
* @throws {TypeError} function must be provided at least three arguments
* @throws {TypeError} first argument must be an ndarray-like object
* @throws {TypeError} third argument must be either an ndarray-like object or an integer
From 2a9750e2a4534927a4c35c7db829af831ac5353e Mon Sep 17 00:00:00 2001
From: Athan
Date: Mon, 8 Sep 2025 00:09:12 -0700
Subject: [PATCH 30/41] refactor: avoid unnecessarily calling `hasOwnProp`
Signed-off-by: Athan
---
.../@stdlib/blas/ext/last-index-of/lib/assign.js | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/assign.js b/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/assign.js
index 43772c7bf506..e6929ce59442 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/assign.js
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/assign.js
@@ -188,12 +188,14 @@ function assign( x, searchElement, fromIndex, out ) {
options = arguments[ 4 ];
hasOptions = true;
}
- if ( hasOptions && !isPlainObject( options ) ) {
- throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );
- }
- // Resolve provided options...
- if ( hasOwnProp( options, 'dim' ) ) {
- opts.dims[ 0 ] = options.dim;
+ if ( hasOptions ) {
+ if ( !isPlainObject( options ) ) {
+ throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );
+ }
+ // Resolve provided options...
+ if ( hasOwnProp( options, 'dim' ) ) {
+ opts.dims[ 0 ] = options.dim;
+ }
}
// Resolve the list of non-reduced dimensions:
sh = getShape( x );
From 2fcdd1de2e740096617a9f3e816390c5426eae8f Mon Sep 17 00:00:00 2001
From: Muhammad Haris <101793258+headlessNode@users.noreply.github.com>
Date: Mon, 8 Sep 2025 12:12:38 +0500
Subject: [PATCH 31/41] fix: parameter type description
Signed-off-by: Muhammad Haris <101793258+headlessNode@users.noreply.github.com>
---
lib/node_modules/@stdlib/blas/ext/last-index-of/lib/assign.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/assign.js b/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/assign.js
index e6929ce59442..c7b76d21f878 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/assign.js
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/assign.js
@@ -50,7 +50,7 @@ var DEFAULT_DTYPE = defaults.get( 'dtypes.integer_index' );
* @param {(ndarrayLike|integer)} [fromIndex=-1] - index from which to begin searching
* @param {ndarrayLike} out - output ndarray
* @param {Options} [options] - function options
-* @param {Integer} [options.dim=-1] - dimension over which to perform operation
+* @param {integer} [options.dim=-1] - dimension over which to perform operation
* @throws {TypeError} function must be provided at least three arguments
* @throws {TypeError} first argument must be an ndarray-like object
* @throws {TypeError} third argument must be either an ndarray-like object or an integer
From 8f435cf9892877decb3b4263640f8a04b60e5e2a Mon Sep 17 00:00:00 2001
From: Muhammad Haris <101793258+headlessNode@users.noreply.github.com>
Date: Mon, 8 Sep 2025 12:13:13 +0500
Subject: [PATCH 32/41] fix: parameter type description
Signed-off-by: Muhammad Haris <101793258+headlessNode@users.noreply.github.com>
---
lib/node_modules/@stdlib/blas/ext/last-index-of/lib/main.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/main.js b/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/main.js
index 07b2ffabb2d4..ddd7b3c1fade 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/main.js
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/main.js
@@ -49,7 +49,7 @@ var DEFAULT_DTYPE = defaults.get( 'dtypes.integer_index' );
* @param {(ndarrayLike|*)} searchElement - search element
* @param {(ndarrayLike|integer)} [fromIndex] - index from which to begin searching
* @param {Options} [options] - function options
-* @param {Integer} [options.dim=-1] - dimension over which to perform operation
+* @param {integer} [options.dim=-1] - dimension over which to perform operation
* @param {boolean} [options.keepdims=false] - boolean indicating whether the reduced dimensions should be included in the returned ndarray as singleton dimensions
* @param {string} [options.dtype] - output ndarray data type
* @throws {TypeError} first argument must be an ndarray-like object
From 6b09f69fd1d192ce3978f58297913375c436c879 Mon Sep 17 00:00:00 2001
From: Athan
Date: Mon, 8 Sep 2025 00:13:40 -0700
Subject: [PATCH 33/41] docs: document default value
Signed-off-by: Athan
---
lib/node_modules/@stdlib/blas/ext/last-index-of/lib/main.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/main.js b/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/main.js
index ddd7b3c1fade..02b3db304b2b 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/main.js
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/main.js
@@ -47,7 +47,7 @@ var DEFAULT_DTYPE = defaults.get( 'dtypes.integer_index' );
*
* @param {ndarrayLike} x - input ndarray
* @param {(ndarrayLike|*)} searchElement - search element
-* @param {(ndarrayLike|integer)} [fromIndex] - index from which to begin searching
+* @param {(ndarrayLike|integer)} [fromIndex=-1] - index from which to begin searching
* @param {Options} [options] - function options
* @param {integer} [options.dim=-1] - dimension over which to perform operation
* @param {boolean} [options.keepdims=false] - boolean indicating whether the reduced dimensions should be included in the returned ndarray as singleton dimensions
From c637cf7890152da3435c1a1cca341534bf0cba4b Mon Sep 17 00:00:00 2001
From: Athan
Date: Mon, 8 Sep 2025 00:15:46 -0700
Subject: [PATCH 34/41] fix: avoid repeatedly calling `hasOwnProp` when we
don't need to
Signed-off-by: Athan
---
.../blas/ext/last-index-of/lib/main.js | 26 ++++++++++---------
1 file changed, 14 insertions(+), 12 deletions(-)
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/main.js b/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/main.js
index 02b3db304b2b..510f4f8020a5 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/main.js
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/lib/main.js
@@ -161,18 +161,20 @@ function lastIndexOf( x, searchElement, fromIndex ) {
options = arguments[ 3 ];
hasOptions = true;
}
- if ( hasOptions && !isPlainObject( options ) ) {
- throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );
- }
- // Resolve provided options...
- if ( hasOwnProp( options, 'dim' ) ) {
- opts.dims[ 0 ] = options.dim;
- }
- if ( hasOwnProp( options, 'keepdims' ) ) {
- opts.keepdims = options.keepdims;
- }
- if ( hasOwnProp( options, 'dtype' ) ) {
- opts.dtype = options.dtype;
+ if ( hasOptions ) {
+ if ( !isPlainObject( options ) ) {
+ throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );
+ }
+ // Resolve provided options...
+ if ( hasOwnProp( options, 'dim' ) ) {
+ opts.dims[ 0 ] = options.dim;
+ }
+ if ( hasOwnProp( options, 'keepdims' ) ) {
+ opts.keepdims = options.keepdims;
+ }
+ if ( hasOwnProp( options, 'dtype' ) ) {
+ opts.dtype = options.dtype;
+ }
}
// Resolve the list of non-reduced dimensions:
sh = getShape( x );
From 7c3fb164d5fb6882e973a99c728259df15f70e86 Mon Sep 17 00:00:00 2001
From: Athan
Date: Mon, 8 Sep 2025 00:22:13 -0700
Subject: [PATCH 35/41] test: fix test
Signed-off-by: Athan
---
.../blas/ext/last-index-of/test/test.assign.js | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.assign.js b/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.assign.js
index b8061bc6e3a6..a9f6847606a9 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.assign.js
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.assign.js
@@ -524,22 +524,28 @@ tape( 'the function throws an error if provided a third argument which is not an
}
});
-tape( 'the function throws an error if provided an output argument which is not an ndarray-like object or an integer', function test( t ) {
+tape( 'the function throws an error if provided an output argument which is not an ndarray-like object', function test( t ) {
var values;
+ var opts;
var i;
var x;
- x = zeros( [ 2, 2 ], {
- 'dtype': 'float64'
- });
+ opts = {
+ 'dtype': 'generic'
+ };
+
+ x = zeros( [ 2, 2 ], opts );
+
values = [
'5',
+ 5,
NaN,
true,
false,
null,
void 0,
[],
+ {},
function noop() {}
];
for ( i = 0; i < values.length; i++ ) {
@@ -549,7 +555,7 @@ tape( 'the function throws an error if provided an output argument which is not
function badValue( value ) {
return function badValue() {
- lastIndexOf( x, scalar2ndarray( 2.0 ), scalar2ndarray( 0 ), value, {} );
+ lastIndexOf( x, 2.0, value );
};
}
});
From a18955953a8e1b358277f2a2da209062c667ba1c Mon Sep 17 00:00:00 2001
From: Athan
Date: Mon, 8 Sep 2025 00:23:21 -0700
Subject: [PATCH 36/41] test: remove dupe test
Signed-off-by: Athan
---
.../ext/last-index-of/test/test.assign.js | 36 -------------------
1 file changed, 36 deletions(-)
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.assign.js b/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.assign.js
index a9f6847606a9..5c60dc14344f 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.assign.js
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.assign.js
@@ -560,42 +560,6 @@ tape( 'the function throws an error if provided an output argument which is not
}
});
-tape( 'the function throws an error if provided an output argument which is not an ndarray-like object', function test( t ) {
- var values;
- var opts;
- var i;
- var x;
-
- opts = {
- 'dtype': 'generic'
- };
-
- x = zeros( [ 2, 2 ], opts );
-
- values = [
- '5',
- 5,
- NaN,
- true,
- false,
- null,
- void 0,
- [],
- {},
- function noop() {}
- ];
- for ( i = 0; i < values.length; i++ ) {
- t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
- }
- t.end();
-
- function badValue( value ) {
- return function badValue() {
- lastIndexOf( x, 2.0, value );
- };
- }
-});
-
tape( 'the function throws an error if provided an output argument which is not an ndarray-like object (options)', function test( t ) {
var values;
var opts;
From 431cae7b48f731d72c5754718521af6adf56ec9f Mon Sep 17 00:00:00 2001
From: Athan
Date: Mon, 8 Sep 2025 00:32:46 -0700
Subject: [PATCH 37/41] test: fix descriptions and clean-up
Signed-off-by: Athan
---
.../@stdlib/blas/ext/last-index-of/test/test.assign.js | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.assign.js b/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.assign.js
index 5c60dc14344f..c4135da1f879 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.assign.js
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.assign.js
@@ -1072,7 +1072,7 @@ tape( 'the function throws an error if provided a `dim` option which is not an i
}
});
-tape( 'the function returns the first index of a specified search element in an ndarray (row-major)', function test( t ) {
+tape( 'the function returns the last index of a specified search element in an ndarray (row-major)', function test( t ) {
var expected;
var actual;
var xbuf;
@@ -1114,7 +1114,7 @@ tape( 'the function returns the first index of a specified search element in an
t.end();
});
-tape( 'the function returns the first index of a specified search element in an ndarray (column-major)', function test( t ) {
+tape( 'the function returns the last index of a specified search element in an ndarray (column-major)', function test( t ) {
var expected;
var actual;
var xbuf;
@@ -1548,7 +1548,7 @@ tape( 'the function supports providing a from index (0d ndarray, options)', func
t.end();
});
-tape( 'the function supports providing a from index and operation dimension', function test( t ) {
+tape( 'the function supports providing a from index (scalar, broadcasted)', function test( t ) {
var expected;
var actual;
var xbuf;
@@ -1613,7 +1613,7 @@ tape( 'the function supports providing a from index and operation dimension', fu
t.end();
});
-tape( 'the function supports providing a from index and operation dimension (0d ndarray)', function test( t ) {
+tape( 'the function supports providing a from index (0d ndarray, broadcasted)', function test( t ) {
var expected;
var fromIdx;
var actual;
@@ -1682,7 +1682,7 @@ tape( 'the function supports providing a from index and operation dimension (0d
t.end();
});
-tape( 'the function supports providing an ndarray from index and search element with operation dimension (1d ndarray)', function test( t ) {
+tape( 'the function supports providing a from index (ndarray)', function test( t ) {
var searchElement;
var expected;
var fromIdx;
From 46dc2acb9c02722b84970fdd34d9bc996c8fff9c Mon Sep 17 00:00:00 2001
From: Athan
Date: Mon, 8 Sep 2025 01:29:51 -0700
Subject: [PATCH 38/41] test: fix strides
Signed-off-by: Athan
---
.../@stdlib/blas/ext/last-index-of/test/test.main.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.main.js b/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.main.js
index 54fb584b2e49..7005be4f2085 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.main.js
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.main.js
@@ -1055,7 +1055,7 @@ tape( 'the function supports specifying the `keepdims` option (column-major)', f
var x;
xbuf = [ -1.0, 2.0, -3.0, 2.0 ];
- x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'column-major' );
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
actual = lastIndexOf( x, 2.0, {
'keepdims': true
From a34a8b9593dc0d70908e27d5719beafe76106fb2 Mon Sep 17 00:00:00 2001
From: Athan
Date: Mon, 8 Sep 2025 01:31:20 -0700
Subject: [PATCH 39/41] test: fix expected value
Signed-off-by: Athan
---
.../@stdlib/blas/ext/last-index-of/test/test.main.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.main.js b/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.main.js
index 7005be4f2085..d28e4cbc28d6 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.main.js
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.main.js
@@ -1060,7 +1060,7 @@ tape( 'the function supports specifying the `keepdims` option (column-major)', f
actual = lastIndexOf( x, 2.0, {
'keepdims': true
});
- expected = [ [ 1 ], [ 1 ] ];
+ expected = [ [ -1 ], [ 1 ] ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
From 4feace6423245f0635a3bcc0810e598d05e7a3fe Mon Sep 17 00:00:00 2001
From: Athan
Date: Mon, 8 Sep 2025 01:31:45 -0700
Subject: [PATCH 40/41] test: fix expected value
Signed-off-by: Athan
---
.../@stdlib/blas/ext/last-index-of/test/test.main.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.main.js b/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.main.js
index d28e4cbc28d6..e039aaf24213 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.main.js
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.main.js
@@ -1071,7 +1071,7 @@ tape( 'the function supports specifying the `keepdims` option (column-major)', f
actual = lastIndexOf( x, 2.0, 0, {
'keepdims': true
});
- expected = [ [ -1 ], [ -1 ] ];
+ expected = [ [ -1 ], [ 0 ] ];
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
From ef2400aef1e639f78cdb330c106c31f4a56a6872 Mon Sep 17 00:00:00 2001
From: Athan
Date: Mon, 8 Sep 2025 01:35:10 -0700
Subject: [PATCH 41/41] test: update test descriptions
Signed-off-by: Athan
---
.../@stdlib/blas/ext/last-index-of/test/test.main.js | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.main.js b/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.main.js
index e039aaf24213..04c837a19982 100644
--- a/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.main.js
+++ b/lib/node_modules/@stdlib/blas/ext/last-index-of/test/test.main.js
@@ -1307,7 +1307,7 @@ tape( 'the function supports providing a from index (0d ndarray, options)', func
t.end();
});
-tape( 'the function supports providing a from index and operation dimension', function test( t ) {
+tape( 'the function supports providing a from index (scalar, broadcasted)', function test( t ) {
var expected;
var actual;
var xbuf;
@@ -1362,7 +1362,7 @@ tape( 'the function supports providing a from index and operation dimension', fu
t.end();
});
-tape( 'the function supports providing a from index and operation dimension (0d ndarray)', function test( t ) {
+tape( 'the function supports providing a from index (0d ndarray, broadcasted)', function test( t ) {
var expected;
var fromIdx;
var actual;
@@ -1421,7 +1421,7 @@ tape( 'the function supports providing a from index and operation dimension (0d
t.end();
});
-tape( 'the function supports providing an ndarray from index and search element with operation dimension (1d ndarray)', function test( t ) {
+tape( 'the function supports providing a from index (1d ndarray)', function test( t ) {
var searchElement;
var expected;
var fromIdx;