diff --git a/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/README.md b/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/README.md index 90e302f0c23a..68c79111bbcb 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/README.md +++ b/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/README.md @@ -207,7 +207,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_dnannsumkbn2( const CBLAS_INT N, const double *X, const CBLAS_INT strideX, CBLAS_INT *n ); @@ -231,7 +231,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_dnannsumkbn2_ndarray( const CBLAS_INT N, const double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, CBLAS_INT *n ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/lib/dnannsumkbn2.js b/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/lib/dnannsumkbn2.js index 979e874c0411..1070df5b7bca 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/lib/dnannsumkbn2.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/lib/dnannsumkbn2.js @@ -58,11 +58,7 @@ function dnannsumkbn2( N, x, strideX, out, strideOut ) { var io; ix = stride2offset( N, strideX ); - if ( strideOut < 0 ) { - io = -strideOut; - } else { - io = 0; - } + io = stride2offset( 2, strideOut ); return ndarray( N, x, strideX, ix, out, strideOut, io ); } diff --git a/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/src/addon.c b/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/src/addon.c index fd853ce40aeb..d5e698d9d629 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/src/addon.c +++ b/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/src/addon.c @@ -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 #include /** @@ -39,13 +41,7 @@ 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; - } - + int64_t io = stdlib_strided_stride2offset( 2, strideOut ); double *out = Out; CBLAS_INT n; 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 ) { 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_dnannsumkbn2_ndarray)( N, X, strideX, offsetX, &n ); - out[ io+strideOut ] = (double)n; + out[ offsetOut ] = API_SUFFIX(stdlib_strided_dnannsumkbn2_ndarray)( N, X, strideX, offsetX, &n ); + out[ offsetOut+strideOut ] = (double)n; return NULL; } diff --git a/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/src/main.c b/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/src/main.c index 1b33595e5afd..1befe61dc419 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/src/main.c +++ b/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/src/main.c @@ -36,7 +36,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_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 * @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_dnannsumkbn2_ndarray)( const CBLAS_INT N, const double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, CBLAS_INT *n ) { + CBLAS_INT ix; + CBLAS_INT i; double sum; double ccs; double cs; double cc; - CBLAS_INT ix; - CBLAS_INT i; double v; double t; double c; diff --git a/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/test/test.dnannsumkbn2.js b/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/test/test.dnannsumkbn2.js index 99369e7acf4f..a2440f1e6684 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/test/test.dnannsumkbn2.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/test/test.dnannsumkbn2.js @@ -220,6 +220,7 @@ tape( 'if provided a `stride` parameter equal to `0`, the function returns the s var out; var x; var v; + x = new Float64Array( [ 1.0, -2.0, -4.0, 5.0, 3.0 ] ); out = new Float64Array( 2 ); v = dnannsumkbn2( x.length, x, 0, out, 1 ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/test/test.dnannsumkbn2.native.js b/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/test/test.dnannsumkbn2.native.js index 900cf84a8dfa..77f39cba8257 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/test/test.dnannsumkbn2.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/test/test.dnannsumkbn2.native.js @@ -229,6 +229,7 @@ tape( 'if provided a `stride` parameter equal to `0`, the function returns the s var out; var x; var v; + x = new Float64Array( [ 1.0, -2.0, -4.0, 5.0, 3.0 ] ); out = new Float64Array( 2 ); v = dnannsumkbn2( x.length, x, 0, out, 1 ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/test/test.ndarray.js index 42a3d9b40f80..ac7034349bfa 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/test/test.ndarray.js @@ -220,6 +220,7 @@ tape( 'if provided a `stride` parameter equal to `0`, the function returns the s var out; var x; var v; + x = new Float64Array( [ 1.0, -2.0, -4.0, 5.0, 3.0 ] ); out = new Float64Array( 2 ); v = dnannsumkbn2( x.length, x, 0, 0, out, 1, 0 ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/test/test.ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/test/test.ndarray.native.js index e8e121e298a9..edc27ee55ece 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/test/test.ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/test/test.ndarray.native.js @@ -229,6 +229,7 @@ tape( 'if provided a `stride` parameter equal to `0`, the function returns the s var out; var x; var v; + x = new Float64Array( [ 1.0, -2.0, -4.0, 5.0, 3.0 ] ); out = new Float64Array( 2 ); v = dnannsumkbn2( x.length, x, 0, 0, out, 1, 0 );