diff --git a/lib/node_modules/@stdlib/stats/base/svariancepn/README.md b/lib/node_modules/@stdlib/stats/base/svariancepn/README.md
index 2e8f965b47d8..e460e165a3fb 100644
--- a/lib/node_modules/@stdlib/stats/base/svariancepn/README.md
+++ b/lib/node_modules/@stdlib/stats/base/svariancepn/README.md
@@ -98,7 +98,7 @@ The use of the term `n-1` is commonly referred to as Bessel's correction. Note,
var svariancepn = require( '@stdlib/stats/base/svariancepn' );
```
-#### svariancepn( N, correction, x, stride )
+#### svariancepn( N, correction, x, strideX )
Computes the [variance][variance] of a single-precision floating-point strided array `x` using a two-pass algorithm.
@@ -106,9 +106,8 @@ Computes the [variance][variance] of a single-precision floating-point strided a
var Float32Array = require( '@stdlib/array/float32' );
var x = new Float32Array( [ 1.0, -2.0, 2.0 ] );
-var N = x.length;
-var v = svariancepn( N, 1, x, 1 );
+var v = svariancepn( x.length, 1, x, 1 );
// returns ~4.3333
```
@@ -117,18 +116,16 @@ The function has the following parameters:
- **N**: number of indexed elements.
- **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 [`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 [variance][variance] of every other element in `x`,
+The `N` and stride parameters determine which elements in the strided array are accessed at runtime. For example, to compute the [variance][variance] 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 ] );
-var N = floor( x.length / 2 );
-var v = svariancepn( N, 1, x, 2 );
+var v = svariancepn( 4, 1, x, 2 );
// returns 6.25
```
@@ -138,18 +135,15 @@ Note that indexing is relative to the first index. To introduce an offset, use [
```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 ] );
var x1 = new Float32Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
-var N = floor( x0.length / 2 );
-
-var v = svariancepn( N, 1, x1, 2 );
+var v = svariancepn( 4, 1, x1, 2 );
// returns 6.25
```
-#### svariancepn.ndarray( N, correction, x, stride, offset )
+#### svariancepn.ndarray( N, correction, x, strideX, offsetX )
Computes the [variance][variance] of a single-precision floating-point strided array using a two-pass algorithm and alternative indexing semantics.
@@ -157,26 +151,23 @@ Computes the [variance][variance] of a single-precision floating-point strided a
var Float32Array = require( '@stdlib/array/float32' );
var x = new Float32Array( [ 1.0, -2.0, 2.0 ] );
-var N = x.length;
-var v = svariancepn.ndarray( N, 1, x, 1, 0 );
+var v = svariancepn.ndarray( x.length, 1, x, 1, 0 );
// returns ~4.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 [variance][variance] for every other value in `x` starting from the second value
+While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameter supports indexing semantics based on a starting index. For example, to calculate the [variance][variance] for every other element in `x` starting from the second element
```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 ] );
-var N = floor( x.length / 2 );
-var v = svariancepn.ndarray( N, 1, x, 2, 1 );
+var v = svariancepn.ndarray( 4, 1, x, 2, 1 );
// returns 6.25
```
@@ -202,18 +193,12 @@ var v = svariancepn.ndarray( N, 1, x, 2, 1 );
```javascript
-var randu = require( '@stdlib/random/base/randu' );
-var round = require( '@stdlib/math/base/special/round' );
-var Float32Array = require( '@stdlib/array/float32' );
+var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
var svariancepn = require( '@stdlib/stats/base/svariancepn' );
-var x;
-var i;
-
-x = new Float32Array( 10 );
-for ( i = 0; i < x.length; i++ ) {
- x[ i ] = round( (randu()*100.0) - 50.0 );
-}
+var x = discreteUniform( 10, -50, 50, {
+ 'dtype': 'float32'
+});
console.log( x );
var v = svariancepn( x.length, 1, x, 1 );
@@ -224,6 +209,125 @@ console.log( v );
+
+
+* * *
+
+
+
+## C APIs
+
+
+
+
+
+
+
+
+
+
+
+### Usage
+
+```c
+#include "stdlib/stats/base/svariancepn.h"
+```
+
+#### stdlib_strided_svariancepn( N, correction, \*X, strideX )
+
+Computes the [variance][variance] of a single-precision floating-point strided array using a two-pass algorithm.
+
+```c
+const float x[] = { 1.0f, -2.0f, 2.0f };
+
+float v = stdlib_strided_svariancepn( 3, 1.0f, x, 1 );
+// returns ~4.3333f
+```
+
+The function accepts the following arguments:
+
+- **N**: `[in] CBLAS_INT` number of indexed elements.
+- **correction**: `[in] float` 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**: `[in] float*` input array.
+- **strideX**: `[in] CBLAS_INT` stride length for `X`.
+
+```c
+float stdlib_strided_svariancepn( const CBLAS_INT N, const float correction, const float *X, const CBLAS_INT strideX );
+```
+
+#### stdlib_strided_svariancepn_ndarray( N, correction, \*X, strideX, offsetX )
+
+Computes the [variance][variance] of a single-precision floating-point strided array using a two-pass algorithm and alternative indexing semantics.
+
+```c
+const float x[] = { 1.0f, -2.0f, 2.0f };
+
+float v = stdlib_strided_svariancepn_ndarray( 3, 1.0f, x, 1, 0 );
+// returns ~4.3333f
+```
+
+The function accepts the following arguments:
+
+- **N**: `[in] CBLAS_INT` number of indexed elements.
+- **correction**: `[in] float` 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**: `[in] float*` input array.
+- **strideX**: `[in] CBLAS_INT` stride length for `X`.
+- **offsetX**: `[in] CBLAS_INT` starting index for `X`.
+
+```c
+float stdlib_strided_svariancepn_ndarray( const CBLAS_INT N, const float correction, const float *X, const CBLAS_INT strideX, const CBLAS_INT offsetX );
+```
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+### Examples
+
+```c
+#include "stdlib/stats/base/svariancepn.h"
+#include
+
+int main( void ) {
+ // Create a strided array:
+ const float 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:
+ float v = stdlib_strided_svariancepn( N, 1.0f, x, strideX );
+
+ // Print the result:
+ printf( "sample variance: %f\n", v );
+}
+```
+
+
+
+
+
+
+
+
+
* * *
diff --git a/lib/node_modules/@stdlib/stats/base/svariancepn/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/svariancepn/benchmark/benchmark.js
index dc578ccd9843..7c7a1f505ec6 100644
--- a/lib/node_modules/@stdlib/stats/base/svariancepn/benchmark/benchmark.js
+++ b/lib/node_modules/@stdlib/stats/base/svariancepn/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 Float32Array = require( '@stdlib/array/float32' );
var pkg = require( './../package.json' ).name;
var svariancepn = require( './../lib/svariancepn.js' );
+// VARIABLES //
+
+var options = {
+ 'dtype': 'float32'
+};
+
+
// FUNCTIONS //
/**
@@ -39,13 +45,7 @@ var svariancepn = require( './../lib/svariancepn.js' );
* @returns {Function} benchmark function
*/
function createBenchmark( len ) {
- var x;
- var i;
-
- x = new Float32Array( len );
- for ( i = 0; i < x.length; i++ ) {
- x[ i ] = ( randu()*20.0 ) - 10.0;
- }
+ var x = uniform( len, -10.0, 10.0, options );
return benchmark;
function benchmark( b ) {
diff --git a/lib/node_modules/@stdlib/stats/base/svariancepn/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/stats/base/svariancepn/benchmark/benchmark.native.js
index bad48227d3e2..40ed11862ad8 100644
--- a/lib/node_modules/@stdlib/stats/base/svariancepn/benchmark/benchmark.native.js
+++ b/lib/node_modules/@stdlib/stats/base/svariancepn/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 Float32Array = require( '@stdlib/array/float32' );
var tryRequire = require( '@stdlib/utils/try-require' );
var pkg = require( './../package.json' ).name;
@@ -36,6 +35,9 @@ var svariancepn = tryRequire( resolve( __dirname, './../lib/svariancepn.native.j
var opts = {
'skip': ( svariancepn instanceof Error )
};
+var options = {
+ 'dtype': 'float32'
+};
// FUNCTIONS //
@@ -48,13 +50,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++ ) {
- x[ i ] = ( randu()*20.0 ) - 10.0;
- }
+ var x = uniform( len, -10.0, 10.0, options );
return benchmark;
function benchmark( b ) {
diff --git a/lib/node_modules/@stdlib/stats/base/svariancepn/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/stats/base/svariancepn/benchmark/benchmark.ndarray.js
index 0a5d757c475b..6ac8e147cd6d 100644
--- a/lib/node_modules/@stdlib/stats/base/svariancepn/benchmark/benchmark.ndarray.js
+++ b/lib/node_modules/@stdlib/stats/base/svariancepn/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 Float32Array = require( '@stdlib/array/float32' );
var pkg = require( './../package.json' ).name;
var svariancepn = require( './../lib/ndarray.js' );
+// VARIABLES //
+
+var options = {
+ 'dtype': 'float32'
+};
+
+
// FUNCTIONS //
/**
@@ -39,13 +45,7 @@ var svariancepn = 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++ ) {
- x[ i ] = ( randu()*20.0 ) - 10.0;
- }
+ var x = uniform( len, -10.0, 10.0, options );
return benchmark;
function benchmark( b ) {
diff --git a/lib/node_modules/@stdlib/stats/base/svariancepn/benchmark/benchmark.ndarray.native.js b/lib/node_modules/@stdlib/stats/base/svariancepn/benchmark/benchmark.ndarray.native.js
index 070ff97e6345..8d8b769a0d5e 100644
--- a/lib/node_modules/@stdlib/stats/base/svariancepn/benchmark/benchmark.ndarray.native.js
+++ b/lib/node_modules/@stdlib/stats/base/svariancepn/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 Float32Array = require( '@stdlib/array/float32' );
var tryRequire = require( '@stdlib/utils/try-require' );
var pkg = require( './../package.json' ).name;
@@ -36,6 +35,9 @@ var svariancepn = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' )
var opts = {
'skip': ( svariancepn instanceof Error )
};
+var options = {
+ 'dtype': 'float32'
+};
// FUNCTIONS //
@@ -48,13 +50,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++ ) {
- x[ i ] = ( randu()*20.0 ) - 10.0;
- }
+ var x = uniform( len, -10.0, 10.0, options );
return benchmark;
function benchmark( b ) {
diff --git a/lib/node_modules/@stdlib/stats/base/svariancepn/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/stats/base/svariancepn/benchmark/c/benchmark.length.c
index af1192fab34d..22117461d90c 100644
--- a/lib/node_modules/@stdlib/stats/base/svariancepn/benchmark/c/benchmark.length.c
+++ b/lib/node_modules/@stdlib/stats/base/svariancepn/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 ];
float v;
@@ -107,6 +107,7 @@ static double benchmark( int iterations, int len ) {
v = 0.0f;
t = tic();
for ( i = 0; i < iterations; i++ ) {
+ // cppcheck-suppress uninitvar
v = stdlib_strided_svariancepn( len, 1.0f, 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;
+ float x[ len ];
+ float v;
+ double t;
+ int i;
+
+ for ( i = 0; i < len; i++ ) {
+ x[ i ] = ( rand_float() * 20000.0f ) - 10000.0f;
+ }
+ v = 0.0f;
+ t = tic();
+ for ( i = 0; i < iterations; i++ ) {
+ // cppcheck-suppress uninitvar
+ v = stdlib_strided_svariancepn_ndarray( len, 1.0f, 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 +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; 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/svariancepn/docs/repl.txt b/lib/node_modules/@stdlib/stats/base/svariancepn/docs/repl.txt
index 2ca63a32cfcb..c41646ed7569 100644
--- a/lib/node_modules/@stdlib/stats/base/svariancepn/docs/repl.txt
+++ b/lib/node_modules/@stdlib/stats/base/svariancepn/docs/repl.txt
@@ -1,9 +1,9 @@
-{{alias}}( N, correction, x, stride )
+{{alias}}( N, correction, x, strideX )
Computes the variance of a single-precision floating-point strided array
using a two-pass algorithm.
- The `N` and `stride` parameters determine which elements in `x` are accessed
+ The `N` and stride parameters determine which elements in `x` are accessed
at runtime.
Indexing is relative to the first index. To introduce an offset, use a typed
@@ -31,8 +31,8 @@
x: Float32Array
Input array.
- stride: integer
- Index increment.
+ strideX: integer
+ Stride Length.
Returns
-------
@@ -46,22 +46,19 @@
> {{alias}}( x.length, 1, x, 1 )
~4.3333
- // Using `N` and `stride` parameters:
+ // Using `N` and stride parameters:
> x = new {{alias:@stdlib/array/float32}}( [ -2.0, 1.0, 1.0, -5.0, 2.0, -1.0 ] );
- > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 );
- > var stride = 2;
- > {{alias}}( N, 1, x, stride )
+ > {{alias}}( 3, 1, x, 2 )
~4.3333
// Using view offsets:
> var x0 = new {{alias:@stdlib/array/float32}}( [ 1.0, -2.0, 3.0, 2.0, 5.0, -1.0 ] );
> 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, 1, x1, stride )
+ > {{alias}}( 3, 1, x1, 2 )
~4.3333
-{{alias}}.ndarray( N, correction, x, stride, offset )
+
+{{alias}}.ndarray( N, correction, x, strideX, offsetX )
Computes the variance of a single-precision floating-point strided array
using a two-pass algorithm and alternative indexing semantics.
@@ -89,10 +86,10 @@
x: Float32Array
Input array.
- stride: integer
- Index increment.
+ strideX: integer
+ Stride Length.
- offset: integer
+ offsetX: integer
Starting index.
Returns
@@ -109,8 +106,7 @@
// Using offset parameter:
> var x = new {{alias:@stdlib/array/float32}}( [ 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, x, 2, 1 )
+ > {{alias}}.ndarray( 3, 1, x, 2, 1 )
~4.3333
See Also
diff --git a/lib/node_modules/@stdlib/stats/base/svariancepn/docs/types/index.d.ts b/lib/node_modules/@stdlib/stats/base/svariancepn/docs/types/index.d.ts
index b0e50d931b5d..f8e1149f7003 100644
--- a/lib/node_modules/@stdlib/stats/base/svariancepn/docs/types/index.d.ts
+++ b/lib/node_modules/@stdlib/stats/base/svariancepn/docs/types/index.d.ts
@@ -28,7 +28,7 @@ interface Routine {
* @param N - number of indexed elements
* @param correction - degrees of freedom adjustment
* @param x - input array
- * @param stride - stride length
+ * @param strideX - stride length
* @returns variance
*
* @example
@@ -39,7 +39,7 @@ interface Routine {
* var v = svariancepn( x.length, 1, x, 1 );
* // returns ~4.3333
*/
- ( N: number, correction: number, x: Float32Array, stride: number ): number;
+ ( N: number, correction: number, x: Float32Array, strideX: number ): number;
/**
* Computes the variance of a single-precision floating-point strided array using a two-pass algorithm and alternative indexing semantics.
@@ -47,8 +47,8 @@ interface Routine {
* @param N - number of indexed elements
* @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
@@ -59,7 +59,7 @@ interface Routine {
* var v = svariancepn.ndarray( x.length, 1, x, 1, 0 );
* // returns ~4.3333
*/
- ndarray( N: number, correction: number, x: Float32Array, stride: number, offset: number ): number;
+ ndarray( N: number, correction: number, x: Float32Array, strideX: number, offsetX: number ): number;
}
/**
@@ -68,7 +68,7 @@ interface Routine {
* @param N - number of indexed elements
* @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/svariancepn/examples/c/example.c b/lib/node_modules/@stdlib/stats/base/svariancepn/examples/c/example.c
index 39eaa2c3f994..914cd990de0a 100644
--- a/lib/node_modules/@stdlib/stats/base/svariancepn/examples/c/example.c
+++ b/lib/node_modules/@stdlib/stats/base/svariancepn/examples/c/example.c
@@ -17,21 +17,20 @@
*/
#include "stdlib/stats/base/svariancepn.h"
-#include
#include
int main( void ) {
// Create a strided array:
- float x[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 };
+ const float 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:
- float v = stdlib_strided_svariancepn( N, 1.0f, x, stride );
+ float v = stdlib_strided_svariancepn( N, 1.0f, x, strideX );
// Print the result:
printf( "sample variance: %f\n", v );
diff --git a/lib/node_modules/@stdlib/stats/base/svariancepn/include/stdlib/stats/base/svariancepn.h b/lib/node_modules/@stdlib/stats/base/svariancepn/include/stdlib/stats/base/svariancepn.h
index fa4b71bebe1b..87d3a0cd486e 100644
--- a/lib/node_modules/@stdlib/stats/base/svariancepn/include/stdlib/stats/base/svariancepn.h
+++ b/lib/node_modules/@stdlib/stats/base/svariancepn/include/stdlib/stats/base/svariancepn.h
@@ -19,7 +19,7 @@
#ifndef STDLIB_STATS_BASE_SVARIANCEPN_H
#define STDLIB_STATS_BASE_SVARIANCEPN_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 variance of a single-precision floating-point strided array using a two-pass algorithm.
*/
-float stdlib_strided_svariancepn( const int64_t N, const float correction, const float *X, const int64_t stride );
+float API_SUFFIX(stdlib_strided_svariancepn)( const CBLAS_INT N, const float correction, const float *X, const CBLAS_INT strideX );
+
+/**
+* Computes the variance of a single-precision floating-point strided array using a two-pass algorithm and alternative indexing semantics.
+*/
+float API_SUFFIX(stdlib_strided_svariancepn_ndarray)( const CBLAS_INT N, const float correction, const float *X, const CBLAS_INT strideX, const CBLAS_INT offsetX );
#ifdef __cplusplus
}
diff --git a/lib/node_modules/@stdlib/stats/base/svariancepn/lib/index.js b/lib/node_modules/@stdlib/stats/base/svariancepn/lib/index.js
index 9b17a7459f44..418411708508 100644
--- a/lib/node_modules/@stdlib/stats/base/svariancepn/lib/index.js
+++ b/lib/node_modules/@stdlib/stats/base/svariancepn/lib/index.js
@@ -28,20 +28,17 @@
* var svariancepn = require( '@stdlib/stats/base/svariancepn' );
*
* var x = new Float32Array( [ 1.0, -2.0, 2.0 ] );
-* var N = x.length;
*
-* var v = svariancepn( N, 1, x, 1 );
+* var v = svariancepn( x.length, 1, x, 1 );
* // returns ~4.3333
*
* @example
* var Float32Array = require( '@stdlib/array/float32' );
-* var floor = require( '@stdlib/math/base/special/floor' );
* var svariancepn = require( '@stdlib/stats/base/svariancepn' );
*
* var x = new Float32Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] );
-* var N = floor( x.length / 2 );
*
-* var v = svariancepn.ndarray( N, 1, x, 2, 1 );
+* var v = svariancepn.ndarray( 4, 1, x, 2, 1 );
* // returns 6.25
*/
diff --git a/lib/node_modules/@stdlib/stats/base/svariancepn/lib/ndarray.js b/lib/node_modules/@stdlib/stats/base/svariancepn/lib/ndarray.js
index c8097ff0afea..cdae0833bce1 100644
--- a/lib/node_modules/@stdlib/stats/base/svariancepn/lib/ndarray.js
+++ b/lib/node_modules/@stdlib/stats/base/svariancepn/lib/ndarray.js
@@ -41,21 +41,19 @@ var ssumpw = require( '@stdlib/blas/ext/base/ssumpw' ).ndarray;
* @param {PositiveInteger} N - number of indexed elements
* @param {number} correction - degrees of freedom adjustment
* @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} variance
*
* @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 ] );
-* var N = floor( x.length / 2 );
*
-* var v = svariancepn( N, 1, x, 2, 1 );
+* var v = svariancepn( 4, 1, x, 2, 1 );
* // returns 6.25
*/
-function svariancepn( N, correction, x, stride, offset ) {
+function svariancepn( N, correction, x, strideX, offsetX ) {
var mu;
var ix;
var M2;
@@ -68,21 +66,21 @@ function svariancepn( N, 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;
}
// Compute an estimate for the mean:
- mu = ssumpw( N, x, stride, offset ) / N;
+ mu = ssumpw( N, x, strideX, offsetX ) / N;
// Compute the variance...
- ix = offset;
+ ix = offsetX;
M2 = 0.0;
M = 0.0;
for ( i = 0; i < N; i++ ) {
d = float64ToFloat32( x[ ix ] - mu );
M2 = float64ToFloat32( M2 + float64ToFloat32( d*d ) );
M = float64ToFloat32( M + d );
- ix += stride;
+ ix += strideX;
}
return float64ToFloat32( float64ToFloat32(M2/n) - float64ToFloat32( float64ToFloat32(M/N)*float64ToFloat32(M/n) ) ); // eslint-disable-line max-len
}
diff --git a/lib/node_modules/@stdlib/stats/base/svariancepn/lib/ndarray.native.js b/lib/node_modules/@stdlib/stats/base/svariancepn/lib/ndarray.native.js
index 1631b9584f4e..2a5e12c6ab28 100644
--- a/lib/node_modules/@stdlib/stats/base/svariancepn/lib/ndarray.native.js
+++ b/lib/node_modules/@stdlib/stats/base/svariancepn/lib/ndarray.native.js
@@ -20,8 +20,7 @@
// MODULES //
-var Float32Array = require( '@stdlib/array/float32' );
-var addon = require( './svariancepn.native.js' );
+var addon = require( './../src/addon.node' );
// MAIN //
@@ -32,27 +31,20 @@ var addon = require( './svariancepn.native.js' );
* @param {PositiveInteger} N - number of indexed elements
* @param {number} correction - degrees of freedom adjustment
* @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} variance
*
* @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 ] );
-* var N = floor( x.length / 2 );
*
-* var v = svariancepn( N, 1, x, 2, 1 );
+* var v = svariancepn( 4, 1, x, 2, 1 );
* // returns 6.25
*/
-function svariancepn( N, correction, 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, correction, view, stride );
+function svariancepn( N, correction, x, strideX, offsetX ) {
+ return addon.ndarray( N, correction, x, strideX, offsetX );
}
diff --git a/lib/node_modules/@stdlib/stats/base/svariancepn/lib/svariancepn.js b/lib/node_modules/@stdlib/stats/base/svariancepn/lib/svariancepn.js
index a9d624cb43e6..9dc701d6a695 100644
--- a/lib/node_modules/@stdlib/stats/base/svariancepn/lib/svariancepn.js
+++ b/lib/node_modules/@stdlib/stats/base/svariancepn/lib/svariancepn.js
@@ -20,8 +20,8 @@
// MODULES //
-var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' );
-var ssumpw = require( '@stdlib/blas/ext/base/ssumpw' );
+var stride2offset = require( '@stdlib/strided/base/stride2offset' );
+var ndarray = require( './ndarray.js' );
// MAIN //
@@ -41,52 +41,19 @@ var ssumpw = require( '@stdlib/blas/ext/base/ssumpw' );
* @param {PositiveInteger} N - number of indexed elements
* @param {number} correction - degrees of freedom adjustment
* @param {Float32Array} x - input array
-* @param {integer} stride - stride length
+* @param {integer} strideX - stride length
* @returns {number} variance
*
* @example
* var Float32Array = require( '@stdlib/array/float32' );
*
* var x = new Float32Array( [ 1.0, -2.0, 2.0 ] );
-* var N = x.length;
*
-* var v = svariancepn( N, 1, x, 1 );
+* var v = svariancepn( x.length, 1, x, 1 );
* // returns ~4.3333
*/
-function svariancepn( N, correction, x, stride ) {
- var mu;
- 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;
- }
- // Compute an estimate for the mean:
- mu = ssumpw( N, x, stride ) / N;
-
- if ( stride < 0 ) {
- ix = (1-N) * stride;
- } else {
- ix = 0;
- }
- // Compute the variance...
- M2 = 0.0;
- M = 0.0;
- for ( i = 0; i < N; i++ ) {
- d = float64ToFloat32( x[ ix ] - mu );
- M2 = float64ToFloat32( M2 + float64ToFloat32( d*d ) );
- M = float64ToFloat32( M + d );
- ix += stride;
- }
- return float64ToFloat32( float64ToFloat32(M2/n) - float64ToFloat32( float64ToFloat32(M/N)*float64ToFloat32(M/n) ) ); // eslint-disable-line max-len
+function svariancepn( N, correction, x, strideX ) {
+ return ndarray( N, correction, x, strideX, stride2offset( N, strideX ) );
}
diff --git a/lib/node_modules/@stdlib/stats/base/svariancepn/lib/svariancepn.native.js b/lib/node_modules/@stdlib/stats/base/svariancepn/lib/svariancepn.native.js
index 58a659822846..322060ad8281 100644
--- a/lib/node_modules/@stdlib/stats/base/svariancepn/lib/svariancepn.native.js
+++ b/lib/node_modules/@stdlib/stats/base/svariancepn/lib/svariancepn.native.js
@@ -31,20 +31,19 @@ var addon = require( './../src/addon.node' );
* @param {PositiveInteger} N - number of indexed elements
* @param {number} correction - degrees of freedom adjustment
* @param {Float32Array} x - input array
-* @param {integer} stride - stride length
+* @param {integer} strideX - stride length
* @returns {number} variance
*
* @example
* var Float32Array = require( '@stdlib/array/float32' );
*
* var x = new Float32Array( [ 1.0, -2.0, 2.0 ] );
-* var N = x.length;
*
-* var v = svariancepn( N, 1, x, 1 );
+* var v = svariancepn( x.length, 1, x, 1 );
* // returns ~4.3333
*/
-function svariancepn( N, correction, x, stride ) {
- return addon( N, correction, x, stride );
+function svariancepn( N, correction, x, strideX ) {
+ return addon( N, correction, x, strideX );
}
diff --git a/lib/node_modules/@stdlib/stats/base/svariancepn/manifest.json b/lib/node_modules/@stdlib/stats/base/svariancepn/manifest.json
index db085fcaf21e..2c1e2f926560 100644
--- a/lib/node_modules/@stdlib/stats/base/svariancepn/manifest.json
+++ b/lib/node_modules/@stdlib/stats/base/svariancepn/manifest.json
@@ -1,6 +1,7 @@
{
"options": {
- "task": "build"
+ "task": "build",
+ "wasm": false
},
"fields": [
{
@@ -26,19 +27,20 @@
],
"confs": [
{
- "task": "build",
+ "task": "build",
+ "wasm": false,
"src": [
- "./src/svariancepn.c"
+ "./src/main.c"
],
"include": [
"./include"
],
- "libraries": [
- "-lm"
- ],
+ "libraries": [],
"libpath": [],
"dependencies": [
"@stdlib/blas/ext/base/ssumpw",
+ "@stdlib/blas/base/shared",
+ "@stdlib/strided/base/stride2offset",
"@stdlib/napi/export",
"@stdlib/napi/argv",
"@stdlib/napi/argv-int64",
@@ -49,34 +51,53 @@
},
{
"task": "benchmark",
+ "wasm": false,
"src": [
- "./src/svariancepn.c"
+ "./src/main.c"
],
"include": [
"./include"
],
- "libraries": [
- "-lm"
- ],
+ "libraries": [],
"libpath": [],
"dependencies": [
- "@stdlib/blas/ext/base/ssumpw"
+ "@stdlib/blas/ext/base/ssumpw",
+ "@stdlib/blas/base/shared",
+ "@stdlib/strided/base/stride2offset"
]
},
{
"task": "examples",
+ "wasm": false,
"src": [
- "./src/svariancepn.c"
+ "./src/main.c"
],
"include": [
"./include"
],
- "libraries": [
- "-lm"
+ "libraries": [],
+ "libpath": [],
+ "dependencies": [
+ "@stdlib/blas/ext/base/ssumpw",
+ "@stdlib/blas/base/shared",
+ "@stdlib/strided/base/stride2offset"
+ ]
+ },
+ {
+ "task": "",
+ "wasm": true,
+ "src": [
+ "./src/main.c"
+ ],
+ "include": [
+ "./include"
],
+ "libraries": [],
"libpath": [],
"dependencies": [
- "@stdlib/blas/ext/base/ssumpw"
+ "@stdlib/blas/ext/base/ssumpw",
+ "@stdlib/blas/base/shared",
+ "@stdlib/strided/base/stride2offset"
]
}
]
diff --git a/lib/node_modules/@stdlib/stats/base/svariancepn/src/addon.c b/lib/node_modules/@stdlib/stats/base/svariancepn/src/addon.c
index ed906ffb9196..052b650eb331 100644
--- a/lib/node_modules/@stdlib/stats/base/svariancepn/src/addon.c
+++ b/lib/node_modules/@stdlib/stats/base/svariancepn/src/addon.c
@@ -17,6 +17,7 @@
*/
#include "stdlib/stats/base/svariancepn.h"
+#include "stdlib/blas/base/shared.h"
#include "stdlib/napi/export.h"
#include "stdlib/napi/argv.h"
#include "stdlib/napi/argv_int64.h"
@@ -36,10 +37,28 @@ static napi_value addon( 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_FLOAT( env, correction, argv, 1 );
- STDLIB_NAPI_ARGV_INT64( env, stride, argv, 3 );
- STDLIB_NAPI_ARGV_STRIDED_FLOAT32ARRAY( env, X, N, stride, argv, 2 )
- STDLIB_NAPI_CREATE_DOUBLE( env, (double)stdlib_strided_svariancepn( N, correction, X, stride ), v );
+ STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 3 );
+ STDLIB_NAPI_ARGV_STRIDED_FLOAT32ARRAY( env, X, N, strideX, argv, 2 )
+ STDLIB_NAPI_CREATE_DOUBLE( env, (double)API_SUFFIX(stdlib_strided_svariancepn)( N, 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, 5 );
+ STDLIB_NAPI_ARGV_INT64( env, N, argv, 0 );
+ STDLIB_NAPI_ARGV_FLOAT( env, correction, argv, 1 );
+ STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 3 );
+ STDLIB_NAPI_ARGV_STRIDED_FLOAT32ARRAY( env, X, N, strideX, argv, 2 );
+ STDLIB_NAPI_ARGV_INT64( env, offsetX, argv, 4 );
+ STDLIB_NAPI_CREATE_DOUBLE( env, (double)API_SUFFIX(stdlib_strided_svariancepn_ndarray)( N, 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/svariancepn/src/svariancepn.c b/lib/node_modules/@stdlib/stats/base/svariancepn/src/main.c
similarity index 64%
rename from lib/node_modules/@stdlib/stats/base/svariancepn/src/svariancepn.c
rename to lib/node_modules/@stdlib/stats/base/svariancepn/src/main.c
index 7ba421b37f50..758e48bcf37e 100644
--- a/lib/node_modules/@stdlib/stats/base/svariancepn/src/svariancepn.c
+++ b/lib/node_modules/@stdlib/stats/base/svariancepn/src/main.c
@@ -1,7 +1,7 @@
/**
* @license Apache-2.0
*
-* Copyright (c) 2020 The Stdlib Authors.
+* Copyright (c) 2025 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.
@@ -18,7 +18,8 @@
#include "stdlib/stats/base/svariancepn.h"
#include "stdlib/blas/ext/base/ssumpw.h"
-#include
+#include "stdlib/blas/base/shared.h"
+#include "stdlib/strided/base/stride2offset.h"
/**
* Computes the variance of a single-precision floating-point strided array using a two-pass algorithm.
@@ -35,12 +36,27 @@
* @param N number of indexed elements
* @param correction degrees of freedom adjustment
* @param X input array
-* @param stride stride length
+* @param strideX stride length
* @return output value
*/
-float stdlib_strided_svariancepn( const int64_t N, const float correction, const float *X, const int64_t stride ) {
- int64_t ix;
- int64_t i;
+float API_SUFFIX(stdlib_strided_svariancepn)( const CBLAS_INT N, const float correction, const float *X, const CBLAS_INT strideX ) {
+ const CBLAS_INT ox = stdlib_strided_stride2offset( N, strideX );
+ return API_SUFFIX(stdlib_strided_svariancepn_ndarray)( N, correction, X, strideX, ox );
+}
+
+/**
+* Computes the variance of a single-precision floating-point strided array using a two-pass algorithm and alternative indexing semantics.
+*
+* @param N number of indexed elements
+* @param correction degrees of freedom adjustment
+* @param X input array
+* @param strideX stride length
+* @param offsetX starting index for X
+* @return output value
+*/
+float API_SUFFIX(stdlib_strided_svariancepn_ndarray)( const CBLAS_INT N, const float correction, const float *X, const CBLAS_INT strideX, const CBLAS_INT offsetX ) {
+ CBLAS_INT ix;
+ CBLAS_INT i;
double dN;
double n;
float mu;
@@ -53,17 +69,14 @@ float stdlib_strided_svariancepn( const int64_t N, const float correction, const
if ( N <= 0 || n <= 0.0f ) {
return 0.0f / 0.0f; // NaN
}
- if ( N == 1 || stride == 0 ) {
+ if ( N == 1 || strideX == 0 ) {
return 0.0f;
}
// Compute an estimate for the mean:
- mu = (double)stdlib_strided_ssumpw( N, X, stride ) / dN;
+ mu = (double)API_SUFFIX(stdlib_strided_ssumpw_ndarray)( N, X, strideX, offsetX ) / dN;
+
+ ix = offsetX;
- if ( stride < 0 ) {
- ix = (1-N) * stride;
- } else {
- ix = 0;
- }
// Compute the variance...
M2 = 0.0f;
M = 0.0f;
@@ -71,7 +84,7 @@ float stdlib_strided_svariancepn( const int64_t N, const float correction, const
d = X[ ix ] - mu;
M2 += d * d;
M += d;
- ix += stride;
+ ix += strideX;
}
return (float)((double)M2/n) - ( (float)((double)M/dN) * (float)((double)M/n) );
}
diff --git a/lib/node_modules/@stdlib/stats/base/svariancepn/test/test.ndarray.js b/lib/node_modules/@stdlib/stats/base/svariancepn/test/test.ndarray.js
index fff5d5192092..761d1a72f833 100644
--- a/lib/node_modules/@stdlib/stats/base/svariancepn/test/test.ndarray.js
+++ b/lib/node_modules/@stdlib/stats/base/svariancepn/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 float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' );
var Float32Array = require( '@stdlib/array/float32' );
@@ -122,7 +121,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;
@@ -137,15 +135,13 @@ tape( 'the function supports a `stride` parameter', function test( t ) {
2.0
]);
- N = floor( x.length / 2 );
- v = svariancepn( N, 1, x, 2, 0 );
+ v = svariancepn( 4, 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;
@@ -160,8 +156,7 @@ tape( 'the function supports a negative `stride` parameter', function test( t )
2.0
]);
- N = floor( x.length / 2 );
- v = svariancepn( N, 1, x, -2, 6 );
+ v = svariancepn( 4, 1, x, -2, 6 );
t.strictEqual( v, 6.25, 'returns expected value' );
t.end();
@@ -180,7 +175,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;
@@ -194,9 +188,8 @@ tape( 'the function supports an `offset` parameter', function test( t ) {
3.0,
4.0 // 3
]);
- N = floor( x.length / 2 );
- v = svariancepn( N, 1, x, 2, 1 );
+ v = svariancepn( 4, 1, x, 2, 1 );
t.strictEqual( v, 6.25, 'returns expected value' );
t.end();
diff --git a/lib/node_modules/@stdlib/stats/base/svariancepn/test/test.ndarray.native.js b/lib/node_modules/@stdlib/stats/base/svariancepn/test/test.ndarray.native.js
index 23a2258a429d..071119c39781 100644
--- a/lib/node_modules/@stdlib/stats/base/svariancepn/test/test.ndarray.native.js
+++ b/lib/node_modules/@stdlib/stats/base/svariancepn/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 float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' );
var Float32Array = require( '@stdlib/array/float32' );
@@ -131,7 +130,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;
@@ -146,15 +144,13 @@ tape( 'the function supports a `stride` parameter', opts, function test( t ) {
2.0
]);
- N = floor( x.length / 2 );
- v = svariancepn( N, 1, x, 2, 0 );
+ v = svariancepn( 4, 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;
@@ -169,8 +165,7 @@ tape( 'the function supports a negative `stride` parameter', opts, function test
2.0
]);
- N = floor( x.length / 2 );
- v = svariancepn( N, 1, x, -2, 6 );
+ v = svariancepn( 4, 1, x, -2, 6 );
t.strictEqual( v, 6.25, 'returns expected value' );
t.end();
@@ -189,7 +184,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;
@@ -203,9 +197,8 @@ tape( 'the function supports an `offset` parameter', opts, function test( t ) {
3.0,
4.0 // 3
]);
- N = floor( x.length / 2 );
- v = svariancepn( N, 1, x, 2, 1 );
+ v = svariancepn( 4, 1, x, 2, 1 );
t.strictEqual( v, 6.25, 'returns expected value' );
t.end();
diff --git a/lib/node_modules/@stdlib/stats/base/svariancepn/test/test.svariancepn.js b/lib/node_modules/@stdlib/stats/base/svariancepn/test/test.svariancepn.js
index 480320f1598c..5440fa2661e4 100644
--- a/lib/node_modules/@stdlib/stats/base/svariancepn/test/test.svariancepn.js
+++ b/lib/node_modules/@stdlib/stats/base/svariancepn/test/test.svariancepn.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 float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' );
var Float32Array = require( '@stdlib/array/float32' );
@@ -122,7 +121,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;
@@ -137,15 +135,13 @@ tape( 'the function supports a `stride` parameter', function test( t ) {
2.0
]);
- N = floor( x.length / 2 );
- v = svariancepn( N, 1, x, 2 );
+ v = svariancepn( 4, 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;
@@ -160,8 +156,7 @@ tape( 'the function supports a negative `stride` parameter', function test( t )
2.0
]);
- N = floor( x.length / 2 );
- v = svariancepn( N, 1, x, -2 );
+ v = svariancepn( 4, 1, x, -2 );
t.strictEqual( v, 6.25, 'returns expected value' );
t.end();
@@ -182,7 +177,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 Float32Array([
@@ -198,9 +192,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 = svariancepn( N, 1, x1, 2 );
+ v = svariancepn( 4, 1, x1, 2 );
t.strictEqual( v, 6.25, 'returns expected value' );
t.end();
diff --git a/lib/node_modules/@stdlib/stats/base/svariancepn/test/test.svariancepn.native.js b/lib/node_modules/@stdlib/stats/base/svariancepn/test/test.svariancepn.native.js
index 3158311cb021..078308abd5a3 100644
--- a/lib/node_modules/@stdlib/stats/base/svariancepn/test/test.svariancepn.native.js
+++ b/lib/node_modules/@stdlib/stats/base/svariancepn/test/test.svariancepn.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 float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' );
var Float32Array = require( '@stdlib/array/float32' );
@@ -131,7 +130,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;
@@ -146,15 +144,13 @@ tape( 'the function supports a `stride` parameter', opts, function test( t ) {
2.0
]);
- N = floor( x.length / 2 );
- v = svariancepn( N, 1, x, 2 );
+ v = svariancepn( 4, 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;
@@ -169,8 +165,7 @@ tape( 'the function supports a negative `stride` parameter', opts, function test
2.0
]);
- N = floor( x.length / 2 );
- v = svariancepn( N, 1, x, -2 );
+ v = svariancepn( 4, 1, x, -2 );
t.strictEqual( v, 6.25, 'returns expected value' );
t.end();
@@ -191,7 +186,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 Float32Array([
@@ -207,9 +201,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 = svariancepn( N, 1, x1, 2 );
+ v = svariancepn( 4, 1, x1, 2 );
t.strictEqual( v, 6.25, 'returns expected value' );
t.end();