Skip to content

Commit 7f18df7

Browse files
committed
Auto-generated commit
1 parent 9d96523 commit 7f18df7

12 files changed

Lines changed: 93 additions & 76 deletions

File tree

‎.github/.keepalive‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2026-04-02T03:30:31.785Z
1+
2026-05-10T03:22:43.356Z

‎.gitignore‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ package.json.copy
2525
###############
2626
build/
2727
downloads/
28+
plans/
2829
reports/
2930
tmp/
3031

@@ -175,6 +176,10 @@ acs-*.bib
175176
*.ind
176177
*.ist
177178

179+
# Git #
180+
#######
181+
.worktrees
182+
178183
# Visual Studio #
179184
#################
180185
.vscode/

‎CHANGELOG.md‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,40 @@
22

33
> Package changelog.
44
5+
<section class="release" id="unreleased">
6+
7+
## Unreleased (2026-05-10)
8+
9+
<section class="commits">
10+
11+
### Commits
12+
13+
<details>
14+
15+
- [`24b7879`](https://github.com/stdlib-js/stdlib/commit/24b78796fa55472fd21fc89a03c4053b88f80440) - **chore:** modernize examples and benchmarks _(by Athan Reines)_
16+
17+
</details>
18+
19+
</section>
20+
21+
<!-- /.commits -->
22+
23+
<section class="contributors">
24+
25+
### Contributors
26+
27+
A total of 1 person contributed to this release. Thank you to this contributor:
28+
29+
- Athan Reines
30+
31+
</section>
32+
33+
<!-- /.contributors -->
34+
35+
</section>
36+
37+
<!-- /.release -->
38+
539
<section class="release" id="v0.1.1">
640

741
## 0.1.1 (2026-02-08)

‎README.md‎

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -136,25 +136,24 @@ var sstdev = require( '@stdlib/stats-base-ndarray-sstdev' );
136136
Computes the [standard deviation][standard-deviation] of a one-dimensional single-precision floating-point ndarray.
137137

138138
```javascript
139-
var Float32Array = require( '@stdlib/array-float32' );
140-
var ndarray = require( '@stdlib/ndarray-base-ctor' );
139+
var Float32Vector = require( '@stdlib/ndarray-vector-float32' );
141140
var scalar2ndarray = require( '@stdlib/ndarray-from-scalar' );
142141

143-
var opts = {
142+
var x = new Float32Vector( [ 1.0, -2.0, 2.0 ] );
143+
var correction = scalar2ndarray( 1.0, {
144144
'dtype': 'float32'
145-
};
146-
147-
var xbuf = new Float32Array( [ 1.0, -2.0, 2.0 ] );
148-
var x = new ndarray( opts.dtype, xbuf, [ 3 ], [ 1 ], 0, 'row-major' );
149-
var correction = scalar2ndarray( 1.0, opts );
145+
});
150146

151147
var v = sstdev( [ x, correction ] );
152148
// returns ~2.0817
153149
```
154150

155151
The function has the following parameters:
156152

157-
- **arrays**: array-like object containing two elements: a one-dimensional input ndarray and a zero-dimensional ndarray specifying the degrees of freedom adjustment. Providing a non-zero degrees of freedom adjustment has the effect of adjusting the divisor during the calculation of the [standard deviation][standard-deviation] according to `N-c` where `N` is the number of elements in the input ndarray and `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).
153+
- **arrays**: array-like object containing the following ndarrays:
154+
155+
- a one-dimensional input ndarray.
156+
- a zero-dimensional ndarray specifying the degrees of freedom adjustment. Providing a non-zero degrees of freedom adjustment has the effect of adjusting the divisor during the calculation of the [standard deviation][standard-deviation] according to `N-c` where `N` is the number of elements in the input ndarray and `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).
158157

159158
</section>
160159

@@ -178,9 +177,7 @@ The function has the following parameters:
178177
<!-- eslint no-undef: "error" -->
179178

