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
- [`f78ae7b`](https://github.com/stdlib-js/stdlib/commit/f78ae7b4ed12879282a4e9c20e6c7b5baf2d6e39) - add C `ndarray` API and refactor `blas/ext/base/dssum` [(#4262)](https://github.com/stdlib-js/stdlib/pull/4262)
@@ -1246,6 +1268,7 @@ A total of 8 people contributed to this release. Thank you to the following cont
1246
1268
1247
1269
<details>
1248
1270
1271
+
- [`f78ae7b`](https://github.com/stdlib-js/stdlib/commit/f78ae7b4ed12879282a4e9c20e6c7b5baf2d6e39) - **feat:** add C `ndarray` API and refactor `blas/ext/base/dssum` [(#4262)](https://github.com/stdlib-js/stdlib/pull/4262) _(by Muhammad Haris)_
- [`cb750b6`](https://github.com/stdlib-js/stdlib/commit/cb750b6d8686990b958c9f62905dd236c86f98c6) - **docs:** fix C examples in `blas/ext/base/dsumkbn` [(#4315)](https://github.com/stdlib-js/stdlib/pull/4315) _(by Muhammad Haris)_
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,
58
+
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:
Computes the sum of single-precision floating-point strided array elements using extended accumulation and alternative indexing semantics and returning an extended precision result.
87
86
@@ -96,9 +95,9 @@ var v = dssum.ndarray( 3, x, 1, 0 );
96
95
97
96
The function has the following additional parameters:
98
97
99
-
-**offset**: starting index for `x`.
98
+
-**offsetX**: starting index for `x`.
100
99
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 calculate the sum of every other value in the strided array 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 calculate the sum of every other element starting from the second element:
@@ -131,11 +130,12 @@ var v = dssum.ndarray( 4, 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 dssum =require( '@stdlib/blas/ext/base/dssum' );
137
135
138
-
var x =filledarrayBy( 10, 'float32', discreteUniform( 0, 100 ) );
136
+
var x =discreteUniform( 10.0, -100, 100, {
137
+
'dtype':'float32'
138
+
});
139
139
console.log( x );
140
140
141
141
var v =dssum( x.length, x, 1 );
@@ -146,6 +146,123 @@ console.log( v );
146
146
147
147
<!-- /.examples -->
148
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/dssum.h"
173
+
```
174
+
175
+
#### stdlib_strided_dssum( N, \*X, strideX )
176
+
177
+
Computes the sum of single-precision floating-point strided array elements using extended accumulation and returning an extended precision result.
178
+
179
+
```c
180
+
constfloat x[] = { 1.0f, 2.0f, 3.0f, 4.0f };
181
+
182
+
double v = stdlib_strided_dssum( 4, x, 1 );
183
+
// returns 10.0
184
+
```
185
+
186
+
The function accepts the following arguments:
187
+
188
+
- **N**: `[in] CBLAS_INT` number of indexed elements.
189
+
- **X**: `[in] float*` input array.
190
+
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
#### stdlib_strided_dssum_ndarray( N, \*X, strideX, offsetX )
197
+
198
+
Computes the sum of single-precision floating-point strided array elements using extended accumulation and alternative indexing semantics and returning an extended precision result.
199
+
200
+
```c
201
+
constfloat x[] = { 1.0f, 2.0f, 3.0f, 4.0f };
202
+
203
+
double v = stdlib_strided_dssum_ndarray( 4, x, 1, 0 );
204
+
// returns 10.0
205
+
```
206
+
207
+
The function accepts the following arguments:
208
+
209
+
- **N**: `[in] CBLAS_INT` number of indexed elements.
210
+
- **X**: `[in] float*` input array.
211
+
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
212
+
- **offsetX**: `[in] CBLAS_INT` starting index for `X`.
0 commit comments