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
feat: add C ndarray API and refactor blas/ext/base/snansumpw
PR-URL: #3353
Reviewed-by: Muhammad Haris <harriskhan047@outlook.com>
Reviewed-by: Philipp Burckhardt <pburckhardt@outlook.com>
Signed-off-by: Snehil Shah <snehilshah.989@gmail.com>
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:
@@ -81,25 +80,24 @@ var v = snansumpw( 4, x1, 2 );
81
80
// returns 5.0
82
81
```
83
82
84
-
#### snansumpw.ndarray( N, x, stride, offset )
83
+
#### snansumpw.ndarray( N, x, strideX, offsetX )
85
84
86
85
Computes the sum of single-precision floating-point strided array elements, ignoring `NaN` values and using pairwise summation and alternative indexing semantics.
var x =newFloat32Array( [ 1.0, -2.0, NaN, 2.0 ] );
92
-
varN=x.length;
93
91
94
-
var v =snansumpw.ndarray( N, x, 1, 0 );
92
+
var v =snansumpw.ndarray( x.length, x, 1, 0 );
95
93
// returns 1.0
96
94
```
97
95
98
96
The function has the following additional parameters:
99
97
100
-
-**offset**: starting index for `x`.
98
+
-**offsetX**: starting index for `x`.
101
99
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 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:
<!-- 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/snansumpw.h"
180
+
```
181
+
182
+
#### stdlib_strided_snansumpw( N, \*X, strideX )
183
+
184
+
Computes the sum of single-precision floating-point strided array elements, ignoring `NaN` values and using pairwise summation.
#### stdlib_strided_snansumpw_ndarray( N, \*X, strideX, offsetX )
204
+
205
+
Computes the sum of single-precision floating-point strided array elements, ignoring `NaN` values and using pairwise summation and alternative indexing semantics.
* Computes the sum of single-precision floating-point strided array elements, ignoring `NaN` values and using pairwise summation and alternative indexing semantics.
0 commit comments