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 single-precision floating-point strided array elements, ignoring `NaN` values and using an improved Kahan–Babuška algorithm and alternative indexing semantics.
87
86
@@ -96,9 +95,9 @@ var v = snansumkbn.ndarray( 4, x, 1, 0 );
96
95
97
96
The function has the following additional parameters:
98
97
99
-
-**offset**: starting index for `x`.
98
+
-**offsetX**: starting index.
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,7 +135,7 @@ var filledarrayBy = require( '@stdlib/array/filled-by' );
136
135
var snansumkbn =require( '@stdlib/blas/ext/base/snansumkbn' );
137
136
138
137
functionrand() {
139
-
if ( bernoulli( 0.8 ) >0 ) {
138
+
if ( bernoulli( 0.5 ) <1 ) {
140
139
returndiscreteUniform( 0, 100 );
141
140
}
142
141
returnNaN;
@@ -153,8 +152,123 @@ console.log( v );
153
152
154
153
<!-- /.examples -->
155
154
155
+
<!-- C interface documentation. -->
156
+
156
157
* * *
157
158
159
+
<sectionclass="c">
160
+
161
+
## C APIs
162
+
163
+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
164
+
165
+
<sectionclass="intro">
166
+
167
+
</section>
168
+
169
+
<!-- /.intro -->
170
+
171
+
<!-- C usage documentation. -->
172
+
173
+
<sectionclass="usage">
174
+
175
+
### Usage
176
+
177
+
```c
178
+
#include"stdlib/blas/ext/base/snansumkbn.h"
179
+
```
180
+
181
+
#### stdlib_strided_snansumkbn( N, \*X, strideX )
182
+
183
+
Computes the sum of single-precision floating-point strided array elements, ignoring `NaN` values and using an improved Kahan–Babuška algorithm.
184
+
185
+
```c
186
+
constfloat x[] = { 1.0f, 2.0f, 0.0f/0.0f, 4.0f };
187
+
188
+
float v = stdlib_strided_snansumkbn( 4, x, 1 );
189
+
// returns 7.0f
190
+
```
191
+
192
+
The function accepts the following arguments:
193
+
194
+
- **N**: `[in] CBLAS_INT` number of indexed elements.
#### stdlib_strided_snansumkbn_ndarray( N, \*X, strideX, offsetX )
203
+
204
+
Computes the sum of single-precision floating-point strided array elements, ignoring `NaN` values and using an improved Kahan–Babuška algorithm and alternative indexing semantics.
205
+
206
+
```c
207
+
constfloat x[] = { 1.0f, 2.0f, 0.0f/0.0f, 4.0f };
208
+
209
+
float v = stdlib_strided_snansumkbn_ndarray( 4, x, 1, 0 );
210
+
// returns 7.0f
211
+
```
212
+
213
+
The function accepts the following arguments:
214
+
215
+
- **N**: `[in] CBLAS_INT` number of indexed elements.
0 commit comments