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