Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/node_modules/@stdlib/blas/ext/base/dnannsumors/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ The function accepts the following arguments:
- **N**: `[in] CBLAS_INT` number of indexed elements.
- **X**: `[in] double*` input array.
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
- **n**: `[out] CBLAS_INT*` number of non-NaN elements.
- **n**: `[out] CBLAS_INT*` pointer for storing the number of non-NaN elements.

```c
double stdlib_strided_dnannsumors( const CBLAS_INT N, const double *X, const CBLAS_INT strideX, CBLAS_INT *n );
Expand All @@ -233,7 +233,7 @@ The function accepts the following arguments:
- **X**: `[in] double*` input array.
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
- **offsetX**: `[in] CBLAS_INT` starting index for `X`.
- **n**: `[out] CBLAS_INT*` number of non-NaN elements.
- **n**: `[out] CBLAS_INT*` pointer for storing the number of non-NaN elements.

```c
double stdlib_strided_dnannsumors_ndarray( const CBLAS_INT N, const double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, CBLAS_INT *n );
Expand Down
18 changes: 8 additions & 10 deletions lib/node_modules/@stdlib/blas/ext/base/dnannsumors/lib/ndarray.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,26 +49,24 @@ var isnan = require( '@stdlib/math/base/assert/is-nan' );
function dnannsumors( N, x, strideX, offsetX, out, strideOut, offsetOut ) {
var sum;
var ix;
var io;
var n;
var i;

sum = 0.0;
io = offsetOut;
if ( N <= 0 ) {
out[ io ] = sum;
out[ io+strideOut ] = 0;
out[ offsetOut ] = sum;
out[ offsetOut+strideOut ] = 0;
return out;
}
ix = offsetX;
if ( strideX === 0 ) {
if ( isnan( x[ ix ] ) ) {
out[ io ] = sum;
out[ io+strideOut ] = 0;
out[ offsetOut ] = sum;
out[ offsetOut+strideOut ] = 0;
return out;
}
out[ io ] = x[ ix ] * N;
out[ io+strideOut ] = N;
out[ offsetOut ] = x[ ix ] * N;
out[ offsetOut+strideOut ] = N;
return out;
}
n = 0;
Expand All @@ -79,8 +77,8 @@ function dnannsumors( N, x, strideX, offsetX, out, strideOut, offsetOut ) {
}
ix += strideX;
}
out[ io ] = sum;
out[ io+strideOut ] = n;
out[ offsetOut ] = sum;
out[ offsetOut+strideOut ] = n;
return out;
}

Expand Down
21 changes: 7 additions & 14 deletions lib/node_modules/@stdlib/blas/ext/base/dnannsumors/src/addon.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#include "stdlib/napi/argv.h"
#include "stdlib/napi/argv_int64.h"
#include "stdlib/napi/argv_strided_float64array.h"
#include "stdlib/strided/base/stride2offset.h"
#include <stdint.h>
#include <node_api.h>

/**
Expand All @@ -39,17 +41,10 @@ static napi_value addon( napi_env env, napi_callback_info info ) {
STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, X, N, strideX, argv, 1 );
STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, Out, 2, strideOut, argv, 3 );

int io;
if ( strideOut < 0 ) {
io = -strideOut;
} else {
io = 0;
}

double *out = Out;
int64_t = stdlib_strided_stride2offset( 2, strideOut );
CBLAS_INT n;
out[ io ] = API_SUFFIX(stdlib_strided_dnannsumors)( N, X, strideX, &n );
out[ io + strideOut ] = (double)n;
Out[ io ] = API_SUFFIX(stdlib_strided_dnannsumors)( N, X, strideX, &n );
Out[ io + strideOut ] = (double)n;

return NULL;
}
Expand All @@ -71,11 +66,9 @@ static napi_value addon_method( napi_env env, napi_callback_info info ) {
STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, X, N, strideX, argv, 1 );
STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY( env, Out, 2, strideOut, argv, 4 );

int io = offsetOut;
double *out = Out;
CBLAS_INT n;
out[ io ] = API_SUFFIX(stdlib_strided_dnannsumors_ndarray)( N, X, strideX, offsetX, &n );
out[ io+strideOut ] = (double)n;
Out[ offsetOut ] = API_SUFFIX(stdlib_strided_dnannsumors_ndarray)( N, X, strideX, offsetX, &n );
Out[ offsetOut+strideOut ] = (double)n;

return NULL;
}
Expand Down
6 changes: 3 additions & 3 deletions lib/node_modules/@stdlib/blas/ext/base/dnannsumors/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* @param N number of indexed elements
* @param X input array
* @param strideX stride length
* @param n number of non-NaN elements
* @param n pointer for storing the number of non-NaN elements
* @return output value
*/
double API_SUFFIX(stdlib_strided_dnannsumors)( const CBLAS_INT N, const double *X, const CBLAS_INT strideX, CBLAS_INT *n ) {
Expand All @@ -42,13 +42,13 @@ double API_SUFFIX(stdlib_strided_dnannsumors)( const CBLAS_INT N, const double *
* @param X input array
* @param strideX stride length
* @param offsetX starting index
* @param n number of non-NaN elements
* @param n pointer for storing the number of non-NaN elements
* @return output value
*/
double API_SUFFIX(stdlib_strided_dnannsumors_ndarray)( const CBLAS_INT N, const double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, CBLAS_INT *n ) {
double sum;
CBLAS_INT ix;
CBLAS_INT i;
double sum;

sum = 0.0;
*n = 0;
Expand Down
Loading