You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+14-2Lines changed: 14 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -4,14 +4,25 @@
4
4
5
5
<sectionclass="release"id="unreleased">
6
6
7
-
## Unreleased (2025-03-30)
7
+
## Unreleased (2025-05-08)
8
+
9
+
<sectionclass="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 -->
8
18
9
19
<sectionclass="commits">
10
20
11
21
### Commits
12
22
13
23
<details>
14
24
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)_
-[`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)_
17
28
-[`62364f6`](https://github.com/stdlib-js/stdlib/commit/62364f62ea823a3b52c2ad25660ecd80c71f8f36) - **style:** fix C comment alignment _(by Philipp Burckhardt)_
@@ -29,11 +40,12 @@
29
40
30
41
### Contributors
31
42
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:
@@ -150,18 +149,16 @@ The function has the following parameters:
150
149
-**N**: number of indexed elements.
151
150
-**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).
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`,
The function has the following additional parameters:
200
193
201
-
-**offset**: starting index for `x`.
194
+
-**offsetX**: starting index for `x`.
202
195
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
var discreteUniform =require( '@stdlib/random-array-discrete-uniform' );
241
230
var sstdev =require( '@stdlib/stats-base-sstdev' );
242
231
243
-
var x;
244
-
var i;
245
-
246
-
x =newFloat32Array( 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
+
});
250
235
console.log( x );
251
236
252
237
var v =sstdev( x.length, 1, x, 1 );
@@ -257,10 +242,129 @@ console.log( v );
257
242
258
243
<!-- /.examples -->
259
244
245
+
<!-- C interface documentation. -->
246
+
260
247
* * *
261
248
249
+
<sectionclass="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
+
<sectionclass="intro">
256
+
257
+
</section>
258
+
259
+
<!-- /.intro -->
260
+
261
+
<!-- C usage documentation. -->
262
+
263
+
<sectionclass="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.
- **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`.
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`.
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
+
262
364
<section class="references">
263
365
366
+
* * *
367
+
264
368
## References
265
369
266
370
- 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