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