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 access every other element in `x`,
59
60
@@ -80,9 +81,9 @@ var v = dapxsumkbn( 4, 5.0, x1, 2 );
80
81
// returns 25.0
81
82
```
82
83
83
-
#### dapxsumkbn.ndarray( N, alpha, x, stride, offset )
84
+
#### dapxsumkbn.ndarray( N, alpha, x, strideX, offsetX )
84
85
85
-
Adds a constant to each double-precision floating-point strided array element and computes the sum using an improved Kahan–Babuška algorithm and alternative indexing semantics.
86
+
Adds a scalar constant to each double-precision floating-point strided array element and computes the sum using an improved Kahan–Babuška algorithm and alternative indexing semantics.
@@ -95,9 +96,9 @@ var v = dapxsumkbn.ndarray( 3, 5.0, x, 1, 0 );
95
96
96
97
The function has the following additional parameters:
97
98
98
-
-**offset**: starting index for `x`.
99
+
-**offsetX**: starting index for `x`.
99
100
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 access every other value in `x` starting from the second value
101
+
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 access every other value in `x` starting from the second value
@@ -129,11 +130,12 @@ var v = dapxsumkbn.ndarray( 4, 5.0, x, 2, 1 );
129
130
<!-- eslint no-undef: "error" -->
130
131
131
132
```javascript
132
-
var discreteUniform =require( '@stdlib/random/base/discrete-uniform' ).factory;
133
-
var filledarrayBy =require( '@stdlib/array/filled-by' );
133
+
var discreteUniform =require( '@stdlib/random/array/discrete-uniform' );
134
134
var dapxsumkbn =require( '@stdlib/blas/ext/base/dapxsumkbn' );
135
135
136
-
var x =filledarrayBy( 10, 'float64', discreteUniform( 0, 100 ) );
136
+
var x =discreteUniform( 10, -100, 100, {
137
+
'dtype':'float64'
138
+
});
137
139
console.log( x );
138
140
139
141
var v =dapxsumkbn( x.length, 5.0, x, 1 );
@@ -144,8 +146,125 @@ console.log( v );
144
146
145
147
<!-- /.examples -->
146
148
149
+
<!-- C interface documentation. -->
150
+
147
151
* * *
148
152
153
+
<sectionclass="c">
154
+
155
+
## C APIs
156
+
157
+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
158
+
159
+
<sectionclass="intro">
160
+
161
+
</section>
162
+
163
+
<!-- /.intro -->
164
+
165
+
<!-- C usage documentation. -->
166
+
167
+
<sectionclass="usage">
168
+
169
+
### Usage
170
+
171
+
```c
172
+
#include"stdlib/blas/ext/base/dapxsumkbn.h"
173
+
```
174
+
175
+
#### stdlib_strided_dapxsumkbn( N, alpha, \*X, strideX )
176
+
177
+
Adds a scalar constant to each double-precision floating-point strided array element and computes the sum using an improved Kahan–Babuška algorithm.
178
+
179
+
```c
180
+
constdouble x[] = { 1.0, 2.0, 3.0, 4.0 };
181
+
182
+
double v = stdlib_strided_dapxsumkbn( 4, 5.0, x, 1 );
183
+
// returns 30.0
184
+
```
185
+
186
+
The function accepts the following arguments:
187
+
188
+
- **N**: `[in] CBLAS_INT` number of indexed elements.
189
+
- **alpha**: `[in] double` scalar constant.
190
+
- **X**: `[in] double*` input array.
191
+
- **strideX**: `[in] CBLAS_INT` index increment for `X`.
#### stdlib_strided_dapxsumkbn_ndarray( N, alpha, \*X, strideX, offsetX )
198
+
199
+
Adds a scalar constant to each double-precision floating-point strided array element and computes the sum using an improved Kahan–Babuška algorithm and alternative indexing semantics.
200
+
201
+
```c
202
+
constdouble x[] = { 1.0, 2.0, 3.0, 4.0 };
203
+
204
+
double v = stdlib_strided_dapxsumkbn_ndarray( 4, 5.0, x, 1, 0 );
205
+
// returns 30.0
206
+
```
207
+
208
+
The function accepts the following arguments:
209
+
210
+
- **N**: `[in] CBLAS_INT` number of indexed elements.
211
+
- **alpha**: `[in] double` scalar constant.
212
+
- **X**: `[in] double*` input array.
213
+
- **strideX**: `[in] CBLAS_INT` index increment for `X`.
214
+
- **offsetX**: `[in] CBLAS_INT` starting index for `X`.
0 commit comments