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:
@@ -115,7 +115,7 @@ The function has the following additional parameters:
115
115
-**offsetX**: starting index for `x`.
116
116
-**offsetY**: starting index for `y`.
117
117
118
-
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
118
+
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/array/discrete-uniform' );
155
153
var scusumors =require( '@stdlib/blas/ext/base/scusumors' );
156
154
157
-
var x =filledarrayBy( 10, 'float32', discreteUniform( 0, 100 ) );
158
-
var y =newFloat32Array( x.length );
159
-
155
+
var x =discreteUniform( 10, -100, 100, {
156
+
'dtype':'float32'
157
+
});
160
158
console.log( x );
159
+
160
+
var y =discreteUniform( 10, -100, 100, {
161
+
'dtype':'float32'
162
+
});
161
163
console.log( y );
162
164
163
165
scusumors( x.length, 0.0, x, 1, y, -1 );
@@ -168,6 +170,138 @@ console.log( y );
168
170
169
171
<!-- /.examples -->
170
172
173
+
<!-- C interface documentation. -->
174
+
175
+
* * *
176
+
177
+
<sectionclass="c">
178
+
179
+
## C APIs
180
+
181
+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
182
+
183
+
<sectionclass="intro">
184
+
185
+
</section>
186
+
187
+
<!-- /.intro -->
188
+
189
+
<!-- C usage documentation. -->
190
+
191
+
<sectionclass="usage">
192
+
193
+
### Usage
194
+
195
+
```c
196
+
#include"stdlib/blas/ext/base/scusumors.h"
197
+
```
198
+
199
+
#### stdlib_strided_scusumors( N, sum, \*X, strideX, \*Y, strideY )
200
+
201
+
Computes the cumulative sum of single-precision floating-point strided array elements using ordinary recursive summation.
202
+
203
+
```c
204
+
constfloat x[] = { 1.0f, 2.0f, 3.0f, 4.0f }
205
+
float y[] = { 0.0f, 0.0f, 0.0f, 0.0f }
206
+
207
+
stdlib_strided_scusumors( 4, 0.0f, x, 1, y, 1 );
208
+
```
209
+
210
+
The function accepts the following arguments:
211
+
212
+
- **N**: `[in] CBLAS_INT` number of indexed elements.
213
+
- **sum**: `[in] float` initial sum.
214
+
- **X**: `[in] float*` input array.
215
+
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
216
+
- **Y**: `[out] float*` output array.
217
+
- **strideY**: `[in] CBLAS_INT` stride length for `Y`.
Computes the cumulative sum of single-precision floating-point strided array elements using ordinary recursive summation and alternative indexing semantics.
230
+
231
+
```c
232
+
constfloat x[] = { 1.0f, 2.0f, 3.0f, 4.0f }
233
+
float y[] = { 0.0f, 0.0f, 0.0f, 0.0f }
234
+
235
+
stdlib_strided_scusumors_ndarray( 4, 0.0f, x, 1, 0, y, 1, 0 );
236
+
```
237
+
238
+
The function accepts the following arguments:
239
+
240
+
- **N**: `[in] CBLAS_INT` number of indexed elements.
241
+
- **sum**: `[in] float` initial sum.
242
+
- **X**: `[in] float*` input array.
243
+
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
244
+
- **offsetX**: `[in] CBLAS_INT` starting index for `X`.
245
+
- **Y**: `[out] float*` output array.
246
+
- **strideY**: `[in] CBLAS_INT` stride length for `Y`.
247
+
- **offsetY**: `[in] CBLAS_INT` starting index for `Y`.
0 commit comments