Skip to content

Commit 3ccdc9e

Browse files
committed
Auto-generated commit
1 parent 3f0096b commit 3ccdc9e

12 files changed

+31
-32
lines changed

CHANGELOG.md

Lines changed: 2 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 (2024-11-11)
7+
## Unreleased (2024-11-17)
88

99
<section class="features">
1010

@@ -22,6 +22,7 @@
2222

2323
<details>
2424

25+
- [`f80e82f`](https://github.com/stdlib-js/stdlib/commit/f80e82fac77275db101aaa28f61eebd7024e2c9f) - **refactor:** update `offset` handling and function parameter description for `blas/ext/base/dnannsumkbn2` [(#3123)](https://github.com/stdlib-js/stdlib/pull/3123) _(by Muhammad Haris)_
2526
- [`f0ecdad`](https://github.com/stdlib-js/stdlib/commit/f0ecdad9731cd40ae9047a87981d2688693e54dc) - **feat:** add C `ndarray` API and refactor `blas/ext/base/dnannsumkbn2` [(#2990)](https://github.com/stdlib-js/stdlib/pull/2990) _(by Muhammad Haris)_
2627

2728
</details>

CONTRIBUTORS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ Mohammad Kaif <98884589+Kaif987@users.noreply.github.com>
5959
Momtchil Momtchev <momtchil@momtchev.com>
6060
Muhammad Haris <harriskhan047@outlook.com>
6161
Naresh Jagadeesan <naresh.naresh000@gmail.com>
62+
Neeraj Pathak <neerajrpathak710@gmail.com>
6263
NightKnight <Ahmedatwa866@yahoo.com>
6364
Nithin Katta <88046362+nithinkatta@users.noreply.github.com>
6465
Nourhan Hasan <109472010+TheNourhan@users.noreply.github.com>
@@ -69,6 +70,7 @@ Prajwal Kulkarni <prajwalkulkarni76@gmail.com>
6970
Pranav Goswami <goswami.4@iitj.ac.in>
7071
Praneki <97080887+PraneGIT@users.noreply.github.com>
7172
Pratik <97464067+Pratik772846@users.noreply.github.com>
73+
Pratyush Kumar Chouhan <pratyushkumar0308@gmail.com>
7274
Priyansh <88396544+itsspriyansh@users.noreply.github.com>
7375
Pushpendra Chandravanshi <pushpendrachandravanshi4@gmail.com>
7476
RISHAV <115060907+rishav2404@users.noreply.github.com>
@@ -79,6 +81,7 @@ Ridam Garg <67867319+RidamGarg@users.noreply.github.com>
7981
Robert Gislason <gztown2216@yahoo.com>
8082
Roman Stetsyk <25715951+romanstetsyk@users.noreply.github.com>
8183
Rutam <138517416+performant23@users.noreply.github.com>
84+
Ruthwik Chikoti <145591715+ruthwikchikoti@users.noreply.github.com>
8285
Ryan Seal <splrk@users.noreply.github.com>
8386
Sai Srikar Dumpeti <80447788+the-r3aper7@users.noreply.github.com>
8487
SarthakPaandey <145528240+SarthakPaandey@users.noreply.github.com>

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ The function accepts the following arguments:
240240
- **N**: `[in] CBLAS_INT` number of indexed elements.
241241
- **X**: `[in] double*` input array.
242242
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
243-
- **n**: `[out] CBLAS_INT*` number of non-NaN elements.
243+
- **n**: `[out] CBLAS_INT*` pointer for storing the number of non-NaN elements.
244244
245245
```c
246246
double stdlib_strided_dnannsumkbn2( const CBLAS_INT N, const double *X, const CBLAS_INT strideX, CBLAS_INT *n );
@@ -264,7 +264,7 @@ The function accepts the following arguments:
264264
- **X**: `[in] double*` input array.
265265
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
266266
- **offsetX**: `[in] CBLAS_INT` starting index for `X`.
267-
- **n**: `[out] CBLAS_INT*` number of non-NaN elements.
267+
- **n**: `[out] CBLAS_INT*` pointer for storing the number of non-NaN elements.
268268
269269
```c
270270
double stdlib_strided_dnannsumkbn2_ndarray( const CBLAS_INT N, const double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, CBLAS_INT *n );

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: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/dnannsumkbn2.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,7 @@ function dnannsumkbn2( N, x, strideX, out, strideOut ) {
5858
var io;
5959

6060
ix = stride2offset( N, strideX );
61-
if ( strideOut < 0 ) {
62-
io = -strideOut;
63-
} else {
64-
io = 0;
65-
}
61+
io = stride2offset( 2, strideOut );
6662
return ndarray( N, x, strideX, ix, out, strideOut, io );
6763
}
6864

src/addon.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
#include "stdlib/napi/argv.h"
2323
#include "stdlib/napi/argv_int64.h"
2424
#include "stdlib/napi/argv_strided_float64array.h"
25+
#include "stdlib/strided/base/stride2offset.h"
26+
#include <stdint.h>
2527
#include <node_api.h>
2628

2729
/**
@@ -39,13 +41,7 @@ static napi_value addon( napi_env env, napi_callback_info info ) {
3941
STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, X, N, strideX, argv, 1 );
4042
STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, Out, 2, strideOut, argv, 3 );
4143

42-
int io;
43-
if ( strideOut < 0 ) {
44-
io = -strideOut;
45-
} else {
46-
io = 0;
47-
}
48-
44+
int64_t io = stdlib_strided_stride2offset( 2, strideOut );
4945
double *out = Out;
5046
CBLAS_INT n;
5147
out[ io ] = API_SUFFIX(stdlib_strided_dnannsumkbn2)( N, X, strideX, &n );
@@ -71,11 +67,10 @@ static napi_value addon_method( napi_env env, napi_callback_info info ) {
7167
STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, X, N, strideX, argv, 1 );
7268
STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, Out, 2, strideOut, argv, 4 );
7369

74-
int io = offsetOut;
7570
double *out = Out;
7671
CBLAS_INT n;
77-
out[ io ] = API_SUFFIX(stdlib_strided_dnannsumkbn2_ndarray)( N, X, strideX, offsetX, &n );
78-
out[ io+strideOut ] = (double)n;
72+
out[ offsetOut ] = API_SUFFIX(stdlib_strided_dnannsumkbn2_ndarray)( N, X, strideX, offsetX, &n );
73+
out[ offsetOut+strideOut ] = (double)n;
7974

8075
return NULL;
8176
}

src/main.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
* @param N number of indexed elements
3737
* @param X input array
3838
* @param strideX stride length
39-
* @param n number of non-NaN elements
39+
* @param n pointer for storing the number of non-NaN elements
4040
* @return output value
4141
*/
4242
double API_SUFFIX(stdlib_strided_dnannsumkbn2)( const CBLAS_INT N, const double *X, const CBLAS_INT strideX, CBLAS_INT *n ) {
@@ -59,16 +59,16 @@ double API_SUFFIX(stdlib_strided_dnannsumkbn2)( const CBLAS_INT N, const double
5959
* @param X input array
6060
* @param strideX stride length
6161
* @param offsetX starting index
62-
* @param n number of non-NaN elements
62+
* @param n pointer for storing the number of non-NaN elements
6363
* @return output value
6464
*/
6565
double API_SUFFIX(stdlib_strided_dnannsumkbn2_ndarray)( const CBLAS_INT N, const double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, CBLAS_INT *n ) {
66+
CBLAS_INT ix;
67+
CBLAS_INT i;
6668
double sum;
6769
double ccs;
6870
double cs;
6971
double cc;
70-
CBLAS_INT ix;
71-
CBLAS_INT i;
7272
double v;
7373
double t;
7474
double c;

test/test.dnannsumkbn2.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ tape( 'if provided a `stride` parameter equal to `0`, the function returns the s
220220
var out;
221221
var x;
222222
var v;
223+
223224
x = new Float64Array( [ 1.0, -2.0, -4.0, 5.0, 3.0 ] );
224225
out = new Float64Array( 2 );
225226
v = dnannsumkbn2( x.length, x, 0, out, 1 );

test/test.dnannsumkbn2.native.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ tape( 'if provided a `stride` parameter equal to `0`, the function returns the s
229229
var out;
230230
var x;
231231
var v;
232+
232233
x = new Float64Array( [ 1.0, -2.0, -4.0, 5.0, 3.0 ] );
233234
out = new Float64Array( 2 );
234235
v = dnannsumkbn2( x.length, x, 0, out, 1 );

0 commit comments

Comments
 (0)