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 array are accessed at runtime. For example, to access every other element in `x`,
59
+
The `N` and stride parameters determine which elements in the strided array are accessed at runtime. For example, to access every other element:
The function has the following additional parameters:
99
98
100
-
-**offset**: starting index for `x`.
99
+
-**offsetX**: starting index.
101
100
102
-
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 element starting from the second element:
@@ -131,18 +130,141 @@ var v = sapxsum.ndarray( 4, 5.0, x, 2, 1 );
131
130
<!-- eslint no-undef: "error" -->
132
131
133
132
```javascript
134
-
var discreteUniform =require( '@stdlib/random/base/discrete-uniform' ).factory;
135
-
var filledarrayBy =require( '@stdlib/array/filled-by' );
133
+
var discreteUniform =require( '@stdlib/random/array/discrete-uniform' );
136
134
var sapxsum =require( '@stdlib/blas/ext/base/sapxsum' );
137
135
138
-
var x =filledarrayBy( 10, 'float32', discreteUniform( 0, 100 ) );
136
+
var x =discreteUniform( 10, -100, 100, {
137
+
'dtype':'float32'
138
+
});
139
139
console.log( x );
140
+
141
+
var v =sapxsum( x.length, 5.0, x, 1 );
142
+
console.log( v );
143
+
```
144
+
145
+
</section>
146
+
147
+
<!-- /.examples -->
148
+
149
+
<!-- C interface documentation. -->
150
+
151
+
* * *
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/sapxsum.h"
173
+
```
174
+
175
+
#### stdlib_strided_sapxsum( N, alpha, \*X, strideX )
176
+
177
+
Adds a scalar constant to each single-precision floating-point strided array element and computes the sum.
178
+
179
+
```c
180
+
constfloat x[] = { 1.0f, 2.0f, 3.0f, 4.0f };
181
+
182
+
float v = stdlib_strided_sapxsum( 4, 5.0f, x, 1 );
183
+
// returns 30.0f
184
+
```
185
+
186
+
The function accepts the following arguments:
187
+
188
+
- **N**: `[in] CBLAS_INT` number of indexed elements.
0 commit comments