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: .github/PULL_REQUEST_TEMPLATE.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,6 @@
2
2
3
3
We are excited about your pull request, but unfortunately we are not accepting pull requests against this repository, as all development happens on the [main project repository](https://github.com/stdlib-js/stdlib). We kindly request that you submit this pull request against the [respective directory](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/stats/base/dnanvariancech) of the main repository where we’ll review and provide feedback.
4
4
5
-
If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/development.md) for help on developing stdlib.
5
+
If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/contributing/development.md) for help on developing stdlib.
6
6
7
7
We look forward to receiving your contribution! :smiley:
Copy file name to clipboardExpand all lines: CHANGELOG.md
+12-1Lines changed: 12 additions & 1 deletion
Display the source diff
Display the rich diff
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-01-20)
7
+
## Unreleased (2025-02-23)
8
+
9
+
<sectionclass="features">
10
+
11
+
### Features
12
+
13
+
-[`00b23b3`](https://github.com/stdlib-js/stdlib/commit/00b23b3cb5b4e72bf977a9ac170062f8e8614ef1) - add C ndarray interface and refactor implementation for `stats/base/dnanvariancech`[(#4803)](https://github.com/stdlib-js/stdlib/pull/4803)
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
+
-[`00b23b3`](https://github.com/stdlib-js/stdlib/commit/00b23b3cb5b4e72bf977a9ac170062f8e8614ef1) - **feat:** add C ndarray interface and refactor implementation for `stats/base/dnanvariancech`[(#4803)](https://github.com/stdlib-js/stdlib/pull/4803)_(by Prashant Kumar Yadav)_
15
26
-[`ca5cd8e`](https://github.com/stdlib-js/stdlib/commit/ca5cd8eda51ba2c274b9aeb0161f6c1cdf6a3e09) - **refactor:** update `stats/base/dnanvariancech` native addon from C++ to C [(#4719)](https://github.com/stdlib-js/stdlib/pull/4719)_(by Prashant Kumar Yadav)_
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)_
@@ -131,7 +131,7 @@ To view installation and usage instructions specific to each branch build, be su
131
131
var dnanvariancech =require( '@stdlib/stats-base-dnanvariancech' );
132
132
```
133
133
134
-
#### dnanvariancech( N, correction, x, stride )
134
+
#### dnanvariancech( N, correction, x, strideX )
135
135
136
136
Computes the [variance][variance] of a double-precision floating-point strided array `x` ignoring `NaN` values and using a one-pass trial mean algorithm.
137
137
@@ -149,18 +149,16 @@ The function has the following parameters:
149
149
-**N**: number of indexed elements.
150
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 and `n` corresponds to the number of non-`NaN` indexed elements. 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 x1 =newFloat64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
177
174
178
-
varN=floor( x0.length/2 );
179
-
180
-
var v =dnanvariancech( N, 1, x1, 2 );
175
+
var v =dnanvariancech( 5, 1, x1, 2 );
181
176
// returns 6.25
182
177
```
183
178
184
-
#### dnanvariancech.ndarray( N, correction, x, stride, offset )
179
+
#### dnanvariancech.ndarray( N, correction, x, strideX, offsetX )
185
180
186
181
Computes the [variance][variance] of a double-precision floating-point strided array ignoring `NaN` values and using a one-pass trial mean algorithm and alternative indexing semantics.
var x =newFloat64Array( [ 1.0, -2.0, NaN, 2.0 ] );
186
+
var x =newFloat64Array( [ 1.0, -2.0, 2.0 ] );
192
187
193
188
var v =dnanvariancech.ndarray( x.length, 1, x, 1, 0 );
194
189
// returns ~4.33333
195
190
```
196
191
197
192
The function has the following additional parameters:
198
193
199
-
-**offset**: starting index for `x`.
194
+
-**offsetX**: starting index for `x`.
200
195
201
-
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 dnanvariancech =require( '@stdlib/stats-base-dnanvariancech' );
241
234
242
-
var x;
243
-
var i;
244
-
245
-
x =newFloat64Array( 10 );
246
-
for ( i =0; i <x.length; i++ ) {
247
-
x[ i ] =round( (randu()*100.0) -50.0 );
235
+
functionrand() {
236
+
if ( bernoulli( 0.8 ) <1 ) {
237
+
returnNaN;
238
+
}
239
+
returnuniform( -50.0, 50.0 );
248
240
}
249
-
console.log( x );
241
+
242
+
var x =filledarrayBy( 10, 'float64', rand );
250
243
251
244
var v =dnanvariancech( x.length, 1, x, 1 );
252
245
console.log( v );
@@ -256,6 +249,125 @@ console.log( v );
256
249
257
250
<!-- /.examples -->
258
251
252
+
<!-- C interface documentation. -->
253
+
254
+
* * *
255
+
256
+
<sectionclass="c">
257
+
258
+
## C APIs
259
+
260
+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
261
+
262
+
<sectionclass="intro">
263
+
264
+
</section>
265
+
266
+
<!-- /.intro -->
267
+
268
+
<!-- C usage documentation. -->
269
+
270
+
<sectionclass="usage">
271
+
272
+
### Usage
273
+
274
+
```c
275
+
#include"stdlib/stats/base/dnanvariancech.h"
276
+
```
277
+
278
+
#### stdlib_strided_dnanvariancech( N, correction, \*X, strideX )
279
+
280
+
Computes the [variance][variance] of a double-precision floating-point strided array `x` ignoring `NaN` values and using a one-pass trial mean algorithm.
281
+
282
+
```c
283
+
constdouble x[] = { 1.0, -2.0, 0.0/0.0, 2.0 };
284
+
285
+
double v = stdlib_strided_dnanvariancech( 4, 1.0, x, 1 );
286
+
// returns ~4.3333
287
+
```
288
+
289
+
The function accepts the following arguments:
290
+
291
+
- **N**: `[in] CBLAS_INT` number of indexed elements.
292
+
- **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 and `n` corresponds to the number of non-`NaN` indexed elements. 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).
293
+
- **X**: `[in] double*` input array.
294
+
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
#### stdlib_strided_dnanvariancech_ndarray( N, correction, \*X, strideX, offsetX )
301
+
302
+
Computes the [variance][variance] of a double-precision floating-point strided array ignoring `NaN` values and using a one-pass trial mean algorithm and alternative indexing semantics.
303
+
304
+
```c
305
+
constdouble x[] = { 1.0, -2.0, 0.0/0.0, 2.0 };
306
+
307
+
double v = stdlib_strided_dnanvariancech_ndarray( 4, 1.0, x, 1, 0 );
308
+
// returns ~4.3333
309
+
```
310
+
311
+
The function accepts the following arguments:
312
+
313
+
- **N**: `[in] CBLAS_INT` number of indexed elements.
314
+
- **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 and `n` corresponds to the number of non-`NaN` indexed elements. 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).
315
+
- **X**: `[in] double*` input array.
316
+
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
317
+
- **offsetX**: `[in] CBLAS_INT` starting index for `X`.
0 commit comments