diff --git a/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/README.md b/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/README.md
index 93d13d5a9f6e..244eb79d876c 100644
--- a/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/README.md
+++ b/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/README.md
@@ -51,7 +51,7 @@ The [arithmetic mean][arithmetic-mean] is defined as
var dsnanmeanwd = require( '@stdlib/stats/base/dsnanmeanwd' );
```
-#### dsnanmeanwd( N, x, stride )
+#### dsnanmeanwd( N, x, strideX )
Computes the [arithmetic mean][arithmetic-mean] of a single-precision floating-point strided array `x`, ignoring `NaN` values, using Welford's algorithm with extended accumulation, and returning an extended precision result.
@@ -59,9 +59,8 @@ Computes the [arithmetic mean][arithmetic-mean] of a single-precision floating-p
var Float32Array = require( '@stdlib/array/float32' );
var x = new Float32Array( [ 1.0, -2.0, NaN, 2.0 ] );
-var N = x.length;
-var v = dsnanmeanwd( N, x, 1 );
+var v = dsnanmeanwd( x.length, x, 1 );
// returns ~0.3333
```
@@ -69,39 +68,36 @@ The function has the following parameters:
- **N**: number of indexed elements.
- **x**: input [`Float32Array`][@stdlib/array/float32].
-- **stride**: index increment for `x`.
+- **strideX**: stride length for `x`.
+
+The `N` and stride parameters determine which elements in `x` are accessed at runtime. For example, to compute the [arithmetic mean][arithmetic-mean] of every other element in `x`,
-The `N` and `stride` parameters determine which elements in `x` are accessed at runtime. For example, to compute the [arithmetic mean][arithmetic-mean] of every other element in `x`,
+
```javascript
var Float32Array = require( '@stdlib/array/float32' );
-var floor = require( '@stdlib/math/base/special/floor' );
-var x = new Float32Array( [ 1.0, 2.0, 2.0, -7.0, -2.0, 3.0, 4.0, 2.0, NaN ] );
-var N = floor( x.length / 2 );
+var x = new Float32Array( [ 1.0, 2.0, 2.0, -7.0, -2.0, 3.0, 4.0, 2.0, NaN, NaN ] );
-var v = dsnanmeanwd( N, x, 2 );
+var v = dsnanmeanwd( 5, x, 2 );
// returns 1.25
```
Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views.
-
+
```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, NaN ] );
+var x0 = new Float32Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0, NaN, NaN ] );
var x1 = new Float32Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
-var N = floor( x0.length / 2 );
-
-var v = dsnanmeanwd( N, x1, 2 );
+var v = dsnanmeanwd( 5, x1, 2 );
// returns 1.25
```
-#### dsnanmeanwd.ndarray( N, x, stride, offset )
+#### dsnanmeanwd.ndarray( N, x, strideX, offsetX )
Computes the [arithmetic mean][arithmetic-mean] of a single-precision floating-point strided array, ignoring `NaN` values and using Welford's algorithm with extended accumulation and alternative indexing semantics.
@@ -109,26 +105,25 @@ Computes the [arithmetic mean][arithmetic-mean] of a single-precision floating-p
var Float32Array = require( '@stdlib/array/float32' );
var x = new Float32Array( [ 1.0, -2.0, NaN, 2.0 ] );
-var N = x.length;
-var v = dsnanmeanwd.ndarray( N, x, 1, 0 );
+var v = dsnanmeanwd.ndarray( x.length, x, 1, 0 );
// returns ~0.33333
```
The function has the following additional parameters:
-- **offset**: starting index for `x`.
+- **offsetX**: 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 [arithmetic mean][arithmetic-mean] for every other element in `x` starting from the second element
-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 [arithmetic mean][arithmetic-mean] for every other value in `x` 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, NaN ] );
-var N = floor( x.length / 2 );
+var x = new Float32Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0, NaN, NaN ] );
-var v = dsnanmeanwd.ndarray( N, x, 2, 1 );
+var v = dsnanmeanwd.ndarray( 5, x, 2, 1 );
// returns 1.25
```
@@ -181,6 +176,107 @@ console.log( v );
+
+
+
+
+### Usage
+
+```c
+#include "stdlib/stats/base/dsnanmeanwd.h"
+```
+
+#### stdlib_strided_dsnanmeanwd( N, \*X, strideX )
+
+Computes the arithmetic mean of a single-precision floating-point strided array, ignoring `NaN` values, using Welford's algorithm with extended accumulation, and returning an extended precision result.
+
+```c
+const float x[] = { 1.0f, 2.0f, 0.0f/0.0f, 3.0f, 0.0f/0.0f, 4.0f, 5.0f, 6.0f, 0.0f/0.0f, 7.0f, 8.0f, 0.0f/0.0f };
+
+double v = stdlib_strided_dsnanmeanwd( 6, x, 2 );
+// returns ~4.6667
+```
+
+The function accepts the following arguments:
+
+- **N**: `[in] CBLAS_INT` number of indexed elements.
+- **X**: `[in] float*` input array.
+- **strideX**: `[in] CBLAS_INT` stride length for `X`.
+
+```c
+double stdlib_strided_dsnanmeanwd( const CBLAS_INT N, const float *X, const CBLAS_INT strideX );
+```
+
+#### stdlib_strided_dsnanmeanwd_ndarray( N, \*X, strideX, offsetX )
+
+Computes the arithmetic mean of a single-precision floating-point strided array, ignoring `NaN` values and using Welford's algorithm with extended accumulation and alternative indexing semantics.
+
+```c
+const float x[] = { 1.0f, 2.0f, 0.0f/0.0f, 3.0f, 0.0f/0.0f, 4.0f, 5.0f, 6.0f, 0.0f/0.0f, 7.0f, 8.0f, 0.0f/0.0f };
+
+double v = stdlib_strided_dsnanmeanwd_ndarray( 6, x, 2, 0 );
+// returns ~4.6667
+```
+
+The function accepts the following arguments:
+
+- **N**: `[in] CBLAS_INT` number of indexed elements.
+- **X**: `[in] float*` input array.
+- **strideX**: `[in] CBLAS_INT` stride length for `X`.
+- **offsetX**: `[in] CBLAS_INT` starting index for `X`.
+
+```c
+double stdlib_strided_dsnanmeanwd_ndarray( const CBLAS_INT N, const float *X, const CBLAS_INT strideX, const CBLAS_INT offsetX );
+```
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+### Examples
+
+```c
+#include "stdlib/stats/base/dsnanmeanwd.h"
+#include
+
+int main( void ) {
+ // Create a strided array:
+ const float x[] = { 1.0f, 2.0f, 0.0f/0.0f, 3.0f, 0.0f/0.0f, 4.0f, 5.0f, 6.0f, 0.0f/0.0f, 7.0f, 8.0f, 0.0f/0.0f };
+
+ // Specify the number of elements:
+ const int N = 6;
+
+ // Specify the stride length:
+ const int strideX = 2;
+
+ // Compute the arithmetic mean:
+ double v = stdlib_strided_dsnanmeanwd( N, x, strideX );
+
+ // Print the result:
+ printf( "mean: %f\n", v );
+}
+```
+
+
+
+
+
+
+
+
+
* * *
diff --git a/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/benchmark/benchmark.js
index 575114a709f7..c80542acf99b 100644
--- a/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/benchmark/benchmark.js
+++ b/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/benchmark/benchmark.js
@@ -21,16 +21,30 @@
// MODULES //
var bench = require( '@stdlib/bench' );
-var randu = require( '@stdlib/random/base/randu' );
+var uniform = require( '@stdlib/random/base/uniform' );
+var bernoulli = require( '@stdlib/random/base/bernoulli' );
+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 dsnanmeanwd = require( './../lib/dsnanmeanwd.js' );
// FUNCTIONS //
+/**
+* Returns a random number.
+*
+* @private
+* @returns {number} random number
+*/
+function rand() {
+ if ( bernoulli( 0.8 ) < 1 ) {
+ return NaN;
+ }
+ return uniform( -10.0, 10.0 );
+}
+
/**
* Creates a benchmark function.
*
@@ -39,17 +53,7 @@ var dsnanmeanwd = require( './../lib/dsnanmeanwd.js' );
* @returns {Function} benchmark function
*/
function createBenchmark( len ) {
- var x;
- var i;
-
- x = new Float32Array( len );
- for ( i = 0; i < x.length; i++ ) {
- if ( randu() < 0.2 ) {
- x[ i ] = NaN;
- } else {
- x[ i ] = ( randu()*20.0 ) - 10.0;
- }
- }
+ var x = filledarrayBy( len, 'float32', rand );
return benchmark;
function benchmark( b ) {
diff --git a/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/benchmark/benchmark.native.js
index c34e6b4d376d..eb277bffd444 100644
--- a/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/benchmark/benchmark.native.js
+++ b/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/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 uniform = require( '@stdlib/random/base/uniform' );
+var bernoulli = require( '@stdlib/random/base/bernoulli' );
+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;
@@ -40,6 +41,19 @@ var opts = {
// FUNCTIONS //
+/**
+* Returns a random number.
+*
+* @private
+* @returns {number} random number
+*/
+function rand() {
+ if ( bernoulli( 0.8 ) < 1 ) {
+ return NaN;
+ }
+ return uniform( -10.0, 10.0 );
+}
+
/**
* Creates a benchmark function.
*
@@ -48,17 +62,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++ ) {
- if ( randu() < 0.2 ) {
- x[ i ] = NaN;
- } else {
- x[ i ] = ( randu()*20.0 ) - 10.0;
- }
- }
+ var x = filledarrayBy( len, 'float32', rand );
return benchmark;
function benchmark( b ) {
diff --git a/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/benchmark/benchmark.ndarray.js
index 4d1fbdbdf728..8437ee7a9781 100644
--- a/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/benchmark/benchmark.ndarray.js
+++ b/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/benchmark/benchmark.ndarray.js
@@ -21,16 +21,30 @@
// MODULES //
var bench = require( '@stdlib/bench' );
-var randu = require( '@stdlib/random/base/randu' );
+var uniform = require( '@stdlib/random/base/uniform' );
+var bernoulli = require( '@stdlib/random/base/bernoulli' );
+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 dsnanmeanwd = require( './../lib/ndarray.js' );
// FUNCTIONS //
+/**
+* Returns a random number.
+*
+* @private
+* @returns {number} random number
+*/
+function rand() {
+ if ( bernoulli( 0.8 ) < 1 ) {
+ return NaN;
+ }
+ return uniform( -10.0, 10.0 );
+}
+
/**
* Creates a benchmark function.
*
@@ -39,17 +53,7 @@ var dsnanmeanwd = 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++ ) {
- if ( randu() < 0.2 ) {
- x[ i ] = NaN;
- } else {
- x[ i ] = ( randu()*20.0 ) - 10.0;
- }
- }
+ var x = filledarrayBy( len, 'float32', rand );
return benchmark;
function benchmark( b ) {
diff --git a/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/benchmark/benchmark.ndarray.native.js b/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/benchmark/benchmark.ndarray.native.js
index 6099d61b01fc..f18dcd568560 100644
--- a/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/benchmark/benchmark.ndarray.native.js
+++ b/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/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 uniform = require( '@stdlib/random/base/uniform' );
+var bernoulli = require( '@stdlib/random/base/bernoulli' );
+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;
@@ -40,6 +41,19 @@ var opts = {
// FUNCTIONS //
+/**
+* Returns a random number.
+*
+* @private
+* @returns {number} random number
+*/
+function rand() {
+ if ( bernoulli( 0.8 ) < 1 ) {
+ return NaN;
+ }
+ return uniform( -10.0, 10.0 );
+}
+
/**
* Creates a benchmark function.
*
@@ -48,17 +62,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++ ) {
- if ( randu() < 0.2 ) {
- x[ i ] = NaN;
- } else {
- x[ i ] = ( randu()*20.0 ) - 10.0;
- }
- }
+ var x = filledarrayBy( len, 'float32', rand );
return benchmark;
function benchmark( b ) {
diff --git a/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/benchmark/c/benchmark.length.c
index 39e750975707..8bbe71247540 100644
--- a/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/benchmark/c/benchmark.length.c
+++ b/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/benchmark/c/benchmark.length.c
@@ -94,7 +94,7 @@ static float rand_float( void ) {
* @param len array length
* @return elapsed time in seconds
*/
-static double benchmark( int iterations, int len ) {
+static double benchmark1( int iterations, int len ) {
double elapsed;
float x[ len ];
double v;
@@ -102,11 +102,16 @@ static double benchmark( int iterations, int len ) {
int i;
for ( i = 0; i < len; i++ ) {
- x[ i ] = ( rand_float()*20000.0f ) - 10000.0f;
+ if ( rand_float() < 0.2f ) {
+ x[ i ] = 0.0f / 0.0f; // NaN
+ } else {
+ x[ i ] = ( rand_float()*20000.0f ) - 10000.0f;
+ }
}
v = 0.0;
t = tic();
for ( i = 0; i < iterations; i++ ) {
+ // cppcheck-suppress uninitvar
v = stdlib_strided_dsnanmeanwd( len, x, 1 );
if ( v != v ) {
printf( "should not return NaN\n" );
@@ -120,6 +125,44 @@ static double benchmark( int iterations, int len ) {
return elapsed;
}
+/**
+* Runs a benchmark.
+*
+* @param iterations number of iterations
+* @param len array length
+* @return elapsed time in seconds
+*/
+static double benchmark2( int iterations, int len ) {
+ double elapsed;
+ float x[ len ];
+ double v;
+ double t;
+ int i;
+
+ for ( i = 0; i < len; i++ ) {
+ if ( rand_float() < 0.2f ) {
+ x[ i ] = 0.0f / 0.0f; // NaN
+ } else {
+ x[ i ] = ( rand_float()*20000.0f ) - 10000.0f;
+ }
+ }
+ v = 0.0;
+ t = tic();
+ for ( i = 0; i < iterations; i++ ) {
+ // cppcheck-suppress uninitvar
+ v = stdlib_strided_dsnanmeanwd_ndarray( len, x, 1, 0 );
+ if ( v != v ) {
+ printf( "should not return NaN\n" );
+ break;
+ }
+ }
+ elapsed = tic() - t;
+ if ( v != v ) {
+ printf( "should not return NaN\n" );
+ }
+ return elapsed;
+}
+
/**
* Main execution sequence.
*/
@@ -142,7 +185,18 @@ int main( void ) {
for ( j = 0; j < REPEATS; j++ ) {
count += 1;
printf( "# c::%s:len=%d\n", NAME, len );
- elapsed = benchmark( iter, len );
+ elapsed = benchmark1( iter, len );
+ print_results( iter, elapsed );
+ printf( "ok %d benchmark finished\n", count );
+ }
+ }
+ for ( i = MIN; i <= MAX; i++ ) {
+ len = pow( 10, i );
+ iter = ITERATIONS / pow( 10, i-1 );
+ for ( j = 0; j < REPEATS; j++ ) {
+ count += 1;
+ printf( "# c::%s:ndarray:len=%d\n", NAME, len );
+ elapsed = benchmark2( iter, len );
print_results( iter, elapsed );
printf( "ok %d benchmark finished\n", count );
}
diff --git a/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/docs/repl.txt b/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/docs/repl.txt
index 418ac4c8d5a7..d78eb8a9b22a 100644
--- a/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/docs/repl.txt
+++ b/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/docs/repl.txt
@@ -1,11 +1,11 @@
-{{alias}}( N, x, stride )
+{{alias}}( N, x, strideX )
Computes the arithmetic mean of a single-precision floating-point strided
array, ignoring `NaN` values, using Welford's algorithm with 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.
@@ -22,8 +22,8 @@
x: Float32Array
Input array.
- stride: integer
- Index increment.
+ strideX: integer
+ Stride length.
Returns
-------
@@ -37,28 +37,25 @@
> {{alias}}( x.length, x, 1 )
~0.3333
- // Using `N` and `stride` parameters:
- > x = new {{alias:@stdlib/array/float32}}( [ -2.0, 1.0, 1.0, -5.0, 2.0, -1.0, NaN ] );
- > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 );
- > var stride = 2;
- > {{alias}}( N, x, stride )
+ // Using `N` and stride parameters:
+ > x = new {{alias:@stdlib/array/float32}}( [ -2.0, 1.0, 1.0, -5.0, 2.0, -1.0, NaN, NaN ] );
+ > {{alias}}( 4, x, 2 )
~0.3333
// Using view offsets:
- > var x0 = new {{alias:@stdlib/array/float32}}( [ 1.0, -2.0, 3.0, 2.0, 5.0, -1.0, NaN ] );
+ > var x0 = new {{alias:@stdlib/array/float32}}( [ 1.0, -2.0, 3.0, 2.0, 5.0, -1.0, NaN, NaN ] );
> 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}}( 4, x1, 2 )
~-0.3333
-{{alias}}.ndarray( N, x, stride, offset )
+
+{{alias}}.ndarray( N, x, strideX, offsetX )
Computes the arithmetic mean of a single-precision floating-point strided
array, ignoring `NaN` values and using Welford's algorithm with extended
accumulation and alternative indexing semantics.
While typed array views mandate a view offset based on the underlying
- buffer, the `offset` parameter supports indexing semantics based on a
+ buffer, the offset parameter supports indexing semantics based on a
starting index.
Parameters
@@ -69,10 +66,10 @@
x: Float32Array
Input array.
- stride: integer
- Index increment.
+ strideX: integer
+ Stride length.
- offset: integer
+ offsetX: integer
Starting index.
Returns
@@ -88,9 +85,8 @@
~0.3333
// Using offset parameter:
- > var x = new {{alias:@stdlib/array/float32}}( [ 1.0, -2.0, 3.0, 2.0, 5.0, -1.0, NaN ] );
- > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 );
- > {{alias}}.ndarray( N, x, 2, 1 )
+ > var x = new {{alias:@stdlib/array/float32}}( [ 1.0, -2.0, 3.0, 2.0, 5.0, -1.0, NaN, NaN ] );
+ > {{alias}}.ndarray( 4, x, 2, 1 )
~-0.3333
See Also
diff --git a/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/docs/types/index.d.ts b/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/docs/types/index.d.ts
index 0c2119fa87cc..f989e4f30962 100644
--- a/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/docs/types/index.d.ts
+++ b/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/docs/types/index.d.ts
@@ -38,15 +38,15 @@ interface Routine {
* var v = dsnanmeanwd( x.length, x, 1 );
* // returns ~0.3333
*/
- ( N: number, x: Float32Array, stride: number ): number;
+ ( N: number, x: Float32Array, strideX: number ): number;
/**
* Computes the arithmetic mean of a single-precision floating-point strided array, ignoring `NaN` values and using Welford's algorithm with extended accumulation and alternative indexing semantics.
*
* @param N - number of indexed elements
* @param x - input array
- * @param stride - stride length
- * @param offset - starting index
+ * @param strideX - stride length
+ * @param offsetX - starting index
* @returns arithmetic mean
*
* @example
@@ -57,7 +57,7 @@ interface Routine {
* var v = dsnanmeanwd.ndarray( x.length, x, 1, 0 );
* // returns ~0.3333
*/
- ndarray( N: number, x: Float32Array, stride: number, offset: number ): number;
+ ndarray( N: number, x: Float32Array, strideX: number, offsetX: number ): number;
}
/**
@@ -65,7 +65,7 @@ interface Routine {
*
* @param N - number of indexed elements
* @param x - input array
-* @param stride - stride length
+* @param strideX - stride length
* @returns arithmetic mean
*
* @example
diff --git a/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/examples/c/example.c b/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/examples/c/example.c
index 06a583cc1edd..40de65e3f2c3 100644
--- a/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/examples/c/example.c
+++ b/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/examples/c/example.c
@@ -17,21 +17,20 @@
*/
#include "stdlib/stats/base/dsnanmeanwd.h"
-#include
#include
int main( void ) {
// Create a strided array:
- float x[] = { 1.0, 2.0, 0.0/0.0, 3.0, 0.0/0.0, 4.0, 5.0, 6.0, 0.0/0.0, 7.0, 8.0, 0.0/0.0 };
+ const float x[] = { 1.0f, 2.0f, 0.0f/0.0f, 3.0f, 0.0f/0.0f, 4.0f, 5.0f, 6.0f, 0.0f/0.0f, 7.0f, 8.0f, 0.0f/0.0f };
// Specify the number of elements:
- int64_t N = 6;
+ const int N = 6;
// Specify the stride length:
- int64_t stride = 2;
+ const int strideX = 2;
// Compute the arithmetic mean:
- double v = stdlib_strided_dsnanmeanwd( N, x, stride );
+ double v = stdlib_strided_dsnanmeanwd( N, x, strideX );
// Print the result:
printf( "mean: %f\n", v );
diff --git a/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/include/stdlib/stats/base/dsnanmeanwd.h b/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/include/stdlib/stats/base/dsnanmeanwd.h
index d86cf4f5de03..2aa8e140b1ac 100644
--- a/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/include/stdlib/stats/base/dsnanmeanwd.h
+++ b/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/include/stdlib/stats/base/dsnanmeanwd.h
@@ -19,7 +19,7 @@
#ifndef STDLIB_STATS_BASE_DSNANMEANWD_H
#define STDLIB_STATS_BASE_DSNANMEANWD_H
-#include
+#include "stdlib/blas/base/shared.h"
/*
* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler.
@@ -31,7 +31,12 @@ extern "C" {
/**
* Computes the arithmetic mean of a single-precision floating-point strided array, ignoring `NaN` values, using Welford's algorithm with extended accumulation, and return an extended precision result.
*/
-double stdlib_strided_dsnanmeanwd( const int64_t N, const float *X, const int64_t stride );
+double API_SUFFIX(stdlib_strided_dsnanmeanwd)( const CBLAS_INT N, const float *X, const CBLAS_INT strideX );
+
+/**
+* Computes the arithmetic mean of a single-precision floating-point strided array, ignoring `NaN` values and using Welford's algorithm with extended accumulation and alternative indexing semantics.
+*/
+double API_SUFFIX(stdlib_strided_dsnanmeanwd_ndarray)( const CBLAS_INT N, const float *X, const CBLAS_INT strideX, const CBLAS_INT offsetX );
#ifdef __cplusplus
}
diff --git a/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/lib/dsnanmeanwd.js b/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/lib/dsnanmeanwd.js
index d0dc54b65649..64f2c96f730a 100644
--- a/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/lib/dsnanmeanwd.js
+++ b/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/lib/dsnanmeanwd.js
@@ -18,6 +18,12 @@
'use strict';
+// MODULES //
+
+var stride2offset = require( '@stdlib/strided/base/stride2offset' );
+var ndarray = require( './ndarray.js' );
+
+
// MAIN //
/**
@@ -43,50 +49,19 @@
*
* @param {PositiveInteger} N - number of indexed elements
* @param {Float32Array} x - input array
-* @param {integer} stride - stride length
+* @param {integer} strideX - stride length
* @returns {number} arithmetic mean
*
* @example
* var Float32Array = require( '@stdlib/array/float32' );
*
* var x = new Float32Array( [ 1.0, -2.0, NaN, 2.0 ] );
-* var N = x.length;
*
-* var v = dsnanmeanwd( N, x, 1 );
+* var v = dsnanmeanwd( x.length, x, 1 );
* // returns ~0.3333
*/
-function dsnanmeanwd( N, x, stride ) {
- var mu;
- var ix;
- var v;
- var n;
- var i;
-
- if ( N <= 0 ) {
- return NaN;
- }
- if ( N === 1 || stride === 0 ) {
- return x[ 0 ];
- }
- if ( stride < 0 ) {
- ix = (1-N) * stride;
- } else {
- ix = 0;
- }
- mu = 0.0;
- n = 0;
- for ( i = 0; i < N; i++ ) {
- v = x[ ix ];
- if ( v === v ) {
- n += 1;
- mu += ( v-mu ) / n;
- }
- ix += stride;
- }
- if ( n === 0 ) {
- return NaN;
- }
- return mu;
+function dsnanmeanwd( N, x, strideX ) {
+ return ndarray( N, x, strideX, stride2offset( N, strideX ) );
}
diff --git a/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/lib/dsnanmeanwd.native.js b/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/lib/dsnanmeanwd.native.js
index f6075d835429..a45ed43370ec 100644
--- a/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/lib/dsnanmeanwd.native.js
+++ b/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/lib/dsnanmeanwd.native.js
@@ -30,20 +30,19 @@ var addon = require( './../src/addon.node' );
*
* @param {PositiveInteger} N - number of indexed elements
* @param {Float32Array} x - input array
-* @param {integer} stride - stride length
+* @param {integer} strideX - stride length
* @returns {number} arithmetic mean
*
* @example
* var Float32Array = require( '@stdlib/array/float32' );
*
* var x = new Float32Array( [ 1.0, -2.0, NaN, 2.0 ] );
-* var N = x.length;
*
-* var v = dsnanmeanwd( N, x, 1 );
+* var v = dsnanmeanwd( x.length, x, 1 );
* // returns ~0.3333
*/
-function dsnanmeanwd( N, x, stride ) {
- return addon( N, x, stride );
+function dsnanmeanwd( N, x, strideX ) {
+ return addon( N, x, strideX );
}
diff --git a/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/lib/index.js b/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/lib/index.js
index b24b76ac2575..3e4f56921892 100644
--- a/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/lib/index.js
+++ b/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/lib/index.js
@@ -28,20 +28,17 @@
* var dsnanmeanwd = require( '@stdlib/stats/base/dsnanmeanwd' );
*
* var x = new Float32Array( [ 1.0, -2.0, NaN, 2.0 ] );
-* var N = x.length;
*
-* var v = dsnanmeanwd( N, x, 1 );
+* var v = dsnanmeanwd( x.length, x, 1 );
* // returns ~0.3333
*
* @example
* var Float32Array = require( '@stdlib/array/float32' );
-* var floor = require( '@stdlib/math/base/special/floor' );
* var dsnanmeanwd = require( '@stdlib/stats/base/dsnanmeanwd' );
*
-* var x = new Float32Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0, NaN ] );
-* var N = floor( x.length / 2 );
+* var x = new Float32Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0, NaN, NaN ] );
*
-* var v = dsnanmeanwd.ndarray( N, x, 2, 1 );
+* var v = dsnanmeanwd.ndarray( 5, x, 2, 1 );
* // returns 1.25
*/
diff --git a/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/lib/ndarray.js b/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/lib/ndarray.js
index a73ce982cd6b..1bffaa94930e 100644
--- a/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/lib/ndarray.js
+++ b/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/lib/ndarray.js
@@ -43,21 +43,19 @@
*
* @param {PositiveInteger} N - number of indexed elements
* @param {Float32Array} x - input array
-* @param {integer} stride - stride length
-* @param {NonNegativeInteger} offset - starting index
+* @param {integer} strideX - stride length
+* @param {NonNegativeInteger} offsetX - starting index
* @returns {number} arithmetic mean
*
* @example
* 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, NaN ] );
-* var N = floor( x.length / 2 );
+* var x = new Float32Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0, NaN, NaN ] );
*
-* var v = dsnanmeanwd( N, x, 2, 1 );
+* var v = dsnanmeanwd( 5, x, 2, 1 );
* // returns 1.25
*/
-function dsnanmeanwd( N, x, stride, offset ) {
+function dsnanmeanwd( N, x, strideX, offsetX ) {
var mu;
var ix;
var v;
@@ -67,10 +65,10 @@ function dsnanmeanwd( N, x, stride, offset ) {
if ( N <= 0 ) {
return NaN;
}
- if ( N === 1 || stride === 0 ) {
- return x[ offset ];
+ if ( N === 1 || strideX === 0 ) {
+ return x[ offsetX ];
}
- ix = offset;
+ ix = offsetX;
mu = 0.0;
n = 0;
for ( i = 0; i < N; i++ ) {
@@ -79,7 +77,7 @@ function dsnanmeanwd( N, x, stride, offset ) {
n += 1;
mu += ( v-mu ) / n;
}
- ix += stride;
+ ix += strideX;
}
if ( n === 0 ) {
return NaN;
diff --git a/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/lib/ndarray.native.js b/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/lib/ndarray.native.js
index e4433f7c17ea..48de24e45c2b 100644
--- a/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/lib/ndarray.native.js
+++ b/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/lib/ndarray.native.js
@@ -20,8 +20,7 @@
// MODULES //
-var Float32Array = require( '@stdlib/array/float32' );
-var addon = require( './dsnanmeanwd.native.js' );
+var addon = require( './../src/addon.node' );
// MAIN //
@@ -31,27 +30,20 @@ var addon = require( './dsnanmeanwd.native.js' );
*
* @param {PositiveInteger} N - number of indexed elements
* @param {Float32Array} x - input array
-* @param {integer} stride - stride length
-* @param {NonNegativeInteger} offset - starting index
+* @param {integer} strideX - stride length
+* @param {NonNegativeInteger} offsetX - starting index
* @returns {number} arithmetic mean
*
* @example
* 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, NaN ] );
-* var N = floor( x.length / 2 );
+* var x = new Float32Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0, NaN, NaN ] );
*
-* var v = dsnanmeanwd( N, x, 2, 1 );
+* var v = dsnanmeanwd( 5, x, 2, 1 );
* // returns 1.25
*/
-function dsnanmeanwd( N, x, stride, offset ) {
- var view;
- if ( stride < 0 ) {
- offset += (N-1) * stride;
- }
- view = new Float32Array( x.buffer, x.byteOffset+(x.BYTES_PER_ELEMENT*offset), x.length-offset ); // eslint-disable-line max-len
- return addon( N, view, stride );
+function dsnanmeanwd( N, x, strideX, offsetX ) {
+ return addon.ndarray( N, x, strideX, offsetX );
}
diff --git a/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/manifest.json b/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/manifest.json
index fa8b90ba5510..7a0fdb1d890b 100644
--- a/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/manifest.json
+++ b/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/manifest.json
@@ -1,5 +1,8 @@
{
- "options": {},
+ "options": {
+ "task": "build",
+ "wasm": false
+ },
"fields": [
{
"field": "src",
@@ -25,17 +28,18 @@
"confs": [
{
"task": "build",
+ "wasm": false,
"src": [
- "./src/dsnanmeanwd.c"
+ "./src/main.c"
],
"include": [
"./include"
],
- "libraries": [
- "-lm"
- ],
+ "libraries": [],
"libpath": [],
"dependencies": [
+ "@stdlib/blas/base/shared",
+ "@stdlib/strided/base/stride2offset",
"@stdlib/napi/export",
"@stdlib/napi/argv",
"@stdlib/napi/argv-int64",
@@ -45,31 +49,51 @@
},
{
"task": "benchmark",
+ "wasm": false,
"src": [
- "./src/dsnanmeanwd.c"
+ "./src/main.c"
],
"include": [
"./include"
],
- "libraries": [
- "-lm"
- ],
+ "libraries": [],
"libpath": [],
- "dependencies": []
+ "dependencies": [
+ "@stdlib/blas/base/shared",
+ "@stdlib/strided/base/stride2offset"
+ ]
},
{
"task": "examples",
+ "wasm": false,
"src": [
- "./src/dsnanmeanwd.c"
+ "./src/main.c"
],
"include": [
"./include"
],
- "libraries": [
- "-lm"
+ "libraries": [],
+ "libpath": [],
+ "dependencies": [
+ "@stdlib/blas/base/shared",
+ "@stdlib/strided/base/stride2offset"
+ ]
+ },
+ {
+ "task": "",
+ "wasm": true,
+ "src": [
+ "./src/main.c"
],
+ "include": [
+ "./include"
+ ],
+ "libraries": [],
"libpath": [],
- "dependencies": []
+ "dependencies": [
+ "@stdlib/blas/base/shared",
+ "@stdlib/strided/base/stride2offset"
+ ]
}
]
}
diff --git a/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/src/addon.c b/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/src/addon.c
index 8d875d33e024..a9abf98676f9 100644
--- a/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/src/addon.c
+++ b/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/src/addon.c
@@ -22,6 +22,7 @@
#include "stdlib/napi/argv_int64.h"
#include "stdlib/napi/argv_strided_float32array.h"
#include "stdlib/napi/create_double.h"
+#include "stdlib/blas/base/shared.h"
#include
/**
@@ -34,10 +35,27 @@
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_FLOAT32ARRAY( env, X, N, stride, argv, 1 );
- STDLIB_NAPI_CREATE_DOUBLE( env, stdlib_strided_dsnanmeanwd( N, X, stride ), v );
+ STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 2 );
+ STDLIB_NAPI_ARGV_STRIDED_FLOAT32ARRAY( env, X, N, strideX, argv, 1 );
+ STDLIB_NAPI_CREATE_DOUBLE( env, API_SUFFIX(stdlib_strided_dsnanmeanwd)( N, X, strideX ), v );
return v;
}
-STDLIB_NAPI_MODULE_EXPORT_FCN( addon )
+/**
+* Receives JavaScript callback invocation data.
+*
+* @param env environment under which the function is invoked
+* @param info callback data
+* @return Node-API value
+*/
+static napi_value addon_method( napi_env env, napi_callback_info info ) {
+ STDLIB_NAPI_ARGV( env, info, argv, argc, 4 );
+ STDLIB_NAPI_ARGV_INT64( env, N, argv, 0 );
+ STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 2 );
+ STDLIB_NAPI_ARGV_INT64( env, offsetX, argv, 3 );
+ STDLIB_NAPI_ARGV_STRIDED_FLOAT32ARRAY( env, X, N, strideX, argv, 1 );
+ STDLIB_NAPI_CREATE_DOUBLE( env, API_SUFFIX(stdlib_strided_dsnanmeanwd_ndarray)( N, X, strideX, offsetX ), v );
+ return v;
+}
+
+STDLIB_NAPI_MODULE_EXPORT_FCN_WITH_METHOD( addon, "ndarray", addon_method )
diff --git a/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/src/dsnanmeanwd.c b/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/src/main.c
similarity index 64%
rename from lib/node_modules/@stdlib/stats/base/dsnanmeanwd/src/dsnanmeanwd.c
rename to lib/node_modules/@stdlib/stats/base/dsnanmeanwd/src/main.c
index d4ce81c47fd8..bf6a8e29b459 100644
--- a/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/src/dsnanmeanwd.c
+++ b/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/src/main.c
@@ -17,7 +17,8 @@
*/
#include "stdlib/stats/base/dsnanmeanwd.h"
-#include
+#include "stdlib/blas/base/shared.h"
+#include "stdlib/strided/base/stride2offset.h"
/**
* Computes the arithmetic mean of a single-precision floating-point strided array, ignoring `NaN` values, using Welford's algorithm with extended accumulation, and returning an extended precision result.
@@ -40,29 +41,39 @@
* - Welford, B. P. 1962. "Note on a Method for Calculating Corrected Sums of Squares and Products." _Technometrics_ 4 (3). Taylor & Francis: 419–20. doi:[10.1080/00401706.1962.10490022](https://doi.org/10.1080/00401706.1962.10490022).
* - van Reeken, A. J. 1968. "Letters to the Editor: Dealing with Neely's Algorithms." _Communications of the ACM_ 11 (3): 149–50. doi:[10.1145/362929.362961](https://doi.org/10.1145/362929.362961).
*
-* @param N number of indexed elements
-* @param X input array
-* @param stride stride length
-* @return output value
+* @param N number of indexed elements
+* @param X input array
+* @param strideX stride length
+* @return output value
*/
-double stdlib_strided_dsnanmeanwd( const int64_t N, const float *X, const int64_t stride ) {
- int64_t ix;
- int64_t i;
- int64_t n;
+double API_SUFFIX(stdlib_strided_dsnanmeanwd)( const CBLAS_INT N, const float *X, const CBLAS_INT strideX ) {
+ const CBLAS_INT ox = stdlib_strided_stride2offset( N, strideX );
+ return API_SUFFIX(stdlib_strided_dsnanmeanwd_ndarray)( N, X, strideX, ox );
+}
+
+/**
+* Computes the arithmetic mean of a single-precision floating-point strided array, ignoring `NaN` values and using Welford's algorithm with extended accumulation and alternative indexing semantics.
+*
+* @param N number of indexed elements
+* @param X input array
+* @param strideX stride length
+* @param offsetX starting index for X
+* @return output value
+*/
+double API_SUFFIX(stdlib_strided_dsnanmeanwd_ndarray)( const CBLAS_INT N, const float *X, const CBLAS_INT strideX, const CBLAS_INT offsetX ) {
+ CBLAS_INT ix;
+ CBLAS_INT i;
+ CBLAS_INT n;
double mu;
double v;
if ( N <= 0 ) {
return 0.0 / 0.0; // NaN
}
- if ( N == 1 || stride == 0 ) {
- return X[ 0 ];
- }
- if ( stride < 0 ) {
- ix = (1-N) * stride;
- } else {
- ix = 0;
+ if ( N == 1 || strideX == 0 ) {
+ return X[ offsetX ];
}
+ ix = offsetX;
mu = 0.0;
n = 0;
for ( i = 0; i < N; i++ ) {
@@ -71,7 +82,7 @@ double stdlib_strided_dsnanmeanwd( const int64_t N, const float *X, const int64_
n += 1;
mu += ( v-mu ) / (double)n;
}
- ix += stride;
+ ix += strideX;
}
if ( n == 0 ) {
return 0.0 / 0.0; // NaN
diff --git a/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/test/test.dsnanmeanwd.js b/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/test/test.dsnanmeanwd.js
index 986c58b23b23..9478023accb9 100644
--- a/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/test/test.dsnanmeanwd.js
+++ b/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/test/test.dsnanmeanwd.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 dsnanmeanwd = require( './../lib/dsnanmeanwd.js' );
@@ -90,7 +89,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;
@@ -106,15 +104,13 @@ tape( 'the function supports a `stride` parameter', function test( t ) {
NaN // 4
]);
- N = floor( x.length / 2 );
- v = dsnanmeanwd( N, x, 2 );
+ v = dsnanmeanwd( 5, x, 2 );
t.strictEqual( v, 1.25, 'returns expected value' );
t.end();
});
tape( 'the function supports a negative `stride` parameter', function test( t ) {
- var N;
var x;
var v;
@@ -130,8 +126,7 @@ tape( 'the function supports a negative `stride` parameter', function test( t )
NaN // 0
]);
- N = floor( x.length / 2 );
- v = dsnanmeanwd( N, x, -2 );
+ v = dsnanmeanwd( 5, x, -2 );
t.strictEqual( v, 1.25, 'returns expected value' );
t.end();
@@ -152,7 +147,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([
@@ -169,9 +163,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 = dsnanmeanwd( N, x1, 2 );
+ v = dsnanmeanwd( 5, x1, 2 );
t.strictEqual( v, 1.25, 'returns expected value' );
t.end();
diff --git a/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/test/test.dsnanmeanwd.native.js b/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/test/test.dsnanmeanwd.native.js
index 031edd6f6001..82f684bc9c3e 100644
--- a/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/test/test.dsnanmeanwd.native.js
+++ b/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/test/test.dsnanmeanwd.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' );
@@ -181,7 +180,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;
@@ -197,15 +195,13 @@ tape( 'the function supports a `stride` parameter', opts, function test( t ) {
NaN // 4
]);
- N = floor( x.length / 2 );
- v = dsnanmeanwd( N, x, 2 );
+ v = dsnanmeanwd( 5, x, 2 );
t.strictEqual( v, 1.25, 'returns expected value' );
t.end();
});
tape( 'the function supports a negative `stride` parameter', opts, function test( t ) {
- var N;
var x;
var v;
@@ -221,8 +217,7 @@ tape( 'the function supports a negative `stride` parameter', opts, function test
NaN // 0
]);
- N = floor( x.length / 2 );
- v = dsnanmeanwd( N, x, -2 );
+ v = dsnanmeanwd( 5, x, -2 );
t.strictEqual( v, 1.25, 'returns expected value' );
t.end();
@@ -243,7 +238,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([
@@ -260,9 +254,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 = dsnanmeanwd( N, x1, 2 );
+ v = dsnanmeanwd( 5, x1, 2 );
t.strictEqual( v, 1.25, 'returns expected value' );
t.end();
diff --git a/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/test/test.ndarray.js b/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/test/test.ndarray.js
index be773e2d611b..395d3beba256 100644
--- a/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/test/test.ndarray.js
+++ b/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/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 dsnanmeanwd = require( './../lib/ndarray.js' );
@@ -90,7 +89,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;
@@ -106,15 +104,13 @@ tape( 'the function supports a `stride` parameter', function test( t ) {
NaN // 4
]);
- N = floor( x.length / 2 );
- v = dsnanmeanwd( N, x, 2, 0 );
+ v = dsnanmeanwd( 5, x, 2, 0 );
t.strictEqual( v, 1.25, 'returns expected value' );
t.end();
});
tape( 'the function supports a negative `stride` parameter', function test( t ) {
- var N;
var x;
var v;
@@ -130,8 +126,7 @@ tape( 'the function supports a negative `stride` parameter', function test( t )
NaN // 0
]);
- N = floor( x.length / 2 );
- v = dsnanmeanwd( N, x, -2, 6 );
+ v = dsnanmeanwd( 5, x, -2, 8 );
t.strictEqual( v, 1.25, 'returns expected value' );
t.end();
@@ -150,7 +145,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;
@@ -166,9 +160,8 @@ tape( 'the function supports an `offset` parameter', function test( t ) {
NaN,
NaN // 4
]);
- N = floor( x.length / 2 );
- v = dsnanmeanwd( N, x, 2, 1 );
+ v = dsnanmeanwd( 5, x, 2, 1 );
t.strictEqual( v, 1.25, 'returns expected value' );
t.end();
diff --git a/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/test/test.ndarray.native.js b/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/test/test.ndarray.native.js
index 9622342c1110..49babbb1d7b6 100644
--- a/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/test/test.ndarray.native.js
+++ b/lib/node_modules/@stdlib/stats/base/dsnanmeanwd/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' );
@@ -99,7 +98,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;
@@ -115,15 +113,13 @@ tape( 'the function supports a `stride` parameter', opts, function test( t ) {
NaN // 4
]);
- N = floor( x.length / 2 );
- v = dsnanmeanwd( N, x, 2, 0 );
+ v = dsnanmeanwd( 5, x, 2, 0 );
t.strictEqual( v, 1.25, 'returns expected value' );
t.end();
});
tape( 'the function supports a negative `stride` parameter', opts, function test( t ) {
- var N;
var x;
var v;
@@ -139,8 +135,7 @@ tape( 'the function supports a negative `stride` parameter', opts, function test
NaN // 0
]);
- N = floor( x.length / 2 );
- v = dsnanmeanwd( N, x, -2, 6 );
+ v = dsnanmeanwd( 5, x, -2, 8 );
t.strictEqual( v, 1.25, 'returns expected value' );
t.end();
@@ -159,7 +154,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;
@@ -175,9 +169,8 @@ tape( 'the function supports an `offset` parameter', opts, function test( t ) {
NaN,
NaN // 4
]);
- N = floor( x.length / 2 );
- v = dsnanmeanwd( N, x, 2, 1 );
+ v = dsnanmeanwd( 5, x, 2, 1 );
t.strictEqual( v, 1.25, 'returns expected value' );
t.end();