Skip to content

Commit 694acf4

Browse files
committed
Auto-generated commit
1 parent 25f1cfc commit 694acf4

31 files changed

+411
-170
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: 15 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-02-02)
8+
9+
<section class="features">
10+
11+
### Features
12+
13+
- [`6516030`](https://github.com/stdlib-js/stdlib/commit/65160305dccd83c8fbf6f9e011e9f9a13c2c0cf8) - add C `ndarray` API and refactor `blas/ext/base/snansum` [(#4872)](https://github.com/stdlib-js/stdlib/pull/4872)
14+
15+
</section>
16+
17+
<!-- /.features -->
818

919
<section class="commits">
1020

1121
### Commits
1222

1323
<details>
1424

25+
- [`6516030`](https://github.com/stdlib-js/stdlib/commit/65160305dccd83c8fbf6f9e011e9f9a13c2c0cf8) - **feat:** add C `ndarray` API and refactor `blas/ext/base/snansum` [(#4872)](https://github.com/stdlib-js/stdlib/pull/4872) _(by Muhammad Haris, Athan Reines)_
1526
- [`62364f6`](https://github.com/stdlib-js/stdlib/commit/62364f62ea823a3b52c2ad25660ecd80c71f8f36) - **style:** fix C comment alignment _(by Philipp Burckhardt)_
1627
- [`0e887d5`](https://github.com/stdlib-js/stdlib/commit/0e887d567344c8a31a382266389022ec26f2bcca) - **style:** add missing spaces _(by Philipp Burckhardt)_
1728

@@ -25,8 +36,10 @@
2536

2637
### Contributors
2738

28-
A total of 1 person contributed to this release. Thank you to this contributor:
39+
A total of 3 people contributed to this release. Thank you to the following contributors:
2940

41+
- Athan Reines
42+
- Muhammad Haris
3043
- Philipp Burckhardt
3144

3245
</section>

CONTRIBUTORS

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ 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>
31+
Dhruv Arvind Singh <154677013+DhruvArvindSingh@users.noreply.github.com>
3032
Divyansh Seth <59174836+sethdivyansh@users.noreply.github.com>
3133
Dominic Lim <46486515+domlimm@users.noreply.github.com>
3234
Dominik Moritz <domoritz@gmail.com>
@@ -49,6 +51,7 @@ Joey Reed <joeyrreed@gmail.com>
4951
Jordan Gallivan <115050475+Jordan-Gallivan@users.noreply.github.com>
5052
Joris Labie <joris.labie1@gmail.com>
5153
Justin Dennison <justin1dennison@gmail.com>
54+
Karan Anand <119553199+anandkaranubc@users.noreply.github.com>
5255
Karthik Prakash <116057817+skoriop@users.noreply.github.com>
5356
Kohantika Nath <145763549+kohantikanath@users.noreply.github.com>
5457
Krishnendu Das <86651039+itskdhere@users.noreply.github.com>
@@ -117,7 +120,7 @@ UtkershBasnet <119008923+UtkershBasnet@users.noreply.github.com>
117120
Vaibhav Patel <98279986+noobCoderVP@users.noreply.github.com>
118121
Varad Gupta <varadgupta21@gmail.com>
119122
Vinit Pandit <106718914+MeastroZI@users.noreply.github.com>
120-
Vivek maurya <155618190+vivekmaurya001@users.noreply.github.com>
123+
Vivek Maurya <vm8118134@gmail.com>
121124
Xiaochuan Ye <tap91624@gmail.com>
122125
Yaswanth Kosuru <116426380+yaswanthkosuru@users.noreply.github.com>
123126
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: 125 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ To view installation and usage instructions specific to each branch build, be su
6969
var snansum = require( '@stdlib/blas-ext-base-snansum' );
7070
```
7171

72-
#### snansum( N, x, stride )
72+
#### snansum( N, x, strideX )
7373

7474
Computes the sum of single-precision floating-point strided array elements, ignoring `NaN` values.
7575

@@ -86,9 +86,9 @@ The function has the following parameters:
8686

8787
- **N**: number of indexed elements.
8888
- **x**: input [`Float32Array`][@stdlib/array/float32].
89-
- **stride**: index increment for `x`.
89+
- **strideX**: stride length.
9090

91-
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 `x`,
91+
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:
9292

9393
```javascript
9494
var Float32Array = require( '@stdlib/array-float32' );
@@ -113,7 +113,7 @@ var v = snansum( 4, x1, 2 );
113113
// returns 5.0
114114
```
115115

116-
#### snansum.ndarray( N, x, stride, offset )
116+
#### snansum.ndarray( N, x, strideX, offsetX )
117117

118118
Computes the sum of single-precision floating-point strided array elements, ignoring `NaN` values and using alternative indexing semantics.
119119

@@ -128,9 +128,9 @@ var v = snansum.ndarray( 4, x, 1, 0 );
128128

129129
The function has the following additional parameters:
130130

131-
- **offset**: starting index for `x`.
131+
- **offsetX**: starting index.
132132

133-
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 `x` starting from the second value
133+
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:
134134

135135
```javascript
136136
var Float32Array = require( '@stdlib/array-float32' );
@@ -168,7 +168,7 @@ var filledarrayBy = require( '@stdlib/array-filled-by' );
168168
var snansum = require( '@stdlib/blas-ext-base-snansum' );
169169

170170
function rand() {
171-
if ( bernoulli( 0.8 ) > 0 ) {
171+
if ( bernoulli( 0.5 ) < 1 ) {
172172
return discreteUniform( 0, 100 );
173173
}
174174
return NaN;
@@ -185,6 +185,123 @@ console.log( v );
185185

186186
<!-- /.examples -->
187187

188+
<!-- C interface documentation. -->
189+
190+
* * *
191+
192+
<section class="c">
193+
194+
## C APIs
195+
196+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
197+
198+
<section class="intro">
199+
200+
</section>
201+
202+
<!-- /.intro -->
203+
204+
<!-- C usage documentation. -->
205+
206+
<section class="usage">
207+
208+
### Usage
209+
210+
```c
211+
#include "stdlib/blas/ext/base/snansum.h"
212+
```
213+
214+
#### stdlib_strided_snansum( N, \*X, strideX )
215+
216+
Computes the sum of single-precision floating-point strided array elements, ignoring `NaN` values.
217+
218+
```c
219+
const float x[] = { 1.0f, 2.0f, 0.0f/0.0f, 4.0f };
220+
221+
float v = stdlib_strided_snansum( 4, x, 1 );
222+
// returns 7.0f
223+
```
224+
225+
The function accepts the following arguments:
226+
227+
- **N**: `[in] CBLAS_INT` number of indexed elements.
228+
- **X**: `[in] float*` input array.
229+
- **strideX**: `[in] CBLAS_INT` stride length.
230+
231+
```c
232+
float stdlib_strided_snansum( const CBLAS_INT N, const float *X, const CBLAS_INT strideX );
233+
```
234+
235+
#### stdlib_strided_snansum_ndarray( N, \*X, strideX, offsetX )
236+
237+
Computes the sum of single-precision floating-point strided array elements, ignoring `NaN` values and using alternative indexing semantics.
238+
239+
```c
240+
const float x[] = { 1.0f, 2.0f, 0.0f/0.0f, 4.0f };
241+
242+
float v = stdlib_strided_snansum_ndarray( 4, x, 1, 0 );
243+
// returns 7.0f
244+
```
245+
246+
The function accepts the following arguments:
247+
248+
- **N**: `[in] CBLAS_INT` number of indexed elements.
249+
- **X**: `[in] float*` input array.
250+
- **strideX**: `[in] CBLAS_INT` stride length.
251+
- **offsetX**: `[in] CBLAS_INT` starting index.
252+
253+
```c
254+
float stdlib_strided_snansum_ndarray( const CBLAS_INT N, const float *X, const CBLAS_INT strideX, const CBLAS_INT offsetX );
255+
```
256+
257+
</section>
258+
259+
<!-- /.usage -->
260+
261+
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
262+
263+
<section class="notes">
264+
265+
</section>
266+
267+
<!-- /.notes -->
268+
269+
<!-- C API usage examples. -->
270+
271+
<section class="examples">
272+
273+
### Examples
274+
275+
```c
276+
#include "stdlib/blas/ext/base/snansum.h"
277+
#include <stdio.h>
278+
279+
int main( void ) {
280+
// Create a strided array:
281+
const float x[] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 0.0f/0.0f, 0.0f/0.0f };
282+
283+
// Specify the number of elements:
284+
const int N = 5;
285+
286+
// Specify the stride length:
287+
const int strideX = 2;
288+
289+
// Compute the sum:
290+
float v = stdlib_strided_snansum( N, x, strideX );
291+
292+
// Print the result:
293+
printf( "Sum: %f\n", v );
294+
}
295+
```
296+
297+
</section>
298+
299+
<!-- /.examples -->
300+
301+
</section>
302+
303+
<!-- /.c -->
304+
188305
<section class="references">
189306
190307
</section>
@@ -234,7 +351,7 @@ See [LICENSE][stdlib-license].
234351
235352
## Copyright
236353
237-
Copyright &copy; 2016-2024. The Stdlib [Authors][stdlib-authors].
354+
Copyright &copy; 2016-2025. The Stdlib [Authors][stdlib-authors].
238355
239356
</section>
240357

benchmark/benchmark.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,19 @@ var snansum = require( './../lib/snansum.js' );
3232

3333
// FUNCTIONS //
3434

35+
/**
36+
* Returns a random number.
37+
*
38+
* @private
39+
* @returns {number} random number
40+
*/
41+
function rand() {
42+
if ( bernoulli( 0.5 ) < 1 ) {
43+
return uniform( -10.0, 10.0 );
44+
}
45+
return NaN;
46+
}
47+
3548
/**
3649
* Creates a benchmark function.
3750
*
@@ -43,13 +56,6 @@ function createBenchmark( len ) {
4356
var x = filledarrayBy( len, 'float32', rand );
4457
return benchmark;
4558

46-
function rand() {
47-
if ( bernoulli( 0.8 ) > 0 ) {
48-
return uniform( -10.0, 10.0 );
49-
}
50-
return NaN;
51-
}
52-
5359
function benchmark( b ) {
5460
var v;
5561
var i;

benchmark/benchmark.native.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,19 @@ var opts = {
4141

4242
// FUNCTIONS //
4343

44+
/**
45+
* Returns a random number.
46+
*
47+
* @private
48+
* @returns {number} random number
49+
*/
50+
function rand() {
51+
if ( bernoulli( 0.5 ) < 1 ) {
52+
return uniform( -10.0, 10.0 );
53+
}
54+
return NaN;
55+
}
56+
4457
/**
4558
* Creates a benchmark function.
4659
*
@@ -52,13 +65,6 @@ function createBenchmark( len ) {
5265
var x = filledarrayBy( len, 'float32', rand );
5366
return benchmark;
5467

55-
function rand() {
56-
if ( bernoulli( 0.8 ) > 0 ) {
57-
return uniform( -10.0, 10.0 );
58-
}
59-
return NaN;
60-
}
61-
6268
function benchmark( b ) {
6369
var v;
6470
var i;

benchmark/benchmark.ndarray.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,19 @@ var snansum = require( './../lib/ndarray.js' );
3232

3333
// FUNCTIONS //
3434

35+
/**
36+
* Returns a random number.
37+
*
38+
* @private
39+
* @returns {number} random number
40+
*/
41+
function rand() {
42+
if ( bernoulli( 0.5 ) < 1 ) {
43+
return uniform( -10.0, 10.0 );
44+
}
45+
return NaN;
46+
}
47+
3548
/**
3649
* Creates a benchmark function.
3750
*
@@ -43,13 +56,6 @@ function createBenchmark( len ) {
4356
var x = filledarrayBy( len, 'float32', rand );
4457
return benchmark;
4558

46-
function rand() {
47-
if ( bernoulli( 0.8 ) > 0 ) {
48-
return uniform( -10.0, 10.0 );
49-
}
50-
return NaN;
51-
}
52-
5359
function benchmark( b ) {
5460
var v;
5561
var i;

benchmark/benchmark.ndarray.native.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,19 @@ var opts = {
4141

4242
// FUNCTIONS //
4343

44+
/**
45+
* Returns a random number.
46+
*
47+
* @private
48+
* @returns {number} random number
49+
*/
50+
function rand() {
51+
if ( bernoulli( 0.5 ) < 1 ) {
52+
return uniform( -10.0, 10.0 );
53+
}
54+
return NaN;
55+
}
56+
4457
/**
4558
* Creates a benchmark function.
4659
*
@@ -52,13 +65,6 @@ function createBenchmark( len ) {
5265
var x = filledarrayBy( len, 'float32', rand );
5366
return benchmark;
5467

55-
function rand() {
56-
if ( bernoulli( 0.8 ) > 0 ) {
57-
return uniform( -10.0, 10.0 );
58-
}
59-
return NaN;
60-
}
61-
6268
function benchmark( b ) {
6369
var v;
6470
var i;

0 commit comments

Comments
 (0)