diff --git a/lib/node_modules/@stdlib/blas/ext/base/scusumpw/README.md b/lib/node_modules/@stdlib/blas/ext/base/scusumpw/README.md index 1254ee178fb..99de471245d 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/scusumpw/README.md +++ b/lib/node_modules/@stdlib/blas/ext/base/scusumpw/README.md @@ -65,18 +65,15 @@ The function has the following parameters: - **y**: output [`Float32Array`][@stdlib/array/float32]. - **strideY**: index increment for `y`. -The `N` and `stride` parameters determine which elements in `x` and `y` are accessed at runtime. For example, to compute the cumulative sum 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 sum of every other element in `x`, ```javascript var Float32Array = require( '@stdlib/array/float32' ); -var floor = require( '@stdlib/math/base/special/floor' ); var x = new Float32Array( [ 1.0, 2.0, 2.0, -7.0, -2.0, 3.0, 4.0, 2.0 ] ); var y = new Float32Array( x.length ); -var N = floor( x.length / 2 ); - -var v = scusumpw( N, 0.0, x, 2, y, 1 ); +var v = scusumpw( 4, 0.0, x, 2, y, 1 ); // y => [ 1.0, 3.0, 1.0, 5.0, 0.0, 0.0, 0.0, 0.0 ] ``` @@ -86,7 +83,6 @@ Note that indexing is relative to the first index. To introduce an offset, use [ ```javascript var Float32Array = require( '@stdlib/array/float32' ); -var floor = require( '@stdlib/math/base/special/floor' ); // Initial arrays... var x0 = new Float32Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] ); @@ -96,9 +92,7 @@ var y0 = new Float32Array( x0.length ); var x1 = new Float32Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element var y1 = new Float32Array( y0.buffer, y0.BYTES_PER_ELEMENT*3 ); // start at 4th element -var N = floor( x0.length / 2 ); - -scusumpw( N, 0.0, x1, -2, y1, 1 ); +scusumpw( 4, 0.0, x1, -2, y1, 1 ); // y0 => [ 0.0, 0.0, 0.0, 4.0, 6.0, 4.0, 5.0, 0.0 ] ``` @@ -125,14 +119,11 @@ While [`typed array`][mdn-typed-array] views mandate a view offset based on the ```javascript 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 ); - -scusumpw.ndarray( N, 0.0, x, 2, 1, y, -1, y.length-1 ); +scusumpw.ndarray( 4, 0.0, x, 2, 1, y, -1, y.length-1 ); // y => [ 0.0, 0.0, 0.0, 0.0, 5.0, 1.0, -1.0, 1.0 ] ``` @@ -158,20 +149,14 @@ scusumpw.ndarray( N, 0.0, 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/base/discrete-uniform' ).factory; +var filledarrayBy = require( '@stdlib/array/filled-by' ); var Float32Array = require( '@stdlib/array/float32' ); var scusumpw = require( '@stdlib/blas/ext/base/scusumpw' ); -var y; -var x; -var i; +var x = filledarrayBy( 10, 'float32', discreteUniform( 0, 100 ) ); +var y = new Float32Array( x.length ); -x = new Float32Array( 10 ); -y = new Float32Array( x.length ); -for ( i = 0; i < x.length; i++ ) { - x[ i ] = round( randu()*100.0 ); -} console.log( x ); console.log( y ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/scusumpw/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/ext/base/scusumpw/benchmark/benchmark.js index b38a94746a1..9140d18b112 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/scusumpw/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/blas/ext/base/scusumpw/benchmark/benchmark.js @@ -21,7 +21,8 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); +var uniform = require( '@stdlib/random/base/uniform' ).factory; +var filledarrayBy = require( '@stdlib/array/filled-by' ); 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 +30,11 @@ var pkg = require( './../package.json' ).name; var scusumpw = require( './../lib/scusumpw.js' ); +// VARIABLES // + +var rand = uniform( -10.0, 10.0 ); + + // FUNCTIONS // /** @@ -39,15 +45,9 @@ var scusumpw = require( './../lib/scusumpw.js' ); * @returns {Function} benchmark function */ function createBenchmark( len ) { - var y; - var x; - var i; + var y = new Float32Array( len ); + var x = filledarrayBy( len, 'float32', rand ); - x = new Float32Array( len ); - y = new Float32Array( len ); - for ( i = 0; i < x.length; i++ ) { - x[ i ] = ( randu()*20.0 ) - 10.0; - } return benchmark; function benchmark( b ) { diff --git a/lib/node_modules/@stdlib/blas/ext/base/scusumpw/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/blas/ext/base/scusumpw/benchmark/benchmark.native.js index 504c1bcae89..e63e3363000 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/scusumpw/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/scusumpw/benchmark/benchmark.native.js @@ -22,7 +22,8 @@ var resolve = require( 'path' ).resolve; var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); +var uniform = require( '@stdlib/random/base/uniform' ).factory; +var filledarrayBy = require( '@stdlib/array/filled-by' ); 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 +37,7 @@ var scusumpw = tryRequire( resolve( __dirname, './../lib/scusumpw.native.js' ) ) var opts = { 'skip': ( scusumpw instanceof Error ) }; +var rand = uniform( -10.0, 10.0 ); // FUNCTIONS // @@ -48,15 +50,9 @@ var opts = { * @returns {Function} benchmark function */ function createBenchmark( len ) { - var x; - var y; - var i; + var x = filledarrayBy( len, 'float32', rand ); + var y = new Float32Array( len ); - x = new Float32Array( len ); - y = new Float32Array( len ); - for ( i = 0; i < x.length; i++ ) { - x[ i ] = ( randu()*20.0 ) - 10.0; - } return benchmark; function benchmark( b ) { diff --git a/lib/node_modules/@stdlib/blas/ext/base/scusumpw/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/scusumpw/benchmark/benchmark.ndarray.js index f030f41e30e..0a6f1bc6c73 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/scusumpw/benchmark/benchmark.ndarray.js +++ b/lib/node_modules/@stdlib/blas/ext/base/scusumpw/benchmark/benchmark.ndarray.js @@ -21,7 +21,8 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); +var uniform = require( '@stdlib/random/base/uniform' ).factory; +var filledarrayBy = require( '@stdlib/array/filled-by' ); 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 +30,11 @@ var pkg = require( './../package.json' ).name; var scusumpw = require( './../lib/ndarray.js' ); +// VARIABLES // + +var rand = uniform( -10.0, 10.0 ); + + // FUNCTIONS // /** @@ -39,15 +45,9 @@ var scusumpw = require( './../lib/ndarray.js' ); * @returns {Function} benchmark function */ function createBenchmark( len ) { - var x; - var y; - var i; + var x = filledarrayBy( len, 'float32', rand ); + var y = new Float32Array( len ); - x = new Float32Array( len ); - y = new Float32Array( len ); - for ( i = 0; i < x.length; i++ ) { - x[ i ] = ( randu()*20.0 ) - 10.0; - } return benchmark; function benchmark( b ) { diff --git a/lib/node_modules/@stdlib/blas/ext/base/scusumpw/benchmark/benchmark.ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/scusumpw/benchmark/benchmark.ndarray.native.js index ee290adbeb3..0a386bb1269 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/scusumpw/benchmark/benchmark.ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/scusumpw/benchmark/benchmark.ndarray.native.js @@ -22,7 +22,8 @@ var resolve = require( 'path' ).resolve; var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); +var uniform = require( '@stdlib/random/base/uniform' ).factory; +var filledarrayBy = require( '@stdlib/array/filled-by' ); 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 +37,7 @@ var scusumpw = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ); var opts = { 'skip': ( scusumpw instanceof Error ) }; +var rand = uniform( -10.0, 10.0 ); // FUNCTIONS // @@ -48,15 +50,9 @@ var opts = { * @returns {Function} benchmark function */ function createBenchmark( len ) { - var x; - var y; - var i; + var x = filledarrayBy( len, 'float32', rand ); + var y = new Float32Array( len ); - x = new Float32Array( len ); - y = new Float32Array( len ); - for ( i = 0; i < x.length; i++ ) { - x[ i ] = ( randu()*20.0 ) - 10.0; - } return benchmark; function benchmark( b ) { diff --git a/lib/node_modules/@stdlib/blas/ext/base/scusumpw/docs/repl.txt b/lib/node_modules/@stdlib/blas/ext/base/scusumpw/docs/repl.txt index cfb10565541..70e9f3b5534 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/scusumpw/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/ext/base/scusumpw/docs/repl.txt @@ -3,8 +3,8 @@ Computes the cumulative sum of single-precision floating-point strided array elements using pairwise summation. - 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. @@ -44,11 +44,10 @@ > {{alias}}( x.length, 0.0, x, 1, y, 1 ) [ 1.0, -1.0, 1.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, 0.0, x, 2, y, 2 ) + > {{alias}}( 3, 0.0, x, 2, y, 2 ) [ -2.0, 0.0, -1.0, 0.0, 1.0, 0.0 ] // Using view offsets: @@ -56,12 +55,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, 0.0, x1, 2, y1, 1 ) + > {{alias}}( 3, 0.0, x1, 2, y1, 1 ) [ -2.0, 0.0, -1.0 ] > y0 [ 0.0, 0.0, 0.0, -2.0, 0.0, -1.0 ] + {{alias}}.ndarray( N, sum, x, strideX, offsetX, y, strideY, offsetY ) Computes the cumulative sum of single-precision floating-point strided array elements using pairwise summation and alternative indexing semantics. @@ -112,8 +111,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, 0.0, x, 2, 1, y, -1, y.length-1 ) + > {{alias}}.ndarray( 3, 0.0, x, 2, 1, y, -1, y.length-1 ) [ 0.0, 0.0, 0.0, -1.0, 0.0, -2.0 ] See Also diff --git a/lib/node_modules/@stdlib/blas/ext/base/scusumpw/examples/index.js b/lib/node_modules/@stdlib/blas/ext/base/scusumpw/examples/index.js index 0e176b0a14f..64d24e25349 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/scusumpw/examples/index.js +++ b/lib/node_modules/@stdlib/blas/ext/base/scusumpw/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/base/discrete-uniform' ).factory; +var filledarrayBy = require( '@stdlib/array/filled-by' ); var Float32Array = require( '@stdlib/array/float32' ); var scusumpw = require( './../lib' ); -var y; -var x; -var i; +var x = filledarrayBy( 10, 'float32', discreteUniform( 0, 100 ) ); +var y = new Float32Array( x.length ); -x = new Float32Array( 10 ); -y = new Float32Array( x.length ); -for ( i = 0; i < x.length; i++ ) { - x[ i ] = round( randu()*100.0 ); -} console.log( x ); console.log( y ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/scusumpw/include.gypi b/lib/node_modules/@stdlib/blas/ext/base/scusumpw/include.gypi index 868c5c12e85..26476a8c265 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/scusumpw/include.gypi +++ b/lib/node_modules/@stdlib/blas/ext/base/scusumpw/include.gypi @@ -36,7 +36,7 @@ # Source files: 'src_files': [ - '<(src_dir)/addon.cpp', + '<(src_dir)/addon.c', ' + + +/** +* Receives JavaScript callback invocation data. +* +* @private +* @param env environment under which the function is invoked +* @param info callback data +* @return Node-API value +*/ +static napi_value addon( napi_env env, napi_callback_info info ) { + STDLIB_NAPI_ARGV( env, info, argv, argc, 6 ); + STDLIB_NAPI_ARGV_INT64( env, N, argv, 0 ); + STDLIB_NAPI_ARGV_FLOAT( env, sum, argv, 1 ); + STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 3 ); + STDLIB_NAPI_ARGV_INT64( env, strideY, argv, 5 ); + STDLIB_NAPI_ARGV_STRIDED_FLOAT32ARRAY( env, X, N, strideX, argv, 2 ); + STDLIB_NAPI_ARGV_STRIDED_FLOAT32ARRAY( env, Y, N, strideY, argv, 4 ); + + stdlib_strided_scusumpw( N, sum, X, strideX, Y, strideY ); + + return NULL; +} + +STDLIB_NAPI_MODULE_EXPORT_FCN( addon ) diff --git a/lib/node_modules/@stdlib/blas/ext/base/scusumpw/src/addon.cpp b/lib/node_modules/@stdlib/blas/ext/base/scusumpw/src/addon.cpp deleted file mode 100644 index 6cb8c89e466..00000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/scusumpw/src/addon.cpp +++ /dev/null @@ -1,164 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2020 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. -*/ - -#include "stdlib/blas/ext/base/scusumpw.h" -#include -#include -#include -#include -#include - -/** -* Add-on namespace. -*/ -namespace stdlib_blas_ext_base_scusumpw { - - /** - * Computes the cumulative sum of single-precision floating-point strided array elements using pairwise summation. - * - * ## Notes - * - * - When called from JavaScript, the function expects six arguments: - * - * - `N`: number of indexed elements - * - `sum`: initial sum - * - `X`: input array - * - `strideX`: `X` stride length - * - `Y`: output array - * - `strideY`: `Y` stride length - */ - napi_value node_scusumpw( napi_env env, napi_callback_info info ) { - napi_status status; - - size_t argc = 6; - napi_value argv[ 6 ]; - status = napi_get_cb_info( env, info, &argc, argv, nullptr, nullptr ); - assert( status == napi_ok ); - - if ( argc < 6 ) { - napi_throw_error( env, nullptr, "invalid invocation. Must provide 6 arguments." ); - return nullptr; - } - - napi_valuetype vtype0; - status = napi_typeof( env, argv[ 0 ], &vtype0 ); - assert( status == napi_ok ); - if ( vtype0 != napi_number ) { - napi_throw_type_error( env, nullptr, "invalid argument. First argument must be a number." ); - return nullptr; - } - - napi_valuetype vtype1; - status = napi_typeof( env, argv[ 1 ], &vtype1 ); - assert( status == napi_ok ); - if ( vtype1 != napi_number ) { - napi_throw_type_error( env, nullptr, "invalid argument. Second argument must be a number." ); - return nullptr; - } - - bool res2; - status = napi_is_typedarray( env, argv[ 2 ], &res2 ); - assert( status == napi_ok ); - if ( res2 == false ) { - napi_throw_type_error( env, nullptr, "invalid argument. Third argument must be a Float32Array." ); - return nullptr; - } - - napi_valuetype vtype3; - status = napi_typeof( env, argv[ 3 ], &vtype3 ); - assert( status == napi_ok ); - if ( vtype3 != napi_number ) { - napi_throw_type_error( env, nullptr, "invalid argument. Fourth argument must be a number." ); - return nullptr; - } - - bool res4; - status = napi_is_typedarray( env, argv[ 4 ], &res4 ); - assert( status == napi_ok ); - if ( res4 == false ) { - napi_throw_type_error( env, nullptr, "invalid argument. Fifth argument must be a Float32Array." ); - return nullptr; - } - - napi_valuetype vtype5; - status = napi_typeof( env, argv[ 5 ], &vtype5 ); - assert( status == napi_ok ); - if ( vtype5 != napi_number ) { - napi_throw_type_error( env, nullptr, "invalid argument. Sixth argument must be a number." ); - return nullptr; - } - - int64_t N; - status = napi_get_value_int64( env, argv[ 0 ], &N ); - assert( status == napi_ok ); - - double sum; - status = napi_get_value_double( env, argv[ 1 ], &sum ); - assert( status == napi_ok ); - - int64_t strideX; - status = napi_get_value_int64( env, argv[ 3 ], &strideX ); - assert( status == napi_ok ); - - int64_t strideY; - status = napi_get_value_int64( env, argv[ 5 ], &strideY ); - assert( status == napi_ok ); - - napi_typedarray_type vtype2; - size_t xlen; - void *X; - status = napi_get_typedarray_info( env, argv[ 2 ], &vtype2, &xlen, &X, nullptr, nullptr ); - assert( status == napi_ok ); - if ( vtype2 != napi_float32_array ) { - napi_throw_type_error( env, nullptr, "invalid argument. Third argument must be a Float32Array." ); - return nullptr; - } - if ( (N-1)*llabs(strideX) >= (int64_t)xlen ) { - napi_throw_range_error( env, nullptr, "invalid argument. Third argument has insufficient elements based on the associated stride and the number of indexed elements." ); - return nullptr; - } - - napi_typedarray_type vtype4; - size_t ylen; - void *Y; - status = napi_get_typedarray_info( env, argv[ 4 ], &vtype4, &ylen, &Y, nullptr, nullptr ); - assert( status == napi_ok ); - if ( vtype4 != napi_float32_array ) { - napi_throw_type_error( env, nullptr, "invalid argument. Fifth argument must be a Float32Array." ); - return nullptr; - } - if ( (N-1)*llabs(strideY) >= (int64_t)ylen ) { - napi_throw_range_error( env, nullptr, "invalid argument. Fifth argument has insufficient elements based on the associated stride and the number of indexed elements." ); - return nullptr; - } - - stdlib_strided_scusumpw( N, (float)sum, (float *)X, strideX, (float *)Y, strideY ); - - return nullptr; - } - - napi_value Init( napi_env env, napi_value exports ) { - napi_status status; - napi_value fcn; - status = napi_create_function( env, "exports", NAPI_AUTO_LENGTH, node_scusumpw, NULL, &fcn ); - assert( status == napi_ok ); - return fcn; - } - - NAPI_MODULE( NODE_GYP_MODULE_NAME, Init ) -} // end namespace stdlib_blas_ext_base_scusumpw diff --git a/lib/node_modules/@stdlib/blas/ext/base/scusumpw/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/scusumpw/test/test.ndarray.js index 8f4b774d068..b72e1617dde 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/scusumpw/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/ext/base/scusumpw/test/test.ndarray.js @@ -141,7 +141,7 @@ tape( 'the function returns a reference to the output array', function test( t ) t.end(); }); -tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `y` unchanged', function test( t ) { +tape( 'if provided an `N` parameter less than or equal to `0`, the function returns output array unchanged', function test( t ) { var expected; var x; var y; @@ -152,10 +152,10 @@ tape( 'if provided an `N` parameter less than or equal to `0`, the function retu expected = new Float32Array( [ 6.0, 7.0, 8.0, 9.0, 10.0 ] ); scusumpw( -1, 0.0, x, 1, 0, y, 1, 0 ); - t.deepEqual( y, expected, 'returns `y` unchanged' ); + t.deepEqual( y, expected, 'returns expected value' ); scusumpw( 0, 0.0, x, 1, 0, y, 1, 0 ); - t.deepEqual( y, expected, 'returns `y` unchanged' ); + t.deepEqual( y, expected, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/blas/ext/base/scusumpw/test/test.ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/scusumpw/test/test.ndarray.native.js index 5b481f1bfc2..aae46fd36e5 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/scusumpw/test/test.ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/scusumpw/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 Float32Array = require( '@stdlib/array/float32' ); var tryRequire = require( '@stdlib/utils/try-require' ); @@ -150,7 +149,7 @@ tape( 'the function returns a reference to the output array', opts, function tes t.end(); }); -tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `y` unchanged', opts, function test( t ) { +tape( 'if provided an `N` parameter less than or equal to `0`, the function returns output array unchanged', opts, function test( t ) { var expected; var x; var y; @@ -161,10 +160,10 @@ tape( 'if provided an `N` parameter less than or equal to `0`, the function retu expected = new Float32Array( [ 6.0, 7.0, 8.0, 9.0, 10.0 ] ); scusumpw( -1, 0.0, x, 1, 0, y, 1, 0 ); - t.deepEqual( y, expected, 'returns `y` unchanged' ); + t.deepEqual( y, expected, 'returns expected value' ); scusumpw( 0, 0.0, x, 1, 0, y, 1, 0 ); - t.deepEqual( y, expected, 'returns `y` unchanged' ); + t.deepEqual( y, expected, 'returns expected value' ); t.end(); }); @@ -277,7 +276,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; @@ -301,9 +299,8 @@ tape( 'the function supports an `x` offset', opts, function test( t ) { 0.0, 0.0 ]); - N = floor( x.length / 2 ); - scusumpw( N, 0.0, x, 2, 1, y, 1, 0 ); + scusumpw( 4, 0.0, x, 2, 1, y, 1, 0 ); expected = new Float32Array( [ 1.0, -1.0, 1.0, 5.0, 0.0, 0.0, 0.0, 0.0 ] ); @@ -313,7 +310,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; @@ -337,9 +333,8 @@ tape( 'the function supports a `y` offset', opts, function test( t ) { 0.0, 0.0 // 3 ]); - N = floor( x.length / 2 ); - scusumpw( N, 0.0, x, 1, 0, y, 2, 1 ); + scusumpw( 4, 0.0, x, 1, 0, y, 2, 1 ); expected = new Float32Array( [ 0.0, 2.0, 0.0, 3.0, 0.0, 5.0, 0.0, 3.0 ] ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/scusumpw/test/test.scusumpw.js b/lib/node_modules/@stdlib/blas/ext/base/scusumpw/test/test.scusumpw.js index b1a31f637e0..ab929b774d7 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/scusumpw/test/test.scusumpw.js +++ b/lib/node_modules/@stdlib/blas/ext/base/scusumpw/test/test.scusumpw.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 Float32Array = require( '@stdlib/array/float32' ); var scusumpw = require( './../lib/scusumpw.js' ); @@ -141,7 +140,7 @@ tape( 'the function returns a reference to the output array', function test( t ) t.end(); }); -tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `y` unchanged', function test( t ) { +tape( 'if provided an `N` parameter less than or equal to `0`, the function returns output array unchanged', function test( t ) { var expected; var x; var y; @@ -152,10 +151,10 @@ tape( 'if provided an `N` parameter less than or equal to `0`, the function retu expected = new Float32Array( [ 6.0, 7.0, 8.0, 9.0, 10.0 ] ); scusumpw( -1, 0.0, x, 1, y, 1 ); - t.deepEqual( y, expected, 'returns `y` unchanged' ); + t.deepEqual( y, expected, 'returns expected value' ); scusumpw( 0, 0.0, x, 1, y, 1 ); - t.deepEqual( y, expected, 'returns `y` unchanged' ); + t.deepEqual( y, expected, 'returns expected value' ); t.end(); }); @@ -304,7 +303,6 @@ tape( 'the function supports view offsets', function test( t ) { var y0; var x1; var y1; - var N; // Initial arrays... x0 = new Float32Array([ @@ -328,9 +326,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 ); - - scusumpw( N, 0.0, x1, -2, y1, 1 ); + scusumpw( 3, 0.0, x1, -2, y1, 1 ); expected = new Float32Array( [ 0.0, 0.0, 0.0, 6.0, 10.0, 12.0 ] ); t.deepEqual( y0, expected, 'returns expected value' ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/scusumpw/test/test.scusumpw.native.js b/lib/node_modules/@stdlib/blas/ext/base/scusumpw/test/test.scusumpw.native.js index a37a8aaf861..38fe431978f 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/scusumpw/test/test.scusumpw.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/scusumpw/test/test.scusumpw.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 Float32Array = require( '@stdlib/array/float32' ); var tryRequire = require( '@stdlib/utils/try-require' ); @@ -150,7 +149,7 @@ tape( 'the function returns a reference to the output array', opts, function tes t.end(); }); -tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `y` unchanged', opts, function test( t ) { +tape( 'if provided an `N` parameter less than or equal to `0`, the function returns the output array unchanged', opts, function test( t ) { var expected; var x; var y; @@ -161,10 +160,10 @@ tape( 'if provided an `N` parameter less than or equal to `0`, the function retu expected = new Float32Array( [ 6.0, 7.0, 8.0, 9.0, 10.0 ] ); scusumpw( -1, 0.0, x, 1, y, 1 ); - t.deepEqual( y, expected, 'returns `y` unchanged' ); + t.deepEqual( y, expected, 'returns expected value' ); scusumpw( 0, 0.0, x, 1, y, 1 ); - t.deepEqual( y, expected, 'returns `y` unchanged' ); + t.deepEqual( y, expected, 'returns expected value' ); t.end(); }); @@ -313,7 +312,6 @@ tape( 'the function supports view offsets', opts, function test( t ) { var y0; var x1; var y1; - var N; // Initial arrays... x0 = new Float32Array([ @@ -337,9 +335,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 ); - - scusumpw( N, 0.0, x1, -2, y1, 1 ); + scusumpw( 3, 0.0, x1, -2, y1, 1 ); expected = new Float32Array( [ 0.0, 0.0, 0.0, 6.0, 10.0, 12.0 ] ); t.deepEqual( y0, expected, 'returns expected value' );