diff --git a/lib/node_modules/@stdlib/blas/ext/base/dssum/README.md b/lib/node_modules/@stdlib/blas/ext/base/dssum/README.md index bd69d901a0a..7444c74e366 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dssum/README.md +++ b/lib/node_modules/@stdlib/blas/ext/base/dssum/README.md @@ -56,16 +56,14 @@ The function has the following parameters: - **x**: input [`Float32Array`][@stdlib/array/float32]. - **stride**: index increment for `x`. -The `N` and `stride` parameters determine which elements in `x` are accessed at runtime. For example, to compute the sum of every other element in `x`, +The `N` and `stride` parameters determine which elements in the strided array are accessed at runtime. For example, to compute the sum of every other element in the strided array, ```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 N = floor( x.length / 2 ); -var v = dssum( N, x, 2 ); +var v = dssum( 4, x, 2 ); // returns 5.0 ``` @@ -75,14 +73,11 @@ 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' ); var x0 = new Float32Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] ); var x1 = new Float32Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element -var N = floor( x0.length / 2 ); - -var v = dssum( N, x1, 2 ); +var v = dssum( 4, x1, 2 ); // returns 5.0 ``` @@ -94,9 +89,8 @@ Computes the sum of single-precision floating-point strided array elements using var Float32Array = require( '@stdlib/array/float32' ); var x = new Float32Array( [ 1.0, -2.0, 2.0 ] ); -var N = x.length; -var v = dssum.ndarray( N, x, 1, 0 ); +var v = dssum.ndarray( 3, x, 1, 0 ); // returns 1.0 ``` @@ -104,16 +98,14 @@ The function has the following additional parameters: - **offset**: starting index for `x`. -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 calculate the sum of every other value in `x` starting from the second value +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 calculate the sum of every other value in the strided array starting from the second value ```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 N = floor( x.length / 2 ); -var v = dssum.ndarray( N, x, 2, 1 ); +var v = dssum.ndarray( 4, x, 2, 1 ); // returns 5.0 ``` @@ -139,18 +131,11 @@ var v = dssum.ndarray( N, x, 2, 1 ); ```javascript -var randu = require( '@stdlib/random/base/randu' ); -var round = require( '@stdlib/math/base/special/round' ); -var Float32Array = require( '@stdlib/array/float32' ); +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; +var filledarrayBy = require( '@stdlib/array/filled-by' ); var dssum = require( '@stdlib/blas/ext/base/dssum' ); -var x; -var i; - -x = new Float32Array( 10 ); -for ( i = 0; i < x.length; i++ ) { - x[ i ] = round( randu()*100.0 ); -} +var x = filledarrayBy( 10, 'float32', discreteUniform( 0, 100 ) ); console.log( x ); var v = dssum( x.length, x, 1 ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dssum/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/ext/base/dssum/benchmark/benchmark.js index 01a51ec1cc9..1f22551b10f 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dssum/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dssum/benchmark/benchmark.js @@ -21,14 +21,19 @@ // 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 isnan = require( '@stdlib/math/base/assert/is-nan' ); var pow = require( '@stdlib/math/base/special/pow' ); -var Float32Array = require( '@stdlib/array/float32' ); var pkg = require( './../package.json' ).name; var dssum = require( './../lib/dssum.js' ); +// VARIABLES // + +var rand = uniform( -10.0, 10.0 ); + + // FUNCTIONS // /** @@ -39,13 +44,7 @@ var dssum = require( './../lib/dssum.js' ); * @returns {Function} benchmark function */ function createBenchmark( len ) { - var x; - var i; - - x = new Float32Array( len ); - for ( i = 0; i < x.length; i++ ) { - x[ i ] = ( randu()*10.0 ) - 20.0; - } + var x = filledarrayBy( len, 'float32', rand ); return benchmark; function benchmark( b ) { diff --git a/lib/node_modules/@stdlib/blas/ext/base/dssum/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/blas/ext/base/dssum/benchmark/benchmark.native.js index 9fe5ab4c911..a7366cf7acb 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dssum/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dssum/benchmark/benchmark.native.js @@ -22,10 +22,10 @@ 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 isnan = require( '@stdlib/math/base/assert/is-nan' ); var pow = require( '@stdlib/math/base/special/pow' ); -var Float32Array = require( '@stdlib/array/float32' ); var tryRequire = require( '@stdlib/utils/try-require' ); var pkg = require( './../package.json' ).name; @@ -36,6 +36,7 @@ var dssum = tryRequire( resolve( __dirname, './../lib/dssum.native.js' ) ); var opts = { 'skip': ( dssum instanceof Error ) }; +var rand = uniform( -10.0, 10.0 ); // FUNCTIONS // @@ -48,13 +49,7 @@ var opts = { * @returns {Function} benchmark function */ function createBenchmark( len ) { - var x; - var i; - - x = new Float32Array( len ); - for ( i = 0; i < x.length; i++ ) { - x[ i ] = ( randu()*10.0 ) - 20.0; - } + var x = filledarrayBy( len, 'float32', rand ); return benchmark; function benchmark( b ) { diff --git a/lib/node_modules/@stdlib/blas/ext/base/dssum/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/dssum/benchmark/benchmark.ndarray.js index a68c3c6f36a..c9c692c4490 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dssum/benchmark/benchmark.ndarray.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dssum/benchmark/benchmark.ndarray.js @@ -21,14 +21,19 @@ // 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 isnan = require( '@stdlib/math/base/assert/is-nan' ); var pow = require( '@stdlib/math/base/special/pow' ); -var Float32Array = require( '@stdlib/array/float32' ); var pkg = require( './../package.json' ).name; var dssum = require( './../lib/ndarray.js' ); +// VARIABLES // + +var rand = uniform( -10.0, 10.0 ); + + // FUNCTIONS // /** @@ -39,13 +44,7 @@ var dssum = require( './../lib/ndarray.js' ); * @returns {Function} benchmark function */ function createBenchmark( len ) { - var x; - var i; - - x = new Float32Array( len ); - for ( i = 0; i < x.length; i++ ) { - x[ i ] = ( randu()*10.0 ) - 20.0; - } + var x = filledarrayBy( len, 'float32', rand ); return benchmark; function benchmark( b ) { diff --git a/lib/node_modules/@stdlib/blas/ext/base/dssum/benchmark/benchmark.ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/dssum/benchmark/benchmark.ndarray.native.js index 2985a8c77b4..c7f00340e40 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dssum/benchmark/benchmark.ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dssum/benchmark/benchmark.ndarray.native.js @@ -22,10 +22,10 @@ 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 isnan = require( '@stdlib/math/base/assert/is-nan' ); var pow = require( '@stdlib/math/base/special/pow' ); -var Float32Array = require( '@stdlib/array/float32' ); var tryRequire = require( '@stdlib/utils/try-require' ); var pkg = require( './../package.json' ).name; @@ -36,6 +36,7 @@ var dssum = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ); var opts = { 'skip': ( dssum instanceof Error ) }; +var rand = uniform( -10.0, 10.0 ); // FUNCTIONS // @@ -48,13 +49,7 @@ var opts = { * @returns {Function} benchmark function */ function createBenchmark( len ) { - var x; - var i; - - x = new Float32Array( len ); - for ( i = 0; i < x.length; i++ ) { - x[ i ] = ( randu()*10.0 ) - 20.0; - } + var x = filledarrayBy( len, 'float32', rand ); return benchmark; function benchmark( b ) { diff --git a/lib/node_modules/@stdlib/blas/ext/base/dssum/docs/repl.txt b/lib/node_modules/@stdlib/blas/ext/base/dssum/docs/repl.txt index 63e7aaf0545..6bb151d1058 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dssum/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/ext/base/dssum/docs/repl.txt @@ -3,8 +3,8 @@ Computes the sum of single-precision floating-point strided array elements using extended accumulation and returning an extended precision result. - The `N` and `stride` parameters determine which elements in `x` are accessed - at runtime. + The `N` and `stride` parameters determine which elements in the strided + array are accessed at runtime. Indexing is relative to the first index. To introduce an offset, use a typed array view. @@ -36,19 +36,16 @@ // Using `N` and `stride` parameters: > x = new {{alias:@stdlib/array/float32}}( [ -2.0, 1.0, 1.0, -5.0, 2.0, -1.0 ] ); - > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 ); - > var stride = 2; - > {{alias}}( N, x, stride ) + > {{alias}}( 3, x, 2 ) 1.0 // Using view offsets: > var x0 = new {{alias:@stdlib/array/float32}}( [ 1.0, -2.0, 3.0, 2.0, 5.0, -1.0 ] ); > var x1 = new {{alias:@stdlib/array/float32}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); - > N = {{alias:@stdlib/math/base/special/floor}}( x0.length / 2 ); - > stride = 2; - > {{alias}}( N, x1, stride ) + > {{alias}}( 3, x1, 2 ) -1.0 + {{alias}}.ndarray( N, x, stride, offset ) Computes the sum of single-precision floating-point strided array elements using extended accumulation and alternative indexing semantics and returning @@ -86,8 +83,7 @@ // Using offset parameter: > var x = new {{alias:@stdlib/array/float32}}( [ 1.0, -2.0, 3.0, 2.0, 5.0, -1.0 ] ); - > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 ); - > {{alias}}.ndarray( N, x, 2, 1 ) + > {{alias}}.ndarray(3, x, 2, 1 ) -1.0 See Also diff --git a/lib/node_modules/@stdlib/blas/ext/base/dssum/examples/index.js b/lib/node_modules/@stdlib/blas/ext/base/dssum/examples/index.js index 3f7a4030829..ef3795ebec4 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dssum/examples/index.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dssum/examples/index.js @@ -18,18 +18,11 @@ 'use strict'; -var randu = require( '@stdlib/random/base/randu' ); -var round = require( '@stdlib/math/base/special/round' ); -var Float32Array = require( '@stdlib/array/float32' ); +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; +var filledarrayBy = require( '@stdlib/array/filled-by' ); var dssum = require( './../lib' ); -var x; -var i; - -x = new Float32Array( 10 ); -for ( i = 0; i < x.length; i++ ) { - x[ i ] = round( randu()*100.0 ); -} +var x = filledarrayBy( 10, 'float32', discreteUniform( 0, 100 )); console.log( x ); var v = dssum( x.length, x, 1 ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dssum/include.gypi b/lib/node_modules/@stdlib/blas/ext/base/dssum/include.gypi index 868c5c12e85..26476a8c265 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dssum/include.gypi +++ b/lib/node_modules/@stdlib/blas/ext/base/dssum/include.gypi @@ -36,7 +36,7 @@ # Source files: 'src_files': [ - '<(src_dir)/addon.cpp', + '<(src_dir)/addon.c', ' +#include + +/** +* 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, 3 ); + STDLIB_NAPI_ARGV_INT64( env, N, argv, 0 ); + STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 2 ); + STDLIB_NAPI_ARGV_STRIDED_FLOAT32ARRAY( env, X, N, strideX, argv, 1 ); + + napi_value v; + status = napi_create_double( env, stdlib_strided_dssum( N, (float *)X, stride ), &v ); + assert( status == napi_ok ); + return v; +} + +STDLIB_NAPI_MODULE_EXPORT_FCN( addon ) diff --git a/lib/node_modules/@stdlib/blas/ext/base/dssum/src/addon.cpp b/lib/node_modules/@stdlib/blas/ext/base/dssum/src/addon.cpp deleted file mode 100644 index e706c6f8698..00000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/dssum/src/addon.cpp +++ /dev/null @@ -1,117 +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/dssum.h" -#include -#include -#include -#include -#include - -/** -* Add-on namespace. -*/ -namespace stdlib_blas_ext_base_dssum { - - /** - * Computes the sum of single-precision floating-point strided array elements using extended accumulation and returning an extended precision result. - * - * ## Notes - * - * - When called from JavaScript, the function expects three arguments: - * - * - `N`: number of indexed elements - * - `X`: input array - * - `stride`: stride length - */ - napi_value node_dssum( napi_env env, napi_callback_info info ) { - napi_status status; - - size_t argc = 3; - napi_value argv[ 3 ]; - status = napi_get_cb_info( env, info, &argc, argv, nullptr, nullptr ); - assert( status == napi_ok ); - - if ( argc < 3 ) { - napi_throw_error( env, nullptr, "invalid invocation. Must provide 3 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; - } - - bool res; - status = napi_is_typedarray( env, argv[ 1 ], &res ); - assert( status == napi_ok ); - if ( res == false ) { - napi_throw_type_error( env, nullptr, "invalid argument. Second argument must be a Float32Array." ); - return nullptr; - } - - napi_valuetype vtype2; - status = napi_typeof( env, argv[ 2 ], &vtype2 ); - assert( status == napi_ok ); - if ( vtype2 != napi_number ) { - napi_throw_type_error( env, nullptr, "invalid argument. Third argument must be a number." ); - return nullptr; - } - - int64_t N; - status = napi_get_value_int64( env, argv[ 0 ], &N ); - assert( status == napi_ok ); - - int64_t stride; - status = napi_get_value_int64( env, argv[ 2 ], &stride ); - assert( status == napi_ok ); - - napi_typedarray_type vtype1; - size_t xlen; - void *X; - status = napi_get_typedarray_info( env, argv[ 1 ], &vtype1, &xlen, &X, nullptr, nullptr ); - assert( status == napi_ok ); - if ( vtype1 != napi_float32_array ) { - napi_throw_type_error( env, nullptr, "invalid argument. Second argument must be a Float32Array." ); - return nullptr; - } - if ( (N-1)*llabs(stride) >= (int64_t)xlen ) { - napi_throw_range_error( env, nullptr, "invalid argument. Second argument has insufficient elements based on the associated stride and the number of indexed elements." ); - return nullptr; - } - - napi_value v; - status = napi_create_double( env, stdlib_strided_dssum( N, (float *)X, stride ), &v ); - assert( status == napi_ok ); - - return v; - } - - 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_dssum, NULL, &fcn ); - assert( status == napi_ok ); - return fcn; - } - - NAPI_MODULE( NODE_GYP_MODULE_NAME, Init ) -} // end namespace stdlib_blas_ext_base_dssum diff --git a/lib/node_modules/@stdlib/blas/ext/base/dssum/test/test.dssum.js b/lib/node_modules/@stdlib/blas/ext/base/dssum/test/test.dssum.js index babb935a397..3801b93734a 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dssum/test/test.dssum.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dssum/test/test.dssum.js @@ -21,7 +21,6 @@ // MODULES // var tape = require( 'tape' ); -var floor = require( '@stdlib/math/base/special/floor' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var Float32Array = require( '@stdlib/array/float32' ); var dssum = require( './../lib/dssum.js' ); @@ -36,7 +35,7 @@ tape( 'main export is a function', function test( t ) { }); tape( 'the function has an arity of 3', function test( t ) { - t.strictEqual( dssum.length, 3, 'has expected arity' ); + t.strictEqual( dssum.length, 3, 'returns expected value' ); t.end(); }); @@ -103,7 +102,6 @@ tape( 'if provided an `N` parameter equal to `1`, the function returns the first }); tape( 'the function supports a `stride` parameter', function test( t ) { - var N; var x; var v; @@ -118,15 +116,13 @@ tape( 'the function supports a `stride` parameter', function test( t ) { 2.0 ]); - N = floor( x.length / 2 ); - v = dssum( N, x, 2 ); + v = dssum( 4, x, 2 ); t.strictEqual( v, 5.0, 'returns expected value' ); t.end(); }); tape( 'the function supports a negative `stride` parameter', function test( t ) { - var N; var x; var v; var i; @@ -142,8 +138,7 @@ tape( 'the function supports a negative `stride` parameter', function test( t ) 2.0 ]); - N = floor( x.length / 2 ); - v = dssum( N, x, -2 ); + v = dssum( 4, x, -2 ); t.strictEqual( v, 5.0, 'returns expected value' ); @@ -172,7 +167,6 @@ tape( 'if provided a `stride` parameter equal to `0`, the function returns the f tape( 'the function supports view offsets', function test( t ) { var x0; var x1; - var N; var v; x0 = new Float32Array([ @@ -188,9 +182,8 @@ tape( 'the function supports view offsets', function test( t ) { ]); x1 = new Float32Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element - N = floor(x1.length / 2); - v = dssum( N, x1, 2 ); + v = dssum( 4, x1, 2 ); t.strictEqual( v, 5.0, 'returns expected value' ); t.end(); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dssum/test/test.dssum.native.js b/lib/node_modules/@stdlib/blas/ext/base/dssum/test/test.dssum.native.js index ce37b77801f..20a983c9a6a 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dssum/test/test.dssum.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dssum/test/test.dssum.native.js @@ -22,7 +22,6 @@ var resolve = require( 'path' ).resolve; var tape = require( 'tape' ); -var floor = require( '@stdlib/math/base/special/floor' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var Float32Array = require( '@stdlib/array/float32' ); var tryRequire = require( '@stdlib/utils/try-require' ); @@ -45,7 +44,7 @@ tape( 'main export is a function', opts, function test( t ) { }); tape( 'the function has an arity of 3', opts, function test( t ) { - t.strictEqual( dssum.length, 3, 'has expected arity' ); + t.strictEqual( dssum.length, 3, 'returns expected value' ); t.end(); }); @@ -194,7 +193,6 @@ tape( 'if provided an `N` parameter equal to `1`, the function returns the first }); tape( 'the function supports a `stride` parameter', opts, function test( t ) { - var N; var x; var v; @@ -209,15 +207,13 @@ tape( 'the function supports a `stride` parameter', opts, function test( t ) { 2.0 ]); - N = floor( x.length / 2 ); - v = dssum( N, x, 2 ); + v = dssum( 4, x, 2 ); t.strictEqual( v, 5.0, 'returns expected value' ); t.end(); }); tape( 'the function supports a negative `stride` parameter', opts, function test( t ) { - var N; var x; var v; var i; @@ -233,8 +229,7 @@ tape( 'the function supports a negative `stride` parameter', opts, function test 2.0 ]); - N = floor( x.length / 2 ); - v = dssum( N, x, -2 ); + v = dssum( 4, x, -2 ); t.strictEqual( v, 5.0, 'returns expected value' ); @@ -263,7 +258,6 @@ tape( 'if provided a `stride` parameter equal to `0`, the function returns the f tape( 'the function supports view offsets', opts, function test( t ) { var x0; var x1; - var N; var v; x0 = new Float32Array([ @@ -279,9 +273,8 @@ tape( 'the function supports view offsets', opts, function test( t ) { ]); x1 = new Float32Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element - N = floor(x1.length / 2); - v = dssum( N, x1, 2 ); + v = dssum( 4, x1, 2 ); t.strictEqual( v, 5.0, 'returns expected value' ); t.end(); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dssum/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/dssum/test/test.ndarray.js index e19dbafec74..90d5b391eef 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dssum/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dssum/test/test.ndarray.js @@ -21,7 +21,6 @@ // MODULES // var tape = require( 'tape' ); -var floor = require( '@stdlib/math/base/special/floor' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var Float32Array = require( '@stdlib/array/float32' ); var dssum = require( './../lib/ndarray.js' ); @@ -36,7 +35,7 @@ tape( 'main export is a function', function test( t ) { }); tape( 'the function has an arity of 4', function test( t ) { - t.strictEqual( dssum.length, 4, 'has expected arity' ); + t.strictEqual( dssum.length, 4, 'returns expected value' ); t.end(); }); @@ -103,7 +102,6 @@ tape( 'if provided an `N` parameter equal to `1`, the function returns the first }); tape( 'the function supports a `stride` parameter', function test( t ) { - var N; var x; var v; @@ -118,15 +116,13 @@ tape( 'the function supports a `stride` parameter', function test( t ) { 2.0 ]); - N = floor( x.length / 2 ); - v = dssum( N, x, 2, 0 ); + v = dssum( 4, x, 2, 0 ); t.strictEqual( v, 5.0, 'returns expected value' ); t.end(); }); tape( 'the function supports a negative `stride` parameter', function test( t ) { - var N; var x; var v; var i; @@ -142,8 +138,7 @@ tape( 'the function supports a negative `stride` parameter', function test( t ) 2.0 ]); - N = floor( x.length / 2 ); - v = dssum( N, x, -2, 6 ); + v = dssum( 4, x, -2, 6 ); t.strictEqual( v, 5.0, 'returns expected value' ); @@ -170,7 +165,6 @@ tape( 'if provided a `stride` parameter equal to `0`, the function returns the f }); tape( 'the function supports an `offset` parameter', function test( t ) { - var N; var x; var v; @@ -184,9 +178,8 @@ tape( 'the function supports an `offset` parameter', function test( t ) { 3.0, 4.0 // 3 ]); - N = floor( x.length / 2 ); - v = dssum( N, x, 2, 1 ); + v = dssum( 4, x, 2, 1 ); t.strictEqual( v, 5.0, 'returns expected value' ); t.end(); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dssum/test/test.ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/dssum/test/test.ndarray.native.js index 9f9ce44b57d..a6ad5ae5da3 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dssum/test/test.ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dssum/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 isnan = require( '@stdlib/math/base/assert/is-nan' ); var Float32Array = require( '@stdlib/array/float32' ); var tryRequire = require( '@stdlib/utils/try-require' ); @@ -45,7 +44,7 @@ tape( 'main export is a function', opts, function test( t ) { }); tape( 'the function has an arity of 4', opts, function test( t ) { - t.strictEqual( dssum.length, 4, 'has expected arity' ); + t.strictEqual( dssum.length, 4, 'returns expected value' ); t.end(); }); @@ -112,7 +111,6 @@ tape( 'if provided an `N` parameter equal to `1`, the function returns the first }); tape( 'the function supports a `stride` parameter', opts, function test( t ) { - var N; var x; var v; @@ -127,15 +125,13 @@ tape( 'the function supports a `stride` parameter', opts, function test( t ) { 2.0 ]); - N = floor( x.length / 2 ); - v = dssum( N, x, 2, 0 ); + v = dssum( 4, x, 2, 0 ); t.strictEqual( v, 5.0, 'returns expected value' ); t.end(); }); tape( 'the function supports a negative `stride` parameter', opts, function test( t ) { - var N; var x; var v; var i; @@ -151,8 +147,7 @@ tape( 'the function supports a negative `stride` parameter', opts, function test 2.0 ]); - N = floor( x.length / 2 ); - v = dssum( N, x, -2, 6 ); + v = dssum( 4, x, -2, 6 ); t.strictEqual( v, 5.0, 'returns expected value' ); @@ -179,7 +174,6 @@ tape( 'if provided a `stride` parameter equal to `0`, the function returns the f }); tape( 'the function supports an `offset` parameter', opts, function test( t ) { - var N; var x; var v; @@ -193,9 +187,8 @@ tape( 'the function supports an `offset` parameter', opts, function test( t ) { 3.0, 4.0 // 3 ]); - N = floor( x.length / 2 ); - v = dssum( N, x, 2, 1 ); + v = dssum( 4, x, 2, 1 ); t.strictEqual( v, 5.0, 'returns expected value' ); t.end();