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 `x` and `y` 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 `x` and `y` are accessed at runtime. For example, to compute the cumulative sum of every other element in `x`,
@@ -119,7 +119,7 @@ The function has the following additional parameters:
119
119
-**offsetX**: starting index for `x`.
120
120
-**offsetY**: starting index for `y`.
121
121
122
-
While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying `buffer`, `offsetX` and `offsetY` 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
122
+
While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, offsetX and offsetY 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
var dcusumkbn2 =require( '@stdlib/blas/ext/base/dcusumkbn2' );
161
160
162
-
var y;
163
-
var x;
164
-
var i;
161
+
var x =discreteUniform( 10, -100, 100, {
162
+
'dtype':'float64'
163
+
});
164
+
var y =newFloat64Array( x.length );
165
165
166
-
x =newFloat64Array( 10 );
167
-
y =newFloat64Array( x.length );
168
-
for ( i =0; i <x.length; i++ ) {
169
-
x[ i ] =round( randu()*100.0 );
170
-
}
171
166
console.log( x );
172
167
console.log( y );
173
168
@@ -179,8 +174,137 @@ console.log( y );
179
174
180
175
<!-- /.examples -->
181
176
177
+
<!-- C interface documentation. -->
178
+
182
179
* * *
183
180
181
+
<sectionclass="c">
182
+
183
+
## C APIs
184
+
185
+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
186
+
187
+
<sectionclass="intro">
188
+
189
+
</section>
190
+
191
+
<!-- /.intro -->
192
+
193
+
<!-- C usage documentation. -->
194
+
195
+
<sectionclass="usage">
196
+
197
+
### Usage
198
+
199
+
```c
200
+
#include"stdlib/blas/ext/base/dcusumkbn2.h"
201
+
```
202
+
203
+
#### stdlib_strided_dcusumkbn2( N, sum, \*X, strideX, \*Y, strideY )
204
+
205
+
Computes the cumulative sum of double-precision floating-point strided array elements using a second-order iterative Kahan–Babuška algorithm.
206
+
207
+
```c
208
+
constdouble x[] = { 1.0, 2.0, 3.0, 4.0 }
209
+
double y[] = { 0.0, 0.0, 0.0, 0.0 }
210
+
211
+
stdlib_strided_dcusumkbn2( 4, 0.0, x, 1, y, 1 );
212
+
```
213
+
214
+
The function accepts the following arguments:
215
+
216
+
- **N**: `[in] CBLAS_INT` number of indexed elements.
217
+
- **sum**: `[in] CBLAS_INT` initial sum.
218
+
- **X**: `[in] double*` input array.
219
+
- **strideX**: `[in] CBLAS_INT` index increment for `X`.
220
+
- **Y**: `[out] double*` output array.
221
+
- **strideY**: `[in] CBLAS_INT` index increment for `Y`.
Computes the cumulative sum of double-precision floating-point strided array elements using a second-order iterative Kahan–Babuška algorithm and alternative indexing semantics.
234
+
235
+
```c
236
+
constdouble x[] = { 1.0, 2.0, 3.0, 4.0 }
237
+
double y[] = { 0.0, 0.0, 0.0, 0.0 }
238
+
239
+
stdlib_strided_dcusumkbn2_ndarray( 4, 0.0, x, 1, 0, y, 1, 0 );
240
+
```
241
+
242
+
The function accepts the following arguments:
243
+
244
+
- **N**: `[in] CBLAS_INT` number of indexed elements.
245
+
- **sum**: `[in] CBLAS_INT` initial sum.
246
+
- **X**: `[in] double*` input array.
247
+
- **strideX**: `[in] CBLAS_INT` index increment for `X`.
248
+
- **offsetX**: `[in] CBLAS_INT` starting index for `X`.
249
+
- **Y**: `[out] double*` output array.
250
+
- **strideY**: `[in] CBLAS_INT` index increment for `Y`.
251
+
- **offsetY**: `[in] CBLAS_INT` starting index for `Y`.
0 commit comments