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
+16-4Lines changed: 16 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -4,15 +4,26 @@
4
4
5
5
<sectionclass="release"id="unreleased">
6
6
7
-
## Unreleased (2024-12-27)
7
+
## Unreleased (2025-01-08)
8
+
9
+
<sectionclass="features">
10
+
11
+
### Features
12
+
13
+
-[`4fae05a`](https://github.com/stdlib-js/stdlib/commit/4fae05a8a8d1851c1619b58d1b262fd903cec395) - add C ndarray interface and refactor implementation for `stats/base/dstdevtk`[(#4621)](https://github.com/stdlib-js/stdlib/pull/4621)
14
+
15
+
</section>
16
+
17
+
<!-- /.features -->
8
18
9
19
<sectionclass="commits">
10
20
11
21
### Commits
12
22
13
23
<details>
14
24
15
-
-[`f03f6b7`](https://github.com/stdlib-js/stdlib/commit/f03f6b79ceb1324b6e17099163167ea56fb9695d) - **refactor:** update `stats/base/dstdevtk` native addon from C++ to C [(#4273)](https://github.com/stdlib-js/stdlib/pull/4273)_(by Vivek maurya)_
25
+
-[`4fae05a`](https://github.com/stdlib-js/stdlib/commit/4fae05a8a8d1851c1619b58d1b262fd903cec395) - **feat:** add C ndarray interface and refactor implementation for `stats/base/dstdevtk`[(#4621)](https://github.com/stdlib-js/stdlib/pull/4621)_(by Aayush Khanna, Athan Reines)_
26
+
-[`f03f6b7`](https://github.com/stdlib-js/stdlib/commit/f03f6b79ceb1324b6e17099163167ea56fb9695d) - **refactor:** update `stats/base/dstdevtk` native addon from C++ to C [(#4273)](https://github.com/stdlib-js/stdlib/pull/4273)_(by Vivek Maurya)_
16
27
-[`62364f6`](https://github.com/stdlib-js/stdlib/commit/62364f62ea823a3b52c2ad25660ecd80c71f8f36) - **style:** fix C comment alignment _(by Philipp Burckhardt)_
17
28
-[`9e689ff`](https://github.com/stdlib-js/stdlib/commit/9e689ffcb7c6223afc521f1e574b42f10921cf5e) - **chore:** fix indentation in manifest.json files _(by Philipp Burckhardt)_
@@ -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`,
var x1 =newFloat64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
178
174
179
-
varN=floor( x0.length/2 );
180
-
181
-
var v =dstdevtk( N, 1, x1, 2 );
175
+
var v =dstdevtk( 4, 1.0, x1, 2 );
182
176
// returns 2.5
183
177
```
184
178
185
-
#### dstdevtk.ndarray( N, correction, x, stride, offset )
179
+
#### dstdevtk.ndarray( N, correction, x, strideX, offsetX )
186
180
187
181
Computes the [standard deviation][standard-deviation] of a double-precision floating-point strided array using a one-pass textbook algorithm and alternative indexing semantics.
var v =dstdevtk.ndarray( x.length, 1.0, x, 1, 0 );
196
189
// returns ~2.0817
197
190
```
198
191
199
192
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' );
242
231
var dstdevtk =require( '@stdlib/stats-base-dstdevtk' );
243
232
244
-
var x;
245
-
var i;
246
-
247
-
x =newFloat64Array( 10 );
248
-
for ( i =0; i <x.length; i++ ) {
249
-
x[ i ] =round( (randu()*100.0) -50.0 );
250
-
}
233
+
var x =discreteUniform( 10, -50, 50, {
234
+
'dtype':'float64'
235
+
});
251
236
console.log( x );
252
237
253
-
var v =dstdevtk( x.length, 1, x, 1 );
238
+
var v =dstdevtk( x.length, 1.0, x, 1 );
254
239
console.log( v );
255
240
```
256
241
257
242
</section>
258
243
259
244
<!-- /.examples -->
260
245
246
+
<!-- C interface documentation. -->
247
+
248
+
* * *
249
+
250
+
<sectionclass="c">
251
+
252
+
## C APIs
253
+
254
+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
255
+
256
+
<sectionclass="intro">
257
+
258
+
</section>
259
+
260
+
<!-- /.intro -->
261
+
262
+
<!-- C usage documentation. -->
263
+
264
+
<sectionclass="usage">
265
+
266
+
### Usage
267
+
268
+
```c
269
+
#include"stdlib/stats/base/dstdevtk.h"
270
+
```
271
+
272
+
#### stdlib_strided_dstdevtk( N, correction, \*X, strideX )
273
+
274
+
Computes the [standard deviation][standard-deviation] of a double-precision floating-point strided array using a one-pass textbook algorithm.
275
+
276
+
```c
277
+
constdouble x[] = { 1.0, -2.0, 2.0 };
278
+
279
+
double v = stdlib_strided_dstdevtk( 3, 1.0, x, 1 );
280
+
// returns ~2.0817
281
+
```
282
+
283
+
The function accepts the following arguments:
284
+
285
+
- **N**: `[in] CBLAS_INT` number of indexed elements.
286
+
- **correction**: `[in] double` 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).
287
+
- **X**: `[in] double*` input array.
288
+
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
#### stdlib_strided_dstdevtk_ndarray( N, correction, \*X, strideX, offsetX )
295
+
296
+
Computes the [standard deviation][standard-deviation] of a double-precision floating-point strided array using a one-pass textbook algorithm and alternative indexing semantics.
297
+
298
+
```c
299
+
constdouble x[] = { 1.0, -2.0, 2.0 };
300
+
301
+
double v = stdlib_strided_dstdevtk_ndarray( 3, 1.0, x, 1, 0 );
302
+
// returns ~2.0817
303
+
```
304
+
305
+
The function accepts the following arguments:
306
+
307
+
- **N**: `[in] CBLAS_INT` number of indexed elements.
308
+
- **correction**: `[in] double` 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).
309
+
- **X**: `[in] double*` input array.
310
+
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
311
+
- **offsetX**: `[in] CBLAS_INT` starting index for `X`.
0 commit comments