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 <135586571+corsairier@users.noreply.github.com>
4343
Dhanyabad behera <110620935+dhanyabad11@users.noreply.github.com>
4444
Dhruv Arvind Singh <154677013+DhruvArvindSingh@users.noreply.github.com>
4545
Dhruvil Mehta <68022411+dhruvilmehta@users.noreply.github.com>
46+
Dipjyoti Das <126075231+dipexplorer@users.noreply.github.com>
4647
Divyansh Seth <59174836+sethdivyansh@users.noreply.github.com>
4748
Dominic Lim <46486515+domlimm@users.noreply.github.com>
4849
Dominik Moritz <domoritz@gmail.com>
4950
Dorrin Sotoudeh <dorrinsotoudeh123@gmail.com>
5051
EuniceSim142 <77243938+EuniceSim142@users.noreply.github.com>
5152
Frank Kovacs <fran70kk@gmail.com>
5253
GK Bishnoi <gkishan1kyt@gmail.com>
54+
GURU PRASAD SHARMA <168292003+GURUPRASADSHARMA@users.noreply.github.com>
5355
Gaurav <gaurav70380@gmail.com>
5456
Gautam sharma <gautamkrishnasharma1@gmail.com>
57+
Girish Garg <garggirish2020@gmail.com>
5558
Golden Kumar <103646877+AuenKr@users.noreply.github.com>
5659
Gunj Joshi <gunjjoshi8372@gmail.com>
5760
Gururaj Gurram <gururajgurram1512@gmail.com>
5861
Haroon Rasheed <51189276+haroon26@users.noreply.github.com>
59-
Harsh <149176984+hrshya@users.noreply.github.com>
62+
Harsh <harshyadav6078@gmail.com>
6063
HarshaNP <96897754+GittyHarsha@users.noreply.github.com>
6164
Harshita Kalani <harshitakalani02@gmail.com>
65+
Hemang Choudhary <coehemang@gmail.com>
6266
Hemant M Mehta <92446645+hemantmm@users.noreply.github.com>
6367
Hridyanshu <124202756+HRIDYANSHU054@users.noreply.github.com>
6468
Jaimin Godhani <112328542+Jai0401@users.noreply.github.com>
@@ -75,16 +79,19 @@ Jordan Gallivan <115050475+Jordan-Gallivan@users.noreply.github.com>
7579
Joris Labie <joris.labie1@gmail.com>
7680
Justin Dennison <justin1dennison@gmail.com>
7781
Justyn Shelby <96994781+ShelbyJustyn@users.noreply.github.com>
78-
Karan Anand <119553199+anandkaranubc@users.noreply.github.com>
82+
Karan Anand <anandkarancompsci@gmail.com>
83+
Karan Yadav <77043443+karanBRAVO@users.noreply.github.com>
7984
Karthik Prakash <116057817+skoriop@users.noreply.github.com>
8085
Kaushikgtm <162317291+Kaushikgtm@users.noreply.github.com>
8186
Kavyansh-Bagdi <153486713+Kavyansh-Bagdi@users.noreply.github.com>
8287
Kohantika Nath <145763549+kohantikanath@users.noreply.github.com>
8388
Krishnam Agarwal <83017176+888krishnam@users.noreply.github.com>
8489
Krishnendu Das <86651039+itskdhere@users.noreply.github.com>
8590
Kshitij-Dale <152467202+Kshitij-Dale@users.noreply.github.com>
91+
Lalit Narayan Yadav <162928571+LalitNarayanYadav@users.noreply.github.com>
8692
Lovelin Dhoni J B <100030865+lovelindhoni@users.noreply.github.com>
8793
MANI <77221000+Eternity0207@users.noreply.github.com>
94+
Mahfuza Humayra Mohona <mhmohona@gmail.com>
8895
Manik Sharma <maniksharma.rke@gmail.com>
8996
Manvith M <148960168+manvith2003@users.noreply.github.com>
9097
Marcus Fantham <mfantham@users.noreply.github.com>
@@ -95,10 +102,14 @@ Mohammad Bin Aftab <48010758+MohammadBinAftab@users.noreply.github.com>
95102
Mohammad Kaif <mdkaifprofession@gmail.com>
96103
Momtchil Momtchev <momtchil@momtchev.com>
97104
Muhammad Haris <harriskhan047@outlook.com>
105+
Muhammad Taaha Tariq <166188821+Taaha-Tariq@users.noreply.github.com>
106+
Muhmmad Saad <106260977+saad-imran-dev@users.noreply.github.com>
98107
Naresh Jagadeesan <naresh.naresh000@gmail.com>
99108
Naveen Kumar <stupiddint@gmail.com>
100109
Neeraj Pathak <neerajrpathak710@gmail.com>
110+
NirvedMishra <139633597+NirvedMishra@users.noreply.github.com>
101111
Nishant Shinde <97207366+nishant-s7@users.noreply.github.com>
112+
Nishant singh <38534128+Nishantsingh11@users.noreply.github.com>
102113
Nishchay Rajput <121144841+NishchayRajput@users.noreply.github.com>
103114
Nithin Katta <88046362+nithinkatta@users.noreply.github.com>
104115
Nourhan Hasan <109472010+TheNourhan@users.noreply.github.com>
@@ -111,8 +122,10 @@ Prajwal Kulkarni <prajwalkulkarni76@gmail.com>
111122
Pranav Goswami <pranavchiku11@gmail.com>
112123
Pranjal Jha <97080887+PraneGIT@users.noreply.github.com>
113124
Prashant Kumar Yadav <144602492+0PrashantYadav0@users.noreply.github.com>
125+
PrathamBhamare <164445568+PrathamBhamare@users.noreply.github.com>
114126
Pratik Singh <97464067+Pratik772846@users.noreply.github.com>
115127
Pratyush Kumar Chouhan <pratyushkumar0308@gmail.com>
128+
Pravesh Kunwar <praveshkunwar04@gmail.com>
116129
Priyansh Prajapati <88396544+itsspriyansh@users.noreply.github.com>
117130
Priyanshu Agarwal <113460573+AgPriyanshu18@users.noreply.github.com>
118131
Pulkit Gupta <65711278+pulkitgupta2@users.noreply.github.com>
@@ -126,12 +139,15 @@ Rishav <115060907+rishav2404@users.noreply.github.com>
126139
Rishav Tarway <rishavtarway@gmail.com>
127140
Robert Gislason <gztown2216@yahoo.com>
128141
Roman Stetsyk <25715951+romanstetsyk@users.noreply.github.com>
142+
Rupa <102663541+Rupa-Rd@users.noreply.github.com>
129143
Rutam Kathale <138517416+performant23@users.noreply.github.com>
130144
Ruthwik Chikoti <145591715+ruthwikchikoti@users.noreply.github.com>
131145
Ryan Seal <splrk@users.noreply.github.com>
132146
Rylan Yang <137365285+rylany27@users.noreply.github.com>
133147
SAHIL KUMAR <168997976+sahilk45@users.noreply.github.com>
134148
SHIVAM YADAV <120725381+Shivam-1827@users.noreply.github.com>
149+
Sahil Goyal <87982509+sahil20021008@users.noreply.github.com>
150+
Sai Avinash <120403424+nasarobot@users.noreply.github.com>
135151
Sai Srikar Dumpeti <80447788+the-r3aper7@users.noreply.github.com>
136152
Sanchay Ketan Sinha <122982233+satansin123@users.noreply.github.com>
137153
Sarthak Paandey <145528240+SarthakPaandey@users.noreply.github.com>
@@ -166,11 +182,15 @@ Yaswanth Kosuru <116426380+yaswanthkosuru@users.noreply.github.com>
166182
Yernar Yergaziyev <yernar.yergaziyev@erg.kz>
167183
Yugal Kaushik <yugalkaushik14@gmail.com>
168184
Yuvi Mittal <128018763+yuvi-mittal@users.noreply.github.com>
185+
devshree-bhati <147095250+devshree-bhati@users.noreply.github.com>
169186
ditsu <170345142+ditsus@users.noreply.github.com>
170187
ekambains <bainsinbusiness@gmail.com>
171188
fadiothman22 <48636283+fadiothman22@users.noreply.github.com>
189+
iraandrushko <71790513+iraandrushko@users.noreply.github.com>
190+
lohithganni <116790357+lohithganni@users.noreply.github.com>
172191
olenkabilonizhka <62379231+olenkabilonizhka@users.noreply.github.com>
173192
pranav-1720 <123018993+pranav-1720@users.noreply.github.com>
174193
rahulrangers <127782777+rahulrangers@users.noreply.github.com>
175194
rainn <88160429+AmCodesLame@users.noreply.github.com>
176195
rei2hu <reimu@reimu.ws>
196+
zhanggy <geodaoyu@foxmail.com>

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)