diff --git a/lib/node_modules/@stdlib/stats/base/dvarmpn/README.md b/lib/node_modules/@stdlib/stats/base/dvarmpn/README.md
index 0095e5a671d0..ff7ad78fce13 100644
--- a/lib/node_modules/@stdlib/stats/base/dvarmpn/README.md
+++ b/lib/node_modules/@stdlib/stats/base/dvarmpn/README.md
@@ -98,7 +98,7 @@ The use of the term `n-1` is commonly referred to as Bessel's correction. Note,
var dvarmpn = require( '@stdlib/stats/base/dvarmpn' );
```
-#### dvarmpn( N, mean, correction, x, stride )
+#### dvarmpn( N, mean, correction, x, strideX )
Computes the [variance][variance] of a double-precision floating-point strided array `x` provided a known `mean` and using Neely's correction algorithm.
@@ -117,9 +117,9 @@ The function has the following parameters:
- **mean**: mean.
- **correction**: degrees of freedom adjustment. Setting this parameter to a value other than `0` has the effect of adjusting the divisor during the calculation of the [variance][variance] according to `N-c` where `c` corresponds to the provided degrees of freedom adjustment. When computing the [variance][variance] of a population, setting this parameter to `0` is the standard choice (i.e., the provided array contains data constituting an entire population). When computing the unbiased sample [variance][variance], setting this parameter to `1` is the standard choice (i.e., the provided array contains data sampled from a larger population; this is commonly referred to as Bessel's correction).
- **x**: input [`Float64Array`][@stdlib/array/float64].
-- **stride**: index increment for `x`.
+- **strideX**: index increment for `x`.
-The `N` and `stride` parameters determine which elements in `x` are accessed at runtime. For example, to compute the [variance][variance] of every other element in `x`,
+The `N` and `strideX` parameters determine which elements in `x` are accessed at runtime. For example, to compute the [variance][variance] of every other element in `x`,
```javascript
var Float64Array = require( '@stdlib/array/float64' );
@@ -149,7 +149,7 @@ var v = dvarmpn( N, 1.25, 1, x1, 2 );
// returns 6.25
```
-#### dvarmpn.ndarray( N, mean, correction, x, stride, offset )
+#### dvarmpn.ndarray( N, mean, correction, x, strideX, offsetX )
Computes the [variance][variance] of a double-precision floating-point strided array provided a known `mean` and using Neely's correction algorithm and alternative indexing semantics.
@@ -164,7 +164,7 @@ var v = dvarmpn.ndarray( x.length, 1.0/3.0, 1, x, 1, 0 );
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 [variance][variance] for every other value in `x` starting from the second value
@@ -223,6 +223,127 @@ console.log( v );
+
+
+* * *
+
+
+
+## C APIs
+
+
+
+
+
+
+
+
+
+
+
+### Usage
+
+```c
+#include "stdlib/stats/base/dvarmpn.h"
+```
+
+#### stdlib_strided_dvarmpn( N, mean, correction, \*X, strideX )
+
+Computes the [variance][variance] of a double-precision floating-point strided array `x` provided a known `mean` and using Neely's correction algorithm.
+
+```c
+const double x[] = { 1.0, -2.0, 2.0 };
+
+double v = stdlib_strided_dvarmpn( x.length, 1.0/3.0, 1, x, 1 );
+// returns ~4.3333
+```
+
+The function accepts the following arguments:
+
+- **N**: number of indexed elements.
+- **mean**: mean.
+- **correction**: degrees of freedom adjustment. Setting this parameter to a value other than `0` has the effect of adjusting the divisor during the calculation of the [variance][variance] according to `N-c` where `c` corresponds to the provided degrees of freedom adjustment. When computing the [variance][variance] of a population, setting this parameter to `0` is the standard choice (i.e., the provided array contains data constituting an entire population). When computing the unbiased sample [variance][variance], setting this parameter to `1` is the standard choice (i.e., the provided array contains data sampled from a larger population; this is commonly referred to as Bessel's correction).
+- **x**: input [`Float64Array`][@stdlib/array/float64].
+- **strideX**: index increment for `x`.
+
+```c
+double stdlib_strided_dvarmpn( const CBLAS_INT N, const double mean, const double correction, const double *X, const CBLAS_INT strideX );
+```
+
+#### stdlib_strided_dvarmpn_ndarray( N, mean, correction, \*X, strideX, offsetX )
+
+Computes the [variance][variance] of a double-precision floating-point strided array provided a known `mean` and using Neely's correction algorithm and alternative indexing semantics.
+
+```c
+const double x[] = { 1.0, -2.0, 2.0 };
+
+double v = stdlib_strided_dvarmpn_ndarray( x.length, 1.0/3.0, 1, x, 1, 0 );
+// returns ~4.3333
+```
+
+The function accepts the following arguments:
+
+- **N**: number of indexed elements.
+- **mean**: mean.
+- **correction**: degrees of freedom adjustment. Setting this parameter to a value other than `0` has the effect of adjusting the divisor during the calculation of the [variance][variance] according to `N-c` where `c` corresponds to the provided degrees of freedom adjustment. When computing the [variance][variance] of a population, setting this parameter to `0` is the standard choice (i.e., the provided array contains data constituting an entire population). When computing the unbiased sample [variance][variance], setting this parameter to `1` is the standard choice (i.e., the provided array contains data sampled from a larger population; this is commonly referred to as Bessel's correction).
+- **x**: input [`Float64Array`][@stdlib/array/float64].
+- **strideX**: index increment for `x`.
+- **offsetX**: `[in] CBLAS_INT` starting index for `X`.
+
+```c
+double stdlib_strided_dvarmpn_ndarray( const CBLAS_INT N, const double mean, const double correction, const double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX );
+```
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+### Examples
+
+```c
+#include "stdlib/stats/base/dvarmpn.h"
+#include
+
+int main( void ) {
+ // Create a strided array:
+ const double x[] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f };
+
+ // Specify the number of elements:
+ const int N = 4;
+
+ // Specify the stride length:
+ const int strideX = 2;
+
+ // Compute the variance:
+ double v = stdlib_strided_dvarmpn( N, 4.5, 1, x, strideX );
+
+ // Print the result:
+ printf( "sample variance: %lf\n", v );
+}
+```
+
+
+
+
+
+
+
+
+
* * *
diff --git a/lib/node_modules/@stdlib/stats/base/dvarmpn/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dvarmpn/benchmark/benchmark.js
index 629b3891f9aa..1eba9844c5bb 100644
--- a/lib/node_modules/@stdlib/stats/base/dvarmpn/benchmark/benchmark.js
+++ b/lib/node_modules/@stdlib/stats/base/dvarmpn/benchmark/benchmark.js
@@ -21,14 +21,20 @@
// MODULES //
var bench = require( '@stdlib/bench' );
-var randu = require( '@stdlib/random/base/randu' );
+var uniform = require( '@stdlib/random/array/uniform' );
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 dvarmpn = require( './../lib/dvarmpn.js' );
+// VARIABLES //
+
+var options = {
+ 'dtype': 'float64'
+};
+
+
// FUNCTIONS //
/**
@@ -39,13 +45,7 @@ var dvarmpn = require( './../lib/dvarmpn.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()*20.0 ) - 10.0;
- }
+ var x = uniform( len, -100, 100, options );
return benchmark;
function benchmark( b ) {
diff --git a/lib/node_modules/@stdlib/stats/base/dvarmpn/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/stats/base/dvarmpn/benchmark/benchmark.native.js
index cf8da139dace..6a4163da2419 100644
--- a/lib/node_modules/@stdlib/stats/base/dvarmpn/benchmark/benchmark.native.js
+++ b/lib/node_modules/@stdlib/stats/base/dvarmpn/benchmark/benchmark.native.js
@@ -22,10 +22,9 @@
var resolve = require( 'path' ).resolve;
var bench = require( '@stdlib/bench' );
-var randu = require( '@stdlib/random/base/randu' );
+var uniform = require( '@stdlib/random/array/uniform' );
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 +35,9 @@ var dvarmpn = tryRequire( resolve( __dirname, './../lib/dvarmpn.native.js' ) );
var opts = {
'skip': ( dvarmpn instanceof Error )
};
+var options = {
+ 'dtype': 'float64'
+};
// FUNCTIONS //
@@ -48,13 +50,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()*20.0 ) - 10.0;
- }
+ var x = uniform( len, -100, 100, options );
return benchmark;
function benchmark( b ) {
diff --git a/lib/node_modules/@stdlib/stats/base/dvarmpn/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/stats/base/dvarmpn/benchmark/benchmark.ndarray.js
index 8fa3ba35a4ae..e562d3d6a9c3 100644
--- a/lib/node_modules/@stdlib/stats/base/dvarmpn/benchmark/benchmark.ndarray.js
+++ b/lib/node_modules/@stdlib/stats/base/dvarmpn/benchmark/benchmark.ndarray.js
@@ -21,14 +21,20 @@
// MODULES //
var bench = require( '@stdlib/bench' );
-var randu = require( '@stdlib/random/base/randu' );
+var uniform = require( '@stdlib/random/array/uniform' );
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 dvarmpn = require( './../lib/ndarray.js' );
+// VARIABLES //
+
+var options = {
+ 'dtype': 'float64'
+};
+
+
// FUNCTIONS //
/**
@@ -39,13 +45,7 @@ var dvarmpn = 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()*20.0 ) - 10.0;
- }
+ var x = uniform( len, -100, 100, options );
return benchmark;
function benchmark( b ) {
diff --git a/lib/node_modules/@stdlib/stats/base/dvarmpn/benchmark/benchmark.ndarray.native.js b/lib/node_modules/@stdlib/stats/base/dvarmpn/benchmark/benchmark.ndarray.native.js
index 070c702dff6b..27e60d6828a8 100644
--- a/lib/node_modules/@stdlib/stats/base/dvarmpn/benchmark/benchmark.ndarray.native.js
+++ b/lib/node_modules/@stdlib/stats/base/dvarmpn/benchmark/benchmark.ndarray.native.js
@@ -22,10 +22,9 @@
var resolve = require( 'path' ).resolve;
var bench = require( '@stdlib/bench' );
-var randu = require( '@stdlib/random/base/randu' );
+var uniform = require( '@stdlib/random/array/uniform' );
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 +35,9 @@ var dvarmpn = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) );
var opts = {
'skip': ( dvarmpn instanceof Error )
};
+var options = {
+ 'dtype': 'float64'
+};
// FUNCTIONS //
@@ -48,13 +50,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()*20.0 ) - 10.0;
- }
+ var x = uniform( len, -100, 100, options );
return benchmark;
function benchmark( b ) {
diff --git a/lib/node_modules/@stdlib/stats/base/dvarmpn/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/stats/base/dvarmpn/benchmark/c/benchmark.length.c
index 56cfbeedb9f3..18b00720190b 100644
--- a/lib/node_modules/@stdlib/stats/base/dvarmpn/benchmark/c/benchmark.length.c
+++ b/lib/node_modules/@stdlib/stats/base/dvarmpn/benchmark/c/benchmark.length.c
@@ -94,7 +94,7 @@ static double rand_double( 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;
double x[ len ];
double v;
@@ -107,6 +107,7 @@ static double benchmark( int iterations, int len ) {
v = 0.0;
t = tic();
for ( i = 0; i < iterations; i++ ) {
+ // cppcheck-suppress uninitvar
v = stdlib_strided_dvarmpn( len, 0.0, 1, x, 1 );
if ( v != v ) {
printf( "should not return NaN\n" );
@@ -120,6 +121,40 @@ 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;
+ double x[ len ];
+ float v;
+ double t;
+ int i;
+
+ for ( i = 0; i < len; i++ ) {
+ x[ i ] = ( rand_double() * 20000.0 ) - 10000.0;
+ }
+ v = 0.0f;
+ t = tic();
+ for ( i = 0; i < iterations; i++ ) {
+ // cppcheck-suppress uninitvar
+ v = stdlib_strided_dvarmpn_ndarray( len, 0.0, 1, x, 1, 1 );
+ 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 +177,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 - 3; i++ ) {
+ len = pow( 10, i );
+ iter = ITERATIONS;
+ 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/dvarmpn/docs/repl.txt b/lib/node_modules/@stdlib/stats/base/dvarmpn/docs/repl.txt
index 051500d27e9f..2b2e73a96b25 100644
--- a/lib/node_modules/@stdlib/stats/base/dvarmpn/docs/repl.txt
+++ b/lib/node_modules/@stdlib/stats/base/dvarmpn/docs/repl.txt
@@ -1,10 +1,10 @@
-{{alias}}( N, mean, correction, x, stride )
+{{alias}}( N, mean, correction, x, strideX )
Computes the variance of a double-precision floating-point strided array
provided a known mean and using Neely's correction algorithm.
- 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.
@@ -34,8 +34,8 @@
x: Float64Array
Input array.
- stride: integer
- Index increment.
+ strideX: integer
+ Stride length.
Returns
-------
@@ -49,20 +49,19 @@
> {{alias}}( x.length, 1.0/3.0, 1, x, 1 )
~4.3333
- // Using `N` and `stride` parameters:
+ // Using `N` and stride parameters:
> x = new {{alias:@stdlib/array/float64}}( [ -2.0, 1.0, 1.0, -5.0, 2.0, -1.0 ] );
- > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 );
- > {{alias}}( N, 1.0/3.0, 1, x, 2 )
+ > {{alias}}( 3, 1.0/3.0, 1, x, 2 )
~4.3333
// Using view offsets:
> var x0 = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 3.0, 2.0, 5.0, 1.0 ] );
> var x1 = new {{alias:@stdlib/array/float64}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 );
- > N = {{alias:@stdlib/math/base/special/floor}}( x0.length / 2 );
- > {{alias}}( N, 1.0/3.0, 1, x1, 2 )
+ > {{alias}}( 3, 1.0/3.0, 1, x1, 2 )
~4.3333
-{{alias}}.ndarray( N, mean, correction, x, stride, offset )
+
+{{alias}}.ndarray( N, mean, correction, x, strideX, offsetX )
Computes the variance of a double-precision floating-point strided array
provided a known mean and using Neely's correction algorithm and alternative
indexing semantics.
@@ -94,10 +93,10 @@
x: Float64Array
Input array.
- stride: integer
- Index increment.
+ strideX: integer
+ Stride length.
- offset: integer
+ offsetX: integer
Starting index.
Returns
@@ -114,8 +113,7 @@
// Using offset parameter:
> var x = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 3.0, 2.0, 5.0, 1.0 ] );
- > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 );
- > {{alias}}.ndarray( N, 1.0/3.0, 1, x, 2, 1 )
+ > {{alias}}.ndarray( 3, 1.0/3.0, 1, x, 2, 1 )
~4.3333
See Also
diff --git a/lib/node_modules/@stdlib/stats/base/dvarmpn/docs/types/index.d.ts b/lib/node_modules/@stdlib/stats/base/dvarmpn/docs/types/index.d.ts
index f3bba910cdba..253f5b6b3daa 100644
--- a/lib/node_modules/@stdlib/stats/base/dvarmpn/docs/types/index.d.ts
+++ b/lib/node_modules/@stdlib/stats/base/dvarmpn/docs/types/index.d.ts
@@ -29,7 +29,7 @@ interface Routine {
* @param mean - mean
* @param correction - degrees of freedom adjustment
* @param x - input array
- * @param stride - stride length
+ * @param strideX - stride length
* @returns variance
*
* @example
@@ -40,7 +40,7 @@ interface Routine {
* var v = dvarmpn( x.length, 1.0/3.0, 1, x, 1 );
* // returns ~4.3333
*/
- ( N: number, mean: number, correction: number, x: Float64Array, stride: number ): number;
+ ( N: number, mean: number, correction: number, x: Float64Array, strideX: number ): number;
/**
* Computes the variance of a double-precision floating-point strided array provided a known mean and using Neely's correction algorithm and alternative indexing semantics.
@@ -49,8 +49,8 @@ interface Routine {
* @param mean - mean
* @param correction - degrees of freedom adjustment
* @param x - input array
- * @param stride - stride length
- * @param offset - starting index
+ * @param strideX - stride length
+ * @param offsetX - starting index
* @returns variance
*
* @example
@@ -61,7 +61,7 @@ interface Routine {
* var v = dvarmpn.ndarray( x.length, 1.0/3.0, 1, x, 1, 0 );
* // returns ~4.3333
*/
- ndarray( N: number, mean: number, correction: number, x: Float64Array, stride: number, offset: number ): number;
+ ndarray( N: number, mean: number, correction: number, x: Float64Array, strideX: number, offsetX: number ): number;
}
/**
@@ -71,7 +71,7 @@ interface Routine {
* @param mean - mean
* @param correction - degrees of freedom adjustment
* @param x - input array
-* @param stride - stride length
+* @param strideX - stride length
* @returns variance
*
* @example
diff --git a/lib/node_modules/@stdlib/stats/base/dvarmpn/examples/c/example.c b/lib/node_modules/@stdlib/stats/base/dvarmpn/examples/c/example.c
index a1a1c0711ebd..6dcdfb5311cc 100644
--- a/lib/node_modules/@stdlib/stats/base/dvarmpn/examples/c/example.c
+++ b/lib/node_modules/@stdlib/stats/base/dvarmpn/examples/c/example.c
@@ -17,21 +17,20 @@
*/
#include "stdlib/stats/base/dvarmpn.h"
-#include
#include
int main( void ) {
// Create a strided array:
- double x[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 };
+ const double x[] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f };
// Specify the number of elements:
- int64_t N = 4;
+ const int N = 4;
// Specify the stride length:
- int64_t stride = 2;
+ const int strideX = 2;
// Compute the variance:
- double v = stdlib_strided_dvarmpn( N, 4.5, 1, x, stride );
+ double v = stdlib_strided_dvarmpn( N, 4.5, 1, x, strideX );
// Print the result:
printf( "sample variance: %lf\n", v );
diff --git a/lib/node_modules/@stdlib/stats/base/dvarmpn/examples/index.js b/lib/node_modules/@stdlib/stats/base/dvarmpn/examples/index.js
index 5cd2c4729b61..2cdc0ff1b798 100644
--- a/lib/node_modules/@stdlib/stats/base/dvarmpn/examples/index.js
+++ b/lib/node_modules/@stdlib/stats/base/dvarmpn/examples/index.js
@@ -18,18 +18,13 @@
'use strict';
-var randu = require( '@stdlib/random/base/randu' );
-var round = require( '@stdlib/math/base/special/round' );
-var Float64Array = require( '@stdlib/array/float64' );
+var uniform = require( '@stdlib/random/array/discrete-uniform' );
var dvarmpn = require( './../lib' );
-var x;
-var i;
-
-x = new Float64Array( 10 );
-for ( i = 0; i < x.length; i++ ) {
- x[ i ] = round( (randu()*100.0) - 50.0 );
-}
+var options = {
+ 'dtype': 'float64'
+};
+var x = uniform( 10, -100, 100, options );
console.log( x );
var v = dvarmpn( x.length, 0.0, 1, x, 1 );
diff --git a/lib/node_modules/@stdlib/stats/base/dvarmpn/include/stdlib/stats/base/dvarmpn.h b/lib/node_modules/@stdlib/stats/base/dvarmpn/include/stdlib/stats/base/dvarmpn.h
index faa2f0cf310e..f1eb54b46ed3 100644
--- a/lib/node_modules/@stdlib/stats/base/dvarmpn/include/stdlib/stats/base/dvarmpn.h
+++ b/lib/node_modules/@stdlib/stats/base/dvarmpn/include/stdlib/stats/base/dvarmpn.h
@@ -19,7 +19,7 @@
#ifndef STDLIB_STATS_BASE_DVARMPN_H
#define STDLIB_STATS_BASE_DVARMPN_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,11 @@ extern "C" {
/**
* Computes the variance of a double-precision floating-point strided array provided a known mean and using Neely's correction algorithm.
*/
-double stdlib_strided_dvarmpn( const int64_t N, const double mean, const double correction, const double *X, const int64_t stride );
+double API_SUFFIX(stdlib_strided_dvarmpn)( const CBLAS_INT N, const double mean, const double correction, const double *X, const CBLAS_INT strideX );
+/**
+* Computes the variance of a double-precision floating-point strided array provided a known mean and using Neely's correction algorithm with alternative indexing semantics.
+*/
+double API_SUFFIX(stdlib_strided_dvarmpn_ndarray)( const CBLAS_INT N, const double mean, const double correction, const double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX );
#ifdef __cplusplus
}
diff --git a/lib/node_modules/@stdlib/stats/base/dvarmpn/lib/dvarmpn.js b/lib/node_modules/@stdlib/stats/base/dvarmpn/lib/dvarmpn.js
index 06ffd38b877a..600039fe1685 100644
--- a/lib/node_modules/@stdlib/stats/base/dvarmpn/lib/dvarmpn.js
+++ b/lib/node_modules/@stdlib/stats/base/dvarmpn/lib/dvarmpn.js
@@ -18,6 +18,12 @@
'use strict';
+// MODULES //
+
+var stride2offset = require( '@stdlib/strided/base/stride2offset' );
+var ndarray = require( './ndarray.js' );
+
+
// MAIN //
/**
@@ -32,7 +38,7 @@
* @param {number} mean - mean
* @param {number} correction - degrees of freedom adjustment
* @param {Float64Array} x - input array
-* @param {integer} stride - stride length
+* @param {integer} strideX - stride length
* @returns {number} variance
*
* @example
@@ -43,35 +49,8 @@
* var v = dvarmpn( x.length, 1.0/3.0, 1, x, 1 );
* // returns ~4.3333
*/
-function dvarmpn( N, mean, correction, x, stride ) {
- var ix;
- var M2;
- var M;
- var d;
- var n;
- var i;
-
- n = N - correction;
- if ( N <= 0 || n <= 0.0 ) {
- return NaN;
- }
- if ( N === 1 || stride === 0 ) {
- return 0.0;
- }
- if ( stride < 0 ) {
- ix = (1-N) * stride;
- } else {
- ix = 0;
- }
- M2 = 0.0;
- M = 0.0;
- for ( i = 0; i < N; i++ ) {
- d = x[ ix ] - mean;
- M2 += d * d;
- M += d;
- ix += stride;
- }
- return (M2/n) - ((M/N)*(M/n));
+function dvarmpn( N, mean, correction, x, strideX ) {
+ return ndarray( N, mean, correction, x, strideX, stride2offset( N, strideX) ); // eslint-disable-line max-len
}
diff --git a/lib/node_modules/@stdlib/stats/base/dvarmpn/lib/dvarmpn.native.js b/lib/node_modules/@stdlib/stats/base/dvarmpn/lib/dvarmpn.native.js
index acadade5dfd6..d279504d69c7 100644
--- a/lib/node_modules/@stdlib/stats/base/dvarmpn/lib/dvarmpn.native.js
+++ b/lib/node_modules/@stdlib/stats/base/dvarmpn/lib/dvarmpn.native.js
@@ -32,7 +32,7 @@ var addon = require( './../src/addon.node' );
* @param {number} mean - mean
* @param {number} correction - degrees of freedom adjustment
* @param {Float64Array} x - input array
-* @param {integer} stride - stride length
+* @param {integer} strideX - stride length
* @returns {number} variance
*
* @example
@@ -41,10 +41,10 @@ var addon = require( './../src/addon.node' );
* var x = new Float64Array( [ 1.0, -2.0, 2.0 ] );
*
* var v = dvarmpn( x.length, 1.0/3.0, 1, x, 1 );
-* // returns ~4.3333
+* //returns ~4.3333
*/
-function dvarmpn( N, mean, correction, x, stride ) {
- return addon( N, mean, correction, x, stride );
+function dvarmpn( N, mean, correction, x, strideX ) {
+ return addon( N, mean, correction, x, strideX );
}
diff --git a/lib/node_modules/@stdlib/stats/base/dvarmpn/lib/ndarray.js b/lib/node_modules/@stdlib/stats/base/dvarmpn/lib/ndarray.js
index 9c90106996c7..38d0601be223 100644
--- a/lib/node_modules/@stdlib/stats/base/dvarmpn/lib/ndarray.js
+++ b/lib/node_modules/@stdlib/stats/base/dvarmpn/lib/ndarray.js
@@ -32,21 +32,19 @@
* @param {number} mean - mean
* @param {number} correction - degrees of freedom adjustment
* @param {Float64Array} 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} variance
*
* @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 N = floor( x.length / 2 );
*
-* var v = dvarmpn( N, 1.25, 1, x, 2, 1 );
-* // returns 6.25
+* var v = dvarmpn( 4, 1.25, 1, x, 2, 1 );
+* //returns 6.25
*/
-function dvarmpn( N, mean, correction, x, stride, offset ) {
+function dvarmpn( N, mean, correction, x, strideX, offsetX ) {
var ix;
var M2;
var M;
@@ -58,17 +56,17 @@ function dvarmpn( N, mean, correction, x, stride, offset ) {
if ( N <= 0 || n <= 0.0 ) {
return NaN;
}
- if ( N === 1 || stride === 0 ) {
+ if ( N === 1 || strideX === 0 ) {
return 0.0;
}
- ix = offset;
+ ix = offsetX;
M2 = 0.0;
M = 0.0;
for ( i = 0; i < N; i++ ) {
d = x[ ix ] - mean;
M2 += d * d;
M += d;
- ix += stride;
+ ix += strideX;
}
return (M2/n) - ((M/N)*(M/n));
}
diff --git a/lib/node_modules/@stdlib/stats/base/dvarmpn/lib/ndarray.native.js b/lib/node_modules/@stdlib/stats/base/dvarmpn/lib/ndarray.native.js
index b6da08fa1994..0e6414dc1344 100644
--- a/lib/node_modules/@stdlib/stats/base/dvarmpn/lib/ndarray.native.js
+++ b/lib/node_modules/@stdlib/stats/base/dvarmpn/lib/ndarray.native.js
@@ -20,8 +20,7 @@
// MODULES //
-var Float64Array = require( '@stdlib/array/float64' );
-var addon = require( './dvarmpn.native.js' );
+var addon = require( './../src/addon.node' );
// MAIN //
@@ -33,27 +32,20 @@ var addon = require( './dvarmpn.native.js' );
* @param {number} mean - mean
* @param {number} correction - degrees of freedom adjustment
* @param {Float64Array} 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} variance
*
* @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 N = floor( x.length / 2 );
*
-* var v = dvarmpn( N, 1.25, 1, x, 2, 1 );
-* // returns 6.25
+* var v = dvarmpn( 4, 1.25, 1, x, 2, 1 );
+* //returns 6.25
*/
-function dvarmpn( N, mean, correction, x, stride, offset ) {
- var view;
- if ( stride < 0 ) {
- offset += (N-1) * stride;
- }
- view = new Float64Array( x.buffer, x.byteOffset+(x.BYTES_PER_ELEMENT*offset), x.length-offset ); // eslint-disable-line max-len
- return addon( N, mean, correction, view, stride );
+function dvarmpn( N, mean, correction, x, strideX, offsetX ) {
+ return addon.ndarray( N, mean, correction, x, strideX, offsetX );
}
diff --git a/lib/node_modules/@stdlib/stats/base/dvarmpn/manifest.json b/lib/node_modules/@stdlib/stats/base/dvarmpn/manifest.json
index ad4bf3c4d7d3..a41fde9bf052 100644
--- a/lib/node_modules/@stdlib/stats/base/dvarmpn/manifest.json
+++ b/lib/node_modules/@stdlib/stats/base/dvarmpn/manifest.json
@@ -1,6 +1,7 @@
{
"options": {
- "task": "build"
+ "task": "build",
+ "wasm": false
},
"fields": [
{
@@ -27,8 +28,9 @@
"confs": [
{
"task": "build",
+ "wasm": false,
"src": [
- "./src/dvarmpn.c"
+ "./src/main.c"
],
"include": [
"./include"
@@ -38,6 +40,8 @@
],
"libpath": [],
"dependencies": [
+ "@stdlib/blas/base/shared",
+ "@stdlib/strided/base/stride2offset",
"@stdlib/napi/export",
"@stdlib/napi/argv",
"@stdlib/napi/argv-int64",
@@ -48,8 +52,9 @@
},
{
"task": "benchmark",
+ "wasm": false,
"src": [
- "./src/dvarmpn.c"
+ "./src/main.c"
],
"include": [
"./include"
@@ -58,12 +63,16 @@
"-lm"
],
"libpath": [],
- "dependencies": []
+ "dependencies": [
+ "@stdlib/blas/base/shared",
+ "@stdlib/strided/base/stride2offset"
+ ]
},
{
"task": "examples",
+ "wasm": false,
"src": [
- "./src/dvarmpn.c"
+ "./src/main.c"
],
"include": [
"./include"
@@ -72,7 +81,26 @@
"-lm"
],
"libpath": [],
- "dependencies": []
+ "dependencies": [
+ "@stdlib/blas/base/shared",
+ "@stdlib/strided/base/stride2offset"
+ ]
+ },
+ {
+ "task": "",
+ "wasm": true,
+ "src": [
+ "./src/main.c"
+ ],
+ "include": [
+ "./include"
+ ],
+ "libraries": [],
+ "libpath": [],
+ "dependencies": [
+ "@stdlib/blas/base/shared",
+ "@stdlib/strided/base/stride2offset"
+ ]
}
]
}
diff --git a/lib/node_modules/@stdlib/stats/base/dvarmpn/src/addon.c b/lib/node_modules/@stdlib/stats/base/dvarmpn/src/addon.c
index f2eb4d860dd8..e1fb00b3161e 100644
--- a/lib/node_modules/@stdlib/stats/base/dvarmpn/src/addon.c
+++ b/lib/node_modules/@stdlib/stats/base/dvarmpn/src/addon.c
@@ -35,12 +35,31 @@
static napi_value addon( napi_env env, napi_callback_info info ) {
STDLIB_NAPI_ARGV( env, info, argv, argc, 5 );
STDLIB_NAPI_ARGV_INT64( env, N, argv, 0 );
- STDLIB_NAPI_ARGV_INT64( env, stride, argv, 4 );
+ STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 4 );
STDLIB_NAPI_ARGV_DOUBLE( env, mean, argv, 1 );
STDLIB_NAPI_ARGV_DOUBLE( env, correction, argv, 2 );
- STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, X, N, stride, argv, 3 );
- STDLIB_NAPI_CREATE_DOUBLE( env, stdlib_strided_dvarmpn( N, mean, correction, X, stride ), v );
+ STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, X, N, strideX, argv, 3 );
+ STDLIB_NAPI_CREATE_DOUBLE( env, API_SUFFIX(stdlib_strided_dvarmpn)( N, mean, correction, 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, 6 );
+ STDLIB_NAPI_ARGV_INT64( env, N, argv, 0 );
+ STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 4 );
+ STDLIB_NAPI_ARGV_INT64( env, offsetX, argv, 5 );
+ STDLIB_NAPI_ARGV_DOUBLE( env, mean, argv, 1 );
+ STDLIB_NAPI_ARGV_DOUBLE( env, correction, argv, 2 );
+ STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, X, N, strideX, argv, 3 );
+ STDLIB_NAPI_CREATE_DOUBLE( env, API_SUFFIX(stdlib_strided_dvarmpn_ndarray)( N, mean, correction, 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/dvarmpn/src/dvarmpn.c b/lib/node_modules/@stdlib/stats/base/dvarmpn/src/main.c
similarity index 63%
rename from lib/node_modules/@stdlib/stats/base/dvarmpn/src/dvarmpn.c
rename to lib/node_modules/@stdlib/stats/base/dvarmpn/src/main.c
index 47755558d75a..a7ea9b6ea70e 100644
--- a/lib/node_modules/@stdlib/stats/base/dvarmpn/src/dvarmpn.c
+++ b/lib/node_modules/@stdlib/stats/base/dvarmpn/src/main.c
@@ -17,7 +17,8 @@
*/
#include "stdlib/stats/base/dvarmpn.h"
-#include
+#include "stdlib/strided/base/stride2offset.h"
+#include "stdlib/blas/base/shared.h"
/**
* Computes the variance of a double-precision floating-point strided array provided a known mean and using Neely's correction algorithm.
@@ -31,12 +32,28 @@
* @param mean mean
* @param correction degrees of freedom adjustment
* @param X input array
-* @param stride stride length
+* @param strideX stride length
* @return output value
*/
-double stdlib_strided_dvarmpn( const int64_t N, const double mean, const double correction, const double *X, const int64_t stride ) {
- int64_t ix;
- int64_t i;
+double API_SUFFIX(stdlib_strided_dvarmpn)( const CBLAS_INT N, const double mean, const double correction, const double *X, const CBLAS_INT strideX ) {
+ return API_SUFFIX(stdlib_strided_dvarmpn_ndarray)( N, mean, correction, X, strideX, stdlib_strided_stride2offset( N, strideX ) );
+}
+
+/**
+* Computes the variance of a double-precision floating-point strided array provided a known mean and using Neely's correction algorithm and alternative indexing semantics.
+*
+* @param N number of indexed elements
+* @param mean mean
+* @param correction degrees of freedom adjustment
+* @param X input array
+* @param strideX stride length
+* @param offsetX starting index
+* @return output value
+*/
+
+double API_SUFFIX(stdlib_strided_dvarmpn_ndarray)( const CBLAS_INT N, const double mean, const double correction, const double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX ) {
+ CBLAS_INT ix;
+ CBLAS_INT i;
double dN;
double M2;
double M;
@@ -48,21 +65,17 @@ double stdlib_strided_dvarmpn( const int64_t N, const double mean, const double
if ( N <= 0 || n <= 0.0 ) {
return 0.0 / 0.0; // NaN
}
- if ( N == 1 || stride == 0 ) {
+ if ( N == 1 || strideX == 0 ) {
return 0.0;
}
- if ( stride < 0 ) {
- ix = (1-N) * stride;
- } else {
- ix = 0;
- }
+ ix = offsetX;
M2 = 0.0;
M = 0.0;
for ( i = 0; i < N; i++ ) {
d = X[ ix ] - mean;
M2 += d * d;
M += d;
- ix += stride;
+ ix += strideX;
}
return (M2/n) - ((M/dN)*(M/n));
}
diff --git a/lib/node_modules/@stdlib/stats/base/dvarmpn/test/test.dvarmpn.js b/lib/node_modules/@stdlib/stats/base/dvarmpn/test/test.dvarmpn.js
index c39ebcc5c373..55f9f58e2b58 100644
--- a/lib/node_modules/@stdlib/stats/base/dvarmpn/test/test.dvarmpn.js
+++ b/lib/node_modules/@stdlib/stats/base/dvarmpn/test/test.dvarmpn.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 dvarmpn = require( './../lib/dvarmpn.js' );
@@ -121,7 +120,6 @@ tape( 'if provided a `correction` parameter yielding `N-correction` less than or
});
tape( 'the function supports a `stride` parameter', function test( t ) {
- var N;
var x;
var v;
@@ -136,15 +134,13 @@ tape( 'the function supports a `stride` parameter', function test( t ) {
2.0
]);
- N = floor( x.length / 2 );
- v = dvarmpn( N, 1.25, 1, x, 2 );
+ v = dvarmpn( 4, 1.25, 1, x, 2 );
t.strictEqual( v, 6.25, 'returns expected value' );
t.end();
});
tape( 'the function supports a negative `stride` parameter', function test( t ) {
- var N;
var x;
var v;
@@ -159,8 +155,7 @@ tape( 'the function supports a negative `stride` parameter', function test( t )
2.0
]);
- N = floor( x.length / 2 );
- v = dvarmpn( N, 1.25, 1, x, -2 );
+ v = dvarmpn( 4, 1.25, 1, x, -2 );
t.strictEqual( v, 6.25, 'returns expected value' );
t.end();
@@ -181,7 +176,6 @@ tape( 'if provided a `stride` parameter equal to `0`, the function returns `0`',
tape( 'the function supports view offsets', function test( t ) {
var x0;
var x1;
- var N;
var v;
x0 = new Float64Array([
@@ -197,9 +191,8 @@ tape( 'the function supports view offsets', function test( t ) {
]);
x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
- N = floor(x1.length / 2);
- v = dvarmpn( N, 1.25, 1, x1, 2 );
+ v = dvarmpn( 4, 1.25, 1, x1, 2 );
t.strictEqual( v, 6.25, 'returns expected value' );
t.end();
diff --git a/lib/node_modules/@stdlib/stats/base/dvarmpn/test/test.dvarmpn.native.js b/lib/node_modules/@stdlib/stats/base/dvarmpn/test/test.dvarmpn.native.js
index 350ba90aa36a..0459dcc77617 100644
--- a/lib/node_modules/@stdlib/stats/base/dvarmpn/test/test.dvarmpn.native.js
+++ b/lib/node_modules/@stdlib/stats/base/dvarmpn/test/test.dvarmpn.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' );
@@ -130,7 +129,6 @@ tape( 'if provided a `correction` parameter yielding `N-correction` less than or
});
tape( 'the function supports a `stride` parameter', opts, function test( t ) {
- var N;
var x;
var v;
@@ -145,15 +143,13 @@ tape( 'the function supports a `stride` parameter', opts, function test( t ) {
2.0
]);
- N = floor( x.length / 2 );
- v = dvarmpn( N, 1.25, 1, x, 2 );
+ v = dvarmpn( 4, 1.25, 1, x, 2 );
t.strictEqual( v, 6.25, 'returns expected value' );
t.end();
});
tape( 'the function supports a negative `stride` parameter', opts, function test( t ) {
- var N;
var x;
var v;
@@ -168,8 +164,7 @@ tape( 'the function supports a negative `stride` parameter', opts, function test
2.0
]);
- N = floor( x.length / 2 );
- v = dvarmpn( N, 1.25, 1, x, -2 );
+ v = dvarmpn( 4, 1.25, 1, x, -2 );
t.strictEqual( v, 6.25, 'returns expected value' );
t.end();
@@ -190,7 +185,6 @@ tape( 'if provided a `stride` parameter equal to `0`, the function returns `0`',
tape( 'the function supports view offsets', opts, function test( t ) {
var x0;
var x1;
- var N;
var v;
x0 = new Float64Array([
@@ -206,9 +200,8 @@ tape( 'the function supports view offsets', opts, function test( t ) {
]);
x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
- N = floor(x1.length / 2);
- v = dvarmpn( N, 1.25, 1, x1, 2 );
+ v = dvarmpn( 4, 1.25, 1, x1, 2 );
t.strictEqual( v, 6.25, 'returns expected value' );
t.end();
diff --git a/lib/node_modules/@stdlib/stats/base/dvarmpn/test/test.ndarray.js b/lib/node_modules/@stdlib/stats/base/dvarmpn/test/test.ndarray.js
index e924282277b3..680b7078df02 100644
--- a/lib/node_modules/@stdlib/stats/base/dvarmpn/test/test.ndarray.js
+++ b/lib/node_modules/@stdlib/stats/base/dvarmpn/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 dvarmpn = require( './../lib/ndarray.js' );
@@ -121,7 +120,6 @@ tape( 'if provided a `correction` parameter yielding `N-correction` less than or
});
tape( 'the function supports a `stride` parameter', function test( t ) {
- var N;
var x;
var v;
@@ -136,15 +134,13 @@ tape( 'the function supports a `stride` parameter', function test( t ) {
2.0
]);
- N = floor( x.length / 2 );
- v = dvarmpn( N, 1.25, 1, x, 2, 0 );
+ v = dvarmpn( 4, 1.25, 1, x, 2, 0 );
t.strictEqual( v, 6.25, 'returns expected value' );
t.end();
});
tape( 'the function supports a negative `stride` parameter', function test( t ) {
- var N;
var x;
var v;
@@ -159,8 +155,7 @@ tape( 'the function supports a negative `stride` parameter', function test( t )
2.0
]);
- N = floor( x.length / 2 );
- v = dvarmpn( N, 1.25, 1, x, -2, 6 );
+ v = dvarmpn( 4, 1.25, 1, x, -2, 6 );
t.strictEqual( v, 6.25, 'returns expected value' );
t.end();
@@ -179,7 +174,6 @@ tape( 'if provided a `stride` parameter equal to `0`, the function returns `0`',
});
tape( 'the function supports an `offset` parameter', function test( t ) {
- var N;
var x;
var v;
@@ -193,9 +187,8 @@ tape( 'the function supports an `offset` parameter', function test( t ) {
3.0,
4.0 // 3
]);
- N = floor( x.length / 2 );
- v = dvarmpn( N, 1.25, 1, x, 2, 1 );
+ v = dvarmpn( 4, 1.25, 1, x, 2, 1 );
t.strictEqual( v, 6.25, 'returns expected value' );
t.end();
diff --git a/lib/node_modules/@stdlib/stats/base/dvarmpn/test/test.ndarray.native.js b/lib/node_modules/@stdlib/stats/base/dvarmpn/test/test.ndarray.native.js
index dcecc2f42cd4..2d9b315be9e2 100644
--- a/lib/node_modules/@stdlib/stats/base/dvarmpn/test/test.ndarray.native.js
+++ b/lib/node_modules/@stdlib/stats/base/dvarmpn/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' );
@@ -130,7 +129,6 @@ tape( 'if provided a `correction` parameter yielding `N-correction` less than or
});
tape( 'the function supports a `stride` parameter', opts, function test( t ) {
- var N;
var x;
var v;
@@ -145,15 +143,13 @@ tape( 'the function supports a `stride` parameter', opts, function test( t ) {
2.0
]);
- N = floor( x.length / 2 );
- v = dvarmpn( N, 1.25, 1, x, 2, 0 );
+ v = dvarmpn( 4, 1.25, 1, x, 2, 0 );
t.strictEqual( v, 6.25, 'returns expected value' );
t.end();
});
tape( 'the function supports a negative `stride` parameter', opts, function test( t ) {
- var N;
var x;
var v;
@@ -168,8 +164,7 @@ tape( 'the function supports a negative `stride` parameter', opts, function test
2.0
]);
- N = floor( x.length / 2 );
- v = dvarmpn( N, 1.25, 1, x, -2, 6 );
+ v = dvarmpn( 4, 1.25, 1, x, -2, 6 );
t.strictEqual( v, 6.25, 'returns expected value' );
t.end();
@@ -188,7 +183,6 @@ tape( 'if provided a `stride` parameter equal to `0`, the function returns `0`',
});
tape( 'the function supports an `offset` parameter', opts, function test( t ) {
- var N;
var x;
var v;
@@ -202,9 +196,8 @@ tape( 'the function supports an `offset` parameter', opts, function test( t ) {
3.0,
4.0 // 3
]);
- N = floor( x.length / 2 );
- v = dvarmpn( N, 1.25, 1, x, 2, 1 );
+ v = dvarmpn( 4, 1.25, 1, x, 2, 1 );
t.strictEqual( v, 6.25, 'returns expected value' );
t.end();