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
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 strided array are accessed at runtime. For example, to compute the [arithmetic mean][arithmetic-mean] of every other element in `x`,
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 =dmeanpn( N, x1, 2 );
94
+
var v =dmeanpn( 4, x1, 2 );
101
95
// returns 1.25
102
96
```
103
97
104
-
#### dmeanpn.ndarray( N, x, stride, offset )
98
+
#### dmeanpn.ndarray( N, x, strideX, offsetX )
105
99
106
100
Computes the [arithmetic mean][arithmetic-mean] of a double-precision floating-point strided array using a two-pass error correction algorithm and alternative indexing semantics.
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 ] );
129
-
varN=floor( x.length/2 );
130
121
131
-
var v =dmeanpn.ndarray( N, x, 2, 1 );
122
+
var v =dmeanpn.ndarray( 4, x, 2, 1 );
132
123
// returns 1.25
133
124
```
134
125
@@ -175,6 +166,123 @@ console.log( v );
175
166
176
167
<!-- /.examples -->
177
168
169
+
<!-- C interface documentation. -->
170
+
171
+
* * *
172
+
173
+
<sectionclass="c">
174
+
175
+
## C APIs
176
+
177
+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
178
+
179
+
<sectionclass="intro">
180
+
181
+
</section>
182
+
183
+
<!-- /.intro -->
184
+
185
+
<!-- C usage documentation. -->
186
+
187
+
<sectionclass="usage">
188
+
189
+
### Usage
190
+
191
+
```c
192
+
#include"stdlib/stats/base/dmeanpn.h"
193
+
```
194
+
195
+
#### stdlib_strided_dmeanpn( N, \*X, strideX )
196
+
197
+
Computes the [arithmetic mean][arithmetic-mean] of a double-precision floating-point strided array using a two-pass error correction algorithm.
#### stdlib_strided_dmeanpn_ndarray( N, \*X, strideX, offsetX )
217
+
218
+
Computes the [arithmetic mean][arithmetic-mean] of a double-precision floating-point strided array using a two-pass error correction algorithm and alternative indexing semantics.
0 commit comments