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
-**out**: output [`Float64Array`][@stdlib/array/float64] whose first element is the sum and whose second element is the number of non-NaN elements.
59
-
-**strideOut**: index increment for `out`.
59
+
-**strideOut**: stride length for `out`.
60
60
61
-
The `N` and `stride` parameters determine which elements in the strided array are accessed at runtime. For example, to compute the sum of every other element in the strided array,
61
+
The `N` and stride parameters determine which elements in the strided array are accessed at runtime. For example, to compute the sum of every other element in the strided array:
@@ -106,7 +106,7 @@ The function has the following additional parameters:
106
106
-**offsetX**: starting index for `x`.
107
107
-**offsetOut**: starting index for `out`.
108
108
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 sum of every other value in the strided array starting from the second value
109
+
While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameters support indexing semantics based on starting indices. For example, to calculate the sum of every other element starting from the second element:
var dnannsum =require( '@stdlib/blas/ext/base/dnannsum' );
147
147
148
-
functionclbk() {
148
+
functionrand() {
149
149
if ( bernoulli( 0.7 ) >0 ) {
150
150
returndiscreteUniform( 0, 100 );
151
151
}
152
152
returnNaN;
153
153
}
154
154
155
-
var x =filledarrayBy( 10, 'float64', clbk );
155
+
var x =filledarrayBy( 10, 'float64', rand );
156
156
console.log( x );
157
157
158
158
var out =newFloat64Array( 2 );
@@ -164,6 +164,136 @@ console.log( out );
164
164
165
165
<!-- /.examples -->
166
166
167
+
<!-- C interface documentation. -->
168
+
169
+
* * *
170
+
171
+
<sectionclass="c">
172
+
173
+
## C APIs
174
+
175
+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
176
+
177
+
<sectionclass="intro">
178
+
179
+
</section>
180
+
181
+
<!-- /.intro -->
182
+
183
+
<!-- C usage documentation. -->
184
+
185
+
<sectionclass="usage">
186
+
187
+
### Usage
188
+
189
+
```c
190
+
#include"stdlib/blas/ext/base/dnannsum.h"
191
+
```
192
+
193
+
#### stdlib_strided_dnannsum( N, \*X, strideX, \*n )
194
+
195
+
Computes the sum of double-precision floating-point strided array elements, ignoring `NaN` values.
196
+
197
+
```c
198
+
#include"stdlib/blas/base/shared.h"
199
+
200
+
constdouble x[] = { 1.0, 2.0, 0.0/0.0, 4.0 };
201
+
CBLAS_INT n = 0;
202
+
203
+
double v = stdlib_strided_dnannsum( 4, x, 1, &n );
204
+
// returns 7.0
205
+
```
206
+
207
+
The function accepts the following arguments:
208
+
209
+
- **N**: `[in] CBLAS_INT` number of indexed elements.
210
+
- **X**: `[in] double*` input array.
211
+
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
212
+
- **n**: `[out] CBLAS_INT*` pointer for storing the number of non-NaN elements.
0 commit comments