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
Display the source diff
Display the rich diff
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-02-03)
8
+
9
+
<sectionclass="features">
10
+
11
+
### Features
12
+
13
+
-[`7feea68`](https://github.com/stdlib-js/stdlib/commit/7feea68e633b9044a8bb6c8b3741f5708395dd97) - add C ndarray interface and refactor implementation for `stats/base/dvariancepn`[(#4688)](https://github.com/stdlib-js/stdlib/pull/4688)
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
-
-[`9e3fd66`](https://github.com/stdlib-js/stdlib/commit/9e3fd661879b02f4200c28c3629fb122fa055d4b) - **refactor:** update `stats/base/dvariancepn` native addon from C++ to C [(#4279)](https://github.com/stdlib-js/stdlib/pull/4279)_(by Vivek maurya)_
25
+
-[`7feea68`](https://github.com/stdlib-js/stdlib/commit/7feea68e633b9044a8bb6c8b3741f5708395dd97) - **feat:** add C ndarray interface and refactor implementation for `stats/base/dvariancepn`[(#4688)](https://github.com/stdlib-js/stdlib/pull/4688)_(by Prashant Kumar Yadav, Athan Reines)_
26
+
-[`9e3fd66`](https://github.com/stdlib-js/stdlib/commit/9e3fd661879b02f4200c28c3629fb122fa055d4b) - **refactor:** update `stats/base/dvariancepn` native addon from C++ to C [(#4279)](https://github.com/stdlib-js/stdlib/pull/4279)_(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 [variance][variance] according to `N-c` where `c` corresponds to the provided degrees of freedom adjustment. When computing the [variance][variance] 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 unbiased sample [variance][variance], 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 [variance][variance] 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 [variance][variance] of every other element in `x`,
var v =dvariancepn.ndarray( x.length, 1, x, 1, 0 );
196
189
// returns ~4.33333
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 [variance][variance] 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 [variance][variance] for every other element in `x` starting from the second element
var discreteUniform =require( '@stdlib/random-array-discrete-uniform' );
241
230
var dvariancepn =require( '@stdlib/stats-base-dvariancepn' );
242
231
243
-
var x;
244
-
var i;
245
-
246
-
x =newFloat64Array( 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':'float64'
234
+
});
250
235
console.log( x );
251
236
252
237
var v =dvariancepn( x.length, 1, x, 1 );
@@ -257,6 +242,125 @@ console.log( v );
257
242
258
243
<!-- /.examples -->
259
244
245
+
<!-- C interface documentation. -->
246
+
247
+
* * *
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/dvariancepn.h"
269
+
```
270
+
271
+
#### stdlib_strided_dvariancepn( N, correction, \*X, strideX )
272
+
273
+
Computes the [variance][variance] of a double-precision floating-point strided array using a two-pass algorithm.
double v = stdlib_strided_dvariancepn( 8, 1.0, x, 1 );
279
+
// returns 6.0
280
+
```
281
+
282
+
The function accepts the following arguments:
283
+
284
+
- **N**: `[in] CBLAS_INT` number of indexed elements.
285
+
- **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 [variance][variance] according to `N-c` where `c` corresponds to the provided degrees of freedom adjustment. When computing the [variance][variance] 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 unbiased sample [variance][variance], 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] double*` input array.
287
+
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
double v = stdlib_strided_dvariancepn_ndarray( 4, 1.0, x, 2, 0 );
301
+
// returns ~6.666667
302
+
```
303
+
304
+
The function accepts the following arguments:
305
+
306
+
- **N**: `[in] CBLAS_INT` number of indexed elements.
307
+
- **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 [variance][variance] according to `N-c` where `c` corresponds to the provided degrees of freedom adjustment. When computing the [variance][variance] 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 unbiased sample [variance][variance], 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] double*` input array.
309
+
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
310
+
- **offsetX**: `[in] CBLAS_INT` starting index for `X`.
0 commit comments