From 16c849a5472a820d1efa7f0708c832e6445aa717 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Tue, 16 Apr 2024 03:48:50 -0700 Subject: [PATCH] refactor: update descriptions, tests, and implementations --- .../@stdlib/blas/base/idamax/README.md | 14 +- .../blas/base/idamax/benchmark/c/Makefile | 31 ++- .../idamax/benchmark/c/benchmark.length.c | 10 +- .../benchmark/fortran/benchmark.length.f | 14 +- .../@stdlib/blas/base/idamax/docs/repl.txt | 12 +- .../blas/base/idamax/docs/types/index.d.ts | 10 +- .../blas/base/idamax/examples/c/Makefile | 33 ++- .../idamax/include/stdlib/blas/base/idamax.h | 2 +- .../include/stdlib/blas/base/idamax_cblas.h | 2 +- .../include/stdlib/blas/base/idamax_fortran.h | 2 +- .../@stdlib/blas/base/idamax/lib/idamax.js | 22 +- .../blas/base/idamax/lib/idamax.native.js | 4 +- .../@stdlib/blas/base/idamax/lib/index.js | 2 +- .../@stdlib/blas/base/idamax/lib/ndarray.js | 19 +- .../blas/base/idamax/lib/ndarray.native.js | 7 +- .../@stdlib/blas/base/idamax/manifest.json | 235 +++++++++++++++++- .../@stdlib/blas/base/idamax/package.json | 6 +- .../@stdlib/blas/base/idamax/src/addon.c | 2 +- .../@stdlib/blas/base/idamax/src/idamax.c | 33 +-- .../@stdlib/blas/base/idamax/src/idamax.f | 13 +- .../blas/base/idamax/src/idamax_cblas.c | 9 +- .../@stdlib/blas/base/idamax/src/idamax_f.c | 11 +- .../@stdlib/blas/base/idamax/src/idamaxsub.f | 8 +- .../blas/base/idamax/test/test.idamax.js | 14 +- .../base/idamax/test/test.idamax.native.js | 14 +- .../blas/base/idamax/test/test.ndarray.js | 16 +- .../base/idamax/test/test.ndarray.native.js | 16 +- 27 files changed, 411 insertions(+), 150 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/idamax/README.md b/lib/node_modules/@stdlib/blas/base/idamax/README.md index 95cf6d993b6..c8f7673baf9 100644 --- a/lib/node_modules/@stdlib/blas/base/idamax/README.md +++ b/lib/node_modules/@stdlib/blas/base/idamax/README.md @@ -20,7 +20,7 @@ limitations under the License. # idamax -> Find the index of the first element having maximum absolute value. +> Find the index of the first element having the maximum absolute value.
@@ -32,7 +32,7 @@ var idamax = require( '@stdlib/blas/base/idamax' ); #### idamax( N, x, strideX ) -Finds the index of the first element having maximum absolute value. +Finds the index of the first element having the maximum absolute value. ```javascript var Float64Array = require( '@stdlib/array/float64' ); @@ -49,7 +49,7 @@ The function has the following parameters: - **x**: input [`Float64Array`][@stdlib/array/float64]. - **strideX**: index increment for `x`. -The `N` and `strideX` parameters determine which elements in `x` are accessed at runtime. For example, to find index of element having maximum absolute value traversing every other value, +The `N` and `strideX` parameters determine which elements in `x` are accessed at runtime. For example, to traverse every other value, ```javascript var Float64Array = require( '@stdlib/array/float64' ); @@ -71,16 +71,14 @@ var x0 = new Float64Array( [ 1.0, -2.0, 3.0, -4.0, 5.0, -6.0 ] ); // Create an offset view: var x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element -// Find index of element having maximum absolute value for every other element... +// Find index of element having the maximum absolute value: var idx = idamax( 3, x1, 2 ); // returns 2 ``` -If either `N` is less than `1` or `strideX` is less than or equal to `0`, the function returns `0`. - #### idamax.ndarray( N, x, strideX, offset ) -Finds the index of the first element having maximum absolute value using alternative indexing semantics. +Finds the index of the first element having the maximum absolute value using alternative indexing semantics. ```javascript var Float64Array = require( '@stdlib/array/float64' ); @@ -95,7 +93,7 @@ The function has the following additional parameters: - **offsetX**: starting index. -While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the `offset` parameter supports indexing semantics based on a starting index. For example, to find the index of the element having the maximum absolute value starting from second index, +While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the `offset` parameter supports indexing semantics based on a starting index. For example, to start from the second index, ```javascript var Float64Array = require( '@stdlib/array/float64' ); diff --git a/lib/node_modules/@stdlib/blas/base/idamax/benchmark/c/Makefile b/lib/node_modules/@stdlib/blas/base/idamax/benchmark/c/Makefile index 8ef44769c19..9f97140e7cb 100644 --- a/lib/node_modules/@stdlib/blas/base/idamax/benchmark/c/Makefile +++ b/lib/node_modules/@stdlib/blas/base/idamax/benchmark/c/Makefile @@ -69,8 +69,17 @@ else fPIC ?= -fPIC endif +# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): +INCLUDE ?= + # List of source files: -c_src := ../../src/idamax.c +SOURCE_FILES ?= + +# List of libraries (e.g., `-lopenblas -lpthread`): +LIBRARIES ?= + +# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): +LIBPATH ?= # List of C targets: c_targets := benchmark.length.out @@ -79,11 +88,15 @@ c_targets := benchmark.length.out # RULES # #/ -# Compiles C source files. +# Compiles source files. # # @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) # @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag indicating whether to generate position independent code (e.g., `-fPIC`) +# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) +# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) +# @param {string} [SOURCE_FILES] - list of source files +# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) +# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) # # @example # make @@ -99,12 +112,16 @@ all: $(c_targets) # Compiles C source files. # # @private -# @param {string} CC - C compiler -# @param {string} CFLAGS - C compiler flags -# @param {(string|void)} fPIC - compiler flag indicating whether to generate position independent code +# @param {string} CC - C compiler (e.g., `gcc`) +# @param {string} CFLAGS - C compiler options +# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) +# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) +# @param {string} SOURCE_FILES - list of source files +# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) +# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) #/ $(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) -I ../../include -o $@ $(c_src) $< -lm + $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) #/ # Runs compiled benchmarks. diff --git a/lib/node_modules/@stdlib/blas/base/idamax/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/blas/base/idamax/benchmark/c/benchmark.length.c index 9a23444cf58..0232f06156b 100644 --- a/lib/node_modules/@stdlib/blas/base/idamax/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/blas/base/idamax/benchmark/c/benchmark.length.c @@ -100,8 +100,8 @@ double rand_double( void ) { double benchmark( int iterations, int len ) { double elapsed; double x[ len ]; - double idx; double t; + int idx; int i; for ( i = 0; i < len; i++ ) { @@ -111,14 +111,14 @@ double benchmark( int iterations, int len ) { t = tic(); for ( i = 0; i < iterations; i++ ) { idx = c_idamax( len, x, 1 ); - if ( idx != idx ) { - printf( "should not return NaN\n" ); + if ( idx < -2 ) { + printf( "unexpected result\n" ); break; } } elapsed = tic() - t; - if ( idx != idx ) { - printf( "should not return NaN\n" ); + if ( idx < -2 ) { + printf( "unexpected result\n" ); } return elapsed; } diff --git a/lib/node_modules/@stdlib/blas/base/idamax/benchmark/fortran/benchmark.length.f b/lib/node_modules/@stdlib/blas/base/idamax/benchmark/fortran/benchmark.length.f index 9c2409b4f69..f1630549c8f 100644 --- a/lib/node_modules/@stdlib/blas/base/idamax/benchmark/fortran/benchmark.length.f +++ b/lib/node_modules/@stdlib/blas/base/idamax/benchmark/fortran/benchmark.length.f @@ -134,9 +134,9 @@ end function idamax integer, intent(in) :: iterations, len ! .. ! Local scalars: - integer :: idx double precision :: elapsed, r double precision :: t1, t2 + integer :: idx integer :: i ! .. ! Local arrays: @@ -150,16 +150,16 @@ end function idamax ! .. do i = 1, len call random_number( r ) - x( i ) = ( r*2000.0 ) - 1000.0 + x( i ) = ( r*2000.0d0 ) - 1000.0d0 end do ! .. - idx = -1 call cpu_time( t1 ) ! .. + idx = 0 do i = 1, iterations idx = idamax( len, x, 1 ) - if ( idx /= idx ) then - print '(A)', 'should not return NaN' + if ( idx < 0 .OR. idx > len ) then + print '(A)', 'unexpected result' exit end if end do @@ -168,8 +168,8 @@ end function idamax ! .. elapsed = t2 - t1 ! .. - if ( idx /= idx ) then - print '(A)', 'should not return NaN' + if ( idx < 0 .OR. idx > len ) then + print '(A)', 'unexpected result' end if ! .. ! Deallocate arrays: diff --git a/lib/node_modules/@stdlib/blas/base/idamax/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/idamax/docs/repl.txt index 95ac97c54f7..97f31b38472 100644 --- a/lib/node_modules/@stdlib/blas/base/idamax/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/base/idamax/docs/repl.txt @@ -1,6 +1,6 @@ {{alias}}( N, x, strideX ) - Finds the index of the first element having maximum absolute value. + Finds the index of the first element having the maximum absolute value. The `N` and `strideX` parameters determine which elements in `x` are accessed at runtime. @@ -8,7 +8,7 @@ Indexing is relative to the first index. To introduce an offset, use typed array views. - If `N < 1` or `strideX <= 0`, the function returns `0`. + If `N < 1` or `strideX <= 0`, the function returns `-1`. Parameters ---------- @@ -35,18 +35,18 @@ // Using `N` and `strideX` parameters: > x = new {{alias:@stdlib/array/float64}}( [ -2.0, 1.0, 3.0, -5.0 ] ); - > var idx = {{alias}}( 2, x, 2 ) + > idx = {{alias}}( 2, x, 2 ) 1 // Using view offsets: > var x0 = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 3.0, -4.0 ] ); > var x1 = new {{alias:@stdlib/array/float64}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); - > var idx = {{alias}}( 3, x1, 1 ) + > idx = {{alias}}( 3, x1, 1 ) 2 {{alias}}.ndarray( N, x, strideX, offsetX ) - Finds the index of the first element having maximum absolute value using + Finds the index of the first element having the maximum absolute value using alternative indexing semantics. While typed array views mandate a view offset based on the underlying @@ -81,7 +81,7 @@ // Using an index offset: > x = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 3.0, -4.0, 5.0, -6.0 ] ); - > var idx = {{alias}}.ndarray( 3, x, 2, 1 ) + > idx = {{alias}}.ndarray( 3, x, 2, 1 ) 2 See Also diff --git a/lib/node_modules/@stdlib/blas/base/idamax/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/idamax/docs/types/index.d.ts index 28bded096af..4cc63d8c76b 100644 --- a/lib/node_modules/@stdlib/blas/base/idamax/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/blas/base/idamax/docs/types/index.d.ts @@ -23,7 +23,7 @@ */ interface Routine { /** - * Finds the index of the first element having maximum absolute value. + * Finds the index of the first element having the maximum absolute value. * * @param N - number of indexed elements * @param x - input array @@ -41,7 +41,7 @@ interface Routine { ( N: number, x: Float64Array, strideX: number ): number; /** - * Finds the index of the first element having maximum absolute value using alternative indexing semantics. + * Finds the index of the first element having the maximum absolute value using alternative indexing semantics. * * @param N - number of indexed elements * @param x - input array @@ -61,7 +61,7 @@ interface Routine { } /** -* Finds the index of the first element having maximum absolute value. +* Finds the index of the first element having the maximum absolute value. * * @param N - number of indexed elements * @param x - input array @@ -81,8 +81,8 @@ interface Routine { * * var x = new Float64Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); * -* var idx = idamax.ndarray( x.length, x, 1, 1 ); -* // returns 2 +* var idx = idamax.ndarray( x.length, x, 1, 0 ); +* // returns 3 */ declare var idamax: Routine; diff --git a/lib/node_modules/@stdlib/blas/base/idamax/examples/c/Makefile b/lib/node_modules/@stdlib/blas/base/idamax/examples/c/Makefile index c34b13fb446..6aed70daf16 100644 --- a/lib/node_modules/@stdlib/blas/base/idamax/examples/c/Makefile +++ b/lib/node_modules/@stdlib/blas/base/idamax/examples/c/Makefile @@ -69,8 +69,17 @@ else fPIC ?= -fPIC endif +# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): +INCLUDE ?= + # List of source files: -c_src := ../../src/idamax.c +SOURCE_FILES ?= + +# List of libraries (e.g., `-lopenblas -lpthread`): +LIBRARIES ?= + +# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): +LIBPATH ?= # List of C targets: c_targets := example.out @@ -79,11 +88,15 @@ c_targets := example.out # RULES # #/ -# Compiles C source files. +# Compiles source files. # # @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) # @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag indicating whether to generate position independent code (e.g., `-fPIC`) +# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) +# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) +# @param {string} [SOURCE_FILES] - list of source files +# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) +# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) # # @example # make @@ -99,15 +112,19 @@ all: $(c_targets) # Compiles C source files. # # @private -# @param {string} CC - C compiler -# @param {string} CFLAGS - C compiler flags -# @param {(string|void)} fPIC - compiler flag indicating whether to generate position independent code +# @param {string} CC - C compiler (e.g., `gcc`) +# @param {string} CFLAGS - C compiler options +# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) +# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) +# @param {string} SOURCE_FILES - list of source files +# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) +# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) #/ $(c_targets): %.out: %.c - $(QUIET) $(CC) $(CFLAGS) $(fPIC) -I ../../include -o $@ $(c_src) $< -lm + $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) #/ -# Runs compiled benchmarks. +# Runs compiled examples. # # @example # make run diff --git a/lib/node_modules/@stdlib/blas/base/idamax/include/stdlib/blas/base/idamax.h b/lib/node_modules/@stdlib/blas/base/idamax/include/stdlib/blas/base/idamax.h index c1a0db04cf8..2288ac6057f 100644 --- a/lib/node_modules/@stdlib/blas/base/idamax/include/stdlib/blas/base/idamax.h +++ b/lib/node_modules/@stdlib/blas/base/idamax/include/stdlib/blas/base/idamax.h @@ -30,7 +30,7 @@ extern "C" { #endif /** -* Finds the index of the first element having maximum absolute value. +* Finds the index of the first element having the maximum absolute value. */ int c_idamax( const int N, const double *X, const int strideX ); diff --git a/lib/node_modules/@stdlib/blas/base/idamax/include/stdlib/blas/base/idamax_cblas.h b/lib/node_modules/@stdlib/blas/base/idamax/include/stdlib/blas/base/idamax_cblas.h index ee7aa1b679b..e44daf4ab01 100644 --- a/lib/node_modules/@stdlib/blas/base/idamax/include/stdlib/blas/base/idamax_cblas.h +++ b/lib/node_modules/@stdlib/blas/base/idamax/include/stdlib/blas/base/idamax_cblas.h @@ -30,7 +30,7 @@ extern "C" { #endif /** -* Finds the index of the first element having maximum absolute value. +* Finds the index of the first element having the maximum absolute value. */ int cblas_idamax( const int N, const double *X, const int strideX ); diff --git a/lib/node_modules/@stdlib/blas/base/idamax/include/stdlib/blas/base/idamax_fortran.h b/lib/node_modules/@stdlib/blas/base/idamax/include/stdlib/blas/base/idamax_fortran.h index f82050368e9..fe340f72181 100644 --- a/lib/node_modules/@stdlib/blas/base/idamax/include/stdlib/blas/base/idamax_fortran.h +++ b/lib/node_modules/@stdlib/blas/base/idamax/include/stdlib/blas/base/idamax_fortran.h @@ -30,7 +30,7 @@ extern "C" { #endif /** -* Finds the index of the first element having maximum absolute value. +* Finds the index of the first element having the maximum absolute value. */ void idamaxsub( const int *, const double *, const int *, int * ); diff --git a/lib/node_modules/@stdlib/blas/base/idamax/lib/idamax.js b/lib/node_modules/@stdlib/blas/base/idamax/lib/idamax.js index fc8b4f8b02f..524eba592ec 100644 --- a/lib/node_modules/@stdlib/blas/base/idamax/lib/idamax.js +++ b/lib/node_modules/@stdlib/blas/base/idamax/lib/idamax.js @@ -26,12 +26,12 @@ var abs = require( '@stdlib/math/base/special/abs' ); // MAIN // /** -* Finds the index of the first element having maximum absolute value. +* Finds the index of the first element having the maximum absolute value. * * @param {PositiveInteger} N - number of indexed elements -* @param {Float64Array} x - first input array +* @param {Float64Array} x - input array * @param {integer} strideX - `x` stride length -* @returns {integer} index of the first element having maximum absolute value +* @returns {integer} index value * * @example * var Float64Array = require( '@stdlib/array/float64' ); @@ -45,12 +45,13 @@ function idamax( N, x, strideX ) { var dmax; var idx; var ix; + var v; var i; - idx = 0; if ( N < 1 || strideX <= 0 ) { return -1; } + idx = 0; if ( N === 1 ) { return idx; } @@ -58,21 +59,22 @@ function idamax( N, x, strideX ) { // Code for stride equal to `1`... dmax = abs( x[ 0 ] ); for ( i = 1; i < N; i++ ) { - if ( abs( x[ i ] ) > dmax ) { + v = abs( x[ i ] ); + if ( v > dmax ) { idx = i; - dmax = abs( x[ i ] ); + dmax = v; } } return idx; } // Code for stride not equal to `1`... - ix = 0; dmax = abs( x[ 0 ] ); - ix += strideX; + ix = strideX; for ( i = 1; i < N; i++ ) { - if ( abs( x[ ix ] ) > dmax ) { + v = abs( x[ ix ] ); + if ( v > dmax ) { idx = i; - dmax = abs( x[ ix ] ); + dmax = v; } ix += strideX; } diff --git a/lib/node_modules/@stdlib/blas/base/idamax/lib/idamax.native.js b/lib/node_modules/@stdlib/blas/base/idamax/lib/idamax.native.js index eb1823e1921..4b4a5bea34b 100644 --- a/lib/node_modules/@stdlib/blas/base/idamax/lib/idamax.native.js +++ b/lib/node_modules/@stdlib/blas/base/idamax/lib/idamax.native.js @@ -26,10 +26,10 @@ var addon = require( './../src/addon.node' ); // MAIN // /** -* Finds the index of the first element having maximum absolute value. +* Finds the index of the first element having the maximum absolute value. * * @param {PositiveInteger} N - number of indexed elements -* @param {Float64Array} x - first input array +* @param {Float64Array} x - input array * @param {integer} strideX - `x` stride length * @returns {integer} index value * diff --git a/lib/node_modules/@stdlib/blas/base/idamax/lib/index.js b/lib/node_modules/@stdlib/blas/base/idamax/lib/index.js index 1e19f57085a..67386b98661 100644 --- a/lib/node_modules/@stdlib/blas/base/idamax/lib/index.js +++ b/lib/node_modules/@stdlib/blas/base/idamax/lib/index.js @@ -19,7 +19,7 @@ 'use strict'; /** -* BLAS level 1 routine to find the index of the first element having maximum absolute value. +* BLAS level 1 routine to find the index of the first element having the maximum absolute value. * * @module @stdlib/blas/base/idamax * diff --git a/lib/node_modules/@stdlib/blas/base/idamax/lib/ndarray.js b/lib/node_modules/@stdlib/blas/base/idamax/lib/ndarray.js index ca05bdc5da0..8b9fd18fc99 100644 --- a/lib/node_modules/@stdlib/blas/base/idamax/lib/ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/idamax/lib/ndarray.js @@ -26,13 +26,13 @@ var abs = require( '@stdlib/math/base/special/abs' ); // MAIN // /** -* Finds the index of the first element having maximum absolute value. +* Finds the index of the first element having the maximum absolute value. * * @param {PositiveInteger} N - number of indexed elements -* @param {Float64Array} x - first input array +* @param {Float64Array} x - input array * @param {integer} strideX - `x` stride length * @param {NonNegativeInteger} offsetX - starting index for `x` -* @returns {integer} index of the first element having maximum absolute value +* @returns {integer} index value * * @example * var Float64Array = require( '@stdlib/array/float64' ); @@ -46,22 +46,23 @@ function idamax( N, x, strideX, offsetX ) { var dmax; var idx; var ix; + var v; var i; - idx = 0; if ( N < 1 || strideX <= 0 ) { return -1; } + idx = 0; if ( N === 1 ) { return idx; } - ix = offsetX; - dmax = abs( x[ 0 ] ); - ix += strideX; + dmax = abs( x[ offsetX ] ); + ix = offsetX + strideX; for ( i = 1; i < N; i++ ) { - if ( abs( x[ ix ] ) > dmax ) { + v = abs( x[ ix ] ); + if ( v > dmax ) { idx = i; - dmax = abs( x[ ix ] ); + dmax = v; } ix += strideX; } diff --git a/lib/node_modules/@stdlib/blas/base/idamax/lib/ndarray.native.js b/lib/node_modules/@stdlib/blas/base/idamax/lib/ndarray.native.js index 98a99522873..e7333942ccc 100644 --- a/lib/node_modules/@stdlib/blas/base/idamax/lib/ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/base/idamax/lib/ndarray.native.js @@ -28,10 +28,10 @@ var addon = require( './idamax.native.js' ); // MAIN // /** -* Finds the index of the first element having maximum absolute value. +* Finds the index of the first element having the maximum absolute value. * * @param {integer} N - number of indexed elements -* @param {Float64Array} x - first input array +* @param {Float64Array} x - input array * @param {integer} strideX - `x` stride length * @param {NonNegativeInteger} offsetX - starting index for `x` * @returns {integer} index value @@ -46,11 +46,8 @@ var addon = require( './idamax.native.js' ); */ function idamax( N, x, strideX, offsetX ) { var viewX; - offsetX = minViewBufferIndex( N, strideX, offsetX ); - viewX = offsetView( x, offsetX ); - return addon( N, viewX, strideX ); } diff --git a/lib/node_modules/@stdlib/blas/base/idamax/manifest.json b/lib/node_modules/@stdlib/blas/base/idamax/manifest.json index 603c7bff78d..f1049aaf9fb 100644 --- a/lib/node_modules/@stdlib/blas/base/idamax/manifest.json +++ b/lib/node_modules/@stdlib/blas/base/idamax/manifest.json @@ -1,5 +1,6 @@ { "options": { + "task": "build", "os": "linux", "blas": "", "wasm": false @@ -28,6 +29,7 @@ ], "confs": [ { + "task": "build", "os": "linux", "blas": "", "wasm": false, @@ -45,10 +47,47 @@ "@stdlib/napi/export", "@stdlib/napi/argv", "@stdlib/napi/argv-int64", - "@stdlib/napi/argv-strided-float64array" + "@stdlib/napi/argv-strided-float64array", + "@stdlib/math/base/special/abs" ] }, { + "task": "benchmark", + "os": "linux", + "blas": "", + "wasm": false, + "src": [ + "./src/idamax.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/math/base/special/abs" + ] + }, + { + "task": "examples", + "os": "linux", + "blas": "", + "wasm": false, + "src": [ + "./src/idamax.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/math/base/special/abs" + ] + }, + + { + "task": "build", "os": "linux", "blas": "openblas", "wasm": false, @@ -71,6 +110,44 @@ ] }, { + "task": "benchmark", + "os": "linux", + "blas": "openblas", + "wasm": false, + "src": [ + "./src/idamax_cblas.c" + ], + "include": [ + "./include" + ], + "libraries": [ + "-lopenblas", + "-lpthread" + ], + "libpath": [], + "dependencies": [] + }, + { + "task": "examples", + "os": "linux", + "blas": "openblas", + "wasm": false, + "src": [ + "./src/idamax_cblas.c" + ], + "include": [ + "./include" + ], + "libraries": [ + "-lopenblas", + "-lpthread" + ], + "libpath": [], + "dependencies": [] + }, + + { + "task": "build", "os": "mac", "blas": "", "wasm": false, @@ -88,10 +165,47 @@ "@stdlib/napi/export", "@stdlib/napi/argv", "@stdlib/napi/argv-int64", - "@stdlib/napi/argv-strided-float64array" + "@stdlib/napi/argv-strided-float64array", + "@stdlib/math/base/special/abs" ] }, { + "task": "benchmark", + "os": "mac", + "blas": "", + "wasm": false, + "src": [ + "./src/idamax.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/math/base/special/abs" + ] + }, + { + "task": "examples", + "os": "mac", + "blas": "", + "wasm": false, + "src": [ + "./src/idamax.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/math/base/special/abs" + ] + }, + + { + "task": "build", "os": "mac", "blas": "apple_accelerate_framework", "wasm": false, @@ -113,6 +227,42 @@ ] }, { + "task": "benchmark", + "os": "mac", + "blas": "apple_accelerate_framework", + "wasm": false, + "src": [ + "./src/idamax_cblas.c" + ], + "include": [ + "./include" + ], + "libraries": [ + "-lblas" + ], + "libpath": [], + "dependencies": [] + }, + { + "task": "examples", + "os": "mac", + "blas": "apple_accelerate_framework", + "wasm": false, + "src": [ + "./src/idamax_cblas.c" + ], + "include": [ + "./include" + ], + "libraries": [ + "-lblas" + ], + "libpath": [], + "dependencies": [] + }, + + { + "task": "build", "os": "mac", "blas": "openblas", "wasm": false, @@ -135,6 +285,44 @@ ] }, { + "task": "benchmark", + "os": "mac", + "blas": "openblas", + "wasm": false, + "src": [ + "./src/idamax_cblas.c" + ], + "include": [ + "./include" + ], + "libraries": [ + "-lopenblas", + "-lpthread" + ], + "libpath": [], + "dependencies": [] + }, + { + "task": "examples", + "os": "mac", + "blas": "openblas", + "wasm": false, + "src": [ + "./src/idamax_cblas.c" + ], + "include": [ + "./include" + ], + "libraries": [ + "-lopenblas", + "-lpthread" + ], + "libpath": [], + "dependencies": [] + }, + + { + "task": "build", "os": "win", "blas": "", "wasm": false, @@ -150,10 +338,47 @@ "@stdlib/napi/export", "@stdlib/napi/argv", "@stdlib/napi/argv-int64", - "@stdlib/napi/argv-strided-float64array" + "@stdlib/napi/argv-strided-float64array", + "@stdlib/math/base/special/abs" ] }, { + "task": "benchmark", + "os": "win", + "blas": "", + "wasm": false, + "src": [ + "./src/idamax.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/math/base/special/abs" + ] + }, + { + "task": "examples", + "os": "win", + "blas": "", + "wasm": false, + "src": [ + "./src/idamax.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/math/base/special/abs" + ] + }, + + { + "task": "build", "os": "", "blas": "", "wasm": true, @@ -165,7 +390,9 @@ ], "libraries": [], "libpath": [], - "dependencies": [] + "dependencies": [ + "@stdlib/math/base/special/abs" + ] } ] } diff --git a/lib/node_modules/@stdlib/blas/base/idamax/package.json b/lib/node_modules/@stdlib/blas/base/idamax/package.json index 2823ada3371..0fb84ee480e 100644 --- a/lib/node_modules/@stdlib/blas/base/idamax/package.json +++ b/lib/node_modules/@stdlib/blas/base/idamax/package.json @@ -1,7 +1,7 @@ { "name": "@stdlib/blas/base/idamax", "version": "0.0.0", - "description": "Find the index of the first element having maximum absolute value.", + "description": "Find the index of the first element having the maximum absolute value.", "license": "Apache-2.0", "author": { "name": "The Stdlib Authors", @@ -61,6 +61,10 @@ "level 1", "idamax", "maximum", + "abs", + "absolute", + "find", + "index", "linear", "algebra", "subroutines", diff --git a/lib/node_modules/@stdlib/blas/base/idamax/src/addon.c b/lib/node_modules/@stdlib/blas/base/idamax/src/addon.c index d76418ba34d..63776a7e614 100644 --- a/lib/node_modules/@stdlib/blas/base/idamax/src/addon.c +++ b/lib/node_modules/@stdlib/blas/base/idamax/src/addon.c @@ -39,7 +39,7 @@ static napi_value addon( napi_env env, napi_callback_info info ) { STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, X, N, strideX, argv, 1 ); napi_value idx; - napi_status status = napi_create_int64( env, c_idamax( N, X, strideX ), &idx ); + napi_status status = napi_create_int32( env, c_idamax( N, X, strideX ), &idx ); // TODO: revisit once we support 64-bit integers as return values and 64 integers more generally in JavaScript assert( status == napi_ok ); return idx; } diff --git a/lib/node_modules/@stdlib/blas/base/idamax/src/idamax.c b/lib/node_modules/@stdlib/blas/base/idamax/src/idamax.c index 829d6a4c5be..f63236119ad 100644 --- a/lib/node_modules/@stdlib/blas/base/idamax/src/idamax.c +++ b/lib/node_modules/@stdlib/blas/base/idamax/src/idamax.c @@ -17,47 +17,50 @@ */ #include "stdlib/blas/base/idamax.h" -#include +#include "stdlib/math/base/special/abs.h" /** -* Finds the index of the first element having maximum fabsolute value. +* Finds the index of the first element having the maximum absolute value. * -* @param N number of indexed elements -* @param X input array -* @param strideX index increment for `x` +* @param N number of indexed elements +* @param X input array +* @param strideX stride length +* @return index value */ int c_idamax( const int N, const double *X, const int strideX ) { double dmax; + double v; int idx; int ix; int i; - idx = 0; if ( N < 1 || strideX <= 0 ) { return -1; } + idx = 0; if ( N == 1 ) { return idx; } - if (strideX == 1 ) { + if ( strideX == 1 ) { // Code for stride equal to `1`... - dmax = fabs( X[ 0 ] ); + dmax = stdlib_base_abs( X[ 0 ] ); for ( i = 1; i < N; i++ ) { - if ( fabs( X[ i ] ) > dmax ) { + v = stdlib_base_abs( X[ i ] ); + if ( v > dmax ) { idx = i; - dmax = fabs( X[ i ] ); + dmax = v; } } return idx; } // Code for stride not equal to `1`... - ix = 0; - dmax = fabs( X[ 0 ] ); - ix += strideX; + dmax = stdlib_base_abs( X[ 0 ] ); + ix = strideX; for ( i = 1; i < N; i++ ) { - if ( fabs( X[ ix ] ) > dmax ) { + v = stdlib_base_abs( X[ ix ] ); + if ( v > dmax ) { idx = i; - dmax = fabs( X[ ix ] ); + dmax = v; } ix += strideX; } diff --git a/lib/node_modules/@stdlib/blas/base/idamax/src/idamax.f b/lib/node_modules/@stdlib/blas/base/idamax/src/idamax.f index e510d697220..4361fb2557d 100644 --- a/lib/node_modules/@stdlib/blas/base/idamax/src/idamax.f +++ b/lib/node_modules/@stdlib/blas/base/idamax/src/idamax.f @@ -16,7 +16,7 @@ ! limitations under the License. !< -!> Find the index of the first element having maximum absolute value. +!> Find the index of the first element having the maximum absolute value. ! ! ## Notes ! @@ -51,6 +51,7 @@ ! @param {integer} N - number of indexed elements ! @param {Array} dx - input array ! @param {integer} stride - `dx` stride length +! @returns {integer} index value !< integer function idamax( N, dx, stride ) implicit none @@ -68,25 +69,23 @@ integer function idamax( N, dx, stride ) ! Intrinsic functions: intrinsic DABS ! .. - IDAMAX = 0 + idamax = 0 if ( N < 1 .OR. stride <= 0 ) then return end if - IDAMAX = 1 + idamax = 1 ! .. - ! If N is equal to `1`, return early... if ( N == 1 ) then return end if ! .. - ! If stride is equal to `1`, use unrolled loops... if ( stride == 1 ) then ! .. ! Code for increment equal to `1`... dmax = DABS( dx( 1 ) ) do i = 2, N if ( DABS( dx( i ) ) > dmax ) then - IDAMAX = i + idamax = i dmax = DABS( dx( i ) ) end if end do @@ -99,7 +98,7 @@ integer function idamax( N, dx, stride ) do i = 2, N ix = ix + stride if ( DABS( dx( ix ) ) > dmax ) then - IDAMAX = i + idamax = i dmax = DABS( dx( ix ) ) end if end do diff --git a/lib/node_modules/@stdlib/blas/base/idamax/src/idamax_cblas.c b/lib/node_modules/@stdlib/blas/base/idamax/src/idamax_cblas.c index 85906770886..6c7fd60c7d3 100644 --- a/lib/node_modules/@stdlib/blas/base/idamax/src/idamax_cblas.c +++ b/lib/node_modules/@stdlib/blas/base/idamax/src/idamax_cblas.c @@ -20,11 +20,12 @@ #include "stdlib/blas/base/idamax_cblas.h" /** -* Finds the index of the first element having maximum absolute value. +* Finds the index of the first element having the maximum absolute value. * -* @param N number of indexed elements -* @param X input array -* @param strideX index increment for `x` +* @param N number of indexed elements +* @param X input array +* @param strideX stride length +* @returns index value */ int c_idamax( const int N, const double *X, const int strideX ) { return cblas_idamax( N, X, strideX ); diff --git a/lib/node_modules/@stdlib/blas/base/idamax/src/idamax_f.c b/lib/node_modules/@stdlib/blas/base/idamax/src/idamax_f.c index 47232703f22..e86dc0cb504 100644 --- a/lib/node_modules/@stdlib/blas/base/idamax/src/idamax_f.c +++ b/lib/node_modules/@stdlib/blas/base/idamax/src/idamax_f.c @@ -16,20 +16,15 @@ * limitations under the License. */ -/** - * Find the index of the first element having maximum absolute value. - * - * @see idamax - */ #include "stdlib/blas/base/idamax.h" #include "stdlib/blas/base/idamax_fortran.h" /** -* Finds the index of the first element having maximum absolute value. +* Finds the index of the first element having the maximum absolute value. * * @param N number of indexed elements -* @param X first array -* @param strideX X stride length +* @param X input array +* @param strideX stride length * @return index value */ int c_idamax( const int N, const double *X, const int strideX ) { diff --git a/lib/node_modules/@stdlib/blas/base/idamax/src/idamaxsub.f b/lib/node_modules/@stdlib/blas/base/idamax/src/idamaxsub.f index 8ce187798f8..bf8ef3defab 100644 --- a/lib/node_modules/@stdlib/blas/base/idamax/src/idamaxsub.f +++ b/lib/node_modules/@stdlib/blas/base/idamax/src/idamaxsub.f @@ -19,9 +19,9 @@ !> Wraps `idamax` as a subroutine. ! ! @param {integer} N - number of indexed elements -! @param {Array} dx - first array -! @param {integer} strideX - `dx` stride length -! @param {integer} index - output variable reference +! @param {Array} dx - input array +! @param {integer} strideX - stride length +! @param {integer} idx - output variable reference !< subroutine idamaxsub( N, dx, strideX, idx ) implicit none @@ -40,7 +40,7 @@ end function idamax ! Array arguments: double precision :: dx(*) ! .. - ! Compute the dot product: + ! Find the maximum absolute value: idx = idamax( N, dx, strideX ) return end subroutine idamaxsub \ No newline at end of file diff --git a/lib/node_modules/@stdlib/blas/base/idamax/test/test.idamax.js b/lib/node_modules/@stdlib/blas/base/idamax/test/test.idamax.js index 25c196ad011..0de75844924 100644 --- a/lib/node_modules/@stdlib/blas/base/idamax/test/test.idamax.js +++ b/lib/node_modules/@stdlib/blas/base/idamax/test/test.idamax.js @@ -55,7 +55,7 @@ tape( 'the function finds the index of the element with the maximum absolute val expected = 2; idx = idamax( 4, x, 1 ); - t.deepEqual( idx, expected, 'returns expected value' ); + t.strictEqual( idx, expected, 'returns expected value' ); x = new Float64Array( [ 0.2, // 1 @@ -67,7 +67,7 @@ tape( 'the function finds the index of the element with the maximum absolute val expected = 1; idx = idamax( 3, x, 1 ); - t.deepEqual( idx, expected, 'returns expected value' ); + t.strictEqual( idx, expected, 'returns expected value' ); t.end(); }); @@ -85,7 +85,7 @@ tape( 'if provided an `N` parameter less than `1`, the function returns `-1`', f expected = -1; idx = idamax( 0, x, 1 ); - t.deepEqual( idx, expected, 'returns expected value' ); + t.strictEqual( idx, expected, 'returns expected value' ); t.end(); }); @@ -99,10 +99,10 @@ tape( 'if provided a `strideX` parameter less than or equal to `0`, the function expected = -1; idx = idamax( x.length, x, 0 ); - t.deepEqual( idx, expected, 'returns expected value' ); + t.strictEqual( idx, expected, 'returns expected value' ); idx = idamax( x.length, x, -1 ); - t.deepEqual( idx, expected, 'returns expected value' ); + t.strictEqual( idx, expected, 'returns expected value' ); t.end(); }); @@ -125,7 +125,7 @@ tape( 'the function supports specifying a stride', function test( t ) { expected = 2; idx = idamax( 4, x, 2 ); - t.deepEqual( idx, expected, 'returns expected value' ); + t.strictEqual( idx, expected, 'returns expected value' ); t.end(); }); @@ -148,6 +148,6 @@ tape( 'the function supports view offsets', function test( t ) { x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); idx = idamax( 3, x1, 2 ); - t.deepEqual( idx, expected, 'returns expected value' ); + t.strictEqual( idx, expected, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/blas/base/idamax/test/test.idamax.native.js b/lib/node_modules/@stdlib/blas/base/idamax/test/test.idamax.native.js index 245515e191d..b1aeead33ba 100644 --- a/lib/node_modules/@stdlib/blas/base/idamax/test/test.idamax.native.js +++ b/lib/node_modules/@stdlib/blas/base/idamax/test/test.idamax.native.js @@ -64,7 +64,7 @@ tape( 'the function finds the index of the element with the maximum absolute val expected = 2; idx = idamax( 4, x, 1 ); - t.deepEqual( idx, expected, 'returns expected value' ); + t.strictEqual( idx, expected, 'returns expected value' ); x = new Float64Array( [ 0.2, // 1 @@ -76,7 +76,7 @@ tape( 'the function finds the index of the element with the maximum absolute val expected = 1; idx = idamax( 3, x, 1 ); - t.deepEqual( idx, expected, 'returns expected value' ); + t.strictEqual( idx, expected, 'returns expected value' ); t.end(); }); @@ -94,7 +94,7 @@ tape( 'if provided an `N` parameter less than `1`, the function returns `-1`', o expected = -1; idx = idamax( 0, x, 1 ); - t.deepEqual( idx, expected, 'returns expected value' ); + t.strictEqual( idx, expected, 'returns expected value' ); t.end(); }); @@ -108,10 +108,10 @@ tape( 'if provided a `strideX` parameter less than or equal to `0`, the function expected = -1; idx = idamax( x.length, x, 0 ); - t.deepEqual( idx, expected, 'returns expected value' ); + t.strictEqual( idx, expected, 'returns expected value' ); idx = idamax( x.length, x, -1 ); - t.deepEqual( idx, expected, 'returns expected value' ); + t.strictEqual( idx, expected, 'returns expected value' ); t.end(); }); @@ -134,7 +134,7 @@ tape( 'the function supports specifying a stride', opts, function test( t ) { expected = 2; idx = idamax( 4, x, 2 ); - t.deepEqual( idx, expected, 'returns expected value' ); + t.strictEqual( idx, expected, 'returns expected value' ); t.end(); }); @@ -157,6 +157,6 @@ tape( 'the function supports view offsets', opts, function test( t ) { x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); idx = idamax( 3, x1, 2 ); - t.deepEqual( idx, expected, 'returns expected value' ); + t.strictEqual( idx, expected, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/blas/base/idamax/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/idamax/test/test.ndarray.js index d5ad8f3bf2e..09e33858adf 100644 --- a/lib/node_modules/@stdlib/blas/base/idamax/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/idamax/test/test.ndarray.js @@ -55,7 +55,7 @@ tape( 'the function finds the index of the element with the maximum absolute val expected = 2; idx = idamax( 4, x, 1, 0 ); - t.deepEqual( idx, expected, 'returns expected value' ); + t.strictEqual( idx, expected, 'returns expected value' ); x = new Float64Array( [ 0.2, // 1 @@ -67,7 +67,7 @@ tape( 'the function finds the index of the element with the maximum absolute val expected = 1; idx = idamax( 3, x, 1, 0 ); - t.deepEqual( idx, expected, 'returns expected value' ); + t.strictEqual( idx, expected, 'returns expected value' ); t.end(); }); @@ -85,7 +85,7 @@ tape( 'if provided an `N` parameter less than `1`, the function returns `0`', fu expected = -1; idx = idamax( 0, x, 1, 0 ); - t.deepEqual( idx, expected, 'returns expected value' ); + t.strictEqual( idx, expected, 'returns expected value' ); t.end(); }); @@ -99,10 +99,10 @@ tape( 'if provided a `strideX` parameter less than or equal to `0`, the function expected = -1; idx = idamax( x.length, x, 0, 0 ); - t.deepEqual( idx, expected, 'returns expected value' ); + t.strictEqual( idx, expected, 'returns expected value' ); idx = idamax( x.length, x, -1, 0 ); - t.deepEqual( idx, expected, 'returns expected value' ); + t.strictEqual( idx, expected, 'returns expected value' ); t.end(); }); @@ -125,7 +125,7 @@ tape( 'the function supports specifying a stride', function test( t ) { expected = 2; idx = idamax( 4, x, 2, 0 ); - t.deepEqual( idx, expected, 'returns expected value' ); + t.strictEqual( idx, expected, 'returns expected value' ); t.end(); }); @@ -145,7 +145,7 @@ tape( 'the function supports specifying an `x` offset', function test( t ) { expected = 4; idx = idamax( 5, x, 1, 1 ); - t.deepEqual( idx, expected, 'returns expected value' ); + t.strictEqual( idx, expected, 'returns expected value' ); t.end(); }); @@ -165,6 +165,6 @@ tape( 'the function supports complex access patterns', function test( t ) { expected = 2; idx = idamax( 3, x, 2, 1 ); - t.deepEqual( idx, expected, 'returns expected value' ); + t.strictEqual( idx, expected, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/blas/base/idamax/test/test.ndarray.native.js b/lib/node_modules/@stdlib/blas/base/idamax/test/test.ndarray.native.js index f84818e730a..3f081a3a5f5 100644 --- a/lib/node_modules/@stdlib/blas/base/idamax/test/test.ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/base/idamax/test/test.ndarray.native.js @@ -64,7 +64,7 @@ tape( 'the function finds the index of the element with the maximum absolute val expected = 2; idx = idamax( 4, x, 1, 0 ); - t.deepEqual( idx, expected, 'returns expected value' ); + t.strictEqual( idx, expected, 'returns expected value' ); x = new Float64Array( [ 0.2, // 1 @@ -76,7 +76,7 @@ tape( 'the function finds the index of the element with the maximum absolute val expected = 1; idx = idamax( 3, x, 1, 0 ); - t.deepEqual( idx, expected, 'returns expected value' ); + t.strictEqual( idx, expected, 'returns expected value' ); t.end(); }); @@ -94,7 +94,7 @@ tape( 'if provided an `N` parameter less than `1`, the function returns `0`', op expected = -1; idx = idamax( 0, x, 1, 0 ); - t.deepEqual( idx, expected, 'returns expected value' ); + t.strictEqual( idx, expected, 'returns expected value' ); t.end(); }); @@ -108,10 +108,10 @@ tape( 'if provided a `strideX` parameter less than or equal to `0`, the function expected = -1; idx = idamax( x.length, x, 0, 0 ); - t.deepEqual( idx, expected, 'returns expected value' ); + t.strictEqual( idx, expected, 'returns expected value' ); idx = idamax( x.length, x, -1, 5 ); - t.deepEqual( idx, expected, 'returns expected value' ); + t.strictEqual( idx, expected, 'returns expected value' ); t.end(); }); @@ -134,7 +134,7 @@ tape( 'the function supports specifying a stride', opts, function test( t ) { expected = 2; idx = idamax( 4, x, 2, 0 ); - t.deepEqual( idx, expected, 'returns expected value' ); + t.strictEqual( idx, expected, 'returns expected value' ); t.end(); }); @@ -154,7 +154,7 @@ tape( 'the function supports specifying an `x` offset', opts, function test( t ) expected = 4; idx = idamax( 5, x, 1, 1 ); - t.deepEqual( idx, expected, 'returns expected value' ); + t.strictEqual( idx, expected, 'returns expected value' ); t.end(); }); @@ -174,6 +174,6 @@ tape( 'the function supports complex access patterns', opts, function test( t ) expected = 2; idx = idamax( 3, x, 2, 1 ); - t.deepEqual( idx, expected, 'returns expected value' ); + t.strictEqual( idx, expected, 'returns expected value' ); t.end(); });