diff --git a/lib/node_modules/@stdlib/blas/ext/base/dnanasum/README.md b/lib/node_modules/@stdlib/blas/ext/base/dnanasum/README.md index 0f17f7cb5c3..4b66f7d3180 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dnanasum/README.md +++ b/lib/node_modules/@stdlib/blas/ext/base/dnanasum/README.md @@ -71,16 +71,14 @@ The function has the following parameters: - **x**: input [`Float64Array`][@stdlib/array/float64]. - **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 absolute values ([_L1_ norm][l1norm]) 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 absolute values ([_L1_ norm][l1norm]) every other element in the strided array, ```javascript var Float64Array = require( '@stdlib/array/float64' ); -var floor = require( '@stdlib/math/base/special/floor' ); var x = new Float64Array( [ 1.0, 2.0, NaN, -7.0, NaN, 3.0, 4.0, 2.0 ] ); -var N = floor( x.length / 2 ); -var v = dnanasum( N, x, 2 ); +var v = dnanasum( 4, x, 2 ); // returns 5.0 ``` @@ -90,14 +88,11 @@ Note that indexing is relative to the first index. To introduce an offset, use [ ```javascript var Float64Array = require( '@stdlib/array/float64' ); -var floor = require( '@stdlib/math/base/special/floor' ); var x0 = new Float64Array( [ 2.0, 1.0, NaN, -2.0, -2.0, 2.0, 3.0, 4.0 ] ); var x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element -var N = floor( x0.length / 2 ); - -var v = dnanasum( N, x1, 2 ); +var v = dnanasum( 4, x1, 2 ); // returns 9.0 ``` @@ -109,9 +104,8 @@ Computes the sum of absolute values ([_L1_ norm][l1norm]) of double-precision fl var Float64Array = require( '@stdlib/array/float64' ); var x = new Float64Array( [ 1.0, -2.0, NaN, 2.0 ] ); -var N = x.length; -var v = dnanasum.ndarray( N, x, 1, 0 ); +var v = dnanasum.ndarray( 4, x, 1, 0 ); // returns 5.0 ``` @@ -119,16 +113,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 absolute values ([_L1_ norm][l1norm]) 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 absolute values ([_L1_ norm][l1norm]) every other value in the strided array starting from the second value ```javascript var Float64Array = require( '@stdlib/array/float64' ); -var floor = require( '@stdlib/math/base/special/floor' ); var x = new Float64Array( [ 2.0, 1.0, NaN, -2.0, -2.0, 2.0, 3.0, 4.0 ] ); -var N = floor( x.length / 2 ); -var v = dnanasum.ndarray( N, x, 2, 1 ); +var v = dnanasum.ndarray( 4, x, 2, 1 ); // returns 9.0 ``` @@ -153,22 +145,20 @@ var v = dnanasum.ndarray( N, x, 2, 1 ); ```javascript -var randu = require( '@stdlib/random/base/randu' ); -var round = require( '@stdlib/math/base/special/round' ); +var bernoulli = require( '@stdlib/random/base/bernoulli' ); +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ); +var filledarrayBy = require( '@stdlib/array/filled-by' ); var Float64Array = require( '@stdlib/array/float64' ); var dnanasum = require( '@stdlib/blas/ext/base/dnanasum' ); -var x; -var i; - -x = new Float64Array( 10 ); -for ( i = 0; i < x.length; i++ ) { - if ( randu() < 0.2 ) { - x[ i ] = NaN; - } else { - x[ i ] = round( randu()*100.0 ); +function rand() { + if ( bernoulli( 0.8 ) > 0 ) { + return discreteUniform( 0, 100 ); } + return NaN; } + +var x = filledarrayBy( 10, 'float64', rand ); console.log( x ); var v = dnanasum( x.length, x, 1 ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dnanasum/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/ext/base/dnanasum/benchmark/benchmark.js index 28f172784e9..1c6de1bff06 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dnanasum/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dnanasum/benchmark/benchmark.js @@ -21,10 +21,11 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); +var bernoulli = require( '@stdlib/random/base/bernoulli' ); +var uniform = require( '@stdlib/random/base/uniform' ); +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 Float64Array = require( '@stdlib/array/float64' ); var pkg = require( './../package.json' ).name; var dnanasum = require( './../lib/dnanasum.js' ); @@ -39,18 +40,15 @@ var dnanasum = require( './../lib/dnanasum.js' ); * @returns {Function} benchmark function */ function createBenchmark( len ) { - var x; - var i; + var x = filledarrayBy( len, 'float64', rand ); + return benchmark; - x = new Float64Array( len ); - for ( i = 0; i < x.length; i++ ) { - if ( randu() < 0.2 ) { - x[ i ] = NaN; - } else { - x[ i ] = ( randu()*20.0 ) - 10.0; + function rand() { + if ( bernoulli( 0.8 ) > 0 ) { + return uniform( -10.0, 10.0 ); } + return NaN; } - return benchmark; function benchmark( b ) { var v; diff --git a/lib/node_modules/@stdlib/blas/ext/base/dnanasum/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/blas/ext/base/dnanasum/benchmark/benchmark.native.js index fa0b19bb700..41320972efb 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dnanasum/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dnanasum/benchmark/benchmark.native.js @@ -22,10 +22,11 @@ var resolve = require( 'path' ).resolve; var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); +var bernoulli = require( '@stdlib/random/base/bernoulli' ); +var uniform = require( '@stdlib/random/base/uniform' ); +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 Float64Array = require( '@stdlib/array/float64' ); var tryRequire = require( '@stdlib/utils/try-require' ); var pkg = require( './../package.json' ).name; @@ -48,18 +49,15 @@ var opts = { * @returns {Function} benchmark function */ function createBenchmark( len ) { - var x; - var i; + var x = filledarrayBy( len, 'float64', rand ); + return benchmark; - x = new Float64Array( len ); - for ( i = 0; i < x.length; i++ ) { - if ( randu() < 0.2 ) { - x[ i ] = NaN; - } else { - x[ i ] = ( randu()*20.0 ) - 10.0; + function rand() { + if ( bernoulli( 0.8 ) > 0 ) { + return uniform( -10.0, 10.0 ); } + return NaN; } - return benchmark; function benchmark( b ) { var v; diff --git a/lib/node_modules/@stdlib/blas/ext/base/dnanasum/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/dnanasum/benchmark/benchmark.ndarray.js index 79481e19178..ca650778d1c 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dnanasum/benchmark/benchmark.ndarray.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dnanasum/benchmark/benchmark.ndarray.js @@ -21,10 +21,11 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); +var bernoulli = require( '@stdlib/random/base/bernoulli' ); +var uniform = require( '@stdlib/random/base/uniform' ); +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 Float64Array = require( '@stdlib/array/float64' ); var pkg = require( './../package.json' ).name; var dnanasum = require( './../lib/ndarray.js' ); @@ -39,18 +40,15 @@ var dnanasum = require( './../lib/ndarray.js' ); * @returns {Function} benchmark function */ function createBenchmark( len ) { - var x; - var i; + var x = filledarrayBy( len, 'float64', rand ); + return benchmark; - x = new Float64Array( len ); - for ( i = 0; i < x.length; i++ ) { - if ( randu() < 0.2 ) { - x[ i ] = NaN; - } else { - x[ i ] = ( randu()*20.0 ) - 10.0; + function rand() { + if ( bernoulli( 0.8 ) > 0 ) { + return uniform( -10.0, 10.0 ); } + return NaN; } - return benchmark; function benchmark( b ) { var v; diff --git a/lib/node_modules/@stdlib/blas/ext/base/dnanasum/benchmark/benchmark.ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/dnanasum/benchmark/benchmark.ndarray.native.js index 01a121858b9..28dcaaa05ac 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dnanasum/benchmark/benchmark.ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dnanasum/benchmark/benchmark.ndarray.native.js @@ -22,10 +22,11 @@ var resolve = require( 'path' ).resolve; var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); +var bernoulli = require( '@stdlib/random/base/bernoulli' ); +var uniform = require( '@stdlib/random/base/uniform' ); +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 Float64Array = require( '@stdlib/array/float64' ); var tryRequire = require( '@stdlib/utils/try-require' ); var pkg = require( './../package.json' ).name; @@ -48,18 +49,15 @@ var opts = { * @returns {Function} benchmark function */ function createBenchmark( len ) { - var x; - var i; + var x = filledarrayBy( len, 'float64', rand ); + return benchmark; - x = new Float64Array( len ); - for ( i = 0; i < x.length; i++ ) { - if ( randu() < 0.2 ) { - x[ i ] = NaN; - } else { - x[ i ] = ( randu()*20.0 ) - 10.0; + function rand() { + if ( bernoulli( 0.8 ) > 0 ) { + return uniform( -10.0, 10.0 ); } + return NaN; } - return benchmark; function benchmark( b ) { var v; diff --git a/lib/node_modules/@stdlib/blas/ext/base/dnanasum/docs/repl.txt b/lib/node_modules/@stdlib/blas/ext/base/dnanasum/docs/repl.txt index 9d1cdbeea77..5af6fed5186 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dnanasum/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/ext/base/dnanasum/docs/repl.txt @@ -3,8 +3,8 @@ Computes the sum of absolute values (L1 norm) of double-precision floating- point strided array elements, ignoring `NaN` values. - 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/float64}}( [ -2.0, 1.0, 1.0, -5.0, 2.0, -1.0, NaN, NaN ] ); - > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 ); - > var stride = 2; - > {{alias}}( N, x, stride ) + > {{alias}}( 4, x, 2 ) 5.0 // Using view offsets: > var x0 = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 3.0, 2.0, 5.0, -1.0, NaN, NaN ] ); > var x1 = new {{alias:@stdlib/array/float64}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); - > N = {{alias:@stdlib/math/base/special/floor}}( x0.length / 2 ); - > stride = 2; - > {{alias}}( N, x1, stride ) + > {{alias}}( 4, x1, 2 ) 5.0 + {{alias}}.ndarray( N, x, stride, offset ) Computes the sum of absolute values (L1 norm) of double-precision floating- point strided array elements, ignoring `NaN` values and using alternative @@ -86,10 +83,8 @@ // Using offset parameter: > var x = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 3.0, 2.0, 5.0, -1.0, NaN, NaN ] ); - > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 ); - > {{alias}}.ndarray( N, x, 2, 1 ) + > {{alias}}.ndarray( 4, x, 2, 1 ) 5.0 See Also -------- - diff --git a/lib/node_modules/@stdlib/blas/ext/base/dnanasum/examples/index.js b/lib/node_modules/@stdlib/blas/ext/base/dnanasum/examples/index.js index d73df14cf37..9143164ef0c 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dnanasum/examples/index.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dnanasum/examples/index.js @@ -18,22 +18,19 @@ 'use strict'; -var randu = require( '@stdlib/random/base/randu' ); -var round = require( '@stdlib/math/base/special/round' ); -var Float64Array = require( '@stdlib/array/float64' ); +var bernoulli = require( '@stdlib/random/base/bernoulli' ); +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ); +var filledarrayBy = require( '@stdlib/array/filled-by' ); var dnanasum = require( './../lib' ); -var x; -var i; - -x = new Float64Array( 10 ); -for ( i = 0; i < x.length; i++ ) { - if ( randu() < 0.2 ) { - x[ i ] = NaN; - } else { - x[ i ] = round( randu()*100.0 ); +function rand() { + if ( bernoulli( 0.8 ) > 0 ) { + return discreteUniform( 0, 100 ); } + return NaN; } + +var x = filledarrayBy( 10, 'float64', rand ); console.log( x ); var v = dnanasum( x.length, x, 1 ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dnanasum/include.gypi b/lib/node_modules/@stdlib/blas/ext/base/dnanasum/include.gypi index 868c5c12e85..26476a8c265 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dnanasum/include.gypi +++ b/lib/node_modules/@stdlib/blas/ext/base/dnanasum/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, stride, argv, 2 ); + STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, X, N, stride, argv, 1 ); + + napi_value v; + napi_status status = napi_create_double( env, stdlib_strided_dnanasum( N, 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/dnanasum/src/addon.cpp b/lib/node_modules/@stdlib/blas/ext/base/dnanasum/src/addon.cpp deleted file mode 100644 index 4cb63007da6..00000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/dnanasum/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/dnanasum.h" -#include -#include -#include -#include -#include - -/** -* Add-on namespace. -*/ -namespace stdlib_blas_ext_base_dnanasum { - - /** - * Computes the sum of absolute values (L1 norm) of double-precision floating-point strided array elements, ignoring `NaN` values. - * - * ## Notes - * - * - When called from JavaScript, the function expects three arguments: - * - * - `N`: number of indexed elements - * - `X`: input array - * - `stride`: stride length - */ - napi_value node_dnanasum( 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 Float64Array." ); - 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_float64_array ) { - napi_throw_type_error( env, nullptr, "invalid argument. Second argument must be a Float64Array." ); - 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_dnanasum( N, (double *)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_dnanasum, NULL, &fcn ); - assert( status == napi_ok ); - return fcn; - } - - NAPI_MODULE( NODE_GYP_MODULE_NAME, Init ) -} // end namespace stdlib_blas_ext_base_dnanasum diff --git a/lib/node_modules/@stdlib/blas/ext/base/dnanasum/test/test.dnanasum.js b/lib/node_modules/@stdlib/blas/ext/base/dnanasum/test/test.dnanasum.js index bdc6739d932..31dc16d5be1 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dnanasum/test/test.dnanasum.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dnanasum/test/test.dnanasum.js @@ -21,7 +21,6 @@ // MODULES // var tape = require( 'tape' ); -var floor = require( '@stdlib/math/base/special/floor' ); var Float64Array = require( '@stdlib/array/float64' ); var dnanasum = require( './../lib/dnanasum.js' ); @@ -35,7 +34,7 @@ tape( 'main export is a function', function test( t ) { }); tape( 'the function has an arity of 3', function test( t ) { - t.strictEqual( dnanasum.length, 3, 'has expected arity' ); + t.strictEqual( dnanasum.length, 3, 'returns expected value' ); t.end(); }); @@ -106,7 +105,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; @@ -123,15 +121,13 @@ tape( 'the function supports a `stride` parameter', function test( t ) { NaN ]); - N = floor( x.length / 2 ); - v = dnanasum( N, x, 2 ); + v = dnanasum( 5, x, 2 ); t.strictEqual( v, 9.0, 'returns expected value' ); t.end(); }); tape( 'the function supports a negative `stride` parameter', function test( t ) { - var N; var x; var v; @@ -148,8 +144,7 @@ tape( 'the function supports a negative `stride` parameter', function test( t ) 2.0 ]); - N = floor( x.length / 2 ); - v = dnanasum( N, x, -2 ); + v = dnanasum( 5, x, -2 ); t.strictEqual( v, 9.0, 'returns expected value' ); t.end(); @@ -170,7 +165,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 Float64Array([ @@ -188,9 +182,8 @@ tape( 'the function supports view offsets', function test( t ) { ]); x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element - N = floor(x1.length / 2); - v = dnanasum( N, x1, 2 ); + v = dnanasum( 5, x1, 2 ); t.strictEqual( v, 9.0, 'returns expected value' ); t.end(); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dnanasum/test/test.dnanasum.native.js b/lib/node_modules/@stdlib/blas/ext/base/dnanasum/test/test.dnanasum.native.js index ebddab346aa..5b544d313bd 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dnanasum/test/test.dnanasum.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dnanasum/test/test.dnanasum.native.js @@ -22,7 +22,6 @@ var resolve = require( 'path' ).resolve; var tape = require( 'tape' ); -var floor = require( '@stdlib/math/base/special/floor' ); var Float64Array = require( '@stdlib/array/float64' ); var tryRequire = require( '@stdlib/utils/try-require' ); @@ -44,7 +43,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( dnanasum.length, 3, 'has expected arity' ); + t.strictEqual( dnanasum.length, 3, 'returns expected value' ); t.end(); }); @@ -197,7 +196,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; @@ -214,15 +212,13 @@ tape( 'the function supports a `stride` parameter', opts, function test( t ) { NaN ]); - N = floor( x.length / 2 ); - v = dnanasum( N, x, 2 ); + v = dnanasum( 5, x, 2 ); t.strictEqual( v, 9.0, 'returns expected value' ); t.end(); }); tape( 'the function supports a negative `stride` parameter', opts, function test( t ) { - var N; var x; var v; @@ -239,8 +235,7 @@ tape( 'the function supports a negative `stride` parameter', opts, function test 2.0 ]); - N = floor( x.length / 2 ); - v = dnanasum( N, x, -2 ); + v = dnanasum( 5, x, -2 ); t.strictEqual( v, 9.0, 'returns expected value' ); t.end(); @@ -261,7 +256,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 Float64Array([ @@ -279,9 +273,8 @@ tape( 'the function supports view offsets', opts, function test( t ) { ]); x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element - N = floor(x1.length / 2); - v = dnanasum( N, x1, 2 ); + v = dnanasum( 5, x1, 2 ); t.strictEqual( v, 9.0, 'returns expected value' ); t.end(); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dnanasum/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/dnanasum/test/test.ndarray.js index 4b24b046657..bb1da774ef4 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dnanasum/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dnanasum/test/test.ndarray.js @@ -21,7 +21,6 @@ // MODULES // var tape = require( 'tape' ); -var floor = require( '@stdlib/math/base/special/floor' ); var Float64Array = require( '@stdlib/array/float64' ); var dnanasum = require( './../lib/ndarray.js' ); @@ -35,7 +34,7 @@ tape( 'main export is a function', function test( t ) { }); tape( 'the function has an arity of 4', function test( t ) { - t.strictEqual( dnanasum.length, 4, 'has expected arity' ); + t.strictEqual( dnanasum.length, 4, 'returns expected value' ); t.end(); }); @@ -106,7 +105,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; @@ -123,15 +121,13 @@ tape( 'the function supports a `stride` parameter', function test( t ) { NaN ]); - N = floor( x.length / 2 ); - v = dnanasum( N, x, 2, 0 ); + v = dnanasum( 5, x, 2, 0 ); t.strictEqual( v, 9.0, 'returns expected value' ); t.end(); }); tape( 'the function supports a negative `stride` parameter', function test( t ) { - var N; var x; var v; @@ -148,8 +144,7 @@ tape( 'the function supports a negative `stride` parameter', function test( t ) 2.0 ]); - N = floor( x.length / 2 ); - v = dnanasum( N, x, -2, 8 ); + v = dnanasum( 5, x, -2, 8 ); t.strictEqual( v, 9.0, 'returns expected value' ); t.end(); @@ -168,7 +163,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 ) { NaN, NaN // 4 ]); - N = floor( x.length / 2 ); - v = dnanasum( N, x, 2, 1 ); + v = dnanasum( 5, x, 2, 1 ); t.strictEqual( v, 9.0, 'returns expected value' ); t.end(); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dnanasum/test/test.ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/dnanasum/test/test.ndarray.native.js index b108f50c796..9f9a1cbdd1c 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dnanasum/test/test.ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dnanasum/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 Float64Array = require( '@stdlib/array/float64' ); var tryRequire = require( '@stdlib/utils/try-require' ); @@ -44,7 +43,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( dnanasum.length, 4, 'has expected arity' ); + t.strictEqual( dnanasum.length, 4, 'returns expected value' ); t.end(); }); @@ -115,7 +114,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; @@ -132,15 +130,13 @@ tape( 'the function supports a `stride` parameter', opts, function test( t ) { NaN ]); - N = floor( x.length / 2 ); - v = dnanasum( N, x, 2, 0 ); + v = dnanasum( 5, x, 2, 0 ); t.strictEqual( v, 9.0, 'returns expected value' ); t.end(); }); tape( 'the function supports a negative `stride` parameter', opts, function test( t ) { - var N; var x; var v; @@ -157,8 +153,7 @@ tape( 'the function supports a negative `stride` parameter', opts, function test 2.0 ]); - N = floor( x.length / 2 ); - v = dnanasum( N, x, -2, 8 ); + v = dnanasum( 5, x, -2, 8 ); t.strictEqual( v, 9.0, 'returns expected value' ); t.end(); @@ -177,7 +172,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 ) { NaN, NaN // 4 ]); - N = floor( x.length / 2 ); - v = dnanasum( N, x, 2, 1 ); + v = dnanasum( 5, x, 2, 1 ); t.strictEqual( v, 9.0, 'returns expected value' ); t.end();