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
@@ -116,18 +116,16 @@ The function has the following parameters:
116
116
-**N**: number of indexed elements.
117
117
-**correction**: degrees of freedom adjustment. Setting this parameter to a value other than `0` has the effect of adjusting the divisor during the calculation of the [standard deviation][standard-deviation] according to `N-c` where `c` corresponds to the provided degrees of freedom adjustment. When computing the [standard deviation][standard-deviation] of a population, setting this parameter to `0` is the standard choice (i.e., the provided array contains data constituting an entire population). When computing the corrected sample [standard deviation][standard-deviation], setting this parameter to `1` is the standard choice (i.e., the provided array contains data sampled from a larger population; this is commonly referred to as Bessel's correction).
The `N` and `stride` parameters determine which elements in `x` are accessed at runtime. For example, to compute the [standard deviation][standard-deviation] of every other element in `x`,
121
+
The `N` and stride parameters determine which elements in the strided array are accessed at runtime. For example, to compute the [standard deviation][standard-deviation] of every other element in `x`,
var floor =require( '@stdlib/math/base/special/floor' );
126
125
127
126
var x =newFloat64Array( [ 1.0, 2.0, 2.0, -7.0, -2.0, 3.0, 4.0, 2.0, NaN ] );
128
-
varN=floor( x.length/2 );
129
127
130
-
var v =dnanstdev( N, 1, x, 2 );
128
+
var v =dnanstdev( 4, 1, x, 2 );
131
129
// returns 2.5
132
130
```
133
131
@@ -142,13 +140,11 @@ var floor = require( '@stdlib/math/base/special/floor' );
142
140
var x0 =newFloat64Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0, NaN ] );
143
141
var x1 =newFloat64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
144
142
145
-
varN=floor( x0.length/2 );
146
-
147
-
var v =dnanstdev( N, 1, x1, 2 );
143
+
var v =dnanstdev( 4, 1, x1, 2 );
148
144
// returns 2.5
149
145
```
150
146
151
-
#### dnanstdev.ndarray( N, correction, x, stride, offset )
147
+
#### dnanstdev.ndarray( N, correction, x, strideX, offsetX )
152
148
153
149
Computes the [standard deviation][standard-deviation] of a double-precision floating-point strided array ignoring `NaN` values and using alternative indexing semantics.
154
150
@@ -163,18 +159,16 @@ var v = dnanstdev.ndarray( x.length, 1, x, 1, 0 );
163
159
164
160
The function has the following additional parameters:
165
161
166
-
-**offset**: starting index for `x`.
162
+
-**offsetX**: starting index for `x`.
167
163
168
-
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 [standard deviation][standard-deviation] for every other value in `x` starting from the second value
164
+
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 [standard deviation][standard-deviation] for every other element in `x` starting from the second element
var floor =require( '@stdlib/math/base/special/floor' );
173
168
174
169
var x =newFloat64Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] );
175
-
varN=floor( x.length/2 );
176
170
177
-
var v =dnanstdev.ndarray( N, 1, x, 2, 1 );
171
+
var v =dnanstdev.ndarray( 4, 1, x, 2, 1 );
178
172
// returns 2.5
179
173
```
180
174
@@ -222,6 +216,125 @@ console.log( v );
222
216
223
217
<!-- /.examples -->
224
218
219
+
<!-- C interface documentation. -->
220
+
221
+
* * *
222
+
223
+
<sectionclass="c">
224
+
225
+
## C APIs
226
+
227
+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
228
+
229
+
<sectionclass="intro">
230
+
231
+
</section>
232
+
233
+
<!-- /.intro -->
234
+
235
+
<!-- C usage documentation. -->
236
+
237
+
<sectionclass="usage">
238
+
239
+
### Usage
240
+
241
+
```c
242
+
#include"stdlib/stats/base/dnanstdev.h"
243
+
```
244
+
245
+
#### stdlib_strided_dnanstdev( N, \*X, strideX )
246
+
247
+
Computes the standard deviation of a double-precision floating-point strided array ignoring `NaN` values.
double v = stdlib_strided_dnanstdev( 6, 1.0, x, 2 );
253
+
// returns 2.0736
254
+
```
255
+
256
+
The function accepts the following arguments:
257
+
258
+
- **N**: `[in] CBLAS_INT` number of indexed elements.
259
+
- **correction**: `[in] double` degrees of freedom adjustment. Setting this parameter to a value other than `0` has the effect of adjusting the divisor during the calculation of the [standard deviation][standard-deviation] according to `N-c` where `c` corresponds to the provided degrees of freedom adjustment. When computing the [standard deviation][standard-deviation] of a population, setting this parameter to `0` is the standard choice (i.e., the provided array contains data constituting an entire population). When computing the corrected sample [standard deviation][standard-deviation], setting this parameter to `1` is the standard choice (i.e., the provided array contains data sampled from a larger population; this is commonly referred to as Bessel's correction).
260
+
- **X**: `[in] double*` input array.
261
+
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
double v = stdlib_strided_dnanstdev_ndarray( 6, 1.0, x, 2, 1 );
275
+
// returns 2.0736
276
+
```
277
+
278
+
The function accepts the following arguments:
279
+
280
+
- **N**: `[in] CBLAS_INT` number of indexed elements.
281
+
- **correction**: `[in] double` degrees of freedom adjustment. Setting this parameter to a value other than `0` has the effect of adjusting the divisor during the calculation of the [standard deviation][standard-deviation] according to `N-c` where `c` corresponds to the provided degrees of freedom adjustment. When computing the [standard deviation][standard-deviation] of a population, setting this parameter to `0` is the standard choice (i.e., the provided array contains data constituting an entire population). When computing the corrected sample [standard deviation][standard-deviation], setting this parameter to `1` is the standard choice (i.e., the provided array contains data sampled from a larger population; this is commonly referred to as Bessel's correction).
282
+
- **X**: `[in] double*` input array.
283
+
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
284
+
- **offsetX**: `[in] CBLAS_INT` starting index for `X`.
0 commit comments