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 the strided array are accessed at runtime. For example, to compute the sum of every other element in `x`,
58
+
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:
Computes the sum of double-precision floating-point strided array elements, ignoring `NaN` values and using pairwise summation and alternative indexing semantics.
87
86
@@ -90,15 +89,15 @@ var Float64Array = require( '@stdlib/array/float64' );
90
89
91
90
var x =newFloat64Array( [ 1.0, -2.0, NaN, 2.0 ] );
92
91
93
-
var v =dnansumpw.ndarray( 4, x, 1, 0 );
92
+
var v =dnansumpw.ndarray( x.length, x, 1, 0 );
94
93
// returns 1.0
95
94
```
96
95
97
96
The function has the following additional parameters:
98
97
99
-
-**offset**: starting index for `x`.
98
+
-**offsetX**: starting index for `x`.
100
99
101
-
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 `x`starting from the second value
100
+
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 element starting from the second element:
@@ -136,14 +135,14 @@ var bernoulli = require( '@stdlib/random/base/bernoulli' );
136
135
var filledarrayBy =require( '@stdlib/array/filled-by' );
137
136
var dnansumpw =require( '@stdlib/blas/ext/base/dnansumpw' );
138
137
139
-
functionclbk() {
138
+
functionrand() {
140
139
if ( bernoulli( 0.7 ) >0 ) {
141
140
returndiscreteUniform( 0, 100 );
142
141
}
143
142
returnNaN;
144
143
}
145
144
146
-
var x =filledarrayBy( 10, 'float64', clbk );
145
+
var x =filledarrayBy( 10, 'float64', rand );
147
146
console.log( x );
148
147
149
148
var v =dnansumpw( x.length, x, 1 );
@@ -154,8 +153,123 @@ console.log( v );
154
153
155
154
<!-- /.examples -->
156
155
156
+
<!-- C interface documentation. -->
157
+
157
158
* * *
158
159
160
+
<sectionclass="c">
161
+
162
+
## C APIs
163
+
164
+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
165
+
166
+
<sectionclass="intro">
167
+
168
+
</section>
169
+
170
+
<!-- /.intro -->
171
+
172
+
<!-- C usage documentation. -->
173
+
174
+
<sectionclass="usage">
175
+
176
+
### Usage
177
+
178
+
```c
179
+
#include"stdlib/blas/ext/base/dnansumpw.h"
180
+
```
181
+
182
+
#### stdlib_strided_dnansumpw( N, \*X, strideX )
183
+
184
+
Computes the sum of double-precision floating-point strided array elements, ignoring `NaN` values and using pairwise summation.
185
+
186
+
```c
187
+
constdouble x[] = { 1.0, 2.0, 0.0/0.0, 4.0 };
188
+
189
+
double v = stdlib_strided_dnansumpw( 4, x, 1 );
190
+
// returns 7.0
191
+
```
192
+
193
+
The function accepts the following arguments:
194
+
195
+
- **N**: `[in] CBLAS_INT` number of indexed elements.
196
+
- **X**: `[in] double*` input array.
197
+
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
#### stdlib_strided_dnansumpw_ndarray( N, \*X, strideX, offsetX )
204
+
205
+
Computes the sum of double-precision floating-point strided array elements, ignoring `NaN` values and using pairwise summation and alternative indexing semantics.
206
+
207
+
```c
208
+
constdouble x[] = { 1.0, 2.0, 0.0/0.0, 4.0 };
209
+
210
+
double v = stdlib_strided_dnansumpw_ndarray( 4, x, 1, 0 );
211
+
// returns 7.0
212
+
```
213
+
214
+
The function accepts the following arguments:
215
+
216
+
- **N**: `[in] CBLAS_INT` number of indexed elements.
217
+
- **X**: `[in] double*` input array.
218
+
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
219
+
- **offsetX**: `[in] CBLAS_INT` starting index for `X`.
0 commit comments