From d3b0c0c5e8c0cf19bc0b5ec6c43bc6d7d7d065db Mon Sep 17 00:00:00 2001
From: JoyBoy <144602492+0PrashantYadav0@users.noreply.github.com>
Date: Fri, 10 Jan 2025 20:52:04 +0530
Subject: [PATCH 01/10] feat: add C ndarray interface and refactor
implementation
---
type: pre_push_report
description: Results of running various checks prior to pushing changes.
report:
- task: run_javascript_examples
status: na
- task: run_c_examples
status: na
- task: run_cpp_examples
status: na
- task: run_javascript_readme_examples
status: na
- task: run_c_benchmarks
status: na
- task: run_cpp_benchmarks
status: na
- task: run_fortran_benchmarks
status: na
- task: run_javascript_benchmarks
status: na
- task: run_julia_benchmarks
status: na
- task: run_python_benchmarks
status: na
- task: run_r_benchmarks
status: na
- task: run_javascript_tests
status: na
---
---
.../@stdlib/stats/base/dstdev/README.md | 171 ++++++++++++++----
.../stats/base/dstdev/benchmark/benchmark.js | 18 +-
.../base/dstdev/benchmark/benchmark.native.js | 14 +-
.../dstdev/benchmark/benchmark.ndarray.js | 18 +-
.../benchmark/benchmark.ndarray.native.js | 14 +-
.../dstdev/benchmark/c/benchmark.length.c | 50 ++++-
.../@stdlib/stats/base/dstdev/docs/repl.txt | 31 ++--
.../stats/base/dstdev/docs/types/index.d.ts | 12 +-
.../stats/base/dstdev/examples/c/example.c | 9 +-
.../stats/base/dstdev/examples/index.js | 14 +-
.../dstdev/include/stdlib/stats/base/dstdev.h | 9 +-
.../@stdlib/stats/base/dstdev/lib/dstdev.js | 13 +-
.../stats/base/dstdev/lib/dstdev.native.js | 10 +-
.../@stdlib/stats/base/dstdev/lib/index.js | 8 +-
.../@stdlib/stats/base/dstdev/lib/ndarray.js | 16 +-
.../stats/base/dstdev/lib/ndarray.native.js | 21 +--
.../@stdlib/stats/base/dstdev/manifest.json | 48 +++--
.../@stdlib/stats/base/dstdev/src/addon.c | 27 ++-
.../@stdlib/stats/base/dstdev/src/dstdev.c | 34 ----
.../@stdlib/stats/base/dstdev/src/main.c | 51 ++++++
.../stats/base/dstdev/test/test.dstdev.js | 13 +-
.../base/dstdev/test/test.dstdev.native.js | 13 +-
.../stats/base/dstdev/test/test.ndarray.js | 13 +-
.../base/dstdev/test/test.ndarray.native.js | 13 +-
24 files changed, 394 insertions(+), 246 deletions(-)
delete mode 100644 lib/node_modules/@stdlib/stats/base/dstdev/src/dstdev.c
create mode 100644 lib/node_modules/@stdlib/stats/base/dstdev/src/main.c
diff --git a/lib/node_modules/@stdlib/stats/base/dstdev/README.md b/lib/node_modules/@stdlib/stats/base/dstdev/README.md
index e0bf39b41633..da1d4fa7c1fb 100644
--- a/lib/node_modules/@stdlib/stats/base/dstdev/README.md
+++ b/lib/node_modules/@stdlib/stats/base/dstdev/README.md
@@ -98,7 +98,7 @@ The use of the term `n-1` is commonly referred to as Bessel's correction. Note,
var dstdev = require( '@stdlib/stats/base/dstdev' );
```
-#### dstdev( N, correction, x, stride )
+#### dstdev( N, correction, x, strideX )
Computes the [standard deviation][standard-deviation] of a double-precision floating-point strided array `x`.
@@ -106,9 +106,7 @@ Computes the [standard deviation][standard-deviation] of a double-precision floa
var Float64Array = require( '@stdlib/array/float64' );
var x = new Float64Array( [ 1.0, -2.0, 2.0 ] );
-var N = x.length;
-
-var v = dstdev( N, 1, x, 1 );
+var v = dstdev( x.length, 1, x, 1 );
// returns ~2.0817
```
@@ -117,19 +115,17 @@ 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 [standard deviation][standard-deviation] according to `N-c` where `c` corresponds to the provided degrees of freedom adjustment. When computing the [standard deviation][standard-deviation] 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 corrected sample [standard deviation][standard-deviation], 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**: stride length for `x`.
-The `N` and `stride` parameters determine which elements in `x` are accessed at runtime. For example, to compute the [standard deviation][standard-deviation] 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 [standard deviation][standard-deviation] of every other element in `x`,
```javascript
var Float64Array = require( '@stdlib/array/float64' );
-var floor = require( '@stdlib/math/base/special/floor' );
var x = new Float64Array( [ 1.0, 2.0, 2.0, -7.0, -2.0, 3.0, 4.0, 2.0 ] );
-var N = floor( x.length / 2 );
-var v = dstdev( N, 1, x, 2 );
-// returns 2.5
+var v = dstdev( 4, 1, x, 2 );
+// returns ~2.0817
```
Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views.
@@ -138,18 +134,15 @@ Note that indexing is relative to the first index. To introduce an offset, use [
```javascript
var Float64Array = require( '@stdlib/array/float64' );
-var floor = require( '@stdlib/math/base/special/floor' );
var x0 = new Float64Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] );
var x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
-var N = floor( x0.length / 2 );
-
-var v = dstdev( N, 1, x1, 2 );
-// returns 2.5
+var v = dstdev( 4, 1, x1, 2 );
+// returns ~2.0817
```
-#### dstdev.ndarray( N, correction, x, stride, offset )
+#### dstdev.ndarray( N, correction, x, strideX, offsetX )
Computes the [standard deviation][standard-deviation] of a double-precision floating-point strided array using alternative indexing semantics.
@@ -157,27 +150,24 @@ Computes the [standard deviation][standard-deviation] of a double-precision floa
var Float64Array = require( '@stdlib/array/float64' );
var x = new Float64Array( [ 1.0, -2.0, 2.0 ] );
-var N = x.length;
-var v = dstdev.ndarray( N, 1, x, 1, 0 );
+var v = dstdev.ndarray( x.length, 1, x, 1, 0 );
// returns ~2.0817
```
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 [standard deviation][standard-deviation] 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 [standard deviation][standard-deviation] for every other element in `x` starting from the second element
```javascript
var Float64Array = require( '@stdlib/array/float64' );
-var floor = require( '@stdlib/math/base/special/floor' );
var x = new Float64Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] );
-var N = floor( x.length / 2 );
-var v = dstdev.ndarray( N, 1, x, 2, 1 );
-// returns 2.5
+var v = dstdev.ndarray( 4, 1, x, 2, 1 );
+// returns ~2.0817
```
@@ -202,18 +192,12 @@ var v = dstdev.ndarray( N, 1, x, 2, 1 );
```javascript
-var randu = require( '@stdlib/random/base/randu' );
-var round = require( '@stdlib/math/base/special/round' );
-var Float64Array = require( '@stdlib/array/float64' );
+var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
var dstdev = require( '@stdlib/stats/base/dstdev' );
-var x;
-var i;
-
-x = new Float64Array( 10 );
-for ( i = 0; i < x.length; i++ ) {
- x[ i ] = round( (randu()*100.0) - 50.0 );
-}
+var x = discreteUniform( 10, -50, 50, {
+ 'dtype': 'float64'
+});
console.log( x );
var v = dstdev( x.length, 1, x, 1 );
@@ -224,6 +208,125 @@ console.log( v );
+
+
+* * *
+
+
+
+## C APIs
+
+
+
+
+
+
+
+
+
+
+
+### Usage
+
+```c
+#include "stdlib/stats/base/dstdev.h"
+```
+
+#### stdlib_strided_dstdev( N, correction, \*X, strideX )
+
+Computes the [standard deviation][standard-deviation] of a double-precision floating-point strided array `x`.
+
+```c
+const double x[] = { 1.0, -2.0, 2.0 };
+
+double v = stdlib_strided_dstdev( 3, 1.0, x, 1 );
+// returns ~2.0817
+```
+
+The function accepts the following arguments:
+
+- **N**: `[in] CBLAS_INT` number of indexed elements.
+- **correction**: `[in] double` 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 [standard deviation][standard-deviation] according to `N-c` where `c` corresponds to the provided degrees of freedom adjustment. When computing the [standard deviation][standard-deviation] 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 corrected sample [standard deviation][standard-deviation], 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] double*` input array.
+- **strideX**: `[in] CBLAS_INT` stride length for `X`.
+
+```c
+double stdlib_strided_dstdev( const CBLAS_INT N, const double correction, const double *X, const CBLAS_INT strideX );
+```
+
+#### stdlib_strided_dstdev_ndarray( N, correction, \*X, strideX, offsetX )
+
+Computes the [standard deviation][standard-deviation] of a double-precision floating-point strided array using alternative indexing semantics.
+
+```c
+const double x[] = { 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 };
+
+double v = stdlib_strided_dstdev_ndarray( 4, 1.0, x, 2, 1 );
+// returns ~2.0817
+```
+
+The function accepts the following arguments:
+
+- **N**: `[in] CBLAS_INT` number of indexed elements.
+- **correction**: `[in] double` 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 [standard deviation][standard-deviation] according to `N-c` where `c` corresponds to the provided degrees of freedom adjustment. When computing the [standard deviation][standard-deviation] 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 corrected sample [standard deviation][standard-deviation], 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] double*` input array.
+- **strideX**: `[in] CBLAS_INT` stride length for `X`.
+- **offsetX**: `[in] CBLAS_INT` starting index for `X`.
+
+```c
+double stdlib_strided_dstdev_ndarray( const CBLAS_INT N, const double correction, const double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX );
+```
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+### Examples
+
+```c
+#include "stdlib/stats/base/dstdev.h"
+#include
+
+int main( void ) {
+ // Create a strided array:
+ const double x[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 };
+
+ // Specify the number of elements:
+ const int N = 4;
+
+ // Specify the stride length:
+ const int strideX = 2;
+
+ // Compute the standard error of the mean:
+ double v = stdlib_strided_dstdev( N, 1.0, x, strideX );
+
+ // Print the result:
+ printf( "sample standard deviation: %lf\n", v );
+}
+```
+
+
+
+
+
+
+
+
+
diff --git a/lib/node_modules/@stdlib/stats/base/dstdev/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dstdev/benchmark/benchmark.js
index 8411e1b297bd..7b8857010a25 100644
--- a/lib/node_modules/@stdlib/stats/base/dstdev/benchmark/benchmark.js
+++ b/lib/node_modules/@stdlib/stats/base/dstdev/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 dstdev = require( './../lib/dstdev.js' );
+// VARIABLES //
+
+var options = {
+ 'dtype': 'float64'
+};
+
+
// FUNCTIONS //
/**
@@ -39,13 +45,7 @@ var dstdev = require( './../lib/dstdev.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, -10.0, 10.0, options );
return benchmark;
function benchmark( b ) {
diff --git a/lib/node_modules/@stdlib/stats/base/dstdev/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/stats/base/dstdev/benchmark/benchmark.native.js
index f9678e9fa786..7df223d0b8d6 100644
--- a/lib/node_modules/@stdlib/stats/base/dstdev/benchmark/benchmark.native.js
+++ b/lib/node_modules/@stdlib/stats/base/dstdev/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 dstdev = tryRequire( resolve( __dirname, './../lib/dstdev.native.js' ) );
var opts = {
'skip': ( dstdev 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, -10.0, 10.0, options );
return benchmark;
function benchmark( b ) {
diff --git a/lib/node_modules/@stdlib/stats/base/dstdev/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/stats/base/dstdev/benchmark/benchmark.ndarray.js
index 4184a3f9695b..c41a47e0dea4 100644
--- a/lib/node_modules/@stdlib/stats/base/dstdev/benchmark/benchmark.ndarray.js
+++ b/lib/node_modules/@stdlib/stats/base/dstdev/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 dstdev = require( './../lib/ndarray.js' );
+// VARIABLES //
+
+var options = {
+ 'dtype': 'float64'
+};
+
+
// FUNCTIONS //
/**
@@ -39,13 +45,7 @@ var dstdev = 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, -10.0, 10.0, options );
return benchmark;
function benchmark( b ) {
diff --git a/lib/node_modules/@stdlib/stats/base/dstdev/benchmark/benchmark.ndarray.native.js b/lib/node_modules/@stdlib/stats/base/dstdev/benchmark/benchmark.ndarray.native.js
index 498eedd0f332..8c33fe8aad60 100644
--- a/lib/node_modules/@stdlib/stats/base/dstdev/benchmark/benchmark.ndarray.native.js
+++ b/lib/node_modules/@stdlib/stats/base/dstdev/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 dstdev = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) );
var opts = {
'skip': ( dstdev 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, -10.0, 10.0, options );
return benchmark;
function benchmark( b ) {
diff --git a/lib/node_modules/@stdlib/stats/base/dstdev/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/stats/base/dstdev/benchmark/c/benchmark.length.c
index 97bcc89fb3df..9931627c83a8 100644
--- a/lib/node_modules/@stdlib/stats/base/dstdev/benchmark/c/benchmark.length.c
+++ b/lib/node_modules/@stdlib/stats/base/dstdev/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_dstdev( len, 1.0, 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 ];
+ double v;
+ double t;
+ int i;
+
+ for ( i = 0; i < len; i++ ) {
+ x[ i ] = ( rand_double() * 20000.0 ) - 10000.0;
+ }
+ v = 0.0;
+ t = tic();
+ for ( i = 0; i < iterations; i++ ) {
+ // cppcheck-suppress uninitvar
+ v = stdlib_strided_dstdev_ndarray( len, 1.0, 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/dstdev/docs/repl.txt b/lib/node_modules/@stdlib/stats/base/dstdev/docs/repl.txt
index 4b4da2655cb3..cb328940b8e4 100644
--- a/lib/node_modules/@stdlib/stats/base/dstdev/docs/repl.txt
+++ b/lib/node_modules/@stdlib/stats/base/dstdev/docs/repl.txt
@@ -1,10 +1,10 @@
-{{alias}}( N, correction, x, stride )
+{{alias}}( N, correction, x, strideX )
Computes the standard deviation of a double-precision floating-point strided
array.
- 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.
@@ -31,8 +31,8 @@
x: Float64Array
Input array.
- stride: integer
- Index increment.
+ strideX: integer
+ Stride Length.
Returns
-------
@@ -46,22 +46,18 @@
> {{alias}}( x.length, 1, x, 1 )
~2.0817
- // 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 );
- > var stride = 2;
- > {{alias}}( N, 1, x, stride )
+ > {{alias}}( 3, 1, x, 2 )
~2.0817
// 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 );
- > stride = 2;
- > {{alias}}( N, 1, x1, stride )
+ > {{alias}}( 3, 1, x1, 2 )
~2.0817
-{{alias}}.ndarray( N, correction, x, stride, offset )
+{{alias}}.ndarray( N, correction, x, strideX, offsetX )
Computes the standard deviation of a double-precision floating-point strided
array using alternative indexing semantics.
@@ -89,10 +85,10 @@
x: Float64Array
Input array.
- stride: integer
- Index increment.
+ strideX: integer
+ Stride Length.
- offset: integer
+ offsetX: integer
Starting index.
Returns
@@ -109,8 +105,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, x, 2, 1 )
+ > {{alias}}.ndarray( 3, 1, x, 2, 1 )
~2.0817
See Also
diff --git a/lib/node_modules/@stdlib/stats/base/dstdev/docs/types/index.d.ts b/lib/node_modules/@stdlib/stats/base/dstdev/docs/types/index.d.ts
index 444e1e439190..4b5d08af6978 100644
--- a/lib/node_modules/@stdlib/stats/base/dstdev/docs/types/index.d.ts
+++ b/lib/node_modules/@stdlib/stats/base/dstdev/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 standard deviation
*
* @example
@@ -39,7 +39,7 @@ interface Routine {
* var v = dstdev( x.length, 1, x, 1 );
* // returns ~2.0817
*/
- ( N: number, correction: number, x: Float64Array, stride: number ): number;
+ ( N: number, correction: number, x: Float64Array, strideX: number ): number;
/**
* Computes the standard deviation of a double-precision floating-point strided array using 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 standard deviation
*
* @example
@@ -59,7 +59,7 @@ interface Routine {
* var v = dstdev.ndarray( x.length, 1, x, 1, 0 );
* // returns ~2.0817
*/
- ndarray( N: number, correction: number, x: Float64Array, stride: number, offset: number ): number;
+ ndarray( N: number, correction: number, x: Float64Array, 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 standard deviation
*
* @example
diff --git a/lib/node_modules/@stdlib/stats/base/dstdev/examples/c/example.c b/lib/node_modules/@stdlib/stats/base/dstdev/examples/c/example.c
index db34a28ad079..ed59078861ed 100644
--- a/lib/node_modules/@stdlib/stats/base/dstdev/examples/c/example.c
+++ b/lib/node_modules/@stdlib/stats/base/dstdev/examples/c/example.c
@@ -17,21 +17,20 @@
*/
#include "stdlib/stats/base/dstdev.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.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 };
// 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 standard deviation:
- double v = stdlib_strided_dstdev( N, 1, x, stride );
+ double v = stdlib_strided_dsemwd( N, 1.0, x, strideX );
// Print the result:
printf( "sample standard deviation: %lf\n", v );
diff --git a/lib/node_modules/@stdlib/stats/base/dstdev/examples/index.js b/lib/node_modules/@stdlib/stats/base/dstdev/examples/index.js
index 81dc0e842d78..07c81d6d12dd 100644
--- a/lib/node_modules/@stdlib/stats/base/dstdev/examples/index.js
+++ b/lib/node_modules/@stdlib/stats/base/dstdev/examples/index.js
@@ -18,18 +18,12 @@
'use strict';
-var randu = require( '@stdlib/random/base/randu' );
-var round = require( '@stdlib/math/base/special/round' );
-var Float64Array = require( '@stdlib/array/float64' );
+var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
var dstdev = 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 x = discreteUniform( 10, -50, 50, {
+ 'dtype': 'float64'
+});
console.log( x );
var v = dstdev( x.length, 1, x, 1 );
diff --git a/lib/node_modules/@stdlib/stats/base/dstdev/include/stdlib/stats/base/dstdev.h b/lib/node_modules/@stdlib/stats/base/dstdev/include/stdlib/stats/base/dstdev.h
index e9125c97e502..9f6ab9e4029d 100644
--- a/lib/node_modules/@stdlib/stats/base/dstdev/include/stdlib/stats/base/dstdev.h
+++ b/lib/node_modules/@stdlib/stats/base/dstdev/include/stdlib/stats/base/dstdev.h
@@ -19,7 +19,7 @@
#ifndef STDLIB_STATS_BASE_DSTDEV_H
#define STDLIB_STATS_BASE_DSTDEV_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 standard deviation of a double-precision floating-point strided array.
*/
-double stdlib_strided_dstdev( const int64_t N, const double correction, const double *X, const int64_t stride );
+double API_SUFFIX(stdlib_strided_dsemwd)( const CBLAS_INT N, const double correction, const double *X, const CBLAS_INT strideX );
+
+/**
+* Computes the standard deviation of a double-precision floating-point strided array and alternative indexing semantics.
+*/
+double API_SUFFIX(stdlib_strided_dsemwd_ndarray)( const CBLAS_INT N, 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/dstdev/lib/dstdev.js b/lib/node_modules/@stdlib/stats/base/dstdev/lib/dstdev.js
index be94ae8d8b93..e93ae99a4dd8 100644
--- a/lib/node_modules/@stdlib/stats/base/dstdev/lib/dstdev.js
+++ b/lib/node_modules/@stdlib/stats/base/dstdev/lib/dstdev.js
@@ -20,7 +20,8 @@
// MODULES //
-var dstdevpn = require( '@stdlib/stats/base/dstdevpn' );
+var stride2offset = require( '@stdlib/strided/base/stride2offset' );
+var ndarray = require( './ndarray.js' );
// MAIN //
@@ -31,20 +32,18 @@ var dstdevpn = require( '@stdlib/stats/base/dstdevpn' );
* @param {PositiveInteger} N - number of indexed elements
* @param {number} correction - degrees of freedom adjustment
* @param {Float64Array} x - input array
-* @param {integer} stride - stride length
+* @param {integer} strideX - stride length
* @returns {number} standard deviation
*
* @example
* var Float64Array = require( '@stdlib/array/float64' );
*
* var x = new Float64Array( [ 1.0, -2.0, 2.0 ] );
-* var N = x.length;
-*
-* var v = dstdev( N, 1, x, 1 );
+* var v = dstdev( x.length, 1, x, 1 );
* // returns ~2.0817
*/
-function dstdev( N, correction, x, stride ) {
- return dstdevpn( N, correction, x, stride );
+function dstdev( N, correction, x, strideX ) {
+ return ndarray( N, correction, x, strideX, stride2offset( N, strideX ) );
}
diff --git a/lib/node_modules/@stdlib/stats/base/dstdev/lib/dstdev.native.js b/lib/node_modules/@stdlib/stats/base/dstdev/lib/dstdev.native.js
index 4267523630bd..dfc37a83ebf9 100644
--- a/lib/node_modules/@stdlib/stats/base/dstdev/lib/dstdev.native.js
+++ b/lib/node_modules/@stdlib/stats/base/dstdev/lib/dstdev.native.js
@@ -31,20 +31,18 @@ var addon = require( './../src/addon.node' );
* @param {PositiveInteger} N - number of indexed elements
* @param {number} correction - degrees of freedom adjustment
* @param {Float64Array} x - input array
-* @param {integer} stride - stride length
+* @param {integer} strideX - stride length
* @returns {number} standard deviation
*
* @example
* var Float64Array = require( '@stdlib/array/float64' );
*
* var x = new Float64Array( [ 1.0, -2.0, 2.0 ] );
-* var N = x.length;
-*
-* var v = dstdev( N, 1, x, 1 );
+* var v = dsemwd( x.length, 1, x, 1 );
* // returns ~2.0817
*/
-function dstdev( N, correction, x, stride ) {
- return addon( N, correction, x, stride );
+function dstdev( N, correction, x, strideX ) {
+ return addon( N, correction, x, strideX );
}
diff --git a/lib/node_modules/@stdlib/stats/base/dstdev/lib/index.js b/lib/node_modules/@stdlib/stats/base/dstdev/lib/index.js
index 8c34d09a54cb..1cebc01b07e9 100644
--- a/lib/node_modules/@stdlib/stats/base/dstdev/lib/index.js
+++ b/lib/node_modules/@stdlib/stats/base/dstdev/lib/index.js
@@ -28,9 +28,7 @@
* var dstdev = require( '@stdlib/stats/base/dstdev' );
*
* var x = new Float64Array( [ 1.0, -2.0, 2.0 ] );
-* var N = x.length;
-*
-* var v = dstdev( N, 1, x, 1 );
+* var v = dsemwd( x.length, 1, x, 1 );
* // returns ~2.0817
*
* @example
@@ -39,9 +37,7 @@
* var dstdev = require( '@stdlib/stats/base/dstdev' );
*
* 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 = dstdev.ndarray( N, 1, x, 2, 1 );
+* var v = dsemwd.ndarray( 4, 1, x, 2, 1 );
* // returns 2.5
*/
diff --git a/lib/node_modules/@stdlib/stats/base/dstdev/lib/ndarray.js b/lib/node_modules/@stdlib/stats/base/dstdev/lib/ndarray.js
index 465890f7346f..59223bda73c5 100644
--- a/lib/node_modules/@stdlib/stats/base/dstdev/lib/ndarray.js
+++ b/lib/node_modules/@stdlib/stats/base/dstdev/lib/ndarray.js
@@ -20,7 +20,8 @@
// MODULES //
-var dstdevpn = require( '@stdlib/stats/base/dstdevpn' ).ndarray;
+var dvariancewd = require( '@stdlib/stats/base/dvariancewd' ).ndarray;
+var sqrt = require( '@stdlib/math/base/special/sqrt' );
// MAIN //
@@ -31,22 +32,19 @@ var dstdevpn = require( '@stdlib/stats/base/dstdevpn' ).ndarray;
* @param {PositiveInteger} N - number of indexed elements
* @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} standard deviation
*
* @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 = dstdev( N, 1, x, 2, 1 );
+* var v = dsemwd( 4, 1, x, 2, 1 );
* // returns 2.5
*/
-function dstdev( N, correction, x, stride, offset ) {
- return dstdevpn( N, correction, x, stride, offset );
+function dstdev( N, correction, x, strideX, offsetX ) {
+ return sqrt( dvariancewd( N, correction, x, strideX, offsetX ) / N );
}
diff --git a/lib/node_modules/@stdlib/stats/base/dstdev/lib/ndarray.native.js b/lib/node_modules/@stdlib/stats/base/dstdev/lib/ndarray.native.js
index 6dc6cbc08525..226e37292fe9 100644
--- a/lib/node_modules/@stdlib/stats/base/dstdev/lib/ndarray.native.js
+++ b/lib/node_modules/@stdlib/stats/base/dstdev/lib/ndarray.native.js
@@ -20,8 +20,7 @@
// MODULES //
-var Float64Array = require( '@stdlib/array/float64' );
-var addon = require( './dstdev.native.js' );
+var addon = require( './../src/addon.node' );
// MAIN //
@@ -32,27 +31,19 @@ var addon = require( './dstdev.native.js' );
* @param {PositiveInteger} N - number of indexed elements
* @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} standard deviation
*
* @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 = dstdev( N, 1, x, 2, 1 );
+* var v = dsemwd( 4, 1, x, 2, 1 );
* // returns 2.5
*/
-function dstdev( N, 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, correction, view, stride );
+function dstdev( N, correction, x, strideX, offsetX ) {
+ return addon.ndarray( N, correction, x, strideX, offsetX );
}
diff --git a/lib/node_modules/@stdlib/stats/base/dstdev/manifest.json b/lib/node_modules/@stdlib/stats/base/dstdev/manifest.json
index 6df92389b446..8ebb2cc13806 100644
--- a/lib/node_modules/@stdlib/stats/base/dstdev/manifest.json
+++ b/lib/node_modules/@stdlib/stats/base/dstdev/manifest.json
@@ -1,6 +1,7 @@
{
"options": {
- "task": "build"
+ "task": "build",
+ "wasm": false
},
"fields": [
{
@@ -27,17 +28,19 @@
"confs": [
{
"task": "build",
+ "wasm": false,
"src": [
- "./src/dstdev.c"
+ "./src/main.c"
],
"include": [
"./include"
],
- "libraries": [
- "-lm"
- ],
+ "libraries": [],
"libpath": [],
"dependencies": [
+ "@stdlib/blas/base/shared",
+ "@stdlib/strided/base/stride2offset",
+ "@stdlib/math/base/special/sqrt",
"@stdlib/stats/base/dstdevpn",
"@stdlib/napi/export",
"@stdlib/napi/argv",
@@ -50,32 +53,53 @@
{
"task": "benchmark",
"src": [
- "./src/dstdev.c"
+ "./src/main.c"
],
"include": [
"./include"
],
- "libraries": [
- "-lm"
- ],
+ "libraries": [],
"libpath": [],
"dependencies": [
+ "@stdlib/blas/base/shared",
+ "@stdlib/strided/base/stride2offset",
+ "@stdlib/math/base/special/sqrt",
"@stdlib/stats/base/dstdevpn"
]
},
{
"task": "examples",
+ "wasm": false,
"src": [
- "./src/dstdev.c"
+ "./src/main.c"
],
"include": [
"./include"
],
- "libraries": [
- "-lm"
+ "libraries": [],
+ "libpath": [],
+ "dependencies": [
+ "@stdlib/blas/base/shared",
+ "@stdlib/strided/base/stride2offset",
+ "@stdlib/math/base/special/sqrt",
+ "@stdlib/stats/base/dvariancewd"
+ ]
+ },
+ {
+ "task": "",
+ "wasm": true,
+ "src": [
+ "./src/main.c"
+ ],
+ "include": [
+ "./include"
],
+ "libraries": [],
"libpath": [],
"dependencies": [
+ "@stdlib/blas/base/shared",
+ "@stdlib/strided/base/stride2offset",
+ "@stdlib/math/base/special/sqrt",
"@stdlib/stats/base/dstdevpn"
]
}
diff --git a/lib/node_modules/@stdlib/stats/base/dstdev/src/addon.c b/lib/node_modules/@stdlib/stats/base/dstdev/src/addon.c
index ee9ac37d3edc..bdec3e4b8f34 100644
--- a/lib/node_modules/@stdlib/stats/base/dstdev/src/addon.c
+++ b/lib/node_modules/@stdlib/stats/base/dstdev/src/addon.c
@@ -17,6 +17,7 @@
*/
#include "stdlib/stats/base/dstdev.h"
+#include "stdlib/blas/base/shared.h"
#include "stdlib/napi/export.h"
#include "stdlib/napi/argv.h"
#include "stdlib/napi/argv_int64.h"
@@ -35,11 +36,29 @@
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_INT64( env, stride, argv, 3 );
STDLIB_NAPI_ARGV_DOUBLE( env, correction, argv, 1 );
- STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, X, N, stride, argv, 2 );
- STDLIB_NAPI_CREATE_DOUBLE( env, stdlib_strided_dstdev( N, correction, X, stride ), v );
+ STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 3 );
+ STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, X, N, strideX, argv, 2 )
+ STDLIB_NAPI_CREATE_DOUBLE( env, API_SUFFIX(stdlib_strided_dstdev)( 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_DOUBLE( env, correction, argv, 1 );
+ STDLIB_NAPI_ARGV_INT64( env, strideX, argv, 3 );
+ STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, X, N, strideX, argv, 2 );
+ STDLIB_NAPI_ARGV_INT64( env, offsetX, argv, 4 );
+ STDLIB_NAPI_CREATE_DOUBLE( env, API_SUFFIX(stdlib_strided_dstdev_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/dstdev/src/dstdev.c b/lib/node_modules/@stdlib/stats/base/dstdev/src/dstdev.c
deleted file mode 100644
index bbc7c4169348..000000000000
--- a/lib/node_modules/@stdlib/stats/base/dstdev/src/dstdev.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
-* @license Apache-2.0
-*
-* Copyright (c) 2020 The Stdlib Authors.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-#include "stdlib/stats/base/dstdev.h"
-#include "stdlib/stats/base/dstdevpn.h"
-#include
-
-/**
-* Computes the standard deviation of a double-precision floating-point strided array.
-*
-* @param N number of indexed elements
-* @param correction degrees of freedom adjustment
-* @param X input array
-* @param stride stride length
-* @return output value
-*/
-double stdlib_strided_dstdev( const int64_t N, const double correction, const double *X, const int64_t stride ) {
- return stdlib_strided_dstdevpn( N, correction, X, stride );
-}
diff --git a/lib/node_modules/@stdlib/stats/base/dstdev/src/main.c b/lib/node_modules/@stdlib/stats/base/dstdev/src/main.c
new file mode 100644
index 000000000000..eb61c701b762
--- /dev/null
+++ b/lib/node_modules/@stdlib/stats/base/dstdev/src/main.c
@@ -0,0 +1,51 @@
+/**
+* @license Apache-2.0
+*
+* 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.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+#include "stdlib/stats/base/dstdev.h"
+#include "stdlib/stats/base/dvariancewd.h"
+#include "stdlib/blas/base/shared.h"
+#include "stdlib/strided/base/stride2offset.h"
+#include "stdlib/math/base/special/sqrt.h"
+
+/**
+* Computes the standard error of the mean for a double-precision floating-point strided array using Welford's algorithm.
+*
+* @param N number of indexed elements
+* @param correction degrees of freedom adjustment
+* @param X input array
+* @param strideX stride length
+* @return output value
+*/
+double API_SUFFIX(stdlib_strided_dstdev)( const CBLAS_INT N, const double correction, const double *X, const CBLAS_INT strideX ) {
+ const CBLAS_INT ox = stdlib_strided_stride2offset( N, strideX );
+ return API_SUFFIX(stdlib_strided_dstdev_ndarray)( N, correction, X, strideX, ox );
+}
+
+/**
+* Computes the standard error of the mean for a double-precision floating-point strided array using Welford's 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
+*/
+double API_SUFFIX(stdlib_strided_dstdev_ndarray)( const CBLAS_INT N, const double correction, const double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX ) {
+ return stdlib_base_sqrt( API_SUFFIX(stdlib_strided_dvariancewd_ndarray)( N, correction, X, strideX, offsetX ) / (double)N );
+}
diff --git a/lib/node_modules/@stdlib/stats/base/dstdev/test/test.dstdev.js b/lib/node_modules/@stdlib/stats/base/dstdev/test/test.dstdev.js
index ae33ce841256..0e4ddad9d8e9 100644
--- a/lib/node_modules/@stdlib/stats/base/dstdev/test/test.dstdev.js
+++ b/lib/node_modules/@stdlib/stats/base/dstdev/test/test.dstdev.js
@@ -21,7 +21,6 @@
// MODULES //
var tape = require( 'tape' );
-var floor = require( '@stdlib/math/base/special/floor' );
var sqrt = require( '@stdlib/math/base/special/sqrt' );
var isnan = require( '@stdlib/math/base/assert/is-nan' );
var Float64Array = require( '@stdlib/array/float64' );
@@ -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 = dstdev( N, 1, x, 2 );
+ v = dstdev( 4, 1, x, 2 );
t.strictEqual( v, 2.5, '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 = dstdev( N, 1, x, -2 );
+ v = dstdev( 4, 1, x, -2 );
t.strictEqual( v, 2.5, '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 Float64Array([
@@ -198,9 +192,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 = dstdev( N, 1, x1, 2 );
+ v = dstdev( 4, 1, x1, 2 );
t.strictEqual( v, 2.5, 'returns expected value' );
t.end();
diff --git a/lib/node_modules/@stdlib/stats/base/dstdev/test/test.dstdev.native.js b/lib/node_modules/@stdlib/stats/base/dstdev/test/test.dstdev.native.js
index bc566cc0c03a..df6d77f156d3 100644
--- a/lib/node_modules/@stdlib/stats/base/dstdev/test/test.dstdev.native.js
+++ b/lib/node_modules/@stdlib/stats/base/dstdev/test/test.dstdev.native.js
@@ -22,7 +22,6 @@
var resolve = require( 'path' ).resolve;
var tape = require( 'tape' );
-var floor = require( '@stdlib/math/base/special/floor' );
var sqrt = require( '@stdlib/math/base/special/sqrt' );
var isnan = require( '@stdlib/math/base/assert/is-nan' );
var Float64Array = require( '@stdlib/array/float64' );
@@ -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 = dstdev( N, 1, x, 2 );
+ v = dstdev( 4, 1, x, 2 );
t.strictEqual( v, 2.5, '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 = dstdev( N, 1, x, -2 );
+ v = dstdev( 4, 1, x, -2 );
t.strictEqual( v, 2.5, '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 Float64Array([
@@ -207,9 +201,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 = dstdev( N, 1, x1, 2 );
+ v = dstdev( 4, 1, x1, 2 );
t.strictEqual( v, 2.5, 'returns expected value' );
t.end();
diff --git a/lib/node_modules/@stdlib/stats/base/dstdev/test/test.ndarray.js b/lib/node_modules/@stdlib/stats/base/dstdev/test/test.ndarray.js
index 7148a305bbf5..015842e012b7 100644
--- a/lib/node_modules/@stdlib/stats/base/dstdev/test/test.ndarray.js
+++ b/lib/node_modules/@stdlib/stats/base/dstdev/test/test.ndarray.js
@@ -21,7 +21,6 @@
// MODULES //
var tape = require( 'tape' );
-var floor = require( '@stdlib/math/base/special/floor' );
var sqrt = require( '@stdlib/math/base/special/sqrt' );
var isnan = require( '@stdlib/math/base/assert/is-nan' );
var Float64Array = require( '@stdlib/array/float64' );
@@ -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 = dstdev( N, 1, x, 2, 0 );
+ v = dstdev( 4, 1, x, 2, 0 );
t.strictEqual( v, 2.5, '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 = dstdev( N, 1, x, -2, 6 );
+ v = dstdev( 4, 1, x, -2, 6 );
t.strictEqual( v, 2.5, '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 = dstdev( N, 1, x, 2, 1 );
+ v = dstdev( 4, 1, x, 2, 1 );
t.strictEqual( v, 2.5, 'returns expected value' );
t.end();
diff --git a/lib/node_modules/@stdlib/stats/base/dstdev/test/test.ndarray.native.js b/lib/node_modules/@stdlib/stats/base/dstdev/test/test.ndarray.native.js
index d78eb4d26588..1c514f599b28 100644
--- a/lib/node_modules/@stdlib/stats/base/dstdev/test/test.ndarray.native.js
+++ b/lib/node_modules/@stdlib/stats/base/dstdev/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 sqrt = require( '@stdlib/math/base/special/sqrt' );
var isnan = require( '@stdlib/math/base/assert/is-nan' );
var Float64Array = require( '@stdlib/array/float64' );
@@ -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 = dstdev( N, 1, x, 2, 0 );
+ v = dstdev( 4, 1, x, 2, 0 );
t.strictEqual( v, 2.5, '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 = dstdev( N, 1, x, -2, 6 );
+ v = dstdev( 4, 1, x, -2, 6 );
t.strictEqual( v, 2.5, '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 = dstdev( N, 1, x, 2, 1 );
+ v = dstdev( 4, 1, x, 2, 1 );
t.strictEqual( v, 2.5, 'returns expected value' );
t.end();
From 3404629391977029ac05c159efd44cc51f855ce3 Mon Sep 17 00:00:00 2001
From: JoyBoy <144602492+0PrashantYadav0@users.noreply.github.com>
Date: Fri, 10 Jan 2025 22:14:21 +0530
Subject: [PATCH 02/10] chore: updated main.c file
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
- task: lint_filenames
status: passed
- task: lint_editorconfig
status: passed
- task: lint_markdown
status: na
- task: lint_package_json
status: na
- task: lint_repl_help
status: na
- task: lint_javascript_src
status: na
- task: lint_javascript_cli
status: na
- task: lint_javascript_examples
status: na
- task: lint_javascript_tests
status: na
- task: lint_javascript_benchmarks
status: na
- task: lint_python
status: na
- task: lint_r
status: na
- task: lint_c_src
status: passed
- task: lint_c_examples
status: na
- task: lint_c_benchmarks
status: na
- task: lint_c_tests_fixtures
status: na
- task: lint_shell
status: na
- task: lint_typescript_declarations
status: na
- task: lint_typescript_tests
status: na
- task: lint_license_headers
status: passed
---
---
type: pre_push_report
description: Results of running various checks prior to pushing changes.
report:
- task: run_javascript_examples
status: na
- task: run_c_examples
status: na
- task: run_cpp_examples
status: na
- task: run_javascript_readme_examples
status: na
- task: run_c_benchmarks
status: na
- task: run_cpp_benchmarks
status: na
- task: run_fortran_benchmarks
status: na
- task: run_javascript_benchmarks
status: na
- task: run_julia_benchmarks
status: na
- task: run_python_benchmarks
status: na
- task: run_r_benchmarks
status: na
- task: run_javascript_tests
status: na
---
---
.../stats/base/dstdev/include/stdlib/stats/base/dstdev.h | 4 ++--
lib/node_modules/@stdlib/stats/base/dstdev/manifest.json | 3 ---
lib/node_modules/@stdlib/stats/base/dstdev/src/main.c | 9 ++++-----
3 files changed, 6 insertions(+), 10 deletions(-)
diff --git a/lib/node_modules/@stdlib/stats/base/dstdev/include/stdlib/stats/base/dstdev.h b/lib/node_modules/@stdlib/stats/base/dstdev/include/stdlib/stats/base/dstdev.h
index 9f6ab9e4029d..7bd2acc63c5a 100644
--- a/lib/node_modules/@stdlib/stats/base/dstdev/include/stdlib/stats/base/dstdev.h
+++ b/lib/node_modules/@stdlib/stats/base/dstdev/include/stdlib/stats/base/dstdev.h
@@ -31,12 +31,12 @@ extern "C" {
/**
* Computes the standard deviation of a double-precision floating-point strided array.
*/
-double API_SUFFIX(stdlib_strided_dsemwd)( const CBLAS_INT N, const double correction, const double *X, const CBLAS_INT strideX );
+double API_SUFFIX(stdlib_strided_dstdev)( const CBLAS_INT N, const double correction, const double *X, const CBLAS_INT strideX );
/**
* Computes the standard deviation of a double-precision floating-point strided array and alternative indexing semantics.
*/
-double API_SUFFIX(stdlib_strided_dsemwd_ndarray)( const CBLAS_INT N, const double correction, const double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX );
+double API_SUFFIX(stdlib_strided_dstdev_ndarray)( const CBLAS_INT N, 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/dstdev/manifest.json b/lib/node_modules/@stdlib/stats/base/dstdev/manifest.json
index 8ebb2cc13806..65e5374b8f16 100644
--- a/lib/node_modules/@stdlib/stats/base/dstdev/manifest.json
+++ b/lib/node_modules/@stdlib/stats/base/dstdev/manifest.json
@@ -63,7 +63,6 @@
"dependencies": [
"@stdlib/blas/base/shared",
"@stdlib/strided/base/stride2offset",
- "@stdlib/math/base/special/sqrt",
"@stdlib/stats/base/dstdevpn"
]
},
@@ -81,7 +80,6 @@
"dependencies": [
"@stdlib/blas/base/shared",
"@stdlib/strided/base/stride2offset",
- "@stdlib/math/base/special/sqrt",
"@stdlib/stats/base/dvariancewd"
]
},
@@ -99,7 +97,6 @@
"dependencies": [
"@stdlib/blas/base/shared",
"@stdlib/strided/base/stride2offset",
- "@stdlib/math/base/special/sqrt",
"@stdlib/stats/base/dstdevpn"
]
}
diff --git a/lib/node_modules/@stdlib/stats/base/dstdev/src/main.c b/lib/node_modules/@stdlib/stats/base/dstdev/src/main.c
index eb61c701b762..9ccdebc4ca21 100644
--- a/lib/node_modules/@stdlib/stats/base/dstdev/src/main.c
+++ b/lib/node_modules/@stdlib/stats/base/dstdev/src/main.c
@@ -17,13 +17,12 @@
*/
#include "stdlib/stats/base/dstdev.h"
-#include "stdlib/stats/base/dvariancewd.h"
+#include "stdlib/stats/base/dstdevpn.h"
#include "stdlib/blas/base/shared.h"
#include "stdlib/strided/base/stride2offset.h"
-#include "stdlib/math/base/special/sqrt.h"
/**
-* Computes the standard error of the mean for a double-precision floating-point strided array using Welford's algorithm.
+* Computes the standard deviation of a double-precision floating-point strided array.
*
* @param N number of indexed elements
* @param correction degrees of freedom adjustment
@@ -37,7 +36,7 @@ double API_SUFFIX(stdlib_strided_dstdev)( const CBLAS_INT N, const double correc
}
/**
-* Computes the standard error of the mean for a double-precision floating-point strided array using Welford's algorithm and alternative indexing semantics.
+* Computes the standard deviation of a double-precision floating-point strided array and alternative indexing semantics.
*
* @param N number of indexed elements
* @param correction degrees of freedom adjustment
@@ -47,5 +46,5 @@ double API_SUFFIX(stdlib_strided_dstdev)( const CBLAS_INT N, const double correc
* @return output value
*/
double API_SUFFIX(stdlib_strided_dstdev_ndarray)( const CBLAS_INT N, const double correction, const double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX ) {
- return stdlib_base_sqrt( API_SUFFIX(stdlib_strided_dvariancewd_ndarray)( N, correction, X, strideX, offsetX ) / (double)N );
+ return API_SUFFIX(stdlib_strided_dstdevpn_ndarray)( N, correction, X, strideX, offsetX );
}
From 013679cd98a955437906265d337387ad88274008 Mon Sep 17 00:00:00 2001
From: JoyBoy <144602492+0PrashantYadav0@users.noreply.github.com>
Date: Sun, 12 Jan 2025 23:16:32 +0530
Subject: [PATCH 03/10] fix: changes return values
---
lib/node_modules/@stdlib/stats/base/dstdev/README.md | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/lib/node_modules/@stdlib/stats/base/dstdev/README.md b/lib/node_modules/@stdlib/stats/base/dstdev/README.md
index da1d4fa7c1fb..195de0c7a644 100644
--- a/lib/node_modules/@stdlib/stats/base/dstdev/README.md
+++ b/lib/node_modules/@stdlib/stats/base/dstdev/README.md
@@ -125,7 +125,7 @@ var Float64Array = require( '@stdlib/array/float64' );
var x = new Float64Array( [ 1.0, 2.0, 2.0, -7.0, -2.0, 3.0, 4.0, 2.0 ] );
var v = dstdev( 4, 1, x, 2 );
-// returns ~2.0817
+// returns 2.5
```
Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views.
@@ -139,7 +139,7 @@ var x0 = new Float64Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] );
var x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
var v = dstdev( 4, 1, x1, 2 );
-// returns ~2.0817
+// returns 2.5
```
#### dstdev.ndarray( N, correction, x, strideX, offsetX )
@@ -167,7 +167,7 @@ var Float64Array = require( '@stdlib/array/float64' );
var x = new Float64Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] );
var v = dstdev.ndarray( 4, 1, x, 2, 1 );
-// returns ~2.0817
+// returns 2.5
```
@@ -242,7 +242,7 @@ Computes the [standard deviation][standard-deviation] of a double-precision floa
const double x[] = { 1.0, -2.0, 2.0 };
double v = stdlib_strided_dstdev( 3, 1.0, x, 1 );
-// returns ~2.0817
+// returns 2.5
```
The function accepts the following arguments:
@@ -264,7 +264,7 @@ Computes the [standard deviation][standard-deviation] of a double-precision floa
const double x[] = { 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 };
double v = stdlib_strided_dstdev_ndarray( 4, 1.0, x, 2, 1 );
-// returns ~2.0817
+// returns 2.5
```
The function accepts the following arguments:
From a24ec0a2a01b8cedb4882140274c3c2500a9ed35 Mon Sep 17 00:00:00 2001
From: JoyBoy <144602492+0PrashantYadav0@users.noreply.github.com>
Date: Sun, 12 Jan 2025 23:16:32 +0530
Subject: [PATCH 04/10] fix: changes return values
---
type: pre_push_report
description: Results of running various checks prior to pushing changes.
report:
---
---
lib/node_modules/@stdlib/stats/base/dstdev/examples/c/example.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/node_modules/@stdlib/stats/base/dstdev/examples/c/example.c b/lib/node_modules/@stdlib/stats/base/dstdev/examples/c/example.c
index ed59078861ed..7462d88050da 100644
--- a/lib/node_modules/@stdlib/stats/base/dstdev/examples/c/example.c
+++ b/lib/node_modules/@stdlib/stats/base/dstdev/examples/c/example.c
@@ -30,7 +30,7 @@ int main( void ) {
const int strideX = 2;
// Compute the standard deviation:
- double v = stdlib_strided_dsemwd( N, 1.0, x, strideX );
+ double v = stdlib_strided_dstdev( N, 1.0, x, strideX );
// Print the result:
printf( "sample standard deviation: %lf\n", v );
From 9ee99822a01cf4f63d6ae1a21ceae1144d3ce97d Mon Sep 17 00:00:00 2001
From: JoyBoy <144602492+0PrashantYadav0@users.noreply.github.com>
Date: Fri, 14 Mar 2025 17:16:48 +0530
Subject: [PATCH 05/10] chore: minor changes
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
- task: lint_filenames
status: passed
- task: lint_editorconfig
status: passed
- task: lint_markdown
status: na
- task: lint_package_json
status: na
- task: lint_repl_help
status: na
- task: lint_javascript_src
status: na
- task: lint_javascript_cli
status: na
- task: lint_javascript_examples
status: na
- task: lint_javascript_tests
status: na
- task: lint_javascript_benchmarks
status: na
- task: lint_python
status: na
- task: lint_r
status: na
- task: lint_c_src
status: na
- task: lint_c_examples
status: na
- task: lint_c_benchmarks
status: na
- task: lint_c_tests_fixtures
status: na
- task: lint_shell
status: na
- task: lint_typescript_declarations
status: na
- task: lint_typescript_tests
status: na
- task: lint_license_headers
status: passed
---
---
lib/node_modules/@stdlib/stats/base/dstdev/manifest.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/node_modules/@stdlib/stats/base/dstdev/manifest.json b/lib/node_modules/@stdlib/stats/base/dstdev/manifest.json
index 65e5374b8f16..ca0c2f0a2c4c 100644
--- a/lib/node_modules/@stdlib/stats/base/dstdev/manifest.json
+++ b/lib/node_modules/@stdlib/stats/base/dstdev/manifest.json
@@ -84,7 +84,7 @@
]
},
{
- "task": "",
+ "task": "build",
"wasm": true,
"src": [
"./src/main.c"
From a93f70b189383ebbaf31a422fd53b7f8d0dbf065 Mon Sep 17 00:00:00 2001
From: JoyBoy <144602492+0PrashantYadav0@users.noreply.github.com>
Date: Sat, 15 Mar 2025 21:33:31 +0530
Subject: [PATCH 06/10] fix: fix lint error and import statements
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
- task: lint_filenames
status: passed
- task: lint_editorconfig
status: passed
- task: lint_markdown
status: na
- task: lint_package_json
status: na
- task: lint_repl_help
status: passed
- task: lint_javascript_src
status: passed
- task: lint_javascript_cli
status: na
- task: lint_javascript_examples
status: na
- task: lint_javascript_tests
status: na
- task: lint_javascript_benchmarks
status: na
- task: lint_python
status: na
- task: lint_r
status: na
- task: lint_c_src
status: na
- task: lint_c_examples
status: na
- task: lint_c_benchmarks
status: na
- task: lint_c_tests_fixtures
status: na
- task: lint_shell
status: na
- task: lint_typescript_declarations
status: na
- task: lint_typescript_tests
status: na
- task: lint_license_headers
status: passed
---
---
lib/node_modules/@stdlib/stats/base/dstdev/docs/repl.txt | 5 +++--
.../@stdlib/stats/base/dstdev/lib/dstdev.native.js | 2 +-
lib/node_modules/@stdlib/stats/base/dstdev/lib/index.js | 4 ++--
lib/node_modules/@stdlib/stats/base/dstdev/lib/ndarray.js | 7 +++----
.../@stdlib/stats/base/dstdev/lib/ndarray.native.js | 2 +-
lib/node_modules/@stdlib/stats/base/dstdev/manifest.json | 2 +-
6 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/lib/node_modules/@stdlib/stats/base/dstdev/docs/repl.txt b/lib/node_modules/@stdlib/stats/base/dstdev/docs/repl.txt
index cb328940b8e4..fed672b511bc 100644
--- a/lib/node_modules/@stdlib/stats/base/dstdev/docs/repl.txt
+++ b/lib/node_modules/@stdlib/stats/base/dstdev/docs/repl.txt
@@ -32,7 +32,7 @@
Input array.
strideX: integer
- Stride Length.
+ Stride length.
Returns
-------
@@ -57,6 +57,7 @@
> {{alias}}( 3, 1, x1, 2 )
~2.0817
+
{{alias}}.ndarray( N, correction, x, strideX, offsetX )
Computes the standard deviation of a double-precision floating-point strided
array using alternative indexing semantics.
@@ -86,7 +87,7 @@
Input array.
strideX: integer
- Stride Length.
+ Stride length.
offsetX: integer
Starting index.
diff --git a/lib/node_modules/@stdlib/stats/base/dstdev/lib/dstdev.native.js b/lib/node_modules/@stdlib/stats/base/dstdev/lib/dstdev.native.js
index dfc37a83ebf9..bb1a1621a589 100644
--- a/lib/node_modules/@stdlib/stats/base/dstdev/lib/dstdev.native.js
+++ b/lib/node_modules/@stdlib/stats/base/dstdev/lib/dstdev.native.js
@@ -38,7 +38,7 @@ var addon = require( './../src/addon.node' );
* var Float64Array = require( '@stdlib/array/float64' );
*
* var x = new Float64Array( [ 1.0, -2.0, 2.0 ] );
-* var v = dsemwd( x.length, 1, x, 1 );
+* var v = dstdev( x.length, 1, x, 1 );
* // returns ~2.0817
*/
function dstdev( N, correction, x, strideX ) {
diff --git a/lib/node_modules/@stdlib/stats/base/dstdev/lib/index.js b/lib/node_modules/@stdlib/stats/base/dstdev/lib/index.js
index 1cebc01b07e9..f451521aa6fc 100644
--- a/lib/node_modules/@stdlib/stats/base/dstdev/lib/index.js
+++ b/lib/node_modules/@stdlib/stats/base/dstdev/lib/index.js
@@ -28,7 +28,7 @@
* var dstdev = require( '@stdlib/stats/base/dstdev' );
*
* var x = new Float64Array( [ 1.0, -2.0, 2.0 ] );
-* var v = dsemwd( x.length, 1, x, 1 );
+* var v = dstdev( x.length, 1, x, 1 );
* // returns ~2.0817
*
* @example
@@ -37,7 +37,7 @@
* var dstdev = require( '@stdlib/stats/base/dstdev' );
*
* var x = new Float64Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] );
-* var v = dsemwd.ndarray( 4, 1, x, 2, 1 );
+* var v = dstdev.ndarray( 4, 1, x, 2, 1 );
* // returns 2.5
*/
diff --git a/lib/node_modules/@stdlib/stats/base/dstdev/lib/ndarray.js b/lib/node_modules/@stdlib/stats/base/dstdev/lib/ndarray.js
index 59223bda73c5..86ac533f5ad5 100644
--- a/lib/node_modules/@stdlib/stats/base/dstdev/lib/ndarray.js
+++ b/lib/node_modules/@stdlib/stats/base/dstdev/lib/ndarray.js
@@ -20,8 +20,7 @@
// MODULES //
-var dvariancewd = require( '@stdlib/stats/base/dvariancewd' ).ndarray;
-var sqrt = require( '@stdlib/math/base/special/sqrt' );
+var dstdevpn = require( '@stdlib/stats/base/dstdevpn' ).ndarray;
// MAIN //
@@ -40,11 +39,11 @@ var sqrt = require( '@stdlib/math/base/special/sqrt' );
* var Float64Array = require( '@stdlib/array/float64' );
*
* var x = new Float64Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] );
-* var v = dsemwd( 4, 1, x, 2, 1 );
+* var v = dstdev( 4, 1, x, 2, 1 );
* // returns 2.5
*/
function dstdev( N, correction, x, strideX, offsetX ) {
- return sqrt( dvariancewd( N, correction, x, strideX, offsetX ) / N );
+ return dstdevpn( N, correction, x, strideX, offsetX );
}
diff --git a/lib/node_modules/@stdlib/stats/base/dstdev/lib/ndarray.native.js b/lib/node_modules/@stdlib/stats/base/dstdev/lib/ndarray.native.js
index 226e37292fe9..3d7e3eb7604b 100644
--- a/lib/node_modules/@stdlib/stats/base/dstdev/lib/ndarray.native.js
+++ b/lib/node_modules/@stdlib/stats/base/dstdev/lib/ndarray.native.js
@@ -39,7 +39,7 @@ var addon = require( './../src/addon.node' );
* var Float64Array = require( '@stdlib/array/float64' );
*
* var x = new Float64Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] );
-* var v = dsemwd( 4, 1, x, 2, 1 );
+* var v = dstdev( 4, 1, x, 2, 1 );
* // returns 2.5
*/
function dstdev( N, correction, x, strideX, offsetX ) {
diff --git a/lib/node_modules/@stdlib/stats/base/dstdev/manifest.json b/lib/node_modules/@stdlib/stats/base/dstdev/manifest.json
index ca0c2f0a2c4c..e3a1b9c5a345 100644
--- a/lib/node_modules/@stdlib/stats/base/dstdev/manifest.json
+++ b/lib/node_modules/@stdlib/stats/base/dstdev/manifest.json
@@ -80,7 +80,7 @@
"dependencies": [
"@stdlib/blas/base/shared",
"@stdlib/strided/base/stride2offset",
- "@stdlib/stats/base/dvariancewd"
+ "@stdlib/stats/base/dstdevpn"
]
},
{
From 1ea690134acc98811b6abe289a6248268c5f287e Mon Sep 17 00:00:00 2001
From: Athan
Date: Sun, 16 Mar 2025 02:28:17 -0700
Subject: [PATCH 07/10] docs: update description
Signed-off-by: Athan
---
lib/node_modules/@stdlib/stats/base/dstdev/README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/node_modules/@stdlib/stats/base/dstdev/README.md b/lib/node_modules/@stdlib/stats/base/dstdev/README.md
index 195de0c7a644..aab01111804b 100644
--- a/lib/node_modules/@stdlib/stats/base/dstdev/README.md
+++ b/lib/node_modules/@stdlib/stats/base/dstdev/README.md
@@ -100,7 +100,7 @@ var dstdev = require( '@stdlib/stats/base/dstdev' );
#### dstdev( N, correction, x, strideX )
-Computes the [standard deviation][standard-deviation] of a double-precision floating-point strided array `x`.
+Computes the [standard deviation][standard-deviation] of a double-precision floating-point strided array.
```javascript
var Float64Array = require( '@stdlib/array/float64' );
From 6095259c236cda5a3150738907ade54933982c44 Mon Sep 17 00:00:00 2001
From: Athan
Date: Sun, 16 Mar 2025 02:29:30 -0700
Subject: [PATCH 08/10] docs: update copy
Signed-off-by: Athan
---
lib/node_modules/@stdlib/stats/base/dstdev/README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/node_modules/@stdlib/stats/base/dstdev/README.md b/lib/node_modules/@stdlib/stats/base/dstdev/README.md
index aab01111804b..51996d972e8b 100644
--- a/lib/node_modules/@stdlib/stats/base/dstdev/README.md
+++ b/lib/node_modules/@stdlib/stats/base/dstdev/README.md
@@ -159,7 +159,7 @@ The function has the following additional parameters:
- **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 [standard deviation][standard-deviation] 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 [standard deviation][standard-deviation] for every other element in `x` starting from the second element
```javascript
var Float64Array = require( '@stdlib/array/float64' );
From 8d6b61bb40f0e96104f04e0ef01cf50c51023498 Mon Sep 17 00:00:00 2001
From: Athan
Date: Sun, 16 Mar 2025 02:30:19 -0700
Subject: [PATCH 09/10] docs: update description
Signed-off-by: Athan
---
lib/node_modules/@stdlib/stats/base/dstdev/README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/node_modules/@stdlib/stats/base/dstdev/README.md b/lib/node_modules/@stdlib/stats/base/dstdev/README.md
index 51996d972e8b..b59992769822 100644
--- a/lib/node_modules/@stdlib/stats/base/dstdev/README.md
+++ b/lib/node_modules/@stdlib/stats/base/dstdev/README.md
@@ -236,7 +236,7 @@ console.log( v );
#### stdlib_strided_dstdev( N, correction, \*X, strideX )
-Computes the [standard deviation][standard-deviation] of a double-precision floating-point strided array `x`.
+Computes the [standard deviation][standard-deviation] of a double-precision floating-point strided array.
```c
const double x[] = { 1.0, -2.0, 2.0 };
From 175d6f7476666741a80cb574a08423b782f2c8f1 Mon Sep 17 00:00:00 2001
From: JoyBoy <144602492+0PrashantYadav0@users.noreply.github.com>
Date: Sun, 16 Mar 2025 19:43:41 +0530
Subject: [PATCH 10/10] chore: changes as per code review
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
- task: lint_filenames
status: passed
- task: lint_editorconfig
status: passed
- task: lint_markdown
status: passed
- task: lint_package_json
status: na
- task: lint_repl_help
status: na
- task: lint_javascript_src
status: passed
- task: lint_javascript_cli
status: na
- task: lint_javascript_examples
status: na
- task: lint_javascript_tests
status: na
- task: lint_javascript_benchmarks
status: na
- task: lint_python
status: na
- task: lint_r
status: na
- task: lint_c_src
status: na
- task: lint_c_examples
status: na
- task: lint_c_benchmarks
status: na
- task: lint_c_tests_fixtures
status: na
- task: lint_shell
status: na
- task: lint_typescript_declarations
status: na
- task: lint_typescript_tests
status: na
- task: lint_license_headers
status: passed
---
---
lib/node_modules/@stdlib/stats/base/dstdev/README.md | 4 ++--
lib/node_modules/@stdlib/stats/base/dstdev/lib/index.js | 1 -
lib/node_modules/@stdlib/stats/base/dstdev/manifest.json | 1 -
3 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/lib/node_modules/@stdlib/stats/base/dstdev/README.md b/lib/node_modules/@stdlib/stats/base/dstdev/README.md
index b59992769822..6a0d3b24c98a 100644
--- a/lib/node_modules/@stdlib/stats/base/dstdev/README.md
+++ b/lib/node_modules/@stdlib/stats/base/dstdev/README.md
@@ -242,14 +242,14 @@ Computes the [standard deviation][standard-deviation] of a double-precision floa
const double x[] = { 1.0, -2.0, 2.0 };
double v = stdlib_strided_dstdev( 3, 1.0, x, 1 );
-// returns 2.5
+// returns ~2.0817
```
The function accepts the following arguments:
- **N**: `[in] CBLAS_INT` number of indexed elements.
- **correction**: `[in] double` 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 [standard deviation][standard-deviation] according to `N-c` where `c` corresponds to the provided degrees of freedom adjustment. When computing the [standard deviation][standard-deviation] 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 corrected sample [standard deviation][standard-deviation], 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] double*` input array.
+- **X**: `[in] double*` input array.
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
```c
diff --git a/lib/node_modules/@stdlib/stats/base/dstdev/lib/index.js b/lib/node_modules/@stdlib/stats/base/dstdev/lib/index.js
index f451521aa6fc..fc04214a3161 100644
--- a/lib/node_modules/@stdlib/stats/base/dstdev/lib/index.js
+++ b/lib/node_modules/@stdlib/stats/base/dstdev/lib/index.js
@@ -33,7 +33,6 @@
*
* @example
* var Float64Array = require( '@stdlib/array/float64' );
-* var floor = require( '@stdlib/math/base/special/floor' );
* var dstdev = require( '@stdlib/stats/base/dstdev' );
*
* var x = new Float64Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] );
diff --git a/lib/node_modules/@stdlib/stats/base/dstdev/manifest.json b/lib/node_modules/@stdlib/stats/base/dstdev/manifest.json
index e3a1b9c5a345..973b5635a29b 100644
--- a/lib/node_modules/@stdlib/stats/base/dstdev/manifest.json
+++ b/lib/node_modules/@stdlib/stats/base/dstdev/manifest.json
@@ -40,7 +40,6 @@
"dependencies": [
"@stdlib/blas/base/shared",
"@stdlib/strided/base/stride2offset",
- "@stdlib/math/base/special/sqrt",
"@stdlib/stats/base/dstdevpn",
"@stdlib/napi/export",
"@stdlib/napi/argv",