Skip to content

Commit f15ce2a

Browse files
committed
Auto-generated commit
1 parent 19e6993 commit f15ce2a

25 files changed

+379
-151
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}]

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 (2024-12-23)
7+
## Unreleased (2025-01-18)
8+
9+
<section class="features">
10+
11+
### Features
12+
13+
- [`6641a29`](https://github.com/stdlib-js/stdlib/commit/6641a29ca92ada4779b1a55d5c681cf375eae791) - add C `ndarray` API and refactor `blas/ext/base/scusum` [(#4799)](https://github.com/stdlib-js/stdlib/pull/4799)
14+
15+
</section>
16+
17+
<!-- /.features -->
818

919
<section class="commits">
1020

1121
### Commits
1222

1323
<details>
1424

25+
- [`6641a29`](https://github.com/stdlib-js/stdlib/commit/6641a29ca92ada4779b1a55d5c681cf375eae791) - **feat:** add C `ndarray` API and refactor `blas/ext/base/scusum` [(#4799)](https://github.com/stdlib-js/stdlib/pull/4799) _(by Muhammad Haris)_
1526
- [`62364f6`](https://github.com/stdlib-js/stdlib/commit/62364f62ea823a3b52c2ad25660ecd80c71f8f36) - **style:** fix C comment alignment _(by Philipp Burckhardt)_
1627

1728
</details>
@@ -24,8 +35,9 @@
2435

2536
### Contributors
2637

27-
A total of 1 person contributed to this release. Thank you to this contributor:
38+
A total of 2 people contributed to this release. Thank you to the following contributors:
2839

40+
- Muhammad Haris
2941
- Philipp Burckhardt
3042

3143
</section>

CONTRIBUTORS

Lines changed: 3 additions & 1 deletion
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+
Dhruv Arvind Singh <154677013+DhruvArvindSingh@users.noreply.github.com>
3031
Divyansh Seth <59174836+sethdivyansh@users.noreply.github.com>
3132
Dominic Lim <46486515+domlimm@users.noreply.github.com>
3233
Dominik Moritz <domoritz@gmail.com>
@@ -49,6 +50,7 @@ Joey Reed <joeyrreed@gmail.com>
4950
Jordan Gallivan <115050475+Jordan-Gallivan@users.noreply.github.com>
5051
Joris Labie <joris.labie1@gmail.com>
5152
Justin Dennison <justin1dennison@gmail.com>
53+
Karan Anand <119553199+anandkaranubc@users.noreply.github.com>
5254
Karthik Prakash <116057817+skoriop@users.noreply.github.com>
5355
Kohantika Nath <145763549+kohantikanath@users.noreply.github.com>
5456
Krishnendu Das <86651039+itskdhere@users.noreply.github.com>
@@ -117,7 +119,7 @@ UtkershBasnet <119008923+UtkershBasnet@users.noreply.github.com>
117119
Vaibhav Patel <98279986+noobCoderVP@users.noreply.github.com>
118120
Varad Gupta <varadgupta21@gmail.com>
119121
Vinit Pandit <106718914+MeastroZI@users.noreply.github.com>
120-
Vivek maurya <155618190+vivekmaurya001@users.noreply.github.com>
122+
Vivek Maurya <vm8118134@gmail.com>
121123
Xiaochuan Ye <tap91624@gmail.com>
122124
Yaswanth Kosuru <116426380+yaswanthkosuru@users.noreply.github.com>
123125
Yernar Yergaziyev <yernar.yergaziyev@erg.kz>

NOTICE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Copyright (c) 2016-2024 The Stdlib Authors.
1+
Copyright (c) 2016-2025 The Stdlib Authors.

README.md

Lines changed: 145 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 the strided input array,
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 the strided input array starting from the second value and to store in the last `N` elements of the strided output array 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 in the strided input array starting from the second element and to store in the last `N` elements of the strided output array starting from the last element:
152152

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

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

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

194197
scusum( x.length, 0.0, x, 1, y, -1 );
@@ -199,6 +202,138 @@ console.log( y );
199202

200203
<!-- /.examples -->
201204

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

benchmark/benchmark.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@
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' );
26-
var Float32Array = require( '@stdlib/array-float32' );
24+
var uniform = require( '@stdlib/random-array-uniform' );
2725
var isnanf = require( '@stdlib/math-base-assert-is-nanf' );
2826
var pow = require( '@stdlib/math-base-special-pow' );
2927
var pkg = require( './../package.json' ).name;
@@ -32,7 +30,9 @@ var scusum = require( './../lib/scusum.js' );
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
return benchmark;
5151

5252
function benchmark( b ) {

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 scusum = tryRequire( resolve( __dirname, './../lib/scusum.native.js' ) );
3735
var opts = {
3836
'skip': ( scusum 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
return benchmark;
5656

5757
function benchmark( b ) {

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 scusum = 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
return benchmark;
5151

5252
function benchmark( b ) {

0 commit comments

Comments
 (0)