Skip to content

Commit 37d5027

Browse files
committed
Auto-generated commit
1 parent 6e10866 commit 37d5027

28 files changed

+370
-298
lines changed

CHANGELOG.md

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

7-
## Unreleased (2025-01-02)
7+
## Unreleased (2025-01-11)
8+
9+
<section class="features">
10+
11+
### Features
12+
13+
- [`0619690`](https://github.com/stdlib-js/stdlib/commit/0619690c1a69a402ba6315631506302f010d6404) - add C ndarray interface and refactor implementation for `stats/base/scumaxabs` [(#4684)](https://github.com/stdlib-js/stdlib/pull/4684)
14+
15+
</section>
16+
17+
<!-- /.features -->
818

919
<section class="bug-fixes">
1020

@@ -22,8 +32,9 @@
2232

2333
<details>
2434

35+
- [`0619690`](https://github.com/stdlib-js/stdlib/commit/0619690c1a69a402ba6315631506302f010d6404) - **feat:** add C ndarray interface and refactor implementation for `stats/base/scumaxabs` [(#4684)](https://github.com/stdlib-js/stdlib/pull/4684) _(by Aayush Khanna)_
2536
- [`604d9b5`](https://github.com/stdlib-js/stdlib/commit/604d9b5a2c932d701b53cee0845c1309a0a2e1f9) - **fix:** remove unused deps and fix indentation _(by Athan Reines)_
26-
- [`dbb2756`](https://github.com/stdlib-js/stdlib/commit/dbb27568ed7d5f00d6edc28f189bfd2d09af09ff) - **refactor:** update `stats/base/scumaxabs` native addon from C++ to C [(#4409)](https://github.com/stdlib-js/stdlib/pull/4409) _(by Vivek maurya)_
37+
- [`dbb2756`](https://github.com/stdlib-js/stdlib/commit/dbb27568ed7d5f00d6edc28f189bfd2d09af09ff) - **refactor:** update `stats/base/scumaxabs` native addon from C++ to C [(#4409)](https://github.com/stdlib-js/stdlib/pull/4409) _(by Vivek Maurya)_
2738
- [`62364f6`](https://github.com/stdlib-js/stdlib/commit/62364f62ea823a3b52c2ad25660ecd80c71f8f36) - **style:** fix C comment alignment _(by Philipp Burckhardt)_
2839
- [`9e689ff`](https://github.com/stdlib-js/stdlib/commit/9e689ffcb7c6223afc521f1e574b42f10921cf5e) - **chore:** fix indentation in manifest.json files _(by Philipp Burckhardt)_
2940
- [`272ae7a`](https://github.com/stdlib-js/stdlib/commit/272ae7ac5c576c68cfab1b6e304c86407faa20cd) - **docs:** remove comment _(by Athan Reines)_
@@ -38,11 +49,12 @@
3849

3950
### Contributors
4051

41-
A total of 3 people contributed to this release. Thank you to the following contributors:
52+
A total of 4 people contributed to this release. Thank you to the following contributors:
4253

54+
- Aayush Khanna
4355
- Athan Reines
4456
- Philipp Burckhardt
45-
- Vivek maurya
57+
- Vivek Maurya
4658

4759
</section>
4860

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: 96 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,11 @@ The function has the following parameters:
8787

8888
- **N**: number of indexed elements.
8989
- **x**: input [`Float32Array`][@stdlib/array/float32].
90-
- **strideX**: index increment for `x`.
90+
- **strideX**: stride length for `x`.
9191
- **y**: output [`Float32Array`][@stdlib/array/float32].
92-
- **strideY**: index increment for `y`.
92+
- **strideY**: stride length for `y`.
9393

94-
The `N` and `stride` parameters determine which elements in `x` and `y` are accessed at runtime. For example, to compute the cumulative maximum absolute value of every other element in `x`,
94+
The `N` and stride parameters determine which elements in the strided arrays are accessed at runtime. For example, to compute the cumulative maximum absolute value of every other element in `x`,
9595

9696
```javascript
9797
var Float32Array = require( '@stdlib/array-float32' );
@@ -141,7 +141,7 @@ The function has the following additional parameters:
141141
- **offsetX**: starting index for `x`.
142142
- **offsetY**: starting index for `y`.
143143

144-
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 maximum absolute value 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
144+
While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, offset parameters support indexing semantics based on a starting indices. For example, to calculate the cumulative maximum absolute value of every other element in `x` starting from the second element and to store in the last `N` elements of `y` starting from the last element
145145

146146
```javascript
147147
var Float32Array = require( '@stdlib/array-float32' );
@@ -174,20 +174,14 @@ scumaxabs.ndarray( 4, x, 2, 1, y, -1, y.length-1 );
174174
<!-- eslint no-undef: "error" -->
175175

176176
```javascript
177-
var randu = require( '@stdlib/random-base-randu' );
178-
var round = require( '@stdlib/math-base-special-round' );
177+
var discreteUniform = require( '@stdlib/random-array-discrete-uniform' );
179178
var Float32Array = require( '@stdlib/array-float32' );
180179
var scumaxabs = require( '@stdlib/stats-base-scumaxabs' );
181180

182-
var y;
183-
var x;
184-
var i;
185-
186-
x = new Float32Array( 10 );
187-
y = new Float32Array( x.length );
188-
for ( i = 0; i < x.length; i++ ) {
189-
x[ i ] = round( (randu()*100.0) - 50.0 );
190-
}
181+
var x = discreteUniform( 10, -50, 50, {
182+
'dtype': 'float32'
183+
});
184+
var y = new Float32Array( x.length );
191185
console.log( x );
192186
console.log( y );
193187

@@ -199,6 +193,93 @@ console.log( y );
199193

200194
<!-- /.examples -->
201195

196+
<!-- C interface documentation. -->
197+
198+
* * *
199+
200+
<section class="c">
201+
202+
## C APIs
203+
204+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
205+
206+
<section class="intro">
207+
208+
</section>
209+
210+
<!-- /.intro -->
211+
212+
<!-- C usage documentation. -->
213+
214+
<section class="usage">
215+
216+
### Usage
217+
218+
```c
219+
#include "stdlib/stats/base/scumaxabs.h"
220+
```
221+
222+
#### stdlib_strided_scumaxabs( N, \*X, strideX, \*Y, strideY )
223+
224+
Computes the cumulative maximum absolute value of single-precision floating-point strided array elements.
225+
226+
```c
227+
const float x[] = { 1.0f, 2.0f, -3.0f, 4.0f, -5.0f, 6.0f, 7.0f, 8.0f };
228+
float y[] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f };
229+
230+
stdlib_strided_scumaxabs( 4, x, 2, y, -2 );
231+
```
232+
233+
The function accepts the following arguments:
234+
235+
- **N**: `[in] CBLAS_INT` number of indexed elements.
236+
- **X**: `[in] float*` input array.
237+
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
238+
- **Y**: `[out] float*` output array.
239+
- **strideY**: `[in] CBLAS_INT` stride length for `Y`.
240+
241+
```c
242+
void stdlib_strided_scumaxabs( const CBLAS_INT N, const float *X, const CBLAS_INT strideX, float *Y, const CBLAS_INT strideY );
243+
```
244+
245+
#### stdlib_strided_scumaxabs_ndarray(N, \*X, strideX, offsetX, \*Y, strideY, offsetY )
246+
247+
Computes the cumulative maximum absolute value of single-precision floating-point strided array elements using alternative indexing semantics.
248+
249+
```c
250+
#include "stdlib/stats/base/scumaxabs.h"
251+
#include <stdio.h>
252+
253+
int main( void ) {
254+
// Create strided arrays:
255+
const float x[] = { 1.0f, 2.0f, -3.0f, 4.0f, -5.0f, 6.0f, 7.0f, 8.0f };
256+
const float y[] = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f };
257+
258+
// Specify the number of elements:
259+
const int N = 4;
260+
261+
// Specify stride lengths:
262+
const int strideX = 2;
263+
const int strideY = -2;
264+
265+
// Compute the cumulative maximum absolute value:
266+
stdlib_strided_scumaxabs( N, x, strideX, y, strideY );
267+
268+
// Print the result:
269+
for ( int i = 0; i < 8; i++ ) {
270+
printf( "y[ %d ] = %f\n", i, y[ i ] );
271+
}
272+
}
273+
```
274+
275+
</section>
276+
277+
<!-- /.examples -->
278+
279+
</section>
280+
281+
<!-- /.c -->
282+
202283
<section class="references">
203284
204285
</section>

benchmark/benchmark.js

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

2323
var bench = require( '@stdlib/bench-harness' );
24-
var randu = require( '@stdlib/random-base-randu' );
24+
var uniform = require( '@stdlib/random-array-uniform' );
2525
var isnanf = require( '@stdlib/math-base-assert-is-nanf' );
2626
var pow = require( '@stdlib/math-base-special-pow' );
2727
var Float32Array = require( '@stdlib/array-float32' );
2828
var pkg = require( './../package.json' ).name;
2929
var scumaxabs = require( './../lib/scumaxabs.js' );
3030

3131

32+
// VARIABLES //
33+
34+
var options = {
35+
'dtype': 'float32'
36+
};
37+
38+
3239
// FUNCTIONS //
3340

3441
/**
@@ -39,15 +46,8 @@ var scumaxabs = require( './../lib/scumaxabs.js' );
3946
* @returns {Function} benchmark function
4047
*/
4148
function createBenchmark( len ) {
42-
var y;
43-
var x;
44-
var i;
45-
46-
x = new Float32Array( len );
47-
y = new Float32Array( len );
48-
for ( i = 0; i < x.length; i++ ) {
49-
x[ i ] = ( randu()*20.0 ) - 10.0;
50-
}
49+
var x = uniform( len, -10.0, 10.0, options );
50+
var y = new Float32Array( len );
5151
return benchmark;
5252

5353
function benchmark( b ) {

benchmark/benchmark.native.js

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

2323
var resolve = require( 'path' ).resolve;
2424
var bench = require( '@stdlib/bench-harness' );
25-
var randu = require( '@stdlib/random-base-randu' );
25+
var uniform = require( '@stdlib/random-array-uniform' );
2626
var isnanf = require( '@stdlib/math-base-assert-is-nanf' );
2727
var pow = require( '@stdlib/math-base-special-pow' );
2828
var Float32Array = require( '@stdlib/array-float32' );
@@ -36,6 +36,9 @@ var scumaxabs = tryRequire( resolve( __dirname, './../lib/scumaxabs.native.js' )
3636
var opts = {
3737
'skip': ( scumaxabs instanceof Error )
3838
};
39+
var options = {
40+
'dtype': 'float32'
41+
};
3942

4043

4144
// FUNCTIONS //
@@ -48,15 +51,8 @@ var opts = {
4851
* @returns {Function} benchmark function
4952
*/
5053
function createBenchmark( len ) {
51-
var x;
52-
var y;
53-
var i;
54-
55-
x = new Float32Array( len );
56-
y = new Float32Array( len );
57-
for ( i = 0; i < x.length; i++ ) {
58-
x[ i ] = ( randu()*20.0 ) - 10.0;
59-
}
54+
var x = uniform( len, -10.0, 10.0, options );
55+
var y = new Float32Array( len );
6056
return benchmark;
6157

6258
function benchmark( b ) {

benchmark/benchmark.ndarray.js

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

2323
var bench = require( '@stdlib/bench-harness' );
24-
var randu = require( '@stdlib/random-base-randu' );
24+
var uniform = require( '@stdlib/random-array-uniform' );
2525
var isnanf = require( '@stdlib/math-base-assert-is-nanf' );
2626
var pow = require( '@stdlib/math-base-special-pow' );
2727
var Float32Array = require( '@stdlib/array-float32' );
2828
var pkg = require( './../package.json' ).name;
2929
var scumaxabs = require( './../lib/ndarray.js' );
3030

3131

32+
// VARIABLES //
33+
34+
var options = {
35+
'dtype': 'float32'
36+
};
37+
38+
3239
// FUNCTIONS //
3340

3441
/**
@@ -39,15 +46,8 @@ var scumaxabs = require( './../lib/ndarray.js' );
3946
* @returns {Function} benchmark function
4047
*/
4148
function createBenchmark( len ) {
42-
var x;
43-
var y;
44-
var i;
45-
46-
x = new Float32Array( len );
47-
y = new Float32Array( len );
48-
for ( i = 0; i < x.length; i++ ) {
49-
x[ i ] = ( randu()*20.0 ) - 10.0;
50-
}
49+
var x = uniform( len, -10.0, 10.0, options );
50+
var y = new Float32Array( len );
5151
return benchmark;
5252

5353
function benchmark( b ) {

benchmark/benchmark.ndarray.native.js

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

2323
var resolve = require( 'path' ).resolve;
2424
var bench = require( '@stdlib/bench-harness' );
25-
var randu = require( '@stdlib/random-base-randu' );
25+
var uniform = require( '@stdlib/random-array-uniform' );
2626
var isnanf = require( '@stdlib/math-base-assert-is-nanf' );
2727
var pow = require( '@stdlib/math-base-special-pow' );
2828
var Float32Array = require( '@stdlib/array-float32' );
@@ -36,6 +36,9 @@ var scumaxabs = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) )
3636
var opts = {
3737
'skip': ( scumaxabs instanceof Error )
3838
};
39+
var options = {
40+
'dtype': 'float32'
41+
};
3942

4043

4144
// FUNCTIONS //
@@ -48,15 +51,8 @@ var opts = {
4851
* @returns {Function} benchmark function
4952
*/
5053
function createBenchmark( len ) {
51-
var x;
52-
var y;
53-
var i;
54-
55-
x = new Float32Array( len );
56-
y = new Float32Array( len );
57-
for ( i = 0; i < x.length; i++ ) {
58-
x[ i ] = ( randu()*20.0 ) - 10.0;
59-
}
54+
var x = uniform( len, -10.0, 10.0, options );
55+
var y = new Float32Array( len );
6056
return benchmark;
6157

6258
function benchmark( b ) {

0 commit comments

Comments
 (0)