180179
```javascript
181-
var discreteUniform = require( '@stdlib/random-array-discrete-uniform' );
182-
var Float32Array = require( '@stdlib/array-float32' );
183-
var ndarray = require( '@stdlib/ndarray-base-ctor' );
180+
var discreteUniform = require( '@stdlib/random-discrete-uniform' );
184181
var scalar2ndarray = require( '@stdlib/ndarray-from-scalar' );
185182
var ndarray2array = require( '@stdlib/ndarray-to-array' );
186183
var sstdev = require( '@stdlib/stats-base-ndarray-sstdev' );
@@ -189,8 +186,7 @@ var opts = {
189186
'dtype': 'float32'
190187
};
191188

192-
var xbuf = discreteUniform( 10, -50, 50, opts );
193-
var x = new ndarray( opts.dtype, xbuf, [ xbuf.length ], [ 1 ], 0, 'row-major' );
189+
var x = discreteUniform( [ 10 ], -50, 50, opts );
194190
console.log( ndarray2array( x ) );
195191

196192
var correction = scalar2ndarray( 1.0, opts );

‎benchmark/benchmark.js‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,9 @@
2121
// MODULES //
2222

2323
var bench = require( '@stdlib/bench-harness' );
24-
var uniform = require( '@stdlib/random-array-uniform' );
24+
var uniform = require( '@stdlib/random-uniform' );
2525
var isnanf = require( '@stdlib/math-base-assert-is-nanf' );
2626
var pow = require( '@stdlib/math-base-special-pow' );
27-
var ndarray = require( '@stdlib/ndarray-base-ctor' );
2827
var scalar2ndarray = require( '@stdlib/ndarray-from-scalar' );
2928
var format = require( '@stdlib/string-format' );
3029
var pkg = require( './../package.json' ).name;
@@ -49,11 +48,9 @@ var options = {
4948
*/
5049
function createBenchmark( len ) {
5150
var correction;
52-
var xbuf;
5351
var x;
5452

55-
xbuf = uniform( len, -10.0, 10.0, options );
56-
x = new ndarray( options.dtype, xbuf, [ len ], [ 1 ], 0, 'row-major' );
53+
x = uniform( [ len ], -10.0, 10.0, options );
5754
correction = scalar2ndarray( 1.0, options );
5855

5956
return benchmark;

‎dist/index.js.map‎

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎docs/repl.txt‎

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@
1212
Parameters
1313
----------
1414
arrays: ArrayLikeObject<ndarray>
15-
Array-like object containing two elements: a one-dimensional input
16-
ndarray and a zero-dimensional ndarray specifying the degrees of freedom
15+
Array-like object containing the following ndarrays:
16+
17+
- a one-dimensional input ndarray.
18+
- a zero-dimensional ndarray specifying the degrees of freedom
1719
adjustment. Providing a non-zero degrees of freedom adjustment has the
1820
effect of adjusting the divisor during the calculation of the standard
1921
deviation according to `N-c` where `N` is the number of elements in the
@@ -33,20 +35,8 @@
3335

3436
Examples
3537
--------
36-
// Create input ndarray:
37-
> var xbuf = new {{alias:@stdlib/array/float32}}( [ 1.0, -2.0, 2.0 ] );
38-
> var dt = 'float32';
39-
> var sh = [ xbuf.length ];
40-
> var st = [ 1 ];
41-
> var oo = 0;
42-
> var ord = 'row-major';
43-
> var x = new {{alias:@stdlib/ndarray/ctor}}( dt, xbuf, sh, st, oo, ord );
44-
45-
// Create correction ndarray:
46-
> var opts = { 'dtype': dt };
47-
> var correction = {{alias:@stdlib/ndarray/from-scalar}}( 1.0, opts );
48-
49-
// Compute the standard deviation:
38+
> var x = new {{alias:@stdlib/ndarray/vector/float32}}( [ 1.0, -2.0, 2.0 ] );
39+
> var correction = {{alias:@stdlib/ndarray/from-scalar}}( 1.0, { 'dtype': 'float32' } );
5040
> {{alias}}( [ x, correction ] )
5141
~2.0817
5242

‎docs/types/index.d.ts‎

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,24 @@ import { float32ndarray, typedndarray } from '@stdlib/types/ndarray';
2525
/**
2626
* Computes the standard deviation of a one-dimensional ndarray.
2727
*
28-
* @param arrays - array-like object containing a one-dimensional input ndarray and a zero-dimensional ndarray specifying a degrees of freedom adjustment
28+
* ## Notes
29+
*
30+
* - The function expects the following ndarrays:
31+
*
32+
* - a one-dimensional input ndarray.
33+
* - a zero-dimensional ndarray specifying the degrees of freedom adjustment.
34+
*
35+
* @param arrays - array-like object containing ndarrays
2936
* @returns standard deviation
3037
*
3138
* @example
32-
* var ndarray = require( '@stdlib/ndarray-base-ctor' );
39+
* var Float32Vector = require( '@stdlib/ndarray-vector-float32' );
3340
* var scalar2ndarray = require( '@stdlib/ndarray-from-scalar' );
34-
* var Float32Array = require( '@stdlib/array-float32' );
3541
*
36-
* var opts = {
42+
* var x = new Float32Vector( [ 1.0, -2.0, 2.0 ] );
43+
* var correction = scalar2ndarray( 1.0, {
3744
* 'dtype': 'float32'
38-
* };
39-
*
40-
* var xbuf = new Float32Array( [ 1.0, -2.0, 2.0 ] );
41-
* var x = new ndarray( opts.dtype, xbuf, [ 3 ], [ 1 ], 0, 'row-major' );
42-
* var correction = scalar2ndarray( 1.0, opts );
45+
* });
4346
*
4447
* var v = sstdev( [ x, correction ] );
4548
* // returns ~2.0817

‎examples/index.js‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,16 @@
1818

1919
'use strict';
2020

21-
var discreteUniform = require( '@stdlib/random-array-discrete-uniform' );
21+
var discreteUniform = require( '@stdlib/random-discrete-uniform' );
2222
var scalar2ndarray = require( '@stdlib/ndarray-from-scalar' );
23-
var ndarray = require( '@stdlib/ndarray-base-ctor' );
2423
var ndarray2array = require( '@stdlib/ndarray-to-array' );
2524
var sstdev = require( './../lib' );
2625

2726
var opts = {
2827
'dtype': 'float32'
2928
};
3029

31-
var xbuf = discreteUniform( 10, -50, 50, opts );
32-
var x = new ndarray( opts.dtype, xbuf, [ xbuf.length ], [ 1 ], 0, 'row-major' );
30+
var x = discreteUniform( [ 10 ], -50, 50, opts );
3331
console.log( ndarray2array( x ) );
3432

3533
var correction = scalar2ndarray( 1.0, opts );

‎lib/index.js‎

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,15 @@
2424
* @module @stdlib/stats-base-ndarray-sstdev
2525
*
2626
* @example
27-
* var Float32Array = require( '@stdlib/array-float32' );
27+
* var Float32Vector = require( '@stdlib/ndarray-vector-float32' );
2828
* var scalar2ndarray = require( '@stdlib/ndarray-from-scalar' );
29-
* var ndarray = require( '@stdlib/ndarray-ctor' );
3029
* var sstdev = require( '@stdlib/stats-base-ndarray-sstdev' );
3130
*
32-
* var opts = {
31+
* var x = new Float32Vector( [ 1.0, -2.0, 2.0 ] );
32+
* var correction = scalar2ndarray( 1.0, {
3333
* 'dtype': 'float32'
34-
* };
34+
* });
3535
*
36-
* // Define a one-dimensional input ndarray:
37-
* var xbuf = new Float32Array( [ 1.0, -2.0, 2.0 ] );
38-
* var x = new ndarray( opts.dtype, xbuf, [ 3 ], [ 1 ], 0, 'row-major' );
39-
*
40-
* // Specify the degrees of freedom adjustment:
41-
* var correction = scalar2ndarray( 1.0, opts );
42-
*
43-
* // Compute the standard deviation:
4436
* var v = sstdev( [ x, correction ] );
4537
* // returns ~2.0817
4638
*/

0 commit comments

Comments
 (0)