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