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 arrays are accessed at runtime. For example, to compute the cumulative sum of every other element in `x`,
68
+
The `N` and stride parameters determine which elements in the strided arrays are accessed at runtime. For example, to compute the cumulative sum of every other element:
@@ -114,7 +114,7 @@ The function has the following additional parameters:
114
114
-**offsetX**: starting index for `x`.
115
115
-**offsetY**: starting index for `y`.
116
116
117
-
While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying `buffer`, offset parameters support indexing semantics based on a starting indices. For example, to calculate the cumulative sum of every other value in `x`starting from the second value and to store in the last `N` elements of `y` starting from the last element
117
+
While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameters support indexing semantics based on starting indices. For example, to calculate the cumulative sum of every other element starting from the second element and to store in the last `N` elements of `y` starting from the last element:
var discreteUniform =require( '@stdlib/random/base/discrete-uniform' ).factory;
151
-
var filledarrayBy =require( '@stdlib/array/filled-by' );
150
+
var discreteUniform =require( '@stdlib/random/array/discrete-uniform' );
152
151
var scusumkbn =require( '@stdlib/blas/ext/base/scusumkbn' );
153
152
154
-
var x =filledarrayBy( 10, 'float32', discreteUniform( 0, 100 ) );
153
+
var x =discreteUniform( 10, -100, 100, {
154
+
'dtype':'float32'
155
+
});
155
156
console.log( x );
156
157
157
-
var y =filledarrayBy( x.length, 'float32', discreteUniform( 0, 10 ) );
158
+
var y =discreteUniform( 10, -100, 100, {
159
+
'dtype':'float32'
160
+
});
158
161
console.log( y );
159
162
160
163
scusumkbn( x.length, 0.0, x, 1, y, -1 );
@@ -165,8 +168,138 @@ console.log( y );
165
168
166
169
<!-- /.examples -->
167
170
171
+
<!-- C interface documentation. -->
172
+
168
173
* * *
169
174
175
+
<sectionclass="c">
176
+
177
+
## C APIs
178
+
179
+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
180
+
181
+
<sectionclass="intro">
182
+
183
+
</section>
184
+
185
+
<!-- /.intro -->
186
+
187
+
<!-- C usage documentation. -->
188
+
189
+
<sectionclass="usage">
190
+
191
+
### Usage
192
+
193
+
```c
194
+
#include"stdlib/blas/ext/base/scusumkbn.h"
195
+
```
196
+
197
+
#### stdlib_strided_scusumkbn( N, sum, \*X, strideX, \*Y, strideY )
198
+
199
+
Computes the cumulative sum of single-precision floating-point strided array elements using an improved Kahan–Babuška algorithm.
200
+
201
+
```c
202
+
constfloat x[] = { 1.0f, 2.0f, 3.0f, 4.0f };
203
+
float y[] = { 0.0f, 0.0f, 0.0f, 0.0f };
204
+
205
+
stdlib_strided_scusumkbn( 4, 0.0f, x, 1, y, 1 );
206
+
```
207
+
208
+
The function accepts the following arguments:
209
+
210
+
- **N**: `[in] CBLAS_INT` number of indexed elements.
211
+
- **sum**: `[in] float` initial sum.
212
+
- **X**: `[in] float*` input array.
213
+
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
214
+
- **Y**: `[out] float*` output array.
215
+
- **strideY**: `[in] CBLAS_INT` stride length for `Y`.
Computes the cumulative sum of single-precision floating-point strided array elements using an improved Kahan–Babuška algorithm and alternative indexing semantics.
228
+
229
+
```c
230
+
constfloat x[] = { 1.0f, 2.0f, 3.0f, 4.0f };
231
+
float y[] = { 0.0f, 0.0f, 0.0f, 0.0f };
232
+
233
+
stdlib_strided_scusumkbn_ndarray( 4, 0.0f, x, 1, 0, y, 1, 0 );
234
+
```
235
+
236
+
The function accepts the following arguments:
237
+
238
+
- **N**: `[in] CBLAS_INT` number of indexed elements.
239
+
- **sum**: `[in] float` initial sum.
240
+
- **X**: `[in] float*` input array.
241
+
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
242
+
- **offsetX**: `[in] CBLAS_INT` starting index for `X`.
243
+
- **Y**: `[out] float*` output array.
244
+
- **strideY**: `[in] CBLAS_INT` stride length for `Y`.
245
+
- **offsetY**: `[in] CBLAS_INT` starting index for `Y`.
0 commit comments