From 5b15c9675be434c0e11b1ec1e1f78d7b089abbcd Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Fri, 1 Dec 2023 12:33:25 -0800 Subject: [PATCH] refactor: update implementation in accordance with current project conventions Ref: https://github.com/stdlib-js/stdlib/issues/788 --- .../@stdlib/blas/base/dasum/README.md | 37 +- .../blas/base/dasum/benchmark/benchmark.js | 17 +- .../base/dasum/benchmark/benchmark.native.js | 13 +- .../base/dasum/benchmark/benchmark.ndarray.js | 17 +- .../benchmark/benchmark.ndarray.native.js | 13 +- .../@stdlib/blas/base/dasum/examples/index.js | 25 +- .../@stdlib/blas/base/dasum/include.gypi | 2 +- .../blas/base/dasum/lib/ndarray.native.js | 7 +- .../@stdlib/blas/base/dasum/manifest.json | 317 ++++++++++-------- .../@stdlib/blas/base/dasum/src/addon.c | 48 +++ .../@stdlib/blas/base/dasum/src/addon.cpp | 117 ------- .../blas/base/dasum/test/test.dasum.js | 12 +- .../blas/base/dasum/test/test.dasum.native.js | 8 +- .../@stdlib/blas/base/dasum/test/test.js | 4 +- .../blas/base/dasum/test/test.ndarray.js | 6 +- .../base/dasum/test/test.ndarray.native.js | 6 +- 16 files changed, 286 insertions(+), 363 deletions(-) create mode 100644 lib/node_modules/@stdlib/blas/base/dasum/src/addon.c delete mode 100644 lib/node_modules/@stdlib/blas/base/dasum/src/addon.cpp diff --git a/lib/node_modules/@stdlib/blas/base/dasum/README.md b/lib/node_modules/@stdlib/blas/base/dasum/README.md index f09c1b8d411..a0f80cdeb97 100644 --- a/lib/node_modules/@stdlib/blas/base/dasum/README.md +++ b/lib/node_modules/@stdlib/blas/base/dasum/README.md @@ -74,14 +74,10 @@ The `N` and `stride` parameters determine which elements in `x` are used to comp ```javascript var Float64Array = require( '@stdlib/array/float64' ); -var floor = require( '@stdlib/math/base/special/floor' ); var x = new Float64Array( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); -var N = floor( x.length / 2 ); -var stride = 2; - -var sum = dasum( N, x, stride ); +var sum = dasum( 4, x, 2 ); // returns 10.0 ``` @@ -96,10 +92,8 @@ var x0 = new Float64Array( [ 1.0, -2.0, 3.0, -4.0, 5.0, -6.0 ] ); // Create an offset view... var x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element -var N = 3; - // Sum every other value... -var sum = dasum( N, x1, 2 ); +var sum = dasum( 3, x1, 2 ); // returns 12.0 ``` @@ -159,28 +153,15 @@ sum = dasum.ndarray( 3, x, -1, x.length-1 ); ```javascript -var round = require( '@stdlib/math/base/special/round' ); -var randu = require( '@stdlib/random/base/randu' ); -var Float64Array = require( '@stdlib/array/float64' ); +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; +var filledarrayBy = require( '@stdlib/array/filled-by' ); var dasum = require( '@stdlib/blas/base/dasum' ); -var rand; -var sign; -var x; -var i; - -x = new Float64Array( 100 ); -for ( i = 0; i < x.length; i++ ) { - rand = round( randu()*100.0 ); - sign = randu(); - if ( sign < 0.5 ) { - sign = -1.0; - } else { - sign = 1.0; - } - x[ i ] = sign * rand; -} -console.log( dasum( x.length, x, 1 ) ); +var x = filledarrayBy( 10, 'float64', discreteUniform( -100, 100 ) ); +console.log( x ); + +var y = dasum( x.length, x, 1 ); +console.log( y ); ``` diff --git a/lib/node_modules/@stdlib/blas/base/dasum/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/base/dasum/benchmark/benchmark.js index c5dc2a7a290..c1fb11de4d5 100644 --- a/lib/node_modules/@stdlib/blas/base/dasum/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/blas/base/dasum/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 Float64Array = require( '@stdlib/array/float64' ); var pkg = require( './../package.json' ).name; var dasum = require( './../lib/dasum.js' ); +// VARIABLES // + +var rand = uniform( -100.0, 100.0 ); + + // FUNCTIONS // /** @@ -39,13 +44,7 @@ var dasum = require( './../lib/dasum.js' ); * @returns {Function} benchmark function */ function createBenchmark( len ) { - var x; - var i; - - x = new Float64Array( len ); - for ( i = 0; i < x.length; i++ ) { - x[ i ] = ( randu()*20000.0 ) - 10000.0; - } + var x = filledarrayBy( len, 'float64', rand ); return benchmark; /** diff --git a/lib/node_modules/@stdlib/blas/base/dasum/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/blas/base/dasum/benchmark/benchmark.native.js index 2ddcfef9368..71750ae132a 100644 --- a/lib/node_modules/@stdlib/blas/base/dasum/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/blas/base/dasum/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 Float64Array = require( '@stdlib/array/float64' ); var tryRequire = require( '@stdlib/utils/try-require' ); var pkg = require( './../package.json' ).name; @@ -36,6 +36,7 @@ var dasum = tryRequire( resolve( __dirname, './../lib/dasum.native.js' ) ); var opts = { 'skip': ( dasum instanceof Error ) }; +var rand = uniform( -100.0, 100.0 ); // FUNCTIONS // @@ -48,13 +49,7 @@ var opts = { * @returns {Function} benchmark function */ function createBenchmark( len ) { - var x; - var i; - - x = new Float64Array( len ); - for ( i = 0; i < x.length; i++ ) { - x[ i ] = ( randu()*20000.0 ) - 10000.0; - } + var x = filledarrayBy( len, 'float64', rand ); return benchmark; /** diff --git a/lib/node_modules/@stdlib/blas/base/dasum/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/base/dasum/benchmark/benchmark.ndarray.js index 5bd5d179fdb..e8073ecf4d6 100644 --- a/lib/node_modules/@stdlib/blas/base/dasum/benchmark/benchmark.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/dasum/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 Float64Array = require( '@stdlib/array/float64' ); var pkg = require( './../package.json' ).name; var dasum = require( './../lib/ndarray.js' ); +// VARIABLES // + +var rand = uniform( -100.0, 100.0 ); + + // FUNCTIONS // /** @@ -39,13 +44,7 @@ var dasum = require( './../lib/ndarray.js' ); * @returns {Function} benchmark function */ function createBenchmark( len ) { - var x; - var i; - - x = new Float64Array( len ); - for ( i = 0; i < x.length; i++ ) { - x[ i ] = ( randu()*20000.0 ) - 10000.0; - } + var x = filledarrayBy( len, 'float64', rand ); return benchmark; /** diff --git a/lib/node_modules/@stdlib/blas/base/dasum/benchmark/benchmark.ndarray.native.js b/lib/node_modules/@stdlib/blas/base/dasum/benchmark/benchmark.ndarray.native.js index c2a9072718c..323637b0055 100644 --- a/lib/node_modules/@stdlib/blas/base/dasum/benchmark/benchmark.ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/base/dasum/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 Float64Array = require( '@stdlib/array/float64' ); var tryRequire = require( '@stdlib/utils/try-require' ); var pkg = require( './../package.json' ).name; @@ -36,6 +36,7 @@ var dasum = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ); var opts = { 'skip': ( dasum instanceof Error ) }; +var rand = uniform( -100.0, 100.0 ); // FUNCTIONS // @@ -48,13 +49,7 @@ var opts = { * @returns {Function} benchmark function */ function createBenchmark( len ) { - var x; - var i; - - x = new Float64Array( len ); - for ( i = 0; i < x.length; i++ ) { - x[ i ] = ( randu()*20000.0 ) - 10000.0; - } + var x = filledarrayBy( len, 'float64', rand ); return benchmark; /** diff --git a/lib/node_modules/@stdlib/blas/base/dasum/examples/index.js b/lib/node_modules/@stdlib/blas/base/dasum/examples/index.js index 62cf9cac129..6f259ee3005 100644 --- a/lib/node_modules/@stdlib/blas/base/dasum/examples/index.js +++ b/lib/node_modules/@stdlib/blas/base/dasum/examples/index.js @@ -18,25 +18,12 @@ 'use strict'; -var round = require( '@stdlib/math/base/special/round' ); -var randu = require( '@stdlib/random/base/randu' ); -var Float64Array = require( '@stdlib/array/float64' ); +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory; +var filledarrayBy = require( '@stdlib/array/filled-by' ); var dasum = require( './../lib' ); -var rand; -var sign; -var x; -var i; +var x = filledarrayBy( 10, 'float64', discreteUniform( -100, 100 ) ); +console.log( x ); -x = new Float64Array( 100 ); -for ( i = 0; i < x.length; i++ ) { - rand = round( randu()*100.0 ); - sign = randu(); - if ( sign < 0.5 ) { - sign = -1.0; - } else { - sign = 1.0; - } - x[ i ] = sign * rand; -} -console.log( dasum( x.length, x, 1 ) ); +var y = dasum( x.length, x, 1 ); +console.log( y ); diff --git a/lib/node_modules/@stdlib/blas/base/dasum/include.gypi b/lib/node_modules/@stdlib/blas/base/dasum/include.gypi index 22e6289c74d..3bfc9e282aa 100644 --- a/lib/node_modules/@stdlib/blas/base/dasum/include.gypi +++ b/lib/node_modules/@stdlib/blas/base/dasum/include.gypi @@ -52,7 +52,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_FLOAT64ARRAY( env, X, N, strideX, argv, 1 ); + + napi_value v; + napi_status status = napi_create_double( env, c_dasum( N, (double *)X, strideX ), &v ); + assert( status == napi_ok ); + + return v; +} + +STDLIB_NAPI_MODULE_EXPORT_FCN( addon ) diff --git a/lib/node_modules/@stdlib/blas/base/dasum/src/addon.cpp b/lib/node_modules/@stdlib/blas/base/dasum/src/addon.cpp deleted file mode 100644 index db32b3cb93d..00000000000 --- a/lib/node_modules/@stdlib/blas/base/dasum/src/addon.cpp +++ /dev/null @@ -1,117 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 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/base/dasum.h" -#include -#include -#include -#include -#include - -/** -* Add-on namespace. -*/ -namespace stdlib_blas_base_dasum { - - /** - * Computes the sum of absolute values. - * - * ## Notes - * - * - When called from JavaScript, the function expects three arguments: - * - * - `N`: number of indexed elements - * - `X`: input array - * - `strideX`: `X` stride length - */ - napi_value node_dasum( 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 res1; - status = napi_is_typedarray( env, argv[ 1 ], &res1 ); - assert( status == napi_ok ); - if ( res1 == 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 strideX; - status = napi_get_value_int64( env, argv[ 2 ], &strideX ); - 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(strideX) >= (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, c_dasum( N, (double *)X, strideX ), &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_dasum, NULL, &fcn ); - assert( status == napi_ok ); - return fcn; - } - - NAPI_MODULE( NODE_GYP_MODULE_NAME, Init ) -} // end namespace stdlib_blas_base_dasum diff --git a/lib/node_modules/@stdlib/blas/base/dasum/test/test.dasum.js b/lib/node_modules/@stdlib/blas/base/dasum/test/test.dasum.js index cf75cc627ba..6b61954ad07 100644 --- a/lib/node_modules/@stdlib/blas/base/dasum/test/test.dasum.js +++ b/lib/node_modules/@stdlib/blas/base/dasum/test/test.dasum.js @@ -21,7 +21,6 @@ // MODULES // var tape = require( 'tape' ); -var floor = require( '@stdlib/math/base/special/floor' ); var randu = require( '@stdlib/random/base/randu' ); var Float64Array = require( '@stdlib/array/float64' ); var dasum = require( './../lib/dasum.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( dasum.length, 3, 'arity of 3' ); + t.strictEqual( dasum.length, 3, 'returns expected value' ); t.end(); }); @@ -47,7 +46,7 @@ tape( 'the function computes the sum of absolute values', function test( t ) { x = new Float64Array( [ 1.0, -2.0, 3.0, -4.0, 5.0 ] ); y = dasum( x.length, x, 1 ); - t.strictEqual( y, 15.0, 'returns 15' ); + t.strictEqual( y, 15.0, 'returns expected value' ); t.end(); }); @@ -114,8 +113,7 @@ tape( 'the function supports view offsets', function test( t ) { // Create an offset view... x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // begin at 2nd element - N = floor( x0.length / 2 ); - + N = 3; y = dasum( N, x1, 2 ); t.strictEqual( y, 12.0, 'returns expected value' ); @@ -142,7 +140,7 @@ tape( 'if the stride equals `1`, the function efficiently sums the absolute valu y = dasum( x.length, x, 1 ); // Compare to closed-form formula: - t.strictEqual( y, x.length*(x.length+1)/2, 'returns expected sum' ); + t.strictEqual( y, x.length*(x.length+1)/2, 'returns expected value' ); x = new Float64Array( 240 ); for ( i = 0; i < x.length; i++ ) { @@ -158,7 +156,7 @@ tape( 'if the stride equals `1`, the function efficiently sums the absolute valu y = dasum( x.length, x, 1 ); // Compare to closed-form formula: - t.strictEqual( y, x.length*(x.length+1)/2, 'returns expected sum' ); + t.strictEqual( y, x.length*(x.length+1)/2, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/blas/base/dasum/test/test.dasum.native.js b/lib/node_modules/@stdlib/blas/base/dasum/test/test.dasum.native.js index 2ca409e6c15..a6650e397ac 100644 --- a/lib/node_modules/@stdlib/blas/base/dasum/test/test.dasum.native.js +++ b/lib/node_modules/@stdlib/blas/base/dasum/test/test.dasum.native.js @@ -22,7 +22,6 @@ var resolve = require( 'path' ).resolve; var tape = require( 'tape' ); -var floor = require( '@stdlib/math/base/special/floor' ); var randu = require( '@stdlib/random/base/randu' ); var Float64Array = require( '@stdlib/array/float64' ); var tryRequire = require( '@stdlib/utils/try-require' ); @@ -118,8 +117,7 @@ tape( 'the function supports view offsets', opts, function test( t ) { // Create an offset view... x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // begin at 2nd element - N = floor( x0.length / 2 ); - + N = 3; y = dasum( N, x1, 2 ); t.strictEqual( y, 12.0, 'returns expected value' ); @@ -146,7 +144,7 @@ tape( 'if the stride equals `1`, the function efficiently sums the absolute valu y = dasum( x.length, x, 1 ); // Compare to closed-form formula: - t.strictEqual( y, x.length*(x.length+1)/2, 'returns expected sum' ); + t.strictEqual( y, x.length*(x.length+1)/2, 'returns expected value' ); x = new Float64Array( 240 ); for ( i = 0; i < x.length; i++ ) { @@ -162,7 +160,7 @@ tape( 'if the stride equals `1`, the function efficiently sums the absolute valu y = dasum( x.length, x, 1 ); // Compare to closed-form formula: - t.strictEqual( y, x.length*(x.length+1)/2, 'returns expected sum' ); + t.strictEqual( y, x.length*(x.length+1)/2, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/blas/base/dasum/test/test.js b/lib/node_modules/@stdlib/blas/base/dasum/test/test.js index b074eec4245..710fb548f84 100644 --- a/lib/node_modules/@stdlib/blas/base/dasum/test/test.js +++ b/lib/node_modules/@stdlib/blas/base/dasum/test/test.js @@ -51,7 +51,7 @@ tape( 'if a native implementation is available, the main export is the native im '@stdlib/utils/try-require': tryRequire }); - t.strictEqual( dasum, mock, 'returns native implementation' ); + t.strictEqual( dasum, mock, 'returns expected value' ); t.end(); function tryRequire() { @@ -73,7 +73,7 @@ tape( 'if a native implementation is not available, the main export is a JavaScr '@stdlib/utils/try-require': tryRequire }); - t.strictEqual( dasum, main, 'returns JavaScript implementation' ); + t.strictEqual( dasum, main, 'returns expected value' ); t.end(); function tryRequire() { diff --git a/lib/node_modules/@stdlib/blas/base/dasum/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/dasum/test/test.ndarray.js index 06e7bdbd340..fe7ad352729 100644 --- a/lib/node_modules/@stdlib/blas/base/dasum/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/dasum/test/test.ndarray.js @@ -35,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( dasum.length, 4, 'arity of 4' ); + t.strictEqual( dasum.length, 4, 'returns expected value' ); t.end(); }); @@ -147,7 +147,7 @@ tape( 'if the stride equals `1`, the function efficiently sums the absolute valu y = dasum( x.length, x, 1, 0 ); // Compare to closed-form formula: - t.strictEqual( y, x.length*(x.length+1)/2, 'returns expected sum' ); + t.strictEqual( y, x.length*(x.length+1)/2, 'returns expected value' ); x = new Float64Array( 240 ); for ( i = 0; i < x.length; i++ ) { @@ -164,7 +164,7 @@ tape( 'if the stride equals `1`, the function efficiently sums the absolute valu y = dasum( N, x, 1, 6 ); // Compare to closed-form formula: - t.strictEqual( y, N*(N+1)/2, 'returns expected sum' ); + t.strictEqual( y, N*(N+1)/2, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/blas/base/dasum/test/test.ndarray.native.js b/lib/node_modules/@stdlib/blas/base/dasum/test/test.ndarray.native.js index b034ffa2b79..0f8867ae078 100644 --- a/lib/node_modules/@stdlib/blas/base/dasum/test/test.ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/base/dasum/test/test.ndarray.native.js @@ -44,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( dasum.length, 4, 'arity of 4' ); + t.strictEqual( dasum.length, 4, 'returns expected value' ); t.end(); }); @@ -156,7 +156,7 @@ tape( 'if the stride equals `1`, the function efficiently sums the absolute valu y = dasum( x.length, x, 1, 0 ); // Compare to closed-form formula: - t.strictEqual( y, x.length*(x.length+1)/2, 'returns expected sum' ); + t.strictEqual( y, x.length*(x.length+1)/2, 'returns expected value' ); x = new Float64Array( 240 ); for ( i = 0; i < x.length; i++ ) { @@ -173,7 +173,7 @@ tape( 'if the stride equals `1`, the function efficiently sums the absolute valu y = dasum( N, x, 1, 6 ); // Compare to closed-form formula: - t.strictEqual( y, N*(N+1)/2, 'returns expected sum' ); + t.strictEqual( y, N*(N+1)/2, 'returns expected value' ); t.end(); });