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 dsmeanpn =require( '@stdlib/stats/base/dsmeanpn' );
52
52
```
53
53
54
-
#### dsmeanpn( N, x, stride )
54
+
#### dsmeanpn( N, x, strideX )
55
55
56
56
Computes the [arithmetic mean][arithmetic-mean] of a single-precision floating-point strided array `x` using a two-pass error correction 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 the strided array 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 =dsmeanpn( N, x1, 2 );
94
+
var v =dsmeanpn( 4, x1, 2 );
101
95
// returns 1.25
102
96
```
103
97
104
-
#### dsmeanpn.ndarray( N, x, stride, offset )
98
+
#### dsmeanpn.ndarray( N, x, strideX, offsetX )
105
99
106
100
Computes the [arithmetic mean][arithmetic-mean] of a single-precision floating-point strided array using a two-pass error correction algorithm with extended accumulation and alternative indexing semantics and returning an extended precision result.
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 =newFloat32Array( [ 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 =dsmeanpn.ndarray( N, x, 2, 1 );
122
+
var v =dsmeanpn.ndarray( 4, x, 2, 1 );
132
123
// returns 1.25
133
124
```
134
125
@@ -141,7 +132,7 @@ var v = dsmeanpn.ndarray( N, x, 2, 1 );
141
132
## Notes
142
133
143
134
- If `N <= 0`, both functions return `NaN`.
144
-
- Accumulated intermediate values are stored as double-precision floating-point numbers.
135
+
- Accumulated intermediate values are stored as double-precision floating-point numbers.
145
136
146
137
</section>
147
138
@@ -176,6 +167,123 @@ console.log( v );
176
167
177
168
<!-- /.examples -->
178
169
170
+
<!-- C interface documentation. -->
171
+
172
+
* * *
173
+
174
+
<sectionclass="c">
175
+
176
+
## C APIs
177
+
178
+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
179
+
180
+
<sectionclass="intro">
181
+
182
+
</section>
183
+
184
+
<!-- /.intro -->
185
+
186
+
<!-- C usage documentation. -->
187
+
188
+
<sectionclass="usage">
189
+
190
+
### Usage
191
+
192
+
```c
193
+
#include"stdlib/stats/base/smax.h"
194
+
```
195
+
196
+
#### stdlib_strided_dsmeanpn( N, \*X, strideX )
197
+
198
+
Computes the arithmetic mean value of a single-precision floating-point strided array.
0 commit comments