Skip to content

Commit fb9642a

Browse files
committed
Auto-generated commit
1 parent 491127e commit fb9642a

File tree

16 files changed

+443
-130
lines changed

16 files changed

+443
-130
lines changed

CHANGELOG.md

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,37 @@
44
55
<section class="release" id="unreleased">
66

7-
## Unreleased (2025-07-01)
7+
## Unreleased (2025-07-09)
8+
9+
<section class="features">
10+
11+
### Features
12+
13+
- [`02bedd4`](https://github.com/stdlib-js/stdlib/commit/02bedd4c6ebc39c099f3503ece5e953949546242) - refactor and add protocol support to `stats/base/stdevyc` [(#7586)](https://github.com/stdlib-js/stdlib/pull/7586)
14+
15+
</section>
16+
17+
<!-- /.features -->
18+
19+
<section class="issues">
20+
21+
### Closed Issues
22+
23+
This release closes the following issue:
24+
25+
[#5686](https://github.com/stdlib-js/stdlib/issues/5686)
26+
27+
</section>
28+
29+
<!-- /.issues -->
830

931
<section class="commits">
1032

1133
### Commits
1234

1335
<details>
1436

37+
- [`02bedd4`](https://github.com/stdlib-js/stdlib/commit/02bedd4c6ebc39c099f3503ece5e953949546242) - **feat:** refactor and add protocol support to `stats/base/stdevyc` [(#7586)](https://github.com/stdlib-js/stdlib/pull/7586) _(by Gururaj Gurram, Athan Reines)_
1538
- [`33b006d`](https://github.com/stdlib-js/stdlib/commit/33b006da9166c233b4e423e1da318aa99f56db00) - **refactor:** update paths _(by Gururaj Gurram)_
1639
- [`5269da4`](https://github.com/stdlib-js/stdlib/commit/5269da48b9b1cbc6b3bfab79edf9682f76a73d3a) - **refactor:** update paths _(by Aayush Khanna)_
1740
- [`438e57b`](https://github.com/stdlib-js/stdlib/commit/438e57b5e91d062a5c28897e408d8aa81b3de137) - **refactor:** update paths _(by Aayush Khanna)_
@@ -26,9 +49,10 @@
2649

2750
### Contributors
2851

29-
A total of 2 people contributed to this release. Thank you to the following contributors:
52+
A total of 3 people contributed to this release. Thank you to the following contributors:
3053

3154
- Aayush Khanna
55+
- Athan Reines
3256
- Gururaj Gurram
3357

3458
</section>

CONTRIBUTORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Annamalai Prabu <apfossdev@gmail.com>
2727
Anshu Kumar <132515490+anxhukumar@users.noreply.github.com>
2828
Anshu Kumar <contact.anshukumar@protonmail.com>
2929
Anudeep Sanapala <anudeep0306@gmail.com>
30+
Arihant Pal <arihant0pal@gmail.com>
3031
Aryan Bhirud <112156883+AryanBhirud@users.noreply.github.com>
3132
Athan Reines <kgryte@gmail.com>
3233
Ayaka <73595362+USERSATOSHI@users.noreply.github.com>

README.md

Lines changed: 17 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,9 @@ To view installation and usage instructions specific to each branch build, be su
131131
var stdevyc = require( '@stdlib/stats-base-stdevyc' );
132132
```
133133

134-
#### stdevyc( N, correction, x, stride )
134+
#### stdevyc( N, correction, x, strideX )
135135

136-
Computes the [standard deviation][standard-deviation] of a strided array `x` using a one-pass algorithm proposed by Youngs and Cramer.
136+
Computes the [standard deviation][standard-deviation] of a strided array using a one-pass algorithm proposed by Youngs and Cramer.
137137

138138
```javascript
139139
var x = [ 1.0, -2.0, 2.0 ];
@@ -147,17 +147,14 @@ The function has the following parameters:
147147
- **N**: number of indexed elements.
148148
- **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).
149149
- **x**: input [`Array`][mdn-array] or [`typed array`][mdn-typed-array].
150-
- **stride**: index increment for `x`.
150+
- **strideX**: stride length for `x`.
151151

152-
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`,
152+
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`,
153153

154154
```javascript
155-
var floor = require( '@stdlib/math-base-special-floor' );
156-
157155
var x = [ 1.0, 2.0, 2.0, -7.0, -2.0, 3.0, 4.0, 2.0 ];
158-
var N = floor( x.length / 2 );
159156

160-
var v = stdevyc( N, 1, x, 2 );
157+
var v = stdevyc( 4, 1, x, 2 );
161158
// returns 2.5
162159
```
163160

@@ -167,18 +164,15 @@ Note that indexing is relative to the first index. To introduce an offset, use [
167164

168165
```javascript
169166
var Float64Array = require( '@stdlib/array-float64' );
170-
var floor = require( '@stdlib/math-base-special-floor' );
171167

172168
var x0 = new Float64Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] );
173169
var x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
174170

175-
var N = floor( x0.length / 2 );
176-
177-
var v = stdevyc( N, 1, x1, 2 );
171+
var v = stdevyc( 4, 1, x1, 2 );
178172
// returns 2.5
179173
```
180174

181-
#### stdevyc.ndarray( N, correction, x, stride, offset )
175+
#### stdevyc.ndarray( N, correction, x, strideX, offsetX )
182176

183177
Computes the [standard deviation][standard-deviation] of a strided array using a one-pass algorithm proposed by Youngs and Cramer and alternative indexing semantics.
184178

@@ -191,17 +185,14 @@ var v = stdevyc.ndarray( x.length, 1, x, 1, 0 );
191185

192186
The function has the following additional parameters:
193187

194-
- **offset**: starting index for `x`.
188+
- **offsetX**: starting index for `x`.
195189

196-
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
190+
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
197191

198192
```javascript
199-
var floor = require( '@stdlib/math-base-special-floor' );
200-
201193
var x = [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ];
202-
var N = floor( x.length / 2 );
203194

204-
var v = stdevyc.ndarray( N, 1, x, 2, 1 );
195+
var v = stdevyc.ndarray( 4, 1, x, 2, 1 );
205196
// returns 2.5
206197
```
207198

@@ -215,6 +206,7 @@ var v = stdevyc.ndarray( N, 1, x, 2, 1 );
215206

216207
- If `N <= 0`, both functions return `NaN`.
217208
- If `N - c` is less than or equal to `0` (where `c` corresponds to the provided degrees of freedom adjustment), both functions return `NaN`.
209+
- Both functions support array-like objects having getter and setter accessors for array element access (e.g., [`@stdlib/array-base/accessor`][@stdlib/array/base/accessor]).
218210
- Depending on the environment, the typed versions ([`dstdevyc`][@stdlib/stats/strided/dstdevyc], [`sstdevyc`][@stdlib/stats/strided/sstdevyc], etc.) are likely to be significantly more performant.
219211

220212
</section>
@@ -228,18 +220,12 @@ var v = stdevyc.ndarray( N, 1, x, 2, 1 );
228220
<!-- eslint no-undef: "error" -->
229221

230222
```javascript
231-
var randu = require( '@stdlib/random-base-randu' );
232-
var round = require( '@stdlib/math-base-special-round' );
233-
var Float64Array = require( '@stdlib/array-float64' );
223+
var discreteUniform = require( '@stdlib/random-array-discrete-uniform' );
234224
var stdevyc = require( '@stdlib/stats-base-stdevyc' );
235225

236-
var x;
237-
var i;
238-
239-
x = new Float64Array( 10 );
240-
for ( i = 0; i < x.length; i++ ) {
241-
x[ i ] = round( (randu()*100.0) - 50.0 );
242-
}
226+
var x = discreteUniform( 10, -50, 50, {
227+
'dtype': 'float64'
228+
});
243229
console.log( x );
244230

245231
var v = stdevyc( x.length, 1, x, 1 );
@@ -358,6 +344,8 @@ Copyright &copy; 2016-2025. The Stdlib [Authors][stdlib-authors].
358344

359345
[mdn-typed-array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray
360346

347+
[@stdlib/array/base/accessor]: https://github.com/stdlib-js/array-base-accessor
348+
361349
[@youngs:1971a]: https://doi.org/10.1080/00401706.1971.10488826
362350

363351
<!-- <related-links> -->

benchmark/benchmark.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,20 @@
2121
// MODULES //
2222

2323
var bench = require( '@stdlib/bench-harness' );
24-
var randu = require( '@stdlib/random-base-randu' );
24+
var uniform = require( '@stdlib/random-array-uniform' );
2525
var isnan = require( '@stdlib/math-base-assert-is-nan' );
2626
var pow = require( '@stdlib/math-base-special-pow' );
2727
var pkg = require( './../package.json' ).name;
2828
var stdevyc = require( './../lib/stdevyc.js' );
2929

3030

31+
// VARIABLES //
32+
33+
var options = {
34+
'dtype': 'generic'
35+
};
36+
37+
3138
// FUNCTIONS //
3239

3340
/**
@@ -38,13 +45,7 @@ var stdevyc = require( './../lib/stdevyc.js' );
3845
* @returns {Function} benchmark function
3946
*/
4047
function createBenchmark( len ) {
41-
var x;
42-
var i;
43-
44-
x = [];
45-
for ( i = 0; i < len; i++ ) {
46-
x.push( ( randu()*20.0 ) - 10.0 );
47-
}
48+
var x = uniform( len, -10, 10, options );
4849
return benchmark;
4950

5051
function benchmark( b ) {

benchmark/benchmark.ndarray.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,20 @@
2121
// MODULES //
2222

2323
var bench = require( '@stdlib/bench-harness' );
24-
var randu = require( '@stdlib/random-base-randu' );
24+
var uniform = require( '@stdlib/random-array-uniform' );
2525
var isnan = require( '@stdlib/math-base-assert-is-nan' );
2626
var pow = require( '@stdlib/math-base-special-pow' );
2727
var pkg = require( './../package.json' ).name;
2828
var stdevyc = require( './../lib/ndarray.js' );
2929

3030

31+
// VARIABLES //
32+
33+
var options = {
34+
'dtype': 'generic'
35+
};
36+
37+
3138
// FUNCTIONS //
3239

3340
/**
@@ -38,13 +45,7 @@ var stdevyc = require( './../lib/ndarray.js' );
3845
* @returns {Function} benchmark function
3946
*/
4047
function createBenchmark( len ) {
41-
var x;
42-
var i;
43-
44-
x = [];
45-
for ( i = 0; i < len; i++ ) {
46-
x.push( ( randu()*20.0 ) - 10.0 );
47-
}
48+
var x = uniform( len, -10, 10, options );
4849
return benchmark;
4950

5051
function benchmark( b ) {

dist/index.js

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

0 commit comments

Comments
 (0)