diff --git a/lib/node_modules/@stdlib/stats/base/scumin/README.md b/lib/node_modules/@stdlib/stats/base/scumin/README.md index fa46b155be22..c823109427f4 100644 --- a/lib/node_modules/@stdlib/stats/base/scumin/README.md +++ b/lib/node_modules/@stdlib/stats/base/scumin/README.md @@ -54,11 +54,11 @@ The function has the following parameters: - **N**: number of indexed elements. - **x**: input [`Float32Array`][@stdlib/array/float32]. -- **strideX**: index increment for `x`. +- **strideX**: stride length for `x`. - **y**: output [`Float32Array`][@stdlib/array/float32]. -- **strideY**: index increment for `y`. +- **strideY**: stride length for `y`. -The `N` and `stride` parameters determine which elements in `x` and `y` are accessed at runtime. For example, to compute the cumulative minimum of every other element in `x`, +The `N` and stride parameters determine which elements in the strided arrays are accessed at runtime. For example, to compute the cumulative minimum of every other element in `x`, ```javascript var Float32Array = require( '@stdlib/array/float32' ); @@ -108,7 +108,7 @@ The function has the following additional parameters: - **offsetX**: starting index for `x`. - **offsetY**: starting index for `y`. -While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying `buffer`, `offsetX` and `offsetY` parameters support indexing semantics based on a starting indices. For example, to calculate the cumulative minimum of every other value in `x` starting from the second value and to store in the last `N` elements of `y` starting from the last element +While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, offset parameters support indexing semantics based on a starting indices. For example, to calculate the cumulative minimum of every other element in `x` starting from the second element and to store in the last `N` elements of `y` starting from the last element ```javascript var Float32Array = require( '@stdlib/array/float32' ); @@ -141,20 +141,14 @@ scumin.ndarray( 4, x, 2, 1, y, -1, y.length-1 ); ```javascript -var randu = require( '@stdlib/random/base/randu' ); -var round = require( '@stdlib/math/base/special/round' ); +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); var Float32Array = require( '@stdlib/array/float32' ); var scumin = require( '@stdlib/stats/base/scumin' ); -var y; -var x; -var i; - -x = new Float32Array( 10 ); -y = new Float32Array( x.length ); -for ( i = 0; i < x.length; i++ ) { - x[ i ] = round( randu()*100.0 ); -} +var x = discreteUniform( 10, -50, 50, { + 'dtype': 'float32' +}); +var y = new Float32Array( x.length ); console.log( x ); console.log( y ); @@ -166,6 +160,132 @@ console.log( y ); + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/stats/base/scumin.h" +``` + +#### stdlib_strided_scumin( N, \*X, strideX, \*Y, strideY ) + +Computes the cumulative minimum of single-precision floating-point strided array elements. + +```c +const float x[] = { 1.0f, 2.0f, -3.0f, 4.0f, -5.0f, 6.0f, 7.0f, 8.0f }; +float y[] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f }; + +stdlib_strided_scumin( 4, x, 2, y, -2 ); +``` + +The function accepts the following arguments: + +- **N**: `[in] CBLAS_INT` number of indexed elements. +- **X**: `[in] float*` input array. +- **strideX**: `[in] CBLAS_INT` stride length for `X`. +- **Y**: `[out] float*` output array. +- **strideY**: `[in] CBLAS_INT` stride length for `Y`. + +```c +void stdlib_strided_scumin( const CBLAS_INT N, const float *X, const CBLAS_INT strideX, float *Y, const CBLAS_INT strideY ); +``` + +#### stdlib_strided_scumin_ndarray(N, \*X, strideX, offsetX, \*Y, strideY, offsetY ) + +Computes the cumulative minimum of single-precision floating-point strided array elements using alternative indexing semantics. + +```c +const float x[] = { 1.0f, 2.0f, -3.0f, 4.0f, -5.0f, 6.0f, 7.0f, 8.0f }; +float y[] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f }; + +stdlib_strided_scumin_ndarray( 4, x, 2, 0, y, -2, 0 ); +``` + +The function accepts the following arguments: + +- **N**: `[in] CBLAS_INT` number of indexed elements. +- **X**: `[in] float*` input array. +- **strideX**: `[in] CBLAS_INT` stride length for `X`. +- **offsetX**: `[in] CBLAS_INT` starting index for `X`. +- **Y**: `[out] float*` output array. +- **strideY**: `[in] CBLAS_INT` stride length for `Y`. +- **offsetY**: `[in] CBLAS_INT` starting index for `Y`. + +```c +void stdlib_strided_scumin_ndarray( const CBLAS_INT N, const float *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, float *Y, const CBLAS_INT strideY, const CBLAS_INT offsetY ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/stats/base/scumin.h" +#include + +int main( void ) { + // Create strided arrays: + const float x[] = { 1.0f, 2.0f, -3.0f, 4.0f, -5.0f, 6.0f, 7.0f, 8.0f }; + float y[] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f }; + + // Specify the number of elements: + const int N = 4; + + // Specify stride lengths: + const int strideX = 2; + const int strideY = -2; + + // Compute the cumulative minimum: + stdlib_strided_scumin( N, x, strideX, y, strideY ); + + // Print the result: + for ( int i = 0; i < 8; i++ ) { + printf( "y[ %d ] = %f\n", i, y[ i ] ); + } +} +``` + +
+ + + +
+ + +
diff --git a/lib/node_modules/@stdlib/stats/base/scumin/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/scumin/benchmark/benchmark.js index 209f95db0015..82a95b5f5a00 100644 --- a/lib/node_modules/@stdlib/stats/base/scumin/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/stats/base/scumin/benchmark/benchmark.js @@ -21,7 +21,7 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); +var uniform = require( '@stdlib/random/array/uniform' ); var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); var pow = require( '@stdlib/math/base/special/pow' ); var Float32Array = require( '@stdlib/array/float32' ); @@ -29,6 +29,13 @@ var pkg = require( './../package.json' ).name; var scumin = require( './../lib/scumin.js' ); +// VARIABLES // + +var options = { + 'dtype': 'float32' +}; + + // FUNCTIONS // /** @@ -39,15 +46,8 @@ var scumin = require( './../lib/scumin.js' ); * @returns {Function} benchmark function */ function createBenchmark( len ) { - var y; - var x; - var i; - - x = new Float32Array( len ); - y = new Float32Array( len ); - for ( i = 0; i < x.length; i++ ) { - x[ i ] = ( randu()*20.0 ) - 10.0; - } + var x = uniform( len, -10.0, 10.0, options ); + var y = new Float32Array( len ); return benchmark; function benchmark( b ) { diff --git a/lib/node_modules/@stdlib/stats/base/scumin/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/stats/base/scumin/benchmark/benchmark.native.js index 8e8b9eb7f742..a26023e2361f 100644 --- a/lib/node_modules/@stdlib/stats/base/scumin/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/stats/base/scumin/benchmark/benchmark.native.js @@ -22,7 +22,7 @@ var resolve = require( 'path' ).resolve; var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); +var uniform = require( '@stdlib/random/array/uniform' ); var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); var pow = require( '@stdlib/math/base/special/pow' ); var Float32Array = require( '@stdlib/array/float32' ); @@ -36,6 +36,9 @@ var scumin = tryRequire( resolve( __dirname, './../lib/scumin.native.js' ) ); var opts = { 'skip': ( scumin instanceof Error ) }; +var options = { + 'dtype': 'float32' +}; // FUNCTIONS // @@ -48,15 +51,8 @@ var opts = { * @returns {Function} benchmark function */ function createBenchmark( len ) { - var x; - var y; - var i; - - x = new Float32Array( len ); - y = new Float32Array( len ); - for ( i = 0; i < x.length; i++ ) { - x[ i ] = ( randu()*20.0 ) - 10.0; - } + var x = uniform( len, -10.0, 10.0, options ); + var y = new Float32Array( len ); return benchmark; function benchmark( b ) { diff --git a/lib/node_modules/@stdlib/stats/base/scumin/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/stats/base/scumin/benchmark/benchmark.ndarray.js index cbbd1e623e65..7f37ec681910 100644 --- a/lib/node_modules/@stdlib/stats/base/scumin/benchmark/benchmark.ndarray.js +++ b/lib/node_modules/@stdlib/stats/base/scumin/benchmark/benchmark.ndarray.js @@ -21,7 +21,7 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); +var uniform = require( '@stdlib/random/array/uniform' ); var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); var pow = require( '@stdlib/math/base/special/pow' ); var Float32Array = require( '@stdlib/array/float32' ); @@ -29,6 +29,13 @@ var pkg = require( './../package.json' ).name; var scumin = require( './../lib/ndarray.js' ); +// VARIABLES // + +var options = { + 'dtype': 'float32' +}; + + // FUNCTIONS // /** @@ -39,15 +46,8 @@ var scumin = require( './../lib/ndarray.js' ); * @returns {Function} benchmark function */ function createBenchmark( len ) { - var x; - var y; - var i; - - x = new Float32Array( len ); - y = new Float32Array( len ); - for ( i = 0; i < x.length; i++ ) { - x[ i ] = ( randu()*20.0 ) - 10.0; - } + var x = uniform( len, -10.0, 10.0, options ); + var y = new Float32Array( len ); return benchmark; function benchmark( b ) { diff --git a/lib/node_modules/@stdlib/stats/base/scumin/benchmark/benchmark.ndarray.native.js b/lib/node_modules/@stdlib/stats/base/scumin/benchmark/benchmark.ndarray.native.js index 86438854966d..cff33c47f5b8 100644 --- a/lib/node_modules/@stdlib/stats/base/scumin/benchmark/benchmark.ndarray.native.js +++ b/lib/node_modules/@stdlib/stats/base/scumin/benchmark/benchmark.ndarray.native.js @@ -22,7 +22,7 @@ var resolve = require( 'path' ).resolve; var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); +var uniform = require( '@stdlib/random/array/uniform' ); var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); var pow = require( '@stdlib/math/base/special/pow' ); var Float32Array = require( '@stdlib/array/float32' ); @@ -36,6 +36,9 @@ var scumin = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ); var opts = { 'skip': ( scumin instanceof Error ) }; +var options = { + 'dtype': 'float32' +}; // FUNCTIONS // @@ -48,15 +51,8 @@ var opts = { * @returns {Function} benchmark function */ function createBenchmark( len ) { - var x; - var y; - var i; - - x = new Float32Array( len ); - y = new Float32Array( len ); - for ( i = 0; i < x.length; i++ ) { - x[ i ] = ( randu()*20.0 ) - 10.0; - } + var x = uniform( len, -10.0, 10.0, options ); + var y = new Float32Array( len ); return benchmark; function benchmark( b ) { diff --git a/lib/node_modules/@stdlib/stats/base/scumin/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/stats/base/scumin/benchmark/c/benchmark.length.c index 075ff95496d9..22a4d0e1c61e 100644 --- a/lib/node_modules/@stdlib/stats/base/scumin/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/stats/base/scumin/benchmark/c/benchmark.length.c @@ -94,7 +94,7 @@ static float rand_float( void ) { * @param len array length * @return elapsed time in seconds */ -static double benchmark( int iterations, int len ) { +static double benchmark1( int iterations, int len ) { double elapsed; float x[ len ]; float y[ len ]; @@ -121,6 +121,40 @@ static double benchmark( int iterations, int len ) { return elapsed; } +/** +* Runs a benchmark. +* +* @param iterations number of iterations +* @param len array length +* @return elapsed time in seconds +*/ +static double benchmark2( int iterations, int len ) { + double elapsed; + float x[ len ]; + float y[ len ]; + double t; + int i; + + for ( i = 0; i < len; i++ ) { + x[ i ] = ( rand_float() * 20000.0f ) - 10000.0f; + y[ i ] = 0.0f; + } + t = tic(); + for ( i = 0; i < iterations; i++ ) { + x[ 0 ] += 1.0f; + stdlib_strided_scumin_ndarray( len, x, 1, 0, y, 1, 0 ); + if ( y[ 0 ] != y[ 0 ] ) { + printf( "should not return NaN\n" ); + break; + } + } + elapsed = tic() - t; + if ( y[ len-1 ] != y[ len-1 ] ) { + printf( "should not return NaN\n" ); + } + return elapsed; +} + /** * Main execution sequence. */ @@ -143,7 +177,18 @@ int main( void ) { for ( j = 0; j < REPEATS; j++ ) { count += 1; printf( "# c::%s:len=%d\n", NAME, len ); - elapsed = benchmark( iter, len ); + elapsed = benchmark1( iter, len ); + print_results( iter, elapsed ); + printf( "ok %d benchmark finished\n", count ); + } + } + for ( i = MIN; i <= MAX; i++ ) { + len = pow( 10, i ); + iter = ITERATIONS / pow( 10, i-1 ); + for ( j = 0; j < REPEATS; j++ ) { + count += 1; + printf( "# c::%s:ndarray:len=%d\n", NAME, len ); + elapsed = benchmark2( iter, len ); print_results( iter, elapsed ); printf( "ok %d benchmark finished\n", count ); } diff --git a/lib/node_modules/@stdlib/stats/base/scumin/docs/repl.txt b/lib/node_modules/@stdlib/stats/base/scumin/docs/repl.txt index 1689c56d26ff..6efb54f3da72 100644 --- a/lib/node_modules/@stdlib/stats/base/scumin/docs/repl.txt +++ b/lib/node_modules/@stdlib/stats/base/scumin/docs/repl.txt @@ -3,8 +3,8 @@ Computes the cumulative minimum of single-precision floating-point strided array elements. - The `N` and `stride` parameters determine which elements in `x` and `y` are - accessed at runtime. + The `N` and stride parameters determine which elements in the strided arrays + are accessed at runtime. Indexing is relative to the first index. To introduce an offset, use a typed array view. @@ -20,13 +20,13 @@ Input array. strideX: integer - Index increment for `x`. + Stride Length for `x`. y: Float32Array Output array. strideY: integer - Index increment for `y`. + Stride Length for `y`. Returns ------- @@ -41,11 +41,10 @@ > {{alias}}( x.length, x, 1, y, 1 ) [ 1.0, -2.0, -2.0 ] - // Using `N` and `stride` parameters: + // Using `N` and stride parameters: > x = new {{alias:@stdlib/array/float32}}( [ -2.0, 1.0, 1.0, -5.0, 2.0, -1.0 ] ); > y = new {{alias:@stdlib/array/float32}}( x.length ); - > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 ); - > {{alias}}( N, x, 2, y, 2 ) + > {{alias}}( 3, x, 2, y, 2 ) [ -2.0, 0.0, -2.0, 0.0, -2.0, 0.0 ] // Using view offsets: @@ -53,12 +52,12 @@ > var y0 = new {{alias:@stdlib/array/float32}}( x0.length ); > var x1 = new {{alias:@stdlib/array/float32}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); > var y1 = new {{alias:@stdlib/array/float32}}( y0.buffer, y0.BYTES_PER_ELEMENT*3 ); - > N = {{alias:@stdlib/math/base/special/floor}}( x0.length / 2 ); - > {{alias}}( N, x1, 2, y1, 1 ) + > {{alias}}( 3, x1, 2, y1, 1 ) [ -2.0, -2.0, -2.0 ] > y0 [ 0.0, 0.0, 0.0, -2.0, -2.0, -2.0 ] + {{alias}}.ndarray( N, x, strideX, offsetX, y, strideY, offsetY ) Computes the cumulative minimum of single-precision floating-point strided array elements using alternative indexing semantics. @@ -76,7 +75,7 @@ Input array. strideX: integer - Index increment for `x`. + Stride Length for `x`. offsetX: integer Starting index for `x`. @@ -85,7 +84,7 @@ Output array. strideY: integer - Index increment for `y`. + Stride Length for `y`. offsetY: integer Starting index for `y`. @@ -106,8 +105,7 @@ // Advanced indexing: > x = new {{alias:@stdlib/array/float32}}( [ 1.0, -2.0, 3.0, 2.0, 5.0, -1.0 ] ); > y = new {{alias:@stdlib/array/float32}}( x.length ); - > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 ); - > {{alias}}.ndarray( N, x, 2, 1, y, -1, y.length-1 ) + > {{alias}}.ndarray( 3, x, 2, 1, y, -1, y.length-1 ) [ 0.0, 0.0, 0.0, -2.0, -2.0, -2.0 ] See Also diff --git a/lib/node_modules/@stdlib/stats/base/scumin/examples/c/example.c b/lib/node_modules/@stdlib/stats/base/scumin/examples/c/example.c index 38c2f9642b39..5591ee482a68 100644 --- a/lib/node_modules/@stdlib/stats/base/scumin/examples/c/example.c +++ b/lib/node_modules/@stdlib/stats/base/scumin/examples/c/example.c @@ -17,27 +17,25 @@ */ #include "stdlib/stats/base/scumin.h" -#include #include -#include int main( void ) { // Create strided arrays: - float x[] = { 1.0, 2.0, -3.0, 4.0, -5.0, 6.0, 7.0, 8.0 }; - float y[] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }; + const float x[] = { 1.0f, 2.0f, -3.0f, 4.0f, -5.0f, 6.0f, 7.0f, 8.0f }; + float y[] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f }; // Specify the number of elements: - int64_t N = 4; + const int N = 4; // Specify stride lengths: - int64_t strideX = 2; - int64_t strideY = -2; + const int strideX = 2; + const int strideY = -2; // Compute the cumulative minimum: stdlib_strided_scumin( N, x, strideX, y, strideY ); // Print the result: - for ( int64_t i = 0; i < 8; i++ ) { - printf( "y[ %"PRId64" ] = %f\n", i, y[ i ] ); + for ( int i = 0; i < 8; i++ ) { + printf( "y[ %d ] = %f\n", i, y[ i ] ); } } diff --git a/lib/node_modules/@stdlib/stats/base/scumin/examples/index.js b/lib/node_modules/@stdlib/stats/base/scumin/examples/index.js index cb0647a6d30c..f5f24e86f65c 100644 --- a/lib/node_modules/@stdlib/stats/base/scumin/examples/index.js +++ b/lib/node_modules/@stdlib/stats/base/scumin/examples/index.js @@ -18,20 +18,14 @@ 'use strict'; -var randu = require( '@stdlib/random/base/randu' ); -var round = require( '@stdlib/math/base/special/round' ); +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); var Float32Array = require( '@stdlib/array/float32' ); var scumin = require( './../lib' ); -var y; -var x; -var i; - -x = new Float32Array( 10 ); -y = new Float32Array( x.length ); -for ( i = 0; i < x.length; i++ ) { - x[ i ] = round( randu()*100.0 ); -} +var x = discreteUniform( 10, -50, 50, { + 'dtype': 'float32' +}); +var y = new Float32Array( x.length ); console.log( x ); console.log( y ); diff --git a/lib/node_modules/@stdlib/stats/base/scumin/include/stdlib/stats/base/scumin.h b/lib/node_modules/@stdlib/stats/base/scumin/include/stdlib/stats/base/scumin.h index ac23fb5c0adb..d23cd41ee8ba 100644 --- a/lib/node_modules/@stdlib/stats/base/scumin/include/stdlib/stats/base/scumin.h +++ b/lib/node_modules/@stdlib/stats/base/scumin/include/stdlib/stats/base/scumin.h @@ -19,7 +19,7 @@ #ifndef STDLIB_STATS_BASE_SCUMIN_H #define STDLIB_STATS_BASE_SCUMIN_H -#include +#include "stdlib/blas/base/shared.h" /* * If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. @@ -31,7 +31,12 @@ extern "C" { /** * Computes the cumulative minimum of single-precision floating-point strided array elements. */ -void stdlib_strided_scumin( const int64_t N, const float *X, const int64_t strideX, float *Y, const int64_t strideY ); +void API_SUFFIX(stdlib_strided_scumin)( const CBLAS_INT N, const float *X, const CBLAS_INT strideX, float *Y, const CBLAS_INT strideY ); + +/** +* Computes the cumulative minimum of single-precision floating-point strided array elements using alternative indexing semantics. +*/ +void API_SUFFIX(stdlib_strided_scumin_ndarray)( const CBLAS_INT N, const float *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, float *Y, const CBLAS_INT strideY, const CBLAS_INT offsetY ); #ifdef __cplusplus } diff --git a/lib/node_modules/@stdlib/stats/base/scumin/lib/index.js b/lib/node_modules/@stdlib/stats/base/scumin/lib/index.js index 5586e56d769a..061b684d1ddb 100644 --- a/lib/node_modules/@stdlib/stats/base/scumin/lib/index.js +++ b/lib/node_modules/@stdlib/stats/base/scumin/lib/index.js @@ -29,21 +29,18 @@ * * var x = new Float32Array( [ 1.0, -2.0, 2.0 ] ); * var y = new Float32Array( x.length ); -* var N = x.length; * -* scumin( N, x, 1, y, 1 ); +* scumin( x.length, x, 1, y, 1 ); * // y => [ 1.0, -2.0, -2.0 ] * * @example * var Float32Array = require( '@stdlib/array/float32' ); -* var floor = require( '@stdlib/math/base/special/floor' ); * var scumin = require( '@stdlib/stats/base/scumin' ); * * var x = new Float32Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] ); * var y = new Float32Array( x.length ); -* var N = floor( x.length / 2 ); * -* scumin.ndarray( N, x, 2, 1, y, 1, 0 ); +* scumin.ndarray( 4, x, 2, 1, y, 1, 0 ); * // y => [ 1.0, -2.0, -2.0, -2.0, 0.0, 0.0, 0.0, 0.0 ] */ diff --git a/lib/node_modules/@stdlib/stats/base/scumin/lib/ndarray.js b/lib/node_modules/@stdlib/stats/base/scumin/lib/ndarray.js index ca104af2e9b1..bfc52052310b 100644 --- a/lib/node_modules/@stdlib/stats/base/scumin/lib/ndarray.js +++ b/lib/node_modules/@stdlib/stats/base/scumin/lib/ndarray.js @@ -40,13 +40,11 @@ var isNegativeZerof = require( '@stdlib/math/base/assert/is-negative-zerof' ); * * @example * var Float32Array = require( '@stdlib/array/float32' ); -* var floor = require( '@stdlib/math/base/special/floor' ); * * var x = new Float32Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] ); * var y = new Float32Array( x.length ); -* var N = floor( x.length / 2 ); * -* var v = scumin( N, x, 2, 1, y, 1, 0 ); +* var v = scumin( 4, x, 2, 1, y, 1, 0 ); * // returns [ 1.0, -2.0, -2.0, -2.0, 0.0, 0.0, 0.0, 0.0 ] */ function scumin( N, x, strideX, offsetX, y, strideY, offsetY ) { diff --git a/lib/node_modules/@stdlib/stats/base/scumin/lib/ndarray.native.js b/lib/node_modules/@stdlib/stats/base/scumin/lib/ndarray.native.js index fbe4aca2c82c..c014219f089e 100644 --- a/lib/node_modules/@stdlib/stats/base/scumin/lib/ndarray.native.js +++ b/lib/node_modules/@stdlib/stats/base/scumin/lib/ndarray.native.js @@ -20,8 +20,7 @@ // MODULES // -var Float32Array = require( '@stdlib/array/float32' ); -var addon = require( './scumin.native.js' ); +var addon = require( './../src/addon.node' ); // MAIN // @@ -40,27 +39,15 @@ var addon = require( './scumin.native.js' ); * * @example * var Float32Array = require( '@stdlib/array/float32' ); -* var floor = require( '@stdlib/math/base/special/floor' ); * * var x = new Float32Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] ); * var y = new Float32Array( x.length ); -* var N = floor( x.length / 2 ); * -* var v = scumin( N, x, 2, 1, y, 1, 0 ); +* var v = scumin( 4, x, 2, 1, y, 1, 0 ); * // returns [ 1.0, -2.0, -2.0, -2.0, 0.0, 0.0, 0.0, 0.0 ] */ function scumin( N, x, strideX, offsetX, y, strideY, offsetY ) { - var viewX; - var viewY; - if ( strideX < 0 ) { - offsetX += (N-1) * strideX; - } - if ( strideY < 0 ) { - offsetY += (N-1) * strideY; - } - viewX = new Float32Array( x.buffer, x.byteOffset+(x.BYTES_PER_ELEMENT*offsetX), x.length-offsetX ); // eslint-disable-line max-len - viewY = new Float32Array( y.buffer, y.byteOffset+(y.BYTES_PER_ELEMENT*offsetY), y.length-offsetY ); // eslint-disable-line max-len - addon( N, viewX, strideX, viewY, strideY ); + addon.ndarray( N, x, strideX, offsetX, y, strideY, offsetY ); return y; } diff --git a/lib/node_modules/@stdlib/stats/base/scumin/lib/scumin.js b/lib/node_modules/@stdlib/stats/base/scumin/lib/scumin.js index 9345c3089792..a56aaa050385 100644 --- a/lib/node_modules/@stdlib/stats/base/scumin/lib/scumin.js +++ b/lib/node_modules/@stdlib/stats/base/scumin/lib/scumin.js @@ -20,8 +20,8 @@ // MODULES // -var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); -var isNegativeZerof = require( '@stdlib/math/base/assert/is-negative-zerof' ); +var stride2offset = require( '@stdlib/strided/base/stride2offset' ); +var ndarray = require( './ndarray.js' ); // MAIN // @@ -41,58 +41,14 @@ var isNegativeZerof = require( '@stdlib/math/base/assert/is-negative-zerof' ); * * var x = new Float32Array( [ 1.0, -2.0, 2.0 ] ); * var y = new Float32Array( x.length ); -* var N = x.length; * -* var v = scumin( N, x, 1, y, 1 ); +* var v = scumin( x.length, x, 1, y, 1 ); * // returns [ 1.0, -2.0, -2.0 ] */ function scumin( N, x, strideX, y, strideY ) { - var min; - var ix; - var iy; - var v; - var i; - - if ( N <= 0 ) { - return y; - } - if ( strideX < 0 ) { - ix = (1-N) * strideX; - } else { - ix = 0; - } - if ( strideY < 0 ) { - iy = (1-N) * strideY; - } else { - iy = 0; - } - min = x[ ix ]; - y[ iy ] = min; - - iy += strideY; - i = 1; - if ( isnanf( min ) === false ) { - for ( i; i < N; i++ ) { - ix += strideX; - v = x[ ix ]; - if ( isnanf( v ) ) { - min = v; - break; - } - if ( v < min || ( v === min && isNegativeZerof( v ) ) ) { - min = v; - } - y[ iy ] = min; - iy += strideY; - } - } - if ( isnanf( min ) ) { - for ( i; i < N; i++ ) { - y[ iy ] = min; - iy += strideY; - } - } - return y; + var ox = stride2offset( N, strideX ); + var oy = stride2offset( N, strideY ); + return ndarray( N, x, strideX, ox, y, strideY, oy ); } diff --git a/lib/node_modules/@stdlib/stats/base/scumin/lib/scumin.native.js b/lib/node_modules/@stdlib/stats/base/scumin/lib/scumin.native.js index eb64296a84e9..b48a97aba623 100644 --- a/lib/node_modules/@stdlib/stats/base/scumin/lib/scumin.native.js +++ b/lib/node_modules/@stdlib/stats/base/scumin/lib/scumin.native.js @@ -40,9 +40,8 @@ var addon = require( './../src/addon.node' ); * * var x = new Float32Array( [ 1.0, -2.0, 2.0 ] ); * var y = new Float32Array( x.length ); -* var N = x.length; * -* var v = scumin( N, x, 1, y, 1 ); +* var v = scumin( x.length, x, 1, y, 1 ); * // returns [ 1.0, -2.0, -2.0 ] */ function scumin( N, x, strideX, y, strideY ) { diff --git a/lib/node_modules/@stdlib/stats/base/scumin/manifest.json b/lib/node_modules/@stdlib/stats/base/scumin/manifest.json index ca723f7115ce..ec1f8510708f 100644 --- a/lib/node_modules/@stdlib/stats/base/scumin/manifest.json +++ b/lib/node_modules/@stdlib/stats/base/scumin/manifest.json @@ -1,6 +1,7 @@ { "options": { - "task": "build" + "task": "build", + "wasm": false }, "fields": [ { @@ -27,19 +28,20 @@ "confs": [ { "task": "build", + "wasm": false, "src": [ - "./src/scumin.c" + "./src/main.c" ], "include": [ "./include" ], - "libraries": [ - "-lm" - ], + "libraries": [], "libpath": [], "dependencies": [ - "@stdlib/math/base/assert/is-nanf", + "@stdlib/blas/base/shared", + "@stdlib/strided/base/stride2offset", "@stdlib/math/base/assert/is-negative-zerof", + "@stdlib/math/base/assert/is-nanf", "@stdlib/napi/export", "@stdlib/napi/argv", "@stdlib/napi/argv-int64", @@ -48,34 +50,54 @@ }, { "task": "benchmark", + "wasm": false, "src": [ - "./src/scumin.c" + "./src/main.c" ], "include": [ "./include" ], - "libraries": [ - "-lm" + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/strided/base/stride2offset", + "@stdlib/math/base/assert/is-negative-zerof", + "@stdlib/math/base/assert/is-nanf" + ] + }, + { + "task": "examples", + "wasm": false, + "src": [ + "./src/main.c" + ], + "include": [ + "./include" ], + "libraries": [], "libpath": [], "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/strided/base/stride2offset", "@stdlib/math/base/assert/is-nanf", "@stdlib/math/base/assert/is-negative-zerof" ] }, { - "task": "examples", + "task": "", + "wasm": true, "src": [ - "./src/scumin.c" + "./src/main.c" ], "include": [ "./include" ], - "libraries": [ - "-lm" - ], + "libraries": [], "libpath": [], "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/strided/base/stride2offset", "@stdlib/math/base/assert/is-nanf", "@stdlib/math/base/assert/is-negative-zerof" ] diff --git a/lib/node_modules/@stdlib/stats/base/scumin/src/addon.c b/lib/node_modules/@stdlib/stats/base/scumin/src/addon.c index f8f4aaf2d484..bcab8f099a35 100644 --- a/lib/node_modules/@stdlib/stats/base/scumin/src/addon.c +++ b/lib/node_modules/@stdlib/stats/base/scumin/src/addon.c @@ -17,6 +17,7 @@ */ #include "stdlib/stats/base/scumin.h" +#include "stdlib/blas/base/shared.h" #include "stdlib/napi/export.h" #include "stdlib/napi/argv.h" #include "stdlib/napi/argv_int64.h" @@ -37,8 +38,28 @@ static napi_value addon( napi_env env, napi_callback_info info ) { STDLIB_NAPI_ARGV_INT64( env, strideY, argv, 4 ); STDLIB_NAPI_ARGV_STRIDED_FLOAT32ARRAY( env, X, N, strideX, argv, 1 ); STDLIB_NAPI_ARGV_STRIDED_FLOAT32ARRAY( env, Y, N, strideY, argv, 3 ); - stdlib_strided_scumin( N, X, strideX, Y, strideY ); + API_SUFFIX(stdlib_strided_scumin)( N, X, strideX, Y, strideY ); return NULL; } -STDLIB_NAPI_MODULE_EXPORT_FCN( addon ) +/** +* Receives JavaScript callback invocation data. +* +* @param env environment under which the function is invoked +* @param info callback data +* @return Node-API value +*/ +static napi_value addon_method( napi_env env, napi_callback_info info ) { + STDLIB_NAPI_ARGV( env, info, argv, argc, 7 ); + STDLIB_NAPI_ARGV_INT64( env, N, argv, 0 ); + STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 2 ); + STDLIB_NAPI_ARGV_INT64( env, strideY, argv, 5 ); + STDLIB_NAPI_ARGV_INT64( env, offsetX, argv, 3 ); + STDLIB_NAPI_ARGV_INT64( env, offsetY, argv, 6 ); + STDLIB_NAPI_ARGV_STRIDED_FLOAT32ARRAY( env, X, N, strideX, argv, 1 ); + STDLIB_NAPI_ARGV_STRIDED_FLOAT32ARRAY( env, Y, N, strideY, argv, 4 ); + API_SUFFIX(stdlib_strided_scumin_ndarray)( N, X, strideX, offsetX, Y, strideY, offsetY ); + return NULL; +} + +STDLIB_NAPI_MODULE_EXPORT_FCN_WITH_METHOD( addon, "ndarray", addon_method ) diff --git a/lib/node_modules/@stdlib/stats/base/scumin/src/scumin.c b/lib/node_modules/@stdlib/stats/base/scumin/src/main.c similarity index 58% rename from lib/node_modules/@stdlib/stats/base/scumin/src/scumin.c rename to lib/node_modules/@stdlib/stats/base/scumin/src/main.c index 070081b0b63f..f94f3a11b494 100644 --- a/lib/node_modules/@stdlib/stats/base/scumin/src/scumin.c +++ b/lib/node_modules/@stdlib/stats/base/scumin/src/main.c @@ -19,7 +19,8 @@ #include "stdlib/stats/base/scumin.h" #include "stdlib/math/base/assert/is_nanf.h" #include "stdlib/math/base/assert/is_negative_zerof.h" -#include +#include "stdlib/blas/base/shared.h" +#include "stdlib/strided/base/stride2offset.h" /** * Computes the cumulative minimum of single-precision floating-point strided array elements. @@ -30,26 +31,36 @@ * @param Y output array * @param strideY Y stride length */ -void stdlib_strided_scumin( const int64_t N, const float *X, const int64_t strideX, float *Y, const int64_t strideY ) { - int64_t ix; - int64_t iy; - int64_t i; +void API_SUFFIX(stdlib_strided_scumin)( const CBLAS_INT N, const float *X, const CBLAS_INT strideX, float *Y, const CBLAS_INT strideY ) { + const CBLAS_INT ox = stdlib_strided_stride2offset( N, strideX ); + const CBLAS_INT oy = stdlib_strided_stride2offset( N, strideY ); + API_SUFFIX(stdlib_strided_scumin_ndarray)( N, X, strideX, ox, Y, strideY, oy ); + return; +} + +/** +* Computes the cumulative minimum of single-precision floating-point strided array elements using alternative indexing semantics. +* +* @param N number of indexed elements +* @param X input array +* @param strideX X stride length +* @param offsetX starting index for X +* @param Y output array +* @param strideY Y stride length +* @param offsetY starting index for Y +*/ +void API_SUFFIX(stdlib_strided_scumin_ndarray)( const CBLAS_INT N, const float *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, float *Y, const CBLAS_INT strideY, const CBLAS_INT offsetY ) { + CBLAS_INT ix; + CBLAS_INT iy; + CBLAS_INT i; float min; float v; if ( N <= 0 ) { return; } - if ( strideX < 0 ) { - ix = (1-N) * strideX; - } else { - ix = 0; - } - if ( strideY < 0 ) { - iy = (1-N) * strideY; - } else { - iy = 0; - } + ix = offsetX; + iy = offsetY; min = X[ ix ]; Y[ iy ] = min; diff --git a/lib/node_modules/@stdlib/stats/base/scumin/test/test.ndarray.js b/lib/node_modules/@stdlib/stats/base/scumin/test/test.ndarray.js index 8274e7a83c04..e9133373df5f 100644 --- a/lib/node_modules/@stdlib/stats/base/scumin/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/stats/base/scumin/test/test.ndarray.js @@ -21,7 +21,6 @@ // MODULES // var tape = require( 'tape' ); -var floor = require( '@stdlib/math/base/special/floor' ); var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); var isNegativeZerof = require( '@stdlib/math/base/assert/is-negative-zerof' ); var Float32Array = require( '@stdlib/array/float32' ); @@ -150,7 +149,6 @@ tape( 'the function supports an `x` stride', function test( t ) { var expected; var x; var y; - var N; x = new Float32Array([ 1.0, // 0 @@ -166,9 +164,8 @@ tape( 'the function supports an `x` stride', function test( t ) { 0.0, 0.0 ]); - N = 3; - scumin( N, x, 2, 0, y, 1, 0 ); + scumin( 3, x, 2, 0, y, 1, 0 ); expected = new Float32Array( [ 1.0, 1.0, -5.0, 0.0, 0.0 ] ); t.deepEqual( y, expected, 'returns expected value' ); @@ -180,7 +177,6 @@ tape( 'the function supports a `y` stride', function test( t ) { var expected; var x; var y; - var N; x = new Float32Array([ 1.0, // 0 @@ -196,9 +192,8 @@ tape( 'the function supports a `y` stride', function test( t ) { 0.0, 0.0 // 2 ]); - N = 3; - scumin( N, x, 1, 0, y, 2, 0 ); + scumin( 3, x, 1, 0, y, 2, 0 ); expected = new Float32Array( [ 1.0, 0.0, -2.0, 0.0, -2.0 ] ); t.deepEqual( y, expected, 'returns expected value' ); @@ -210,7 +205,6 @@ tape( 'the function supports negative strides', function test( t ) { var expected; var x; var y; - var N; x = new Float32Array([ 1.0, // 2 @@ -226,9 +220,8 @@ tape( 'the function supports negative strides', function test( t ) { 0.0, 0.0 ]); - N = 3; - scumin( N, x, -2, x.length-1, y, -1, 2 ); + scumin( 3, x, -2, x.length-1, y, -1, 2 ); expected = new Float32Array( [ -5.0, -5.0, -5.0, 0.0, 0.0 ] ); t.deepEqual( y, expected, 'returns expected value' ); @@ -238,7 +231,6 @@ tape( 'the function supports negative strides', function test( t ) { tape( 'the function supports an `x` offset', function test( t ) { var expected; - var N; var x; var y; @@ -262,9 +254,8 @@ tape( 'the function supports an `x` offset', function test( t ) { 0.0, 0.0 ]); - N = floor( x.length / 2 ); - scumin( N, x, 2, 1, y, 1, 0 ); + scumin( 4, x, 2, 1, y, 1, 0 ); expected = new Float32Array( [ 1.0, -2.0, -2.0, -2.0, 0.0, 0.0, 0.0, 0.0 ] ); // eslint-disable-line max-len t.deepEqual( y, expected, 'returns expected value' ); @@ -274,7 +265,6 @@ tape( 'the function supports an `x` offset', function test( t ) { tape( 'the function supports a `y` offset', function test( t ) { var expected; - var N; var x; var y; @@ -298,9 +288,8 @@ tape( 'the function supports a `y` offset', function test( t ) { 0.0, 0.0 // 3 ]); - N = floor( x.length / 2 ); - scumin( N, x, 1, 0, y, 2, 1 ); + scumin( 4, x, 1, 0, y, 2, 1 ); expected = new Float32Array( [ 0.0, 2.0, 0.0, 1.0, 0.0, 1.0, 0.0, -2.0 ] ); t.deepEqual( y, expected, 'returns expected value' ); @@ -312,7 +301,6 @@ tape( 'the function supports complex access patterns', function test( t ) { var expected; var x; var y; - var N; x = new Float32Array([ 1.0, // 0 @@ -330,9 +318,8 @@ tape( 'the function supports complex access patterns', function test( t ) { 0.0, 0.0 ]); - N = 3; - scumin( N, x, 2, 0, y, -1, 2 ); + scumin( 3, x, 2, 0, y, -1, 2 ); expected = new Float32Array( [ -3.0, -3.0, 1.0, 0.0, 0.0, 0.0 ] ); t.deepEqual( y, expected, 'returns expected value' ); diff --git a/lib/node_modules/@stdlib/stats/base/scumin/test/test.ndarray.native.js b/lib/node_modules/@stdlib/stats/base/scumin/test/test.ndarray.native.js index 3c851e7a52c2..742332948926 100644 --- a/lib/node_modules/@stdlib/stats/base/scumin/test/test.ndarray.native.js +++ b/lib/node_modules/@stdlib/stats/base/scumin/test/test.ndarray.native.js @@ -22,7 +22,6 @@ var resolve = require( 'path' ).resolve; var tape = require( 'tape' ); -var floor = require( '@stdlib/math/base/special/floor' ); var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); var isNegativeZerof = require( '@stdlib/math/base/assert/is-negative-zerof' ); var Float32Array = require( '@stdlib/array/float32' ); @@ -159,7 +158,6 @@ tape( 'the function supports an `x` stride', opts, function test( t ) { var expected; var x; var y; - var N; x = new Float32Array([ 1.0, // 0 @@ -175,9 +173,8 @@ tape( 'the function supports an `x` stride', opts, function test( t ) { 0.0, 0.0 ]); - N = 3; - scumin( N, x, 2, 0, y, 1, 0 ); + scumin( 3, x, 2, 0, y, 1, 0 ); expected = new Float32Array( [ 1.0, 1.0, -5.0, 0.0, 0.0 ] ); t.deepEqual( y, expected, 'returns expected value' ); @@ -189,7 +186,6 @@ tape( 'the function supports a `y` stride', opts, function test( t ) { var expected; var x; var y; - var N; x = new Float32Array([ 1.0, // 0 @@ -205,9 +201,8 @@ tape( 'the function supports a `y` stride', opts, function test( t ) { 0.0, 0.0 // 2 ]); - N = 3; - scumin( N, x, 1, 0, y, 2, 0 ); + scumin( 3, x, 1, 0, y, 2, 0 ); expected = new Float32Array( [ 1.0, 0.0, -2.0, 0.0, -2.0 ] ); t.deepEqual( y, expected, 'returns expected value' ); @@ -219,7 +214,6 @@ tape( 'the function supports negative strides', opts, function test( t ) { var expected; var x; var y; - var N; x = new Float32Array([ 1.0, // 2 @@ -235,9 +229,8 @@ tape( 'the function supports negative strides', opts, function test( t ) { 0.0, 0.0 ]); - N = 3; - scumin( N, x, -2, x.length-1, y, -1, 2 ); + scumin( 3, x, -2, x.length-1, y, -1, 2 ); expected = new Float32Array( [ -5.0, -5.0, -5.0, 0.0, 0.0 ] ); t.deepEqual( y, expected, 'returns expected value' ); @@ -247,7 +240,6 @@ tape( 'the function supports negative strides', opts, function test( t ) { tape( 'the function supports an `x` offset', opts, function test( t ) { var expected; - var N; var x; var y; @@ -271,9 +263,8 @@ tape( 'the function supports an `x` offset', opts, function test( t ) { 0.0, 0.0 ]); - N = floor( x.length / 2 ); - scumin( N, x, 2, 1, y, 1, 0 ); + scumin( 4, x, 2, 1, y, 1, 0 ); expected = new Float32Array( [ 1.0, -2.0, -2.0, -2.0, 0.0, 0.0, 0.0, 0.0 ] ); // eslint-disable-line max-len t.deepEqual( y, expected, 'returns expected value' ); @@ -283,7 +274,6 @@ tape( 'the function supports an `x` offset', opts, function test( t ) { tape( 'the function supports a `y` offset', opts, function test( t ) { var expected; - var N; var x; var y; @@ -307,9 +297,8 @@ tape( 'the function supports a `y` offset', opts, function test( t ) { 0.0, 0.0 // 3 ]); - N = floor( x.length / 2 ); - scumin( N, x, 1, 0, y, 2, 1 ); + scumin( 4, x, 1, 0, y, 2, 1 ); expected = new Float32Array( [ 0.0, 2.0, 0.0, 1.0, 0.0, 1.0, 0.0, -2.0 ] ); t.deepEqual( y, expected, 'returns expected value' ); @@ -321,7 +310,6 @@ tape( 'the function supports complex access patterns', opts, function test( t ) var expected; var x; var y; - var N; x = new Float32Array([ 1.0, // 0 @@ -339,9 +327,8 @@ tape( 'the function supports complex access patterns', opts, function test( t ) 0.0, 0.0 ]); - N = 3; - scumin( N, x, 2, 0, y, -1, 2 ); + scumin( 3, x, 2, 0, y, -1, 2 ); expected = new Float32Array( [ -3.0, -3.0, 1.0, 0.0, 0.0, 0.0 ] ); t.deepEqual( y, expected, 'returns expected value' ); diff --git a/lib/node_modules/@stdlib/stats/base/scumin/test/test.scumin.js b/lib/node_modules/@stdlib/stats/base/scumin/test/test.scumin.js index 5a3ca492e335..0941a75ed2b8 100644 --- a/lib/node_modules/@stdlib/stats/base/scumin/test/test.scumin.js +++ b/lib/node_modules/@stdlib/stats/base/scumin/test/test.scumin.js @@ -21,7 +21,6 @@ // MODULES // var tape = require( 'tape' ); -var floor = require( '@stdlib/math/base/special/floor' ); var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); var isNegativeZerof = require( '@stdlib/math/base/assert/is-negative-zerof' ); var Float32Array = require( '@stdlib/array/float32' ); @@ -150,7 +149,6 @@ tape( 'the function supports an `x` stride', function test( t ) { var expected; var x; var y; - var N; x = new Float32Array([ 1.0, // 0 @@ -166,9 +164,8 @@ tape( 'the function supports an `x` stride', function test( t ) { 0.0, 0.0 ]); - N = 3; - scumin( N, x, 2, y, 1 ); + scumin( 3, x, 2, y, 1 ); expected = new Float32Array( [ 1.0, 1.0, -5.0, 0.0, 0.0 ] ); t.deepEqual( y, expected, 'returns expected value' ); @@ -180,7 +177,6 @@ tape( 'the function supports a `y` stride', function test( t ) { var expected; var x; var y; - var N; x = new Float32Array([ 1.0, // 0 @@ -196,9 +192,8 @@ tape( 'the function supports a `y` stride', function test( t ) { 0.0, 0.0 // 2 ]); - N = 3; - scumin( N, x, 1, y, 2 ); + scumin( 3, x, 1, y, 2 ); expected = new Float32Array( [ 1.0, 0.0, -2.0, 0.0, -2.0 ] ); t.deepEqual( y, expected, 'returns expected value' ); @@ -210,7 +205,6 @@ tape( 'the function supports negative strides', function test( t ) { var expected; var x; var y; - var N; x = new Float32Array([ 1.0, // 2 @@ -226,9 +220,8 @@ tape( 'the function supports negative strides', function test( t ) { 0.0, 0.0 ]); - N = 3; - scumin( N, x, -2, y, -1 ); + scumin( 3, x, -2, y, -1 ); expected = new Float32Array( [ -5.0, -5.0, -5.0, 0.0, 0.0 ] ); t.deepEqual( y, expected, 'returns expected value' ); @@ -240,7 +233,6 @@ tape( 'the function supports complex access patterns', function test( t ) { var expected; var x; var y; - var N; x = new Float32Array([ 1.0, // 0 @@ -258,9 +250,8 @@ tape( 'the function supports complex access patterns', function test( t ) { 0.0, 0.0 ]); - N = 3; - scumin( N, x, 2, y, -1 ); + scumin( 3, x, 2, y, -1 ); expected = new Float32Array( [ -3.0, -3.0, 1.0, 0.0, 0.0, 0.0 ] ); t.deepEqual( y, expected, 'returns expected value' ); @@ -274,7 +265,6 @@ tape( 'the function supports view offsets', function test( t ) { var y0; var x1; var y1; - var N; // Initial arrays... x0 = new Float32Array([ @@ -298,9 +288,7 @@ tape( 'the function supports view offsets', function test( t ) { x1 = new Float32Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // begin at 2nd element y1 = new Float32Array( y0.buffer, y0.BYTES_PER_ELEMENT*3 ); // begin at the 4th element - N = floor( x0.length / 2 ); - - scumin( N, x1, -2, y1, 1 ); + scumin( 3, x1, -2, y1, 1 ); expected = new Float32Array( [ 0.0, 0.0, 0.0, 6.0, 4.0, 2.0 ] ); t.deepEqual( y0, expected, 'returns expected value' ); diff --git a/lib/node_modules/@stdlib/stats/base/scumin/test/test.scumin.native.js b/lib/node_modules/@stdlib/stats/base/scumin/test/test.scumin.native.js index 557ad15bd368..bfc15cf5de16 100644 --- a/lib/node_modules/@stdlib/stats/base/scumin/test/test.scumin.native.js +++ b/lib/node_modules/@stdlib/stats/base/scumin/test/test.scumin.native.js @@ -22,7 +22,6 @@ var resolve = require( 'path' ).resolve; var tape = require( 'tape' ); -var floor = require( '@stdlib/math/base/special/floor' ); var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); var isNegativeZerof = require( '@stdlib/math/base/assert/is-negative-zerof' ); var Float32Array = require( '@stdlib/array/float32' ); @@ -159,7 +158,6 @@ tape( 'the function supports an `x` stride', opts, function test( t ) { var expected; var x; var y; - var N; x = new Float32Array([ 1.0, // 0 @@ -175,9 +173,8 @@ tape( 'the function supports an `x` stride', opts, function test( t ) { 0.0, 0.0 ]); - N = 3; - scumin( N, x, 2, y, 1 ); + scumin( 3, x, 2, y, 1 ); expected = new Float32Array( [ 1.0, 1.0, -5.0, 0.0, 0.0 ] ); t.deepEqual( y, expected, 'returns expected value' ); @@ -189,7 +186,6 @@ tape( 'the function supports a `y` stride', opts, function test( t ) { var expected; var x; var y; - var N; x = new Float32Array([ 1.0, // 0 @@ -205,9 +201,8 @@ tape( 'the function supports a `y` stride', opts, function test( t ) { 0.0, 0.0 // 2 ]); - N = 3; - scumin( N, x, 1, y, 2 ); + scumin( 3, x, 1, y, 2 ); expected = new Float32Array( [ 1.0, 0.0, -2.0, 0.0, -2.0 ] ); t.deepEqual( y, expected, 'returns expected value' ); @@ -219,7 +214,6 @@ tape( 'the function supports negative strides', opts, function test( t ) { var expected; var x; var y; - var N; x = new Float32Array([ 1.0, // 2 @@ -235,9 +229,8 @@ tape( 'the function supports negative strides', opts, function test( t ) { 0.0, 0.0 ]); - N = 3; - scumin( N, x, -2, y, -1 ); + scumin( 3, x, -2, y, -1 ); expected = new Float32Array( [ -5.0, -5.0, -5.0, 0.0, 0.0 ] ); t.deepEqual( y, expected, 'returns expected value' ); @@ -249,7 +242,6 @@ tape( 'the function supports complex access patterns', opts, function test( t ) var expected; var x; var y; - var N; x = new Float32Array([ 1.0, // 0 @@ -267,9 +259,8 @@ tape( 'the function supports complex access patterns', opts, function test( t ) 0.0, 0.0 ]); - N = 3; - scumin( N, x, 2, y, -1 ); + scumin( 3, x, 2, y, -1 ); expected = new Float32Array( [ -3.0, -3.0, 1.0, 0.0, 0.0, 0.0 ] ); t.deepEqual( y, expected, 'returns expected value' ); @@ -283,7 +274,6 @@ tape( 'the function supports view offsets', opts, function test( t ) { var y0; var x1; var y1; - var N; // Initial arrays... x0 = new Float32Array([ @@ -307,9 +297,7 @@ tape( 'the function supports view offsets', opts, function test( t ) { x1 = new Float32Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // begin at 2nd element y1 = new Float32Array( y0.buffer, y0.BYTES_PER_ELEMENT*3 ); // begin at the 4th element - N = floor( x0.length / 2 ); - - scumin( N, x1, -2, y1, 1 ); + scumin( 3, x1, -2, y1, 1 ); expected = new Float32Array( [ 0.0, 0.0, 0.0, 6.0, 4.0, 2.0 ] ); t.deepEqual( y0, expected, 'returns expected value' );