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: lib/node_modules/@stdlib/stats/base/dnanmeanwd/README.md
+128-20
Original file line number
Diff line number
Diff line change
@@ -51,36 +51,33 @@ The [arithmetic mean][arithmetic-mean] is defined as
51
51
var dnanmeanwd =require( '@stdlib/stats/base/dnanmeanwd' );
52
52
```
53
53
54
-
#### dnanmeanwd( N, x, stride )
54
+
#### dnanmeanwd( N, x, strideX )
55
55
56
56
Computes the [arithmetic mean][arithmetic-mean] of a double-precision floating-point strided array `x`, using Welford's algorithm and ignoring `NaN` values.
The `N` and `stride` parameters determine which elements in `x` are accessed at runtime. For example, to compute the [arithmetic mean][arithmetic-mean] of every other element in `x`,
73
+
The `N` and stride parameters determine which elements in the stride array are accessed at runtime. For example, to compute the [arithmetic mean][arithmetic-mean] of every other element in `x`,
var floor =require( '@stdlib/math/base/special/floor' );
94
90
95
91
var x0 =newFloat64Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0, NaN ] );
96
92
var x1 =newFloat64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
97
93
98
-
varN=floor( x0.length/2 );
99
-
100
-
var v =dnanmeanwd( N, x1, 2 );
94
+
var v =dnanmeanwd( 4, x1, 2 );
101
95
// returns 1.25
102
96
```
103
97
104
-
#### dnanmeanwd.ndarray( N, x, stride, offset )
98
+
#### dnanmeanwd.ndarray( N, x, strideX, offsetX )
105
99
106
100
Computes the [arithmetic mean][arithmetic-mean] of a double-precision floating-point strided array, ignoring `NaN` values and using Welford's algorithm and alternative indexing semantics.
var x =newFloat64Array( [ 1.0, -2.0, NaN, 2.0 ] );
112
-
varN=x.length;
113
106
114
-
var v =dnanmeanwd.ndarray( N, x, 1, 0 );
107
+
var v =dnanmeanwd.ndarray( x.length, x, 1, 0 );
115
108
// returns ~0.33333
116
109
```
117
110
118
111
The function has the following additional parameters:
119
112
120
-
-**offset**: starting index for `x`.
113
+
-**offsetX**: starting index for `x`.
121
114
122
-
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 [arithmetic mean][arithmetic-mean] for every other value in `x` starting from the second value
115
+
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 [arithmetic mean][arithmetic-mean] for every other element in `x` starting from the second element
var floor =require( '@stdlib/math/base/special/floor' );
127
119
128
120
var x =newFloat64Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0, NaN ] );
129
-
varN=floor( x.length/2 );
130
121
131
-
var v =dnanmeanwd.ndarray( N, x, 2, 1 );
122
+
var v =dnanmeanwd.ndarray( 4, x, 2, 1 );
132
123
// returns 1.25
133
124
```
134
125
@@ -180,6 +171,123 @@ console.log( v );
180
171
181
172
<!-- /.examples -->
182
173
174
+
<!-- C interface documentation. -->
175
+
176
+
* * *
177
+
178
+
<sectionclass="c">
179
+
180
+
## C APIs
181
+
182
+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
183
+
184
+
<sectionclass="intro">
185
+
186
+
</section>
187
+
188
+
<!-- /.intro -->
189
+
190
+
<!-- C usage documentation. -->
191
+
192
+
<sectionclass="usage">
193
+
194
+
### Usage
195
+
196
+
```c
197
+
#include"stdlib/stats/base/dnanmeanwd.h"
198
+
```
199
+
200
+
#### stdlib_strided_dnanmeanwd( N, \*X, strideX )
201
+
202
+
Computes the arithmetic mean of a double-precision floating-point strided array `x`, using Welford's algorithm and ignoring `NaN` values.
#### stdlib_strided_dnanmeanwd_ndarray( N, \*X, strideX, offsetX )
222
+
223
+
Computes the arithmetic mean of a double-precision floating-point strided array, ignoring `NaN` values and using Welford's algorithm and alternative indexing semantics.
0 commit comments