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 absolute values of every other element in `x`,
73
+
The `N` and stride parameters determine which elements in the strided array are accessed at runtime. For example, to compute the sum of absolute values of every other element:
Computes the sum of absolute values ([_L1_ norm][l1norm]) of single-precision floating-point strided array elements using pairwise summation and alternative indexing semantics.
The function has the following additional parameters:
114
112
115
-
-**offset**: starting index for `x`.
113
+
-**offsetX**: starting index.
116
114
117
-
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 absolute values of every other value in `x`starting from the second value
115
+
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 absolute values of every other element starting from the second element:
@@ -147,11 +145,12 @@ var v = sasumpw.ndarray( 4, x, 2, 1 );
147
145
<!-- eslint no-undef: "error" -->
148
146
149
147
```javascript
150
-
var discreteUniform =require( '@stdlib/random/base/discrete-uniform' ).factory;
151
-
var filledarrayBy =require( '@stdlib/array/filled-by' );
148
+
var discreteUniform =require( '@stdlib/random/array/discrete-uniform' );
152
149
var sasumpw =require( '@stdlib/blas/ext/base/sasumpw' );
153
150
154
-
var x =filledarrayBy( 10, 'float32', discreteUniform( 0, 100 ) );
151
+
var x =discreteUniform( 10, -100, 100, {
152
+
'dtype':'float32'
153
+
});
155
154
console.log( x );
156
155
157
156
var v =sasumpw( x.length, x, 1 );
@@ -162,8 +161,123 @@ console.log( v );
162
161
163
162
<!-- /.examples -->
164
163
164
+
<!-- C interface documentation. -->
165
+
165
166
* * *
166
167
168
+
<sectionclass="c">
169
+
170
+
## C APIs
171
+
172
+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
173
+
174
+
<sectionclass="intro">
175
+
176
+
</section>
177
+
178
+
<!-- /.intro -->
179
+
180
+
<!-- C usage documentation. -->
181
+
182
+
<sectionclass="usage">
183
+
184
+
### Usage
185
+
186
+
```c
187
+
#include"stdlib/blas/ext/base/sasumpw.h"
188
+
```
189
+
190
+
#### stdlib_strided_sasumpw( N, \*X, strideX )
191
+
192
+
Computes the sum of absolute values ([_L1_ norm][l1norm]) of single-precision floating-point strided array elements using pairwise summation.
193
+
194
+
```c
195
+
constfloat x[] = { 1.0f, 2.0f, 3.0f, 4.0f }
196
+
197
+
float v = stdlib_strided_sasumpw( 4, x, 1 );
198
+
// returns 10.0f
199
+
```
200
+
201
+
The function accepts the following arguments:
202
+
203
+
- **N**: `[in] CBLAS_INT` number of indexed elements.
#### stdlib_strided_sasumpw_ndarray( N, \*X, strideX, offsetX )
212
+
213
+
Computes the sum of absolute values ([_L1_ norm][l1norm]) of single-precision floating-point strided array elements using pairwise summation and alternative indexing semantics.
214
+
215
+
```c
216
+
constfloat x[] = { 1.0f, 2.0f, 3.0f, 4.0f }
217
+
218
+
float v = stdlib_strided_sasumpw_ndarray( 4, x, 1, 0 );
219
+
// returns 10.0f
220
+
```
221
+
222
+
The function accepts the following arguments:
223
+
224
+
- **N**: `[in] CBLAS_INT` number of indexed elements.
0 commit comments