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 [range][range] of every other element in `x`,
60
+
The `N` and stride parameters determine which elements in the strided array are accessed at runtime. For example, to compute the [range][range] of every other element in `x`,
var x =newFloat64Array( [ 1.0, -2.0, NaN, 2.0 ] );
99
-
varN=x.length;
100
93
101
-
var v =dnanrange.ndarray( N, x, 1, 0 );
94
+
var v =dnanrange.ndarray( x.length, x, 1, 0 );
102
95
// returns 4.0
103
96
```
104
97
105
98
The function has the following additional parameters:
106
99
107
-
-**offset**: starting index for `x`.
100
+
-**offsetX**: starting index for `x`.
108
101
109
-
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 [range][range] for every other value in `x` starting from the second value
102
+
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 [range][range] for every other element in `x` starting from the second element
var floor =require( '@stdlib/math/base/special/floor' );
114
106
115
107
var x =newFloat64Array( [ 2.0, 1.0, -2.0, -2.0, 3.0, 4.0, NaN, NaN ] );
116
-
varN=floor( x.length/2 );
117
108
118
-
var v =dnanrange.ndarray( N, x, 2, 1 );
109
+
var v =dnanrange.ndarray( 4, x, 2, 1 );
119
110
// returns 6.0
120
111
```
121
112
@@ -166,6 +157,123 @@ console.log( v );
166
157
167
158
<!-- /.examples -->
168
159
160
+
<!-- C interface documentation. -->
161
+
162
+
* * *
163
+
164
+
<sectionclass="c">
165
+
166
+
## C APIs
167
+
168
+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
169
+
170
+
<sectionclass="intro">
171
+
172
+
</section>
173
+
174
+
<!-- /.intro -->
175
+
176
+
<!-- C usage documentation. -->
177
+
178
+
<sectionclass="usage">
179
+
180
+
### Usage
181
+
182
+
```c
183
+
#include"stdlib/stats/base/dnanrange.h"
184
+
```
185
+
186
+
#### stdlib_strided_dnanrange( N, \*X, strideX )
187
+
188
+
Computes the [range][range] of a double-precision floating-point strided array `x`, ignoring `NaN` values.
189
+
190
+
```c
191
+
constdouble x[] = { 1.0, 0.0/0.0, 3.0, -4.0 };
192
+
193
+
double v = stdlib_strided_dnanrange( 4, x, 1 );
194
+
// returns 7.0
195
+
```
196
+
197
+
The function accepts the following arguments:
198
+
199
+
- **N**: `[in] CBLAS_INT` number of indexed elements.
200
+
- **X**: `[in] double*` input array.
201
+
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
0 commit comments