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,36 +51,33 @@ The [arithmetic mean][arithmetic-mean] is defined as
51
51
var dsmeanwd =require( '@stdlib/stats/base/dsmeanwd' );
52
52
```
53
53
54
-
#### dsmeanwd( N, x, stride )
54
+
#### dsmeanwd( N, x, strideX )
55
55
56
56
Computes the [arithmetic mean][arithmetic-mean] of a single-precision floating-point strided array `x` using Welford's algorithm with extended accumulation and returning an extended precision result.
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 `x` are accessed at runtime. For example, to compute the [arithmetic mean][arithmetic-mean] of every other element in `x`,
var x1 =newFloat32Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
97
93
98
-
varN=floor( x0.length/2 );
99
-
100
-
var v =dsmeanwd( N, x1, 2 );
94
+
var v =dsmeanwd( 4, x1, 2 );
101
95
// returns 1.25
102
96
```
103
97
104
-
#### dsmeanwd.ndarray( N, x, stride, offset )
98
+
#### dsmeanwd.ndarray( N, x, strideX, offsetX )
105
99
106
100
Computes the [arithmetic mean][arithmetic-mean] of a single-precision floating-point strided array using Welford's algorithm with extended accumulation and alternative indexing semantics and returning an extended precision result.
var discreteUniform =require( '@stdlib/random/array/discrete-uniform' );
160
149
var dsmeanwd =require( '@stdlib/stats/base/dsmeanwd' );
161
150
162
-
var x;
163
-
var i;
164
-
165
-
x =newFloat32Array( 10 );
166
-
for ( i =0; i <x.length; i++ ) {
167
-
x[ i ] =round( (randu()*100.0) -50.0 );
168
-
}
151
+
var x =discreteUniform( 10, -50, 50, {
152
+
'dtype':'float32'
153
+
});
169
154
console.log( x );
170
155
171
156
var v =dsmeanwd( x.length, x, 1 );
@@ -176,6 +161,107 @@ console.log( v );
176
161
177
162
<!-- /.examples -->
178
163
164
+
<!-- C usage documentation. -->
165
+
166
+
<sectionclass="usage">
167
+
168
+
### Usage
169
+
170
+
```c
171
+
#include"stdlib/stats/base/dsmeanwd.h"
172
+
```
173
+
174
+
#### stdlib_strided_dsmeanwd( N, \*X, strideX )
175
+
176
+
Computes the arithmetic mean of a single-precision floating-point strided array using Welford's algorithm with extended accumulation and returning an extended precision result.
#### stdlib_strided_dsmeanwd_ndarray( N, \*X, strideX, offsetX )
196
+
197
+
Computes the arithmetic mean of a single-precision floating-point strided array using Welford's algorithm with extended accumulation and alternative indexing semantics and returning an extended precision result.
0 commit comments