diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcusum/README.md b/lib/node_modules/@stdlib/blas/ext/base/dcusum/README.md index aaff8be5b70..2b3d3996877 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcusum/README.md +++ b/lib/node_modules/@stdlib/blas/ext/base/dcusum/README.md @@ -65,18 +65,15 @@ The function has the following parameters: - **y**: output [`Float64Array`][@stdlib/array/float64]. - **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 the strided input array, ```javascript var Float64Array = require( '@stdlib/array/float64' ); -var floor = require( '@stdlib/math/base/special/floor' ); var x = new Float64Array( [ 1.0, 2.0, 2.0, -7.0, -2.0, 3.0, 4.0, 2.0 ] ); var y = new Float64Array( x.length ); -var N = floor( x.length / 2 ); - -var v = dcusum( N, 0.0, x, 2, y, 1 ); +var v = dcusum( 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 Float64Array = require( '@stdlib/array/float64' ); -var floor = require( '@stdlib/math/base/special/floor' ); // Initial arrays... var x0 = new Float64Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] ); @@ -96,9 +92,7 @@ var y0 = new Float64Array( x0.length ); var x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element var y1 = new Float64Array( y0.buffer, y0.BYTES_PER_ELEMENT*3 ); // start at 4th element -var N = floor( x0.length / 2 ); - -dcusum( N, 0.0, x1, -2, y1, 1 ); +dcusum( 4, 0.0, x1, -2, y1, 1 ); // y0 => [ 0.0, 0.0, 0.0, 4.0, 6.0, 4.0, 5.0, 0.0 ] ``` @@ -121,18 +115,15 @@ The function has the following additional parameters: - **offsetX**: starting index for `x`. - **offsetY**: starting index for `y`. -While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying `buffer`, `offsetX` and `offsetY` parameters support indexing semantics based on a starting indices. For example, to calculate the cumulative sum of every other value in `x` starting from the second value and to store in the last `N` elements of `y` starting from the last element +While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying `buffer`, `offsetX` and `offsetY` parameters support indexing semantics based on a starting indices. For example, to calculate the cumulative sum of every other value in the strided input array starting from the second value and to store in the last `N` elements of the strided output array starting from the last element ```javascript var Float64Array = require( '@stdlib/array/float64' ); -var floor = require( '@stdlib/math/base/special/floor' ); var x = new Float64Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] ); var y = new Float64Array( x.length ); -var N = floor( x.length / 2 ); - -dcusum.ndarray( N, 0.0, x, 2, 1, y, -1, y.length-1 ); +dcusum.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 ] ``` @@ -157,20 +148,14 @@ dcusum.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 Float64Array = require( '@stdlib/array/float64' ); var dcusum = require( '@stdlib/blas/ext/base/dcusum' ); -var y; -var x; -var i; +var x = filledarrayBy( 10, 'float64', discreteUniform( 0, 100 ) ); +var y = new Float64Array( x.length ); -x = new Float64Array( 10 ); -y = new Float64Array( 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/dcusum/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/ext/base/dcusum/benchmark/benchmark.js index d8667fbc66b..8745829bfb8 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcusum/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcusum/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 isnan = require( '@stdlib/math/base/assert/is-nan' ); var pow = require( '@stdlib/math/base/special/pow' ); var Float64Array = require( '@stdlib/array/float64' ); @@ -29,6 +30,11 @@ var pkg = require( './../package.json' ).name; var dcusum = require( './../lib/dcusum.js' ); +// VARIABLES // + +var rand = uniform( -10.0, 10.0 ); + + // FUNCTIONS // /** @@ -39,15 +45,8 @@ var dcusum = require( './../lib/dcusum.js' ); * @returns {Function} benchmark function */ function createBenchmark( len ) { - var y; - var x; - var i; - - x = new Float64Array( len ); - y = new Float64Array( len ); - for ( i = 0; i < x.length; i++ ) { - x[ i ] = ( randu()*20.0 ) - 10.0; - } + var x = filledarrayBy( len, 'float64', rand ); + var y = new Float64Array( len ); return benchmark; function benchmark( b ) { diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcusum/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/blas/ext/base/dcusum/benchmark/benchmark.native.js index 102c7ddc358..042b0ca0ac6 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcusum/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcusum/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 isnan = require( '@stdlib/math/base/assert/is-nan' ); var pow = require( '@stdlib/math/base/special/pow' ); var Float64Array = require( '@stdlib/array/float64' ); @@ -36,6 +37,7 @@ var dcusum = tryRequire( resolve( __dirname, './../lib/dcusum.native.js' ) ); var opts = { 'skip': ( dcusum instanceof Error ) }; +var rand = uniform( -10.0, 10.0 ); // FUNCTIONS // @@ -48,15 +50,8 @@ var opts = { * @returns {Function} benchmark function */ function createBenchmark( len ) { - var x; - var y; - var i; - - x = new Float64Array( len ); - y = new Float64Array( len ); - for ( i = 0; i < x.length; i++ ) { - x[ i ] = ( randu()*20.0 ) - 10.0; - } + var x = filledarrayBy( len, 'float64', rand ); + var y = new Float64Array( len ); return benchmark; function benchmark( b ) { diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcusum/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/dcusum/benchmark/benchmark.ndarray.js index a6a29625883..1b02c85dd20 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcusum/benchmark/benchmark.ndarray.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcusum/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 isnan = require( '@stdlib/math/base/assert/is-nan' ); var pow = require( '@stdlib/math/base/special/pow' ); var Float64Array = require( '@stdlib/array/float64' ); @@ -29,6 +30,11 @@ var pkg = require( './../package.json' ).name; var dcusum = require( './../lib/ndarray.js' ); +// VARIABLES // + +var rand = uniform( -10.0, 10.0 ); + + // FUNCTIONS // /** @@ -39,15 +45,8 @@ var dcusum = require( './../lib/ndarray.js' ); * @returns {Function} benchmark function */ function createBenchmark( len ) { - var x; - var y; - var i; - - x = new Float64Array( len ); - y = new Float64Array( len ); - for ( i = 0; i < x.length; i++ ) { - x[ i ] = ( randu()*20.0 ) - 10.0; - } + var x = filledarrayBy( len, 'float64', rand ); + var y = new Float64Array( len ); return benchmark; function benchmark( b ) { diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcusum/benchmark/benchmark.ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/dcusum/benchmark/benchmark.ndarray.native.js index 346d16da2ea..fb8838f4ae4 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcusum/benchmark/benchmark.ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcusum/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 isnan = require( '@stdlib/math/base/assert/is-nan' ); var pow = require( '@stdlib/math/base/special/pow' ); var Float64Array = require( '@stdlib/array/float64' ); @@ -36,6 +37,7 @@ var dcusum = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ); var opts = { 'skip': ( dcusum instanceof Error ) }; +var rand = uniform( -10.0, 10.0 ); // FUNCTIONS // @@ -48,15 +50,8 @@ var opts = { * @returns {Function} benchmark function */ function createBenchmark( len ) { - var x; - var y; - var i; - - x = new Float64Array( len ); - y = new Float64Array( len ); - for ( i = 0; i < x.length; i++ ) { - x[ i ] = ( randu()*20.0 ) - 10.0; - } + var x = filledarrayBy( len, 'float64', rand ); + var y = new Float64Array( len ); return benchmark; function benchmark( b ) { diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcusum/docs/repl.txt b/lib/node_modules/@stdlib/blas/ext/base/dcusum/docs/repl.txt index 6a1f4d707b4..4f955bc57eb 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcusum/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/ext/base/dcusum/docs/repl.txt @@ -3,8 +3,8 @@ Computes the cumulative sum of double-precision floating-point strided array elements. - The `N` and `stride` parameters determine which elements in `x` and `y` are - accessed at runtime. + The `N` and `stride` parameters determine which elements in the strided + arrays are accessed at runtime. Indexing is relative to the first index. To introduce an offset, use a typed array view. @@ -47,8 +47,7 @@ // Using `N` and `stride` parameters: > x = new {{alias:@stdlib/array/float64}}( [ -2.0, 1.0, 1.0, -5.0, 2.0, -1.0 ] ); > y = new {{alias:@stdlib/array/float64}}( 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/float64}}( x0.length ); > var x1 = new {{alias:@stdlib/array/float64}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); > var y1 = new {{alias:@stdlib/array/float64}}( 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 double-precision floating-point strided array elements using alternative indexing semantics. @@ -112,8 +111,7 @@ // Advanced indexing: > x = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 3.0, 2.0, 5.0, -1.0 ] ); > y = new {{alias:@stdlib/array/float64}}( 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/dcusum/examples/index.js b/lib/node_modules/@stdlib/blas/ext/base/dcusum/examples/index.js index dbfbab38024..b5d93580775 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcusum/examples/index.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcusum/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 Float64Array = require( '@stdlib/array/float64' ); var dcusum = require( './../lib' ); -var y; -var x; -var i; +var x = filledarrayBy( 10, 'float64', discreteUniform( 0, 100 ) ); +var y = new Float64Array( x.length ); -x = new Float64Array( 10 ); -y = new Float64Array( 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/dcusum/include.gypi b/lib/node_modules/@stdlib/blas/ext/base/dcusum/include.gypi index 868c5c12e85..26476a8c265 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcusum/include.gypi +++ b/lib/node_modules/@stdlib/blas/ext/base/dcusum/include.gypi @@ -36,7 +36,7 @@ # Source files: 'src_files': [ - '<(src_dir)/addon.cpp', + '<(src_dir)/addon.c', '[ 1.0, -1.0, 1.0 ] */ function dcusum( N, sum, x, strideX, y, strideY ) { diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcusum/lib/dcusum.native.js b/lib/node_modules/@stdlib/blas/ext/base/dcusum/lib/dcusum.native.js index fe7cc207a19..6bd5c1cf194 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcusum/lib/dcusum.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcusum/lib/dcusum.native.js @@ -41,9 +41,8 @@ var addon = require( './../src/addon.node' ); * * var x = new Float64Array( [ 1.0, -2.0, 2.0 ] ); * var y = new Float64Array( x.length ); -* var N = x.length; * -* var v = dcusum( N, 0.0, x, 1, y, 1 ); +* var v = dcusum( 3, 0.0, x, 1, y, 1 ); * // returns [ 1.0, -1.0, 1.0 ] */ function dcusum( N, sum, x, strideX, y, strideY ) { diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcusum/lib/index.js b/lib/node_modules/@stdlib/blas/ext/base/dcusum/lib/index.js index 7f3f016d094..cbd737aaabf 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcusum/lib/index.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcusum/lib/index.js @@ -29,21 +29,18 @@ * * var x = new Float64Array( [ 1.0, -2.0, 2.0 ] ); * var y = new Float64Array( x.length ); -* var N = x.length; * -* dcusum( N, 0.0, x, 1, y, 1 ); +* dcusum( 3, 0.0, x, 1, y, 1 ); * // y => [ 1.0, -1.0, 1.0 ] * * @example * var Float64Array = require( '@stdlib/array/float64' ); -* var floor = require( '@stdlib/math/base/special/floor' ); * var dcusum = require( '@stdlib/blas/ext/base/dcusum' ); * * var x = new Float64Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] ); * var y = new Float64Array( x.length ); -* var N = floor( x.length / 2 ); * -* dcusum.ndarray( N, 0.0, x, 2, 1, y, 1, 0 ); +* dcusum.ndarray( 4, 0.0, x, 2, 1, y, 1, 0 ); * // y => [ 1.0, -1.0, 1.0, 5.0, 0.0, 0.0, 0.0, 0.0 ] */ diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcusum/lib/ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/dcusum/lib/ndarray.js index 883f2f03f5f..bb01272fc4c 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcusum/lib/ndarray.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcusum/lib/ndarray.js @@ -40,13 +40,11 @@ var dcusumkbn = require( '@stdlib/blas/ext/base/dcusumkbn' ).ndarray; * * @example * var Float64Array = require( '@stdlib/array/float64' ); -* var floor = require( '@stdlib/math/base/special/floor' ); * * var x = new Float64Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] ); * var y = new Float64Array( x.length ); -* var N = floor( x.length / 2 ); * -* var v = dcusum( N, 0.0, x, 2, 1, y, 1, 0 ); +* var v = dcusum( 4, 0.0, x, 2, 1, y, 1, 0 ); * // returns [ 1.0, -1.0, 1.0, 5.0, 0.0, 0.0, 0.0, 0.0 ] */ function dcusum( N, sum, x, strideX, offsetX, y, strideY, offsetY ) { diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcusum/lib/ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/dcusum/lib/ndarray.native.js index 5026d16a68d..506154e8441 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcusum/lib/ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcusum/lib/ndarray.native.js @@ -20,7 +20,8 @@ // MODULES // -var Float64Array = require( '@stdlib/array/float64' ); +var minViewBufferIndex = require( '@stdlib/strided/base/min-view-buffer-index' ); +var offsetView = require( '@stdlib/strided/base/offset-view' ); var addon = require( './dcusum.native.js' ); @@ -41,26 +42,21 @@ var addon = require( './dcusum.native.js' ); * * @example * var Float64Array = require( '@stdlib/array/float64' ); -* var floor = require( '@stdlib/math/base/special/floor' ); * * var x = new Float64Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] ); * var y = new Float64Array( x.length ); -* var N = floor( x.length / 2 ); * -* var v = dcusum( N, 0.0, x, 2, 1, y, 1, 0 ); +* var v = dcusum( 4, 0.0, x, 2, 1, y, 1, 0 ); * // returns [ 1.0, -1.0, 1.0, 5.0, 0.0, 0.0, 0.0, 0.0 ] */ function dcusum( N, sum, x, strideX, offsetX, y, strideY, offsetY ) { var viewX; var viewY; - if ( strideX < 0 ) { - offsetX += (N-1) * strideX; - } - if ( strideY < 0 ) { - offsetY += (N-1) * strideY; - } - viewX = new Float64Array( x.buffer, x.byteOffset+(x.BYTES_PER_ELEMENT*offsetX), x.length-offsetX ); // eslint-disable-line max-len - viewY = new Float64Array( y.buffer, y.byteOffset+(y.BYTES_PER_ELEMENT*offsetY), y.length-offsetY ); // eslint-disable-line max-len + + offsetX = minViewBufferIndex( N, strideX, offsetX ); + viewX = offsetView( x, offsetX ); + offsetY = minViewBufferIndex( N, strideY, offsetY ); + viewY = offsetView( y, offsetY ); addon( N, sum, viewX, strideX, viewY, strideY ); return y; } diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcusum/manifest.json b/lib/node_modules/@stdlib/blas/ext/base/dcusum/manifest.json index eccdf0458c3..89ef6d37a9f 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcusum/manifest.json +++ b/lib/node_modules/@stdlib/blas/ext/base/dcusum/manifest.json @@ -1,42 +1,78 @@ { - "options": {}, - "fields": [ - { - "field": "src", - "resolve": true, - "relative": true - }, - { - "field": "include", - "resolve": true, - "relative": true - }, - { - "field": "libraries", - "resolve": false, - "relative": false - }, - { - "field": "libpath", - "resolve": true, - "relative": false - } - ], - "confs": [ - { - "src": [ - "./src/dcusum.c" - ], - "include": [ - "./include" - ], - "libraries": [ - "-lm" - ], - "libpath": [], - "dependencies": [ - "@stdlib/blas/ext/base/dcusumkbn" - ] - } - ] + "options": { + "task": "build" + }, + "fields": [ + { + "field": "src", + "resolve": true, + "relative": true + }, + { + "field": "include", + "resolve": true, + "relative": true + }, + { + "field": "libraries", + "resolve": false, + "relative": false + }, + { + "field": "libpath", + "resolve": true, + "relative": false + } + ], + "confs": [ + { + "task": "build", + "src": [ + "./src/dcusum.c" + ], + "include": [ + "./include" + ], + "libraries": [ + "-lm" + ], + "libpath": [], + "dependencies": [ + "@stdlib/napi/export", + "@stdlib/napi/argv", + "@stdlib/napi/argv-int64", + "@stdlib/napi/argv-double", + "@stdlib/napi/argv-strided-float64array", + "@stdlib/blas/ext/base/dcusumkbn" + ] + }, + { + "task": "benchmark", + "src": [ + "./src/dcusum.c" + ], + "include": [ + "./include" + ], + "libraries": [ + "-lm" + ], + "libpath": [], + "dependencies": [] + }, + { + "task": "examples", + "src": [ + "./src/dcusum.c" + ], + "include": [ + "./include" + ], + "libraries": [ + "-lm" + ], + "libpath": [], + "dependencies": [] + } + ] } diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcusum/package.json b/lib/node_modules/@stdlib/blas/ext/base/dcusum/package.json index 6bd0222f5ae..48c7704807c 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcusum/package.json +++ b/lib/node_modules/@stdlib/blas/ext/base/dcusum/package.json @@ -74,5 +74,7 @@ "double", "float64array" ], - "__stdlib__": {} + "__stdlib__": { + "wasm": false + } } diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcusum/src/addon.c b/lib/node_modules/@stdlib/blas/ext/base/dcusum/src/addon.c new file mode 100644 index 00000000000..65e31134e1c --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/dcusum/src/addon.c @@ -0,0 +1,51 @@ +/** +* @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/dcusum.h" +#include "stdlib/napi/export.h" +#include "stdlib/napi/argv.h" +#include "stdlib/napi/argv_int64.h" +#include "stdlib/napi/argv_double.h" +#include "stdlib/napi/argv_strided_float64array.h" +#include +#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, 6 ); + STDLIB_NAPI_ARGV_INT64( env, N, argv, 0 ); + STDLIB_NAPI_ARGV_DOUBLE( env, N, argv, 1 ); + STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 3 ); + STDLIB_NAPI_ARGV_INT64( env, strideY, argv, 5 ); + STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, X, N, strideX, argv, 2 ); + STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, X, N, strideY, argv, 4 ); + + napi_value v; + status = napi_create_double( env, stdlib_strided_dcusum( N, sum, X, strideX, Y, strideY ), &v ); + assert( status == napi_ok ); + return v; +} + +STDLIB_NAPI_MODULE_EXPORT_FCN( addon ) diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcusum/src/addon.cpp b/lib/node_modules/@stdlib/blas/ext/base/dcusum/src/addon.cpp deleted file mode 100644 index 00013a58a5d..00000000000 --- a/lib/node_modules/@stdlib/blas/ext/base/dcusum/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/dcusum.h" -#include -#include -#include -#include -#include - -/** -* Add-on namespace. -*/ -namespace stdlib_blas_ext_base_dcusum { - - /** - * Computes the cumulative sum of double-precision floating-point strided array elements. - * - * ## 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_dcusum( 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 Float64Array." ); - 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 Float64Array." ); - 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_float64_array ) { - napi_throw_type_error( env, nullptr, "invalid argument. Third argument must be a Float64Array." ); - 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_float64_array ) { - napi_throw_type_error( env, nullptr, "invalid argument. Fifth argument must be a Float64Array." ); - 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_dcusum( N, sum, (double *)X, strideX, (double *)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_dcusum, NULL, &fcn ); - assert( status == napi_ok ); - return fcn; - } - - NAPI_MODULE( NODE_GYP_MODULE_NAME, Init ) -} // end namespace stdlib_blas_ext_base_dcusum diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcusum/test/test.dcusum.js b/lib/node_modules/@stdlib/blas/ext/base/dcusum/test/test.dcusum.js index 1c9c29a7d5d..2595e4accf5 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcusum/test/test.dcusum.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcusum/test/test.dcusum.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 Float64Array = require( '@stdlib/array/float64' ); var dcusum = require( './../lib/dcusum.js' ); @@ -36,7 +35,7 @@ tape( 'main export is a function', function test( t ) { }); tape( 'the function has an arity of 6', function test( t ) { - t.strictEqual( dcusum.length, 6, 'has expected arity' ); + t.strictEqual( dcusum.length, 6, 'returns expected value' ); t.end(); }); @@ -164,7 +163,6 @@ tape( 'the function supports an `x` stride', function test( t ) { var expected; var x; var y; - var N; x = new Float64Array([ 1.0, // 0 @@ -180,9 +178,8 @@ tape( 'the function supports an `x` stride', function test( t ) { 0.0, 0.0 ]); - N = 3; - dcusum( N, 0.0, x, 2, y, 1 ); + dcusum( 3, 0.0, x, 2, y, 1 ); expected = new Float64Array( [ 1.0, 4.0, 9.0, 0.0, 0.0 ] ); @@ -194,7 +191,6 @@ tape( 'the function supports a `y` stride', function test( t ) { var expected; var x; var y; - var N; x = new Float64Array([ 1.0, // 0 @@ -210,9 +206,8 @@ tape( 'the function supports a `y` stride', function test( t ) { 0.0, 0.0 // 2 ]); - N = 3; - dcusum( N, 0.0, x, 1, y, 2 ); + dcusum( 3, 0.0, x, 1, y, 2 ); expected = new Float64Array( [ 1.0, 0.0, 3.0, 0.0, 6.0 ] ); @@ -224,7 +219,6 @@ tape( 'the function supports negative strides', function test( t ) { var expected; var x; var y; - var N; x = new Float64Array([ 1.0, // 2 @@ -240,9 +234,8 @@ tape( 'the function supports negative strides', function test( t ) { 0.0, 0.0 ]); - N = 3; - dcusum( N, 0.0, x, -2, y, -1 ); + dcusum( 3, 0.0, x, -2, y, -1 ); expected = new Float64Array( [ 9.0, 8.0, 5.0, 0.0, 0.0 ] ); @@ -254,7 +247,6 @@ tape( 'the function supports complex access patterns', function test( t ) { var expected; var x; var y; - var N; x = new Float64Array([ 1.0, // 0 @@ -272,9 +264,8 @@ tape( 'the function supports complex access patterns', function test( t ) { 0.0, 0.0 ]); - N = 3; - dcusum( N, 0.0, x, 2, y, -1 ); + dcusum( 3, 0.0, x, 2, y, -1 ); expected = new Float64Array( [ 9.0, 4.0, 1.0, 0.0, 0.0, 0.0 ] ); @@ -288,7 +279,6 @@ tape( 'the function supports view offsets', function test( t ) { var y0; var x1; var y1; - var N; // Initial arrays... x0 = new Float64Array([ @@ -312,9 +302,7 @@ tape( 'the function supports view offsets', function test( t ) { x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // begin at 2nd element y1 = new Float64Array( y0.buffer, y0.BYTES_PER_ELEMENT*3 ); // begin at the 4th element - N = floor( x0.length / 2 ); - - dcusum( N, 0.0, x1, -2, y1, 1 ); + dcusum( 3, 0.0, x1, -2, y1, 1 ); expected = new Float64Array( [ 0.0, 0.0, 0.0, 6.0, 10.0, 12.0 ] ); t.deepEqual( y0, expected, 'deep equal' ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcusum/test/test.dcusum.native.js b/lib/node_modules/@stdlib/blas/ext/base/dcusum/test/test.dcusum.native.js index 63fb22963b4..330f2ca9f83 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcusum/test/test.dcusum.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcusum/test/test.dcusum.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 Float64Array = require( '@stdlib/array/float64' ); 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 6', opts, function test( t ) { - t.strictEqual( dcusum.length, 6, 'has expected arity' ); + t.strictEqual( dcusum.length, 6, 'returns expected value' ); t.end(); }); @@ -173,7 +172,6 @@ tape( 'the function supports an `x` stride', opts, function test( t ) { var expected; var x; var y; - var N; x = new Float64Array([ 1.0, // 0 @@ -189,9 +187,8 @@ tape( 'the function supports an `x` stride', opts, function test( t ) { 0.0, 0.0 ]); - N = 3; - dcusum( N, 0.0, x, 2, y, 1 ); + dcusum( 3, 0.0, x, 2, y, 1 ); expected = new Float64Array( [ 1.0, 4.0, 9.0, 0.0, 0.0 ] ); @@ -203,7 +200,6 @@ tape( 'the function supports a `y` stride', opts, function test( t ) { var expected; var x; var y; - var N; x = new Float64Array([ 1.0, // 0 @@ -219,9 +215,8 @@ tape( 'the function supports a `y` stride', opts, function test( t ) { 0.0, 0.0 // 2 ]); - N = 3; - dcusum( N, 0.0, x, 1, y, 2 ); + dcusum( 3, 0.0, x, 1, y, 2 ); expected = new Float64Array( [ 1.0, 0.0, 3.0, 0.0, 6.0 ] ); @@ -233,7 +228,6 @@ tape( 'the function supports negative strides', opts, function test( t ) { var expected; var x; var y; - var N; x = new Float64Array([ 1.0, // 2 @@ -249,9 +243,8 @@ tape( 'the function supports negative strides', opts, function test( t ) { 0.0, 0.0 ]); - N = 3; - dcusum( N, 0.0, x, -2, y, -1 ); + dcusum( 3, 0.0, x, -2, y, -1 ); expected = new Float64Array( [ 9.0, 8.0, 5.0, 0.0, 0.0 ] ); @@ -263,7 +256,6 @@ tape( 'the function supports complex access patterns', opts, function test( t ) var expected; var x; var y; - var N; x = new Float64Array([ 1.0, // 0 @@ -281,9 +273,8 @@ tape( 'the function supports complex access patterns', opts, function test( t ) 0.0, 0.0 ]); - N = 3; - dcusum( N, 0.0, x, 2, y, -1 ); + dcusum( 3, 0.0, x, 2, y, -1 ); expected = new Float64Array( [ 9.0, 4.0, 1.0, 0.0, 0.0, 0.0 ] ); @@ -297,7 +288,6 @@ tape( 'the function supports view offsets', opts, function test( t ) { var y0; var x1; var y1; - var N; // Initial arrays... x0 = new Float64Array([ @@ -321,9 +311,7 @@ tape( 'the function supports view offsets', opts, function test( t ) { x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // begin at 2nd element y1 = new Float64Array( y0.buffer, y0.BYTES_PER_ELEMENT*3 ); // begin at the 4th element - N = floor( x0.length / 2 ); - - dcusum( N, 0.0, x1, -2, y1, 1 ); + dcusum( 3, 0.0, x1, -2, y1, 1 ); expected = new Float64Array( [ 0.0, 0.0, 0.0, 6.0, 10.0, 12.0 ] ); t.deepEqual( y0, expected, 'deep equal' ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcusum/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/dcusum/test/test.ndarray.js index 4e3dafcee1e..3127ac9e3ab 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcusum/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcusum/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 Float64Array = require( '@stdlib/array/float64' ); var dcusum = require( './../lib/ndarray.js' ); @@ -36,7 +35,7 @@ tape( 'main export is a function', function test( t ) { }); tape( 'the function has an arity of 8', function test( t ) { - t.strictEqual( dcusum.length, 8, 'has expected arity' ); + t.strictEqual( dcusum.length, 8, 'returns expected value' ); t.end(); }); @@ -164,7 +163,6 @@ tape( 'the function supports an `x` stride', function test( t ) { var expected; var x; var y; - var N; x = new Float64Array([ 1.0, // 0 @@ -180,9 +178,8 @@ tape( 'the function supports an `x` stride', function test( t ) { 0.0, 0.0 ]); - N = 3; - dcusum( N, 0.0, x, 2, 0, y, 1, 0 ); + dcusum( 3, 0.0, x, 2, 0, y, 1, 0 ); expected = new Float64Array( [ 1.0, 4.0, 9.0, 0.0, 0.0 ] ); @@ -194,7 +191,6 @@ tape( 'the function supports a `y` stride', function test( t ) { var expected; var x; var y; - var N; x = new Float64Array([ 1.0, // 0 @@ -210,9 +206,8 @@ tape( 'the function supports a `y` stride', function test( t ) { 0.0, 0.0 // 2 ]); - N = 3; - dcusum( N, 0.0, x, 1, 0, y, 2, 0 ); + dcusum( 3, 0.0, x, 1, 0, y, 2, 0 ); expected = new Float64Array( [ 1.0, 0.0, 3.0, 0.0, 6.0 ] ); @@ -224,7 +219,6 @@ tape( 'the function supports negative strides', function test( t ) { var expected; var x; var y; - var N; x = new Float64Array([ 1.0, // 2 @@ -240,9 +234,8 @@ tape( 'the function supports negative strides', function test( t ) { 0.0, 0.0 ]); - N = 3; - dcusum( N, 0.0, x, -2, x.length-1, y, -1, 2 ); + dcusum( 3, 0.0, x, -2, x.length-1, y, -1, 2 ); expected = new Float64Array( [ 9.0, 8.0, 5.0, 0.0, 0.0 ] ); @@ -252,7 +245,6 @@ tape( 'the function supports negative strides', function test( t ) { tape( 'the function supports an `x` offset', function test( t ) { var expected; - var N; var x; var y; @@ -276,9 +268,8 @@ tape( 'the function supports an `x` offset', function test( t ) { 0.0, 0.0 ]); - N = floor( x.length / 2 ); - dcusum( N, 0.0, x, 2, 1, y, 1, 0 ); + dcusum( 4, 0.0, x, 2, 1, y, 1, 0 ); expected = new Float64Array( [ 1.0, -1.0, 1.0, 5.0, 0.0, 0.0, 0.0, 0.0 ] ); @@ -288,7 +279,6 @@ tape( 'the function supports an `x` offset', function test( t ) { tape( 'the function supports a `y` offset', function test( t ) { var expected; - var N; var x; var y; @@ -312,9 +302,8 @@ tape( 'the function supports a `y` offset', function test( t ) { 0.0, 0.0 // 3 ]); - N = floor( x.length / 2 ); - dcusum( N, 0.0, x, 1, 0, y, 2, 1 ); + dcusum( 4, 0.0, x, 1, 0, y, 2, 1 ); expected = new Float64Array( [ 0.0, 2.0, 0.0, 3.0, 0.0, 5.0, 0.0, 3.0 ] ); @@ -326,7 +315,6 @@ tape( 'the function supports complex access patterns', function test( t ) { var expected; var x; var y; - var N; x = new Float64Array([ 1.0, // 0 @@ -344,9 +332,8 @@ tape( 'the function supports complex access patterns', function test( t ) { 0.0, 0.0 ]); - N = 3; - dcusum( N, 0.0, x, 2, 0, y, -1, 2 ); + dcusum( 3, 0.0, x, 2, 0, y, -1, 2 ); expected = new Float64Array( [ 9.0, 4.0, 1.0, 0.0, 0.0, 0.0 ] ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dcusum/test/test.ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/dcusum/test/test.ndarray.native.js index a96a373dfd8..3ab3ce0ad5a 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dcusum/test/test.ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dcusum/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 Float64Array = require( '@stdlib/array/float64' ); 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 8', opts, function test( t ) { - t.strictEqual( dcusum.length, 8, 'has expected arity' ); + t.strictEqual( dcusum.length, 8, 'returns expected value' ); t.end(); }); @@ -173,7 +172,6 @@ tape( 'the function supports an `x` stride', opts, function test( t ) { var expected; var x; var y; - var N; x = new Float64Array([ 1.0, // 0 @@ -189,9 +187,8 @@ tape( 'the function supports an `x` stride', opts, function test( t ) { 0.0, 0.0 ]); - N = 3; - dcusum( N, 0.0, x, 2, 0, y, 1, 0 ); + dcusum( 3, 0.0, x, 2, 0, y, 1, 0 ); expected = new Float64Array( [ 1.0, 4.0, 9.0, 0.0, 0.0 ] ); @@ -203,7 +200,6 @@ tape( 'the function supports a `y` stride', opts, function test( t ) { var expected; var x; var y; - var N; x = new Float64Array([ 1.0, // 0 @@ -219,9 +215,8 @@ tape( 'the function supports a `y` stride', opts, function test( t ) { 0.0, 0.0 // 2 ]); - N = 3; - dcusum( N, 0.0, x, 1, 0, y, 2, 0 ); + dcusum( 3, 0.0, x, 1, 0, y, 2, 0 ); expected = new Float64Array( [ 1.0, 0.0, 3.0, 0.0, 6.0 ] ); @@ -233,7 +228,6 @@ tape( 'the function supports negative strides', opts, function test( t ) { var expected; var x; var y; - var N; x = new Float64Array([ 1.0, // 2 @@ -249,9 +243,8 @@ tape( 'the function supports negative strides', opts, function test( t ) { 0.0, 0.0 ]); - N = 3; - dcusum( N, 0.0, x, -2, x.length-1, y, -1, 2 ); + dcusum( 3, 0.0, x, -2, x.length-1, y, -1, 2 ); expected = new Float64Array( [ 9.0, 8.0, 5.0, 0.0, 0.0 ] ); @@ -261,7 +254,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; @@ -285,9 +277,8 @@ tape( 'the function supports an `x` offset', opts, function test( t ) { 0.0, 0.0 ]); - N = floor( x.length / 2 ); - dcusum( N, 0.0, x, 2, 1, y, 1, 0 ); + dcusum( 4, 0.0, x, 2, 1, y, 1, 0 ); expected = new Float64Array( [ 1.0, -1.0, 1.0, 5.0, 0.0, 0.0, 0.0, 0.0 ] ); @@ -297,7 +288,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; @@ -321,9 +311,8 @@ tape( 'the function supports a `y` offset', opts, function test( t ) { 0.0, 0.0 // 3 ]); - N = floor( x.length / 2 ); - dcusum( N, 0.0, x, 1, 0, y, 2, 1 ); + dcusum( 4, 0.0, x, 1, 0, y, 2, 1 ); expected = new Float64Array( [ 0.0, 2.0, 0.0, 3.0, 0.0, 5.0, 0.0, 3.0 ] ); @@ -335,7 +324,6 @@ tape( 'the function supports complex access patterns', opts, function test( t ) var expected; var x; var y; - var N; x = new Float64Array([ 1.0, // 0 @@ -353,9 +341,8 @@ tape( 'the function supports complex access patterns', opts, function test( t ) 0.0, 0.0 ]); - N = 3; - dcusum( N, 0.0, x, 2, 0, y, -1, 2 ); + dcusum( 3, 0.0, x, 2, 0, y, -1, 2 ); expected = new Float64Array( [ 9.0, 4.0, 1.0, 0.0, 0.0, 0.0 ] );