Skip to content

Commit 7e052b2

Browse files
committed
Auto-generated commit
1 parent 104336d commit 7e052b2

File tree

11 files changed

+70
-18
lines changed

11 files changed

+70
-18
lines changed

.github/.keepalive

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2025-06-02T00:58:22.407Z

CHANGELOG.md

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

7-
## Unreleased (2025-04-26)
7+
## Unreleased (2025-06-02)
88

99
<section class="features">
1010

@@ -16,12 +16,25 @@
1616

1717
<!-- /.features -->
1818

19+
<section class="bug-fixes">
20+
21+
### Bug Fixes
22+
23+
- [`95641f7`](https://github.com/stdlib-js/stdlib/commit/95641f75c1764479af76b23eac8a90101ee12f8d) - update implementation to preserve signed zeros
24+
- [`da339ee`](https://github.com/stdlib-js/stdlib/commit/da339ee8d7e24972cbf4a1592b9174ef617978f8) - update implementation to preserve signed zeros
25+
26+
</section>
27+
28+
<!-- /.bug-fixes -->
29+
1930
<section class="commits">
2031

2132
### Commits
2233

2334
<details>
2435

36+
- [`95641f7`](https://github.com/stdlib-js/stdlib/commit/95641f75c1764479af76b23eac8a90101ee12f8d) - **fix:** update implementation to preserve signed zeros _(by Athan Reines)_
37+
- [`da339ee`](https://github.com/stdlib-js/stdlib/commit/da339ee8d7e24972cbf4a1592b9174ef617978f8) - **fix:** update implementation to preserve signed zeros _(by Athan Reines)_
2538
- [`9f85b5d`](https://github.com/stdlib-js/stdlib/commit/9f85b5d90cb6fcaf052116cd06aa4a693757f0ec) - **test:** fix description _(by Philipp Burckhardt)_
2639
- [`074b9a1`](https://github.com/stdlib-js/stdlib/commit/074b9a191c77d297bab5cb51cf82a727a650fe58) - **feat:** add C `ndarray` API and refactor `blas/ext/base/dsumpw` [(#4329)](https://github.com/stdlib-js/stdlib/pull/4329) _(by Muhammad Haris)_
2740
- [`62364f6`](https://github.com/stdlib-js/stdlib/commit/62364f62ea823a3b52c2ad25660ecd80c71f8f36) - **style:** fix C comment alignment _(by Philipp Burckhardt)_

CONTRIBUTORS

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,15 @@ GK Bishnoi <[email protected]>
5454
GURU PRASAD SHARMA <[email protected]>
5555
5656
Gautam sharma <[email protected]>
57+
Girish Garg <[email protected]>
5758
Golden Kumar <[email protected]>
5859
Gunj Joshi <[email protected]>
5960
Gururaj Gurram <[email protected]>
6061
Haroon Rasheed <[email protected]>
61-
Harsh <[email protected].com>
62+
Harsh <harshyadav6078@gmail.com>
6263
6364
Harshita Kalani <[email protected]>
65+
Hemang Choudhary <[email protected]>
6466
Hemant M Mehta <[email protected]>
6567
Hridyanshu <[email protected]>
6668
Jaimin Godhani <[email protected]>
@@ -78,6 +80,7 @@ Joris Labie <[email protected]>
7880
Justin Dennison <[email protected]>
7981
Justyn Shelby <[email protected]>
8082
Karan Anand <[email protected]>
83+
Karan Vasudevamurthy <[email protected]>
8184
Karan Yadav <[email protected]>
8285
Karthik Prakash <[email protected]>
8386
Kaushikgtm <[email protected]>
@@ -86,6 +89,7 @@ Kohantika Nath <[email protected]>
8689
Krishnam Agarwal <[email protected]>
8790
Krishnendu Das <[email protected]>
8891
Kshitij-Dale <[email protected]>
92+
Lalit Narayan Yadav <[email protected]>
8993
Lovelin Dhoni J B <[email protected]>
9094
9195
Mahfuza Humayra Mohona <[email protected]>
@@ -143,6 +147,7 @@ Ryan Seal <[email protected]>
143147
Rylan Yang <[email protected]>
144148
SAHIL KUMAR <[email protected]>
145149
SHIVAM YADAV <[email protected]>
150+
Sachin Raj <[email protected]>
146151
Sahil Goyal <[email protected]>
147152
Sai Avinash <[email protected]>
148153
Sai Srikar Dumpeti <[email protected]>
@@ -163,14 +168,19 @@ Spandan Barve <[email protected]>
163168
Stephannie Jiménez Gacha <[email protected]>
164169
Suhaib Ilahi <[email protected]>
165170
Suraj Kumar <[email protected]>
171+
Swapnil Hajare <[email protected]>
166172
Tanishq Ahuja <[email protected]>
167173
Tirtadwipa Manunggal <[email protected]>
168174
Tudor Pagu <[email protected]>
169175
Tufailahmed Bargir <[email protected]>
176+
Tushar Bhardwaj <[email protected]>
177+
Uday Kakade <[email protected]>
178+
Ujjwal Kirti <[email protected]>
170179
Utkarsh <http://[email protected]>
171180
Utkarsh Raj <[email protected]>
172181
UtkershBasnet <[email protected]>
173182
Vaibhav Patel <[email protected]>
183+
Vara Rahul Rajana <[email protected]>
174184
Varad Gupta <[email protected]>
175185
Vinit Pandit <[email protected]>
176186
Vivek Maurya <[email protected]>
@@ -190,3 +200,4 @@ pranav-1720 <[email protected]>
190200
rahulrangers <[email protected]>
191201
192202
203+

dist/index.js

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

include/stdlib/blas/ext/base/dsumpw.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ extern "C" {
3131
/**
3232
* Computes the sum of double-precision floating-point strided array elements using pairwise summation.
3333
*/
34-
double API_SUFFIX(stdlib_strided_dsumpw)( const CBLAS_INT N, const double *X, const CBLAS_INT stride );
34+
double API_SUFFIX(stdlib_strided_dsumpw)( const CBLAS_INT N, const double *X, const CBLAS_INT strideX );
3535

3636
/**
3737
* Computes the sum of double-precision floating-point strided array elements using pairwise summation and alternative indexing semantics.

lib/ndarray.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,9 @@ function dsumpw( N, x, strideX, offsetX ) {
8080
}
8181
if ( N < 8 ) {
8282
// Use simple summation...
83-
s = 0.0;
84-
for ( i = 0; i < N; i++ ) {
83+
s = x[ ix ];
84+
ix += strideX;
85+
for ( i = 1; i < N; i++ ) {
8586
s += x[ ix ];
8687
ix += strideX;
8788
}
@@ -115,7 +116,7 @@ function dsumpw( N, x, strideX, offsetX ) {
115116
s = ( (s0+s1) + (s2+s3) ) + ( (s4+s5) + (s6+s7) );
116117

117118
// Clean-up loop...
118-
for ( i; i < N; i++ ) {
119+
for ( ; i < N; i++ ) {
119120
s += x[ ix ];
120121
ix += strideX;
121122
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
"@stdlib/array-float64": "^0.2.2",
5959
"@stdlib/assert-is-browser": "^0.2.2",
6060
"@stdlib/math-base-assert-is-nan": "^0.2.2",
61+
"@stdlib/math-base-assert-is-negative-zero": "^0.2.2",
6162
"@stdlib/math-base-special-pow": "^0.3.0",
6263
"@stdlib/random-array-discrete-uniform": "^0.2.1",
6364
"@stdlib/random-array-uniform": "^0.2.1",

src/main.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,9 @@ double API_SUFFIX(stdlib_strided_dsumpw_ndarray)( const CBLAS_INT N, const doubl
8282
}
8383
if ( N < 8 ) {
8484
// Use simple summation...
85-
sum = 0.0;
86-
for ( i = 0; i < N; i++ ) {
85+
sum = X[ ix ];
86+
ix += strideX;
87+
for ( i = 1; i < N; i++ ) {
8788
sum += X[ ix ];
8889
ix += strideX;
8990
}
@@ -118,7 +119,7 @@ double API_SUFFIX(stdlib_strided_dsumpw_ndarray)( const CBLAS_INT N, const doubl
118119
sum = ( (s0+s1) + (s2+s3) ) + ( (s4+s5) + (s6+s7) );
119120

120121
// Clean-up loop...
121-
for (; i < N; i++ ) {
122+
for ( ; i < N; i++ ) {
122123
sum += X[ ix ];
123124
ix += strideX;
124125
}

test/test.ndarray.js

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

2323
var tape = require( 'tape' );
2424
var isnan = require( '@stdlib/math-base-assert-is-nan' );
25+
var isNegativeZero = require( '@stdlib/math-base-assert-is-negative-zero' );
2526
var Float64Array = require( '@stdlib/array-float64' );
2627
var dsumpw = require( './../lib/ndarray.js' );
2728

@@ -74,6 +75,17 @@ tape( 'the function calculates the sum of all strided array elements', function
7475
t.end();
7576
});
7677

78+
tape( 'the function preserves the sign of zero', function test( t ) {
79+
var x;
80+
var v;
81+
82+
x = new Float64Array( [ -0.0, -0.0, -0.0, -0.0, -0.0 ] );
83+
v = dsumpw( x.length, x, 1, 0 );
84+
t.strictEqual( isNegativeZero( v ), true, 'returns expected value' );
85+
86+
t.end();
87+
});
88+
7789
tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `0.0`', function test( t ) {
7890
var x;
7991
var v;

0 commit comments

Comments
 (0)