Skip to content

Commit eb23904

Browse files
committed
Auto-generated commit
1 parent ea8d664 commit eb23904

27 files changed

+374
-244
lines changed

CHANGELOG.md

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

7-
## Unreleased (2025-03-30)
7+
## Unreleased (2025-05-08)
8+
9+
<section class="features">
10+
11+
### Features
12+
13+
- [`3c04537`](https://github.com/stdlib-js/stdlib/commit/3c045376b0079bd51c2a60ff690ab25f5c178d1a) - add add C ndarray interface and refactor implementation for `stats/base/sstdev` [(#6930)](https://github.com/stdlib-js/stdlib/pull/6930)
14+
15+
</section>
16+
17+
<!-- /.features -->
818

919
<section class="commits">
1020

1121
### Commits
1222

1323
<details>
1424

25+
- [`3c04537`](https://github.com/stdlib-js/stdlib/commit/3c045376b0079bd51c2a60ff690ab25f5c178d1a) - **feat:** add add C ndarray interface and refactor implementation for `stats/base/sstdev` [(#6930)](https://github.com/stdlib-js/stdlib/pull/6930) _(by Gururaj Gurram, Athan Reines, stdlib-bot)_
1526
- [`8e9e556`](https://github.com/stdlib-js/stdlib/commit/8e9e556cbd76873f3418d4b999f1c2f125282a0d) - **refactor:** update paths _(by Aayush Khanna)_
1627
- [`099a20d`](https://github.com/stdlib-js/stdlib/commit/099a20d177062b4d44568ce283f14d391227cfa6) - **refactor:** update `stats/base/sstdev` native addon from C++ to C [(#4507)](https://github.com/stdlib-js/stdlib/pull/4507) _(by Dhruv Arvind Singh)_
1728
- [`62364f6`](https://github.com/stdlib-js/stdlib/commit/62364f62ea823a3b52c2ad25660ecd80c71f8f36) - **style:** fix C comment alignment _(by Philipp Burckhardt)_
@@ -29,11 +40,12 @@
2940

3041
### Contributors
3142

32-
A total of 4 people contributed to this release. Thank you to the following contributors:
43+
A total of 5 people contributed to this release. Thank you to the following contributors:
3344

3445
- Aayush Khanna
3546
- Athan Reines
3647
- Dhruv Arvind Singh
48+
- Gururaj Gurram
3749
- Philipp Burckhardt
3850

3951
</section>

CONTRIBUTORS

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,22 +43,26 @@ Dev Goel <[email protected]>
4343
Dhanyabad behera <[email protected]>
4444
Dhruv Arvind Singh <[email protected]>
4545
Dhruvil Mehta <[email protected]>
46+
Dipjyoti Das <[email protected]>
4647
Divyansh Seth <[email protected]>
4748
Dominic Lim <[email protected]>
4849
Dominik Moritz <[email protected]>
4950
Dorrin Sotoudeh <[email protected]>
5051
EuniceSim142 <[email protected]>
5152
Frank Kovacs <[email protected]>
5253
GK Bishnoi <[email protected]>
54+
GURU PRASAD SHARMA <[email protected]>
5355
5456
Gautam sharma <[email protected]>
57+
Girish Garg <[email protected]>
5558
Golden Kumar <[email protected]>
5659
Gunj Joshi <[email protected]>
5760
Gururaj Gurram <[email protected]>
5861
Haroon Rasheed <[email protected]>
59-
Harsh <[email protected].com>
62+
Harsh <harshyadav6078@gmail.com>
6063
6164
Harshita Kalani <[email protected]>
65+
Hemang Choudhary <[email protected]>
6266
Hemant M Mehta <[email protected]>
6367
Hridyanshu <[email protected]>
6468
Jaimin Godhani <[email protected]>
@@ -75,16 +79,19 @@ Jordan Gallivan <[email protected]>
7579
Joris Labie <[email protected]>
7680
Justin Dennison <[email protected]>
7781
Justyn Shelby <[email protected]>
78-
Karan Anand <[email protected]>
82+
Karan Anand <[email protected]>
83+
Karan Yadav <[email protected]>
7984
Karthik Prakash <[email protected]>
8085
Kaushikgtm <[email protected]>
8186
Kavyansh-Bagdi <[email protected]>
8287
Kohantika Nath <[email protected]>
8388
Krishnam Agarwal <[email protected]>
8489
Krishnendu Das <[email protected]>
8590
Kshitij-Dale <[email protected]>
91+
Lalit Narayan Yadav <[email protected]>
8692
Lovelin Dhoni J B <[email protected]>
8793
94+
Mahfuza Humayra Mohona <[email protected]>
8895
Manik Sharma <[email protected]>
8996
Manvith M <[email protected]>
9097
Marcus Fantham <[email protected]>
@@ -95,10 +102,14 @@ Mohammad Bin Aftab <[email protected]>
95102
Mohammad Kaif <[email protected]>
96103
Momtchil Momtchev <[email protected]>
97104
Muhammad Haris <[email protected]>
105+
Muhammad Taaha Tariq <[email protected]>
106+
Muhmmad Saad <[email protected]>
98107
Naresh Jagadeesan <[email protected]>
99108
Naveen Kumar <[email protected]>
100109
Neeraj Pathak <[email protected]>
110+
NirvedMishra <[email protected]>
101111
Nishant Shinde <[email protected]>
112+
Nishant singh <[email protected]>
102113
Nishchay Rajput <[email protected]>
103114
Nithin Katta <[email protected]>
104115
Nourhan Hasan <[email protected]>
@@ -111,8 +122,10 @@ Prajwal Kulkarni <[email protected]>
111122
Pranav Goswami <[email protected]>
112123
Pranjal Jha <[email protected]>
113124
Prashant Kumar Yadav <[email protected]>
125+
PrathamBhamare <[email protected]>
114126
Pratik Singh <[email protected]>
115127
Pratyush Kumar Chouhan <[email protected]>
128+
Pravesh Kunwar <[email protected]>
116129
Priyansh Prajapati <[email protected]>
117130
Priyanshu Agarwal <[email protected]>
118131
Pulkit Gupta <[email protected]>
@@ -126,12 +139,15 @@ Rishav <[email protected]>
126139
Rishav Tarway <[email protected]>
127140
Robert Gislason <[email protected]>
128141
Roman Stetsyk <[email protected]>
142+
129143
Rutam Kathale <[email protected]>
130144
Ruthwik Chikoti <[email protected]>
131145
Ryan Seal <[email protected]>
132146
Rylan Yang <[email protected]>
133147
SAHIL KUMAR <[email protected]>
134148
SHIVAM YADAV <[email protected]>
149+
Sahil Goyal <[email protected]>
150+
Sai Avinash <[email protected]>
135151
Sai Srikar Dumpeti <[email protected]>
136152
Sanchay Ketan Sinha <[email protected]>
137153
Sarthak Paandey <[email protected]>
@@ -166,11 +182,15 @@ Yaswanth Kosuru <[email protected]>
166182
Yernar Yergaziyev <[email protected]>
167183
Yugal Kaushik <[email protected]>
168184
Yuvi Mittal <[email protected]>
185+
devshree-bhati <[email protected]>
169186
170187
ekambains <[email protected]>
171188
fadiothman22 <[email protected]>
189+
iraandrushko <[email protected]>
190+
lohithganni <[email protected]>
172191
olenkabilonizhka <[email protected]>
173192
pranav-1720 <[email protected]>
174193
rahulrangers <[email protected]>
175194
176195
196+

README.md

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

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

136-
Computes the [standard deviation][standard-deviation] of a single-precision floating-point strided array `x`.
136+
Computes the [standard deviation][standard-deviation] of a single-precision floating-point strided array.
137137

138138
```javascript
139139
var Float32Array = require( '@stdlib/array-float32' );
140140

141141
var x = new Float32Array( [ 1.0, -2.0, 2.0 ] );
142-
var N = x.length;
143142

144-
var v = sstdev( N, 1, x, 1 );
143+
var v = sstdev( x.length, 1, x, 1 );
145144
// returns ~2.0817
146145
```
147146

@@ -150,18 +149,16 @@ The function has the following parameters:
150149
- **N**: number of indexed elements.
151150
- **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).
152151
- **x**: input [`Float32Array`][@stdlib/array/float32].
153-
- **stride**: index increment for `x`.
152+
- **strideX**: stride length for `x`.
154153

155-
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`,
154+
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`,
156155

157156
```javascript
158157
var Float32Array = require( '@stdlib/array-float32' );
159-
var floor = require( '@stdlib/math-base-special-floor' );
160158

161159
var x = new Float32Array( [ 1.0, 2.0, 2.0, -7.0, -2.0, 3.0, 4.0, 2.0 ] );
162-
var N = floor( x.length / 2 );
163160

164-
var v = sstdev( N, 1, x, 2 );
161+
var v = sstdev( 4, 1, x, 2 );
165162
// returns 2.5
166163
```
167164

@@ -171,45 +168,39 @@ Note that indexing is relative to the first index. To introduce an offset, use [
171168

172169
```javascript
173170
var Float32Array = require( '@stdlib/array-float32' );
174-
var floor = require( '@stdlib/math-base-special-floor' );
175171

176172
var x0 = new Float32Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] );
177173
var x1 = new Float32Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
178174

179-
var N = floor( x0.length / 2 );
180-
181-
var v = sstdev( N, 1, x1, 2 );
175+
var v = sstdev( 4, 1, x1, 2 );
182176
// returns 2.5
183177
```
184178

185-
#### sstdev.ndarray( N, correction, x, stride, offset )
179+
#### sstdev.ndarray( N, correction, x, strideX, offsetX )
186180

187181
Computes the [standard deviation][standard-deviation] of a single-precision floating-point strided array using alternative indexing semantics.
188182

189183
```javascript
190184
var Float32Array = require( '@stdlib/array-float32' );
191185

192186
var x = new Float32Array( [ 1.0, -2.0, 2.0 ] );
193-
var N = x.length;
194187

195-
var v = sstdev.ndarray( N, 1, x, 1, 0 );
188+
var v = sstdev.ndarray( x.length, 1, x, 1, 0 );
196189
// returns ~2.0817
197190
```
198191

199192
The function has the following additional parameters:
200193

201-
- **offset**: starting index for `x`.
194+
- **offsetX**: starting index for `x`.
202195

203-
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
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 element in `x` starting from the second element
204197

205198
```javascript
206199
var Float32Array = require( '@stdlib/array-float32' );
207-
var floor = require( '@stdlib/math-base-special-floor' );
208200

209201
var x = new Float32Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] );
210-
var N = floor( x.length / 2 );
211202

212-
var v = sstdev.ndarray( N, 1, x, 2, 1 );
203+
var v = sstdev.ndarray( 4, 1, x, 2, 1 );
213204
// returns 2.5
214205
```
215206

@@ -235,18 +226,12 @@ var v = sstdev.ndarray( N, 1, x, 2, 1 );
235226
<!-- eslint no-undef: "error" -->
236227

237228
```javascript
238-
var randu = require( '@stdlib/random-base-randu' );
239-
var round = require( '@stdlib/math-base-special-round' );
240-
var Float32Array = require( '@stdlib/array-float32' );
229+
var discreteUniform = require( '@stdlib/random-array-discrete-uniform' );
241230
var sstdev = require( '@stdlib/stats-base-sstdev' );
242231

243-
var x;
244-
var i;
245-
246-
x = new Float32Array( 10 );
247-
for ( i = 0; i < x.length; i++ ) {
248-
x[ i ] = round( (randu()*100.0) - 50.0 );
249-
}
232+
var x = discreteUniform( 10, -50, 50, {
233+
'dtype': 'float32'
234+
});
250235
console.log( x );
251236

252237
var v = sstdev( x.length, 1, x, 1 );
@@ -257,10 +242,129 @@ console.log( v );
257242

258243
<!-- /.examples -->
259244

245+
<!-- C interface documentation. -->
246+
260247
* * *
261248

249+
<section class="c">
250+
251+
## C APIs
252+
253+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
254+
255+
<section class="intro">
256+
257+
</section>
258+
259+
<!-- /.intro -->
260+
261+
<!-- C usage documentation. -->
262+
263+
<section class="usage">
264+
265+
### Usage
266+
267+
```c
268+
#include "stdlib/stats/base/sstdev.h"
269+
```
270+
271+
#### stdlib_strided_sstdev( N, correction, \*X, strideX )
272+
273+
Computes the [standard deviation][standard-deviation] of a single-precision floating-point strided array.
274+
275+
```c
276+
const float x[] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f };
277+
278+
float v = stdlib_strided_sstdev( 4, 1.0f, x, 2 );
279+
// returns 2.581989f
280+
```
281+
282+
The function accepts the following arguments:
283+
284+
- **N**: `[in] CBLAS_INT` number of indexed elements.
285+
- **correction**: `[in] float` degrees of freedom adjustment. Setting this parameter to a value other than `0` has the effect of adjusting the divisor during the calculation of the [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).
286+
- **X**: `[in] float*` input array.
287+
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
288+
289+
```c
290+
float stdlib_strided_sstdev( const CBLAS_INT N, const float correction, const float *X, const CBLAS_INT strideX );
291+
```
292+
293+
#### stdlib_strided_sstdev_ndarray( N, correction, \*X, strideX, offsetX )
294+
295+
Computes the [standard deviation][standard-deviation] of a single-precision floating-point strided array using alternative indexing semantics.
296+
297+
```c
298+
const float x[] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f };
299+
300+
float v = stdlib_strided_sstdev_ndarray( 4, 1.0f, x, 2, 0 );
301+
// returns 2.581989f
302+
```
303+
304+
The function accepts the following arguments:
305+
306+
- **N**: `[in] CBLAS_INT` number of indexed elements.
307+
- **correction**: `[in] float` degrees of freedom adjustment. Setting this parameter to a value other than `0` has the effect of adjusting the divisor during the calculation of the [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).
308+
- **X**: `[in] float*` input array.
309+
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
310+
- **offsetX**: `[in] CBLAS_INT` starting index for `X`.
311+
312+
```c
313+
float stdlib_strided_sstdev_ndarray( const CBLAS_INT N, const float correction, const float *X, const CBLAS_INT strideX, const CBLAS_INT offsetX );
314+
```
315+
316+
</section>
317+
318+
<!-- /.usage -->
319+
320+
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
321+
322+
<section class="notes">
323+
324+
</section>
325+
326+
<!-- /.notes -->
327+
328+
<!-- C API usage examples. -->
329+
330+
<section class="examples">
331+
332+
### Examples
333+
334+
```c
335+
#include "stdlib/stats/base/sstdev.h"
336+
#include <stdio.h>
337+
338+
int main( void ) {
339+
// Create a strided array:
340+
const float x[] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f };
341+
342+
// Specify the number of elements:
343+
const int N = 4;
344+
345+
// Specify the stride length:
346+
const int strideX = 2;
347+
348+
// Compute the standard deviation:
349+
float v = stdlib_strided_sstdev( N, 1.0f, x, strideX );
350+
351+
// Print the result:
352+
printf( "sample standard deviation: %f\n", v );
353+
}
354+
```
355+
356+
</section>
357+
358+
<!-- /.examples -->
359+
360+
</section>
361+
362+
<!-- /.c -->
363+
262364
<section class="references">
263365
366+
* * *
367+
264368
## References
265369
266370
- Neely, Peter M. 1966. "Comparison of Several Algorithms for Computation of Means, Standard Deviations and Correlation Coefficients." _Communications of the ACM_ 9 (7). Association for Computing Machinery: 496–99. doi:[10.1145/365719.365958][@neely:1966a].

0 commit comments

Comments
 (0)