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
Copy file name to clipboardExpand all lines: lib/node_modules/@stdlib/blas/ext/base/snansumkbn2/README.md
+124-9
Original file line number
Diff line number
Diff line change
@@ -36,7 +36,7 @@ limitations under the License.
36
36
var snansumkbn2 =require( '@stdlib/blas/ext/base/snansumkbn2' );
37
37
```
38
38
39
-
#### snansumkbn2( N, x, stride )
39
+
#### snansumkbn2( N, x, strideX )
40
40
41
41
Computes the sum of single-precision floating-point strided array elements, ignoring `NaN` values and using a second-order iterative Kahan–Babuška algorithm.
42
42
@@ -45,17 +45,17 @@ var Float32Array = require( '@stdlib/array/float32' );
45
45
46
46
var x =newFloat32Array( [ 1.0, -2.0, NaN, 2.0 ] );
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:
@@ -80,7 +80,7 @@ var v = snansumkbn2( 4, x1, 2 );
80
80
// returns 5.0
81
81
```
82
82
83
-
#### snansumkbn2.ndarray( N, x, stride, offset )
83
+
#### snansumkbn2.ndarray( N, x, strideX, offsetX )
84
84
85
85
Computes the sum of single-precision floating-point strided array elements, ignoring `NaN` values and using a second-order iterative Kahan–Babuška algorithm and alternative indexing semantics.
86
86
@@ -89,15 +89,15 @@ var Float32Array = require( '@stdlib/array/float32' );
89
89
90
90
var x =newFloat32Array( [ 1.0, -2.0, NaN, 2.0 ] );
91
91
92
-
var v =snansumkbn2.ndarray( 4, x, 1, 0 );
92
+
var v =snansumkbn2.ndarray( x.length, x, 1, 0 );
93
93
// returns 1.0
94
94
```
95
95
96
96
The function has the following additional parameters:
97
97
98
-
-**offset**: starting index for `x`.
98
+
-**offsetX**: starting index.
99
99
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 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:
@@ -135,7 +135,7 @@ var filledarrayBy = require( '@stdlib/array/filled-by' );
135
135
var snansumkbn2 =require( '@stdlib/blas/ext/base/snansumkbn2' );
136
136
137
137
functionrand() {
138
-
if ( bernoulli( 0.8 ) >0 ) {
138
+
if ( bernoulli( 0.5 ) <1 ) {
139
139
returndiscreteUniform( 0, 100 );
140
140
}
141
141
returnNaN;
@@ -152,8 +152,123 @@ console.log( v );
152
152
153
153
<!-- /.examples -->
154
154
155
+
<!-- C interface documentation. -->
156
+
155
157
* * *
156
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/snansumkbn2.h"
179
+
```
180
+
181
+
#### stdlib_strided_snansumkbn2( N, \*X, strideX )
182
+
183
+
Computes the sum of single-precision floating-point strided array elements, ignoring `NaN` values and using a second-order iterative 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_snansumkbn2( 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_snansumkbn2_ndarray( N, \*X, strideX, offsetX )
203
+
204
+
Computes the sum of single-precision floating-point strided array elements, ignoring `NaN` values and using a second-order iterative 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_snansumkbn2_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