Skip to content

Commit db7fb5c

Browse files
committed
Auto-generated commit
1 parent 4fd8029 commit db7fb5c

27 files changed

+429
-250
lines changed

.editorconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ indent_style = tab
8686
[*.{f,f.txt}]
8787
indent_style = space
8888
indent_size = 2
89-
insert_final_newline = false
9089

9190
# Set properties for shell files:
9291
[*.{sh,sh.txt}]

.github/.keepalive

Lines changed: 0 additions & 1 deletion
This file was deleted.

CHANGELOG.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,25 @@
44
55
<section class="release" id="unreleased">
66

7-
## Unreleased (2025-01-13)
7+
## Unreleased (2025-01-19)
8+
9+
<section class="features">
10+
11+
### Features
12+
13+
- [`6560077`](https://github.com/stdlib-js/stdlib/commit/6560077508ae3c79fbe9ba1e2f90ec6f5e610db8) - add C `ndarray` API and refactor `blas/ext/base/scusumpw` [(#4814)](https://github.com/stdlib-js/stdlib/pull/4814)
14+
15+
</section>
16+
17+
<!-- /.features -->
818

919
<section class="commits">
1020

1121
### Commits
1222

1323
<details>
1424

25+
- [`6560077`](https://github.com/stdlib-js/stdlib/commit/6560077508ae3c79fbe9ba1e2f90ec6f5e610db8) - **feat:** add C `ndarray` API and refactor `blas/ext/base/scusumpw` [(#4814)](https://github.com/stdlib-js/stdlib/pull/4814) _(by Muhammad Haris, Athan Reines)_
1526
- [`62364f6`](https://github.com/stdlib-js/stdlib/commit/62364f62ea823a3b52c2ad25660ecd80c71f8f36) - **style:** fix C comment alignment _(by Philipp Burckhardt)_
1627
- [`272ae7a`](https://github.com/stdlib-js/stdlib/commit/272ae7ac5c576c68cfab1b6e304c86407faa20cd) - **docs:** remove comment _(by Athan Reines)_
1728
- [`2777e4b`](https://github.com/stdlib-js/stdlib/commit/2777e4be161869d09406e3b17947d24c64b47af2) - **bench:** resolve lint errors in benchmarks _(by Athan Reines)_
@@ -26,9 +37,10 @@
2637

2738
### Contributors
2839

29-
A total of 2 people contributed to this release. Thank you to the following contributors:
40+
A total of 3 people contributed to this release. Thank you to the following contributors:
3041

3142
- Athan Reines
43+
- Muhammad Haris
3244
- Philipp Burckhardt
3345

3446
</section>

CONTRIBUTORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Daniel Killenberger <daniel.killenberger@gmail.com>
2727
Daniel Yu <40680511+Daniel777y@users.noreply.github.com>
2828
Debashis Maharana <debashismaharana7854@gmail.com>
2929
Desh Deepak Kant <118960904+DeshDeepakKant@users.noreply.github.com>
30+
Dev Goel <135586571+corsairier@users.noreply.github.com>
3031
Dhruv Arvind Singh <154677013+DhruvArvindSingh@users.noreply.github.com>
3132
Divyansh Seth <59174836+sethdivyansh@users.noreply.github.com>
3233
Dominic Lim <46486515+domlimm@users.noreply.github.com>

README.md

Lines changed: 142 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,11 @@ The function has the following parameters:
9494
- **N**: number of indexed elements.
9595
- **sum**: initial sum.
9696
- **x**: input [`Float32Array`][@stdlib/array/float32].
97-
- **strideX**: index increment for `x`.
97+
- **strideX**: stride length for `x`.
9898
- **y**: output [`Float32Array`][@stdlib/array/float32].
99-
- **strideY**: index increment for `y`.
99+
- **strideY**: stride length for `y`.
100100

101-
The `N` and `stride` parameters determine which elements in the strided arrays are accessed at runtime. For example, to compute the cumulative sum of every other element in `x`,
101+
The `N` and stride parameters determine which elements in the strided arrays are accessed at runtime. For example, to compute the cumulative sum of every other element:
102102

103103
```javascript
104104
var Float32Array = require( '@stdlib/array-float32' );
@@ -148,7 +148,7 @@ The function has the following additional parameters:
148148
- **offsetX**: starting index for `x`.
149149
- **offsetY**: starting index for `y`.
150150

151-
While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying `buffer`, `offsetX` and `offsetY` parameters support indexing semantics based on a starting indices. For example, to calculate the cumulative sum of every other value in `x` starting from the second value and to store in the last `N` elements of `y` starting from the last element
151+
While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameters support indexing semantics based on starting indices. For example, to calculate the cumulative sum of every other element starting from the second element and to store in the last `N` elements of `y` starting from the last element:
152152

153153
```javascript
154154
var Float32Array = require( '@stdlib/array-float32' );
@@ -182,15 +182,17 @@ scusumpw.ndarray( 4, 0.0, x, 2, 1, y, -1, y.length-1 );
182182
<!-- eslint no-undef: "error" -->
183183

184184
```javascript
185-
var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ).factory;
186-
var filledarrayBy = require( '@stdlib/array-filled-by' );
187-
var Float32Array = require( '@stdlib/array-float32' );
185+
var discreteUniform = require( '@stdlib/random-array-discrete-uniform' );
188186
var scusumpw = require( '@stdlib/blas-ext-base-scusumpw' );
189187

190-
var x = filledarrayBy( 10, 'float32', discreteUniform( 0, 100 ) );
191-
var y = new Float32Array( x.length );
192-
188+
var x = discreteUniform( 10, -100, 100, {
189+
'dtype': 'float32'
190+
});
193191
console.log( x );
192+
193+
var y = discreteUniform( 10, -100, 100, {
194+
'dtype': 'float32'
195+
});
194196
console.log( y );
195197

196198
scusumpw( x.length, 0.0, x, 1, y, -1 );
@@ -201,8 +203,138 @@ console.log( y );
201203

202204
<!-- /.examples -->
203205

206+
<!-- C interface documentation. -->
207+
204208
* * *
205209

210+
<section class="c">
211+
212+
## C APIs
213+
214+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
215+
216+
<section class="intro">
217+
218+
</section>
219+
220+
<!-- /.intro -->
221+
222+
<!-- C usage documentation. -->
223+
224+
<section class="usage">
225+
226+
### Usage
227+
228+
```c
229+
#include "stdlib/blas/ext/base/scusumpw.h"
230+
```
231+
232+
#### stdlib_strided_scusumpw( N, sum, \*X, strideX, \*Y, strideY )
233+
234+
Computes the cumulative sum of single-precision floating-point strided array elements using pairwise summation.
235+
236+
```c
237+
const float x[] = { 1.0f, 2.0f, 3.0f, 4.0f }
238+
float y[] = { 0.0f, 0.0f, 0.0f, 0.0f }
239+
240+
stdlib_strided_scusumpw( 4, 0.0f, x, 1, y, 1 );
241+
```
242+
243+
The function accepts the following arguments:
244+
245+
- **N**: `[in] CBLAS_INT` number of indexed elements.
246+
- **sum**: `[in] float` initial sum.
247+
- **X**: `[in] float*` input array.
248+
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
249+
- **Y**: `[out] float*` output array.
250+
- **strideY**: `[in] CBLAS_INT` stride length for `Y`.
251+
252+
```c
253+
void stdlib_strided_scusumpw( const CBLAS_INT N, const float sum, const float *X, const CBLAS_INT strideX, float *Y, const CBLAS_INT strideY );
254+
```
255+
256+
<!-- lint disable maximum-heading-length -->
257+
258+
#### stdlib_strided_scusumpw_ndarray( N, sum, \*X, strideX, offsetX, \*Y, strideY, offsetY )
259+
260+
<!-- lint enable maximum-heading-length -->
261+
262+
Computes the cumulative sum of single-precision floating-point strided array elements using pairwise summation and alternative indexing semantics.
263+
264+
```c
265+
const float x[] = { 1.0f, 2.0f, 3.0f, 4.0f }
266+
float y[] = { 0.0f, 0.0f, 0.0f, 0.0f }
267+
268+
stdlib_strided_scusumpw_ndarray( 4, 0.0f, x, 1, 0, y, 1, 0 );
269+
```
270+
271+
The function accepts the following arguments:
272+
273+
- **N**: `[in] CBLAS_INT` number of indexed elements.
274+
- **sum**: `[in] float` initial sum.
275+
- **X**: `[in] float*` input array.
276+
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
277+
- **offsetX**: `[in] CBLAS_INT` starting index for `X`.
278+
- **Y**: `[out] float*` output array.
279+
- **strideY**: `[in] CBLAS_INT` stride length for `Y`.
280+
- **offsetY**: `[in] CBLAS_INT` starting index for `Y`.
281+
282+
```c
283+
void stdlib_strided_scusumpw_ndarray( const CBLAS_INT N, const float sum, const float *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, float *Y, const CBLAS_INT strideY, const CBLAS_INT offsetY );
284+
```
285+
286+
</section>
287+
288+
<!-- /.usage -->
289+
290+
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
291+
292+
<section class="notes">
293+
294+
</section>
295+
296+
<!-- /.notes -->
297+
298+
<!-- C API usage examples. -->
299+
300+
<section class="examples">
301+
302+
### Examples
303+
304+
```c
305+
#include "stdlib/blas/ext/base/scusumpw.h"
306+
#include <stdio.h>
307+
308+
int main( void ) {
309+
// Create strided arrays:
310+
const float x[] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f };
311+
float y[] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f };
312+
313+
// Specify the number of elements:
314+
const int N = 4;
315+
316+
// Specify stride lengths:
317+
const int strideX = 2;
318+
const int strideY = -2;
319+
320+
// Compute the cumulative sum:
321+
stdlib_strided_scusumpw( N, 0.0f, x, strideX, y, strideY );
322+
323+
// Print the result:
324+
for ( int i = 0; i < 8; i++ ) {
325+
printf( "y[ %d ] = %f\n", i, y[ i ] );
326+
}
327+
}
328+
```
329+
330+
</section>
331+
332+
<!-- /.examples -->
333+
334+
</section>
335+
336+
<!-- /.c -->
337+
206338
<section class="references">
207339
208340
## References

benchmark/benchmark.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,18 @@
2121
// MODULES //
2222

2323
var bench = require( '@stdlib/bench-harness' );
24-
var uniform = require( '@stdlib/random-base-uniform' ).factory;
25-
var filledarrayBy = require( '@stdlib/array-filled-by' );
24+
var uniform = require( '@stdlib/random-array-uniform' );
2625
var isnanf = require( '@stdlib/math-base-assert-is-nanf' );
2726
var pow = require( '@stdlib/math-base-special-pow' );
28-
var Float32Array = require( '@stdlib/array-float32' );
2927
var pkg = require( './../package.json' ).name;
3028
var scusumpw = require( './../lib/scusumpw.js' );
3129

3230

3331
// VARIABLES //
3432

35-
var rand = uniform( -10.0, 10.0 );
33+
var options = {
34+
'dtype': 'float32'
35+
};
3636

3737

3838
// FUNCTIONS //
@@ -45,8 +45,8 @@ var rand = uniform( -10.0, 10.0 );
4545
* @returns {Function} benchmark function
4646
*/
4747
function createBenchmark( len ) {
48-
var y = new Float32Array( len );
49-
var x = filledarrayBy( len, 'float32', rand );
48+
var x = uniform( len, -100, 100, options );
49+
var y = uniform( len, -100, 100, options );
5050

5151
return benchmark;
5252

benchmark/benchmark.native.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,9 @@
2222

2323
var resolve = require( 'path' ).resolve;
2424
var bench = require( '@stdlib/bench-harness' );
25-
var uniform = require( '@stdlib/random-base-uniform' ).factory;
26-
var filledarrayBy = require( '@stdlib/array-filled-by' );
25+
var uniform = require( '@stdlib/random-array-uniform' );
2726
var isnanf = require( '@stdlib/math-base-assert-is-nanf' );
2827
var pow = require( '@stdlib/math-base-special-pow' );
29-
var Float32Array = require( '@stdlib/array-float32' );
3028
var tryRequire = require( '@stdlib/utils-try-require' );
3129
var pkg = require( './../package.json' ).name;
3230

@@ -37,7 +35,9 @@ var scusumpw = tryRequire( resolve( __dirname, './../lib/scusumpw.native.js' ) )
3735
var opts = {
3836
'skip': ( scusumpw instanceof Error )
3937
};
40-
var rand = uniform( -10.0, 10.0 );
38+
var options = {
39+
'dtype': 'float32'
40+
};
4141

4242

4343
// FUNCTIONS //
@@ -50,8 +50,8 @@ var rand = uniform( -10.0, 10.0 );
5050
* @returns {Function} benchmark function
5151
*/
5252
function createBenchmark( len ) {
53-
var x = filledarrayBy( len, 'float32', rand );
54-
var y = new Float32Array( len );
53+
var x = uniform( len, -100, 100, options );
54+
var y = uniform( len, -100, 100, options );
5555

5656
return benchmark;
5757

benchmark/benchmark.ndarray.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,18 @@
2121
// MODULES //
2222

2323
var bench = require( '@stdlib/bench-harness' );
24-
var uniform = require( '@stdlib/random-base-uniform' ).factory;
25-
var filledarrayBy = require( '@stdlib/array-filled-by' );
24+
var uniform = require( '@stdlib/random-array-uniform' );
2625
var isnanf = require( '@stdlib/math-base-assert-is-nanf' );
2726
var pow = require( '@stdlib/math-base-special-pow' );
28-
var Float32Array = require( '@stdlib/array-float32' );
2927
var pkg = require( './../package.json' ).name;
3028
var scusumpw = require( './../lib/ndarray.js' );
3129

3230

3331
// VARIABLES //
3432

35-
var rand = uniform( -10.0, 10.0 );
33+
var options = {
34+
'dtype': 'float32'
35+
};
3636

3737

3838
// FUNCTIONS //
@@ -45,8 +45,8 @@ var rand = uniform( -10.0, 10.0 );
4545
* @returns {Function} benchmark function
4646
*/
4747
function createBenchmark( len ) {
48-
var x = filledarrayBy( len, 'float32', rand );
49-
var y = new Float32Array( len );
48+
var x = uniform( len, -100, 100, options );
49+
var y = uniform( len, -100, 100, options );
5050

5151
return benchmark;
5252

benchmark/benchmark.ndarray.native.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,9 @@
2222

2323
var resolve = require( 'path' ).resolve;
2424
var bench = require( '@stdlib/bench-harness' );
25-
var uniform = require( '@stdlib/random-base-uniform' ).factory;
26-
var filledarrayBy = require( '@stdlib/array-filled-by' );
25+
var uniform = require( '@stdlib/random-array-uniform' );
2726
var isnanf = require( '@stdlib/math-base-assert-is-nanf' );
2827
var pow = require( '@stdlib/math-base-special-pow' );
29-
var Float32Array = require( '@stdlib/array-float32' );
3028
var tryRequire = require( '@stdlib/utils-try-require' );
3129
var pkg = require( './../package.json' ).name;
3230

@@ -37,7 +35,9 @@ var scusumpw = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) );
3735
var opts = {
3836
'skip': ( scusumpw instanceof Error )
3937
};
40-
var rand = uniform( -10.0, 10.0 );
38+
var options = {
39+
'dtype': 'float32'
40+
};
4141

4242

4343
// FUNCTIONS //
@@ -50,8 +50,8 @@ var rand = uniform( -10.0, 10.0 );
5050
* @returns {Function} benchmark function
5151
*/
5252
function createBenchmark( len ) {
53-
var x = filledarrayBy( len, 'float32', rand );
54-
var y = new Float32Array( len );
53+
var x = uniform( len, -100, 100, options );
54+
var y = uniform( len, -100, 100, options );
5555

5656
return benchmark;
5757

0 commit comments

Comments
 (0)