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