Skip to content

Commit 51f2f13

Browse files
committed
Auto-generated commit
1 parent 6bb24c2 commit 51f2f13

File tree

16 files changed

+467
-127
lines changed

16 files changed

+467
-127
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-03-30)
7+
## Unreleased (2025-06-14)
8+
9+
<section class="features">
10+
11+
### Features
12+
13+
- [`99c73a5`](https://github.com/stdlib-js/stdlib/commit/99c73a545c63afee7c010f8b4da4607c40af8b20) - add support for accessor arrays and refactor `stats/base/stdevch` [(#7344)](https://github.com/stdlib-js/stdlib/pull/7344)
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+
[#5682](https://github.com/stdlib-js/stdlib/issues/5682)
26+
27+
</section>
28+
29+
<!-- /.issues -->
830

931
<section class="commits">
1032

1133
### Commits
1234

1335
<details>
1436

37+
- [`99c73a5`](https://github.com/stdlib-js/stdlib/commit/99c73a545c63afee7c010f8b4da4607c40af8b20) - **feat:** add support for accessor arrays and refactor `stats/base/stdevch` [(#7344)](https://github.com/stdlib-js/stdlib/pull/7344) _(by Gururaj Gurram, stdlib-bot)_
1538
- [`4894ba9`](https://github.com/stdlib-js/stdlib/commit/4894ba93c712a1b42242c1c597afa9cdc811ad8c) - **refactor:** update paths _(by Aayush Khanna)_
1639
- [`17c4e41`](https://github.com/stdlib-js/stdlib/commit/17c4e41ad480a465b085afa0de85e34957861710) - **refactor:** update paths _(by Aayush Khanna)_
1740

@@ -25,9 +48,10 @@
2548

2649
### Contributors
2750

28-
A total of 1 person contributed to this release. Thank you to this contributor:
51+
A total of 2 people contributed to this release. Thank you to the following contributors:
2952

3053
- Aayush Khanna
54+
- Gururaj Gurram
3155

3256
</section>
3357

CONTRIBUTORS

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ AlyAbdelmoneim <[email protected]>
2222
Aman Bhansali <[email protected]>
2323
AmanBhadkariya <[email protected]>
2424
Amit Jimiwal <[email protected]>
25+
Annamalai Prabu <[email protected]>
2526
Anshu Kumar <[email protected]>
2627
Anshu Kumar <[email protected]>
2728
Anudeep Sanapala <[email protected]>
@@ -38,27 +39,33 @@ Daniel Killenberger <[email protected]>
3839
Daniel Yu <[email protected]>
3940
Debashis Maharana <[email protected]>
4041
Deep Trivedi <[email protected]>
42+
Deepak Singh <[email protected]>
4143
Desh Deepak Kant <[email protected]>
4244
4345
Dhanyabad behera <[email protected]>
4446
Dhruv Arvind Singh <[email protected]>
4547
Dhruvil Mehta <[email protected]>
48+
Dipjyoti Das <[email protected]>
4649
Divyansh Seth <[email protected]>
4750
Dominic Lim <[email protected]>
4851
Dominik Moritz <[email protected]>
4952
Dorrin Sotoudeh <[email protected]>
5053
EuniceSim142 <[email protected]>
5154
Frank Kovacs <[email protected]>
5255
GK Bishnoi <[email protected]>
56+
GURU PRASAD SHARMA <[email protected]>
5357
58+
Gautam Kaushik <[email protected]>
5459
Gautam sharma <[email protected]>
60+
Girish Garg <[email protected]>
5561
Golden Kumar <[email protected]>
5662
Gunj Joshi <[email protected]>
5763
Gururaj Gurram <[email protected]>
5864
Haroon Rasheed <[email protected]>
59-
Harsh <[email protected].com>
65+
Harsh <harshyadav6078@gmail.com>
6066
6167
Harshita Kalani <[email protected]>
68+
Hemang Choudhary <[email protected]>
6269
Hemant M Mehta <[email protected]>
6370
Hridyanshu <[email protected]>
6471
Jaimin Godhani <[email protected]>
@@ -75,16 +82,20 @@ Jordan Gallivan <[email protected]>
7582
Joris Labie <[email protected]>
7683
Justin Dennison <[email protected]>
7784
Justyn Shelby <[email protected]>
78-
Karan Anand <[email protected]>
85+
Karan Anand <[email protected]>
86+
Karan Vasudevamurthy <[email protected]>
87+
Karan Yadav <[email protected]>
7988
Karthik Prakash <[email protected]>
8089
Kaushikgtm <[email protected]>
8190
Kavyansh-Bagdi <[email protected]>
8291
Kohantika Nath <[email protected]>
8392
Krishnam Agarwal <[email protected]>
8493
Krishnendu Das <[email protected]>
8594
Kshitij-Dale <[email protected]>
95+
Lalit Narayan Yadav <[email protected]>
8696
Lovelin Dhoni J B <[email protected]>
8797
98+
Mahfuza Humayra Mohona <[email protected]>
8899
Manik Sharma <[email protected]>
89100
Manvith M <[email protected]>
90101
Marcus Fantham <[email protected]>
@@ -95,24 +106,31 @@ Mohammad Bin Aftab <[email protected]>
95106
Mohammad Kaif <[email protected]>
96107
Momtchil Momtchev <[email protected]>
97108
Muhammad Haris <[email protected]>
109+
Muhammad Taaha Tariq <[email protected]>
110+
Muhmmad Saad <[email protected]>
98111
Naresh Jagadeesan <[email protected]>
99112
Naveen Kumar <[email protected]>
100113
Neeraj Pathak <[email protected]>
114+
NirvedMishra <[email protected]>
101115
Nishant Shinde <[email protected]>
116+
Nishant singh <[email protected]>
102117
Nishchay Rajput <[email protected]>
103118
Nithin Katta <[email protected]>
104119
Nourhan Hasan <[email protected]>
105120
Ognjen Jevremović <[email protected]>
106121
Oneday12323 <[email protected]>
107122
Ori Miles <[email protected]>
108123
Philipp Burckhardt <[email protected]>
124+
Pierre Forstmann <[email protected]>
109125
Prajjwal Bajpai <[email protected]>
110126
Prajwal Kulkarni <[email protected]>
111127
Pranav Goswami <[email protected]>
112128
Pranjal Jha <[email protected]>
113129
Prashant Kumar Yadav <[email protected]>
130+
PrathamBhamare <[email protected]>
114131
Pratik Singh <[email protected]>
115132
Pratyush Kumar Chouhan <[email protected]>
133+
Pravesh Kunwar <[email protected]>
116134
Priyansh Prajapati <[email protected]>
117135
Priyanshu Agarwal <[email protected]>
118136
Pulkit Gupta <[email protected]>
@@ -126,12 +144,16 @@ Rishav <[email protected]>
126144
Rishav Tarway <[email protected]>
127145
Robert Gislason <[email protected]>
128146
Roman Stetsyk <[email protected]>
147+
129148
Rutam Kathale <[email protected]>
130149
Ruthwik Chikoti <[email protected]>
131150
Ryan Seal <[email protected]>
132151
Rylan Yang <[email protected]>
133152
SAHIL KUMAR <[email protected]>
134153
SHIVAM YADAV <[email protected]>
154+
Sachin Raj <[email protected]>
155+
Sahil Goyal <[email protected]>
156+
Sai Avinash <[email protected]>
135157
Sai Srikar Dumpeti <[email protected]>
136158
Sanchay Ketan Sinha <[email protected]>
137159
Sarthak Paandey <[email protected]>
@@ -150,14 +172,19 @@ Spandan Barve <[email protected]>
150172
Stephannie Jiménez Gacha <[email protected]>
151173
Suhaib Ilahi <[email protected]>
152174
Suraj Kumar <[email protected]>
175+
Swapnil Hajare <[email protected]>
153176
Tanishq Ahuja <[email protected]>
154177
Tirtadwipa Manunggal <[email protected]>
155178
Tudor Pagu <[email protected]>
156179
Tufailahmed Bargir <[email protected]>
180+
Tushar Bhardwaj <[email protected]>
181+
Uday Kakade <[email protected]>
182+
Ujjwal Kirti <[email protected]>
157183
Utkarsh <http://[email protected]>
158184
Utkarsh Raj <[email protected]>
159185
UtkershBasnet <[email protected]>
160186
Vaibhav Patel <[email protected]>
187+
Vara Rahul Rajana <[email protected]>
161188
Varad Gupta <[email protected]>
162189
Vinit Pandit <[email protected]>
163190
Vivek Maurya <[email protected]>
@@ -166,11 +193,15 @@ Yaswanth Kosuru <[email protected]>
166193
Yernar Yergaziyev <[email protected]>
167194
Yugal Kaushik <[email protected]>
168195
Yuvi Mittal <[email protected]>
196+
devshree-bhati <[email protected]>
169197
170198
ekambains <[email protected]>
171199
fadiothman22 <[email protected]>
200+
iraandrushko <[email protected]>
201+
lohithganni <[email protected]>
172202
olenkabilonizhka <[email protected]>
173203
pranav-1720 <[email protected]>
174204
rahulrangers <[email protected]>
175205
176206
207+

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 stdevch = require( '@stdlib/stats-base-stdevch' );
132132
```
133133

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

136-
Computes the [standard deviation][standard-deviation] of a strided array `x` using a one-pass trial mean algorithm.
136+
Computes the [standard deviation][standard-deviation] of a strided array using a one-pass trial mean algorithm.
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 = stdevch( N, 1, x, 2 );
157+
var v = stdevch( 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 = stdevch( N, 1, x1, 2 );
171+
var v = stdevch( 4, 1, x1, 2 );
178172
// returns 2.5
179173
```
180174

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

183177
Computes the [standard deviation][standard-deviation] of a strided array using a one-pass trial mean algorithm and alternative indexing semantics.
184178

@@ -191,17 +185,14 @@ var v = stdevch.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 = stdevch.ndarray( N, 1, x, 2, 1 );
195+
var v = stdevch.ndarray( 4, 1, x, 2, 1 );
205196
// returns 2.5
206197
```
207198

@@ -216,6 +207,7 @@ var v = stdevch.ndarray( N, 1, x, 2, 1 );
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`.
218209
- The underlying algorithm is a specialized case of Neely's two-pass algorithm. As the standard deviation is invariant with respect to changes in the location parameter, the underlying algorithm uses the first strided array element as a trial mean to shift subsequent data values and thus mitigate catastrophic cancellation. Accordingly, the algorithm's accuracy is best when data is **unordered** (i.e., the data is **not** sorted in either ascending or descending order such that the first value is an "extreme" value).
210+
- 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]).
219211
- Depending on the environment, the typed versions ([`dstdevch`][@stdlib/stats/strided/dstdevch], [`sstdevch`][@stdlib/stats/strided/sstdevch], etc.) are likely to be significantly more performant.
220212

221213
</section>
@@ -229,18 +221,12 @@ var v = stdevch.ndarray( N, 1, x, 2, 1 );
229221
<!-- eslint no-undef: "error" -->
230222

231223
```javascript
232-
var randu = require( '@stdlib/random-base-randu' );
233-
var round = require( '@stdlib/math-base-special-round' );
234-
var Float64Array = require( '@stdlib/array-float64' );
224+
var discreteUniform = require( '@stdlib/random-array-discrete-uniform' );
235225
var stdevch = require( '@stdlib/stats-base-stdevch' );
236226

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

246232
var v = stdevch( x.length, 1, x, 1 );
@@ -362,6 +348,8 @@ Copyright &copy; 2016-2025. The Stdlib [Authors][stdlib-authors].
362348

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

351+
[@stdlib/array/base/accessor]: https://github.com/stdlib-js/array-base-accessor
352+
365353
[@neely:1966a]: https://doi.org/10.1145/365719.365958
366354

367355
[@ling:1974a]: https://doi.org/10.2307/2286154

benchmark/benchmark.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,18 @@
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;
28-
var stdevch = require( './../lib/stdevch.js' );
28+
var stdevch = require( './../lib/main.js' );
29+
30+
31+
// VARIABLES //
32+
33+
var options = {
34+
'dtype': 'generic'
35+
};
2936

3037

3138
// FUNCTIONS //
@@ -38,13 +45,7 @@ var stdevch = require( './../lib/stdevch.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 stdevch = 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 stdevch = 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 ) {

0 commit comments

Comments
 (0)