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 =dmeankbn( N, x1, 2 );
94
+
var v =dmeankbn( 4, x1, 2 );
101
95
// returns 1.25
102
96
```
103
97
104
-
#### dmeankbn.ndarray( N, x, stride, offset )
98
+
#### dmeankbn.ndarray( N, x, strideX, offsetX )
105
99
106
100
Computes the [arithmetic mean][arithmetic-mean] of a double-precision floating-point strided array using an improved Kahan–Babuška 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
#### stdlib_strided_dmeankbn_ndarray( N, \*X, strideX, offsetX )
195
+
196
+
Computes the [arithmetic mean][arithmetic-mean] of a double-precision floating-point strided array using an improved Kahan–Babuška algorithm and alternative indexing semantics.
197
+
198
+
```c
199
+
constdouble x[] = { 1.0, -2.0, 2.0 };
200
+
201
+
double v = stdlib_strided_dmeankbn_ndarray( 3, x, 1, 0 );
202
+
// returns ~0.3333
203
+
```
204
+
205
+
The function accepts the following arguments:
206
+
207
+
- **N**: `[in] CBLAS_INT` number of indexed elements.
208
+
- **X**: `[in] double*` input array.
209
+
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
210
+
- **offsetX**: `[in] CBLAS_INT` starting index for `X`.
0 commit comments