Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
14 changes: 7 additions & 7 deletions lib/node_modules/@stdlib/blas/ext/base/dsnannsumors/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ var v = dsnannsumors( 4, x1, 2, out1, 1 );

#### dsnannsumors.ndarray( N, x, strideX, offsetX, out, strideOut, offsetOut )

Computes the sum of single-precision floating-point strided array elements, ignoring `NaN` values and using ordinary recursive summation with extended accumulation and alternative indexing semantics and returning an extended precision result.
Computes the sum of single-precision floating-point strided array elements, ignoring `NaN` values, using ordinary recursive summation with extended accumulation and alternative indexing semantics, and returning an extended precision result.

```javascript
var Float32Array = require( '@stdlib/array/float32' );
Expand Down Expand Up @@ -202,7 +202,7 @@ console.log( out );
Computes the sum of single-precision floating-point strided array elements, ignoring `NaN` values, using ordinary recursive summation with extended accumulation, and returning an extended precision result.

```c
const float x[] = { 1.0f, -2.0f, 0.0/0.0, 2.0f };
const float x[] = { 1.0f, -2.0f, 0.0f/0.0f, 2.0f };
CBLAS_INT n = 0;

double v = stdlib_strided_dsnannsumors( 4, x, 1, &n );
Expand All @@ -214,18 +214,18 @@ The function accepts the following arguments:
- **N**: `[in] CBLAS_INT` number of indexed elements.
- **X**: `[in] float*` 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_dsnannsumors( const CBLAS_INT N, const float *X, const CBLAS_INT strideX, CBLAS_INT *n );
```

#### stdlib_strided_dsnannsumors_ndarray( N, \*X, strideX, offsetX, \*n )

Computes the sum of single-precision floating-point strided array elements, ignoring `NaN` values and using ordinary recursive summation with extended accumulation and alternative indexing semantics and returning an extended precision result.
Computes the sum of single-precision floating-point strided array elements, ignoring `NaN` values, using ordinary recursive summation with extended accumulation and alternative indexing semantics, and returning an extended precision result.

```c
const float x[] = { 1.0f, -2.0f, 0.0/0.0, 2.0f };
const float x[] = { 1.0f, -2.0f, 0.0f/0.0f, 2.0f };
CBLAS_INT n = 0;

double v = stdlib_strided_dsnannsumors_ndarray( 4, x, 1, 0, &n );
Expand All @@ -238,7 +238,7 @@ The function accepts the following arguments:
- **X**: `[in] float*` 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_dsnannsumors_ndarray( const CBLAS_INT N, const float *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, CBLAS_INT *n );
Expand Down Expand Up @@ -269,7 +269,7 @@ double stdlib_strided_dsnannsumors_ndarray( const CBLAS_INT N, const float *X, c

int main( void ) {
// Create a strided array:
const float x[] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 0.0/0.0, 0.0/0.0 };
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 };

// Specify the number of elements:
const int N = 5;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@

{{alias}}.ndarray( N, x, strideX, offsetX, out, strideOut, offsetOut )
Computes the sum of single-precision floating-point strided array elements,
ignoring `NaN` values and using ordinary recursive summation with extended
accumulation and alternative indexing semantics and returning an extended
ignoring `NaN` values, using ordinary recursive summation with extended
accumulation and alternative indexing semantics, and returning an extended
precision result.

While typed array views mandate a view offset based on the underlying
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

int main( void ) {
// Create a strided array:
const float x[] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 0.0/0.0, 0.0/0.0 };
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 };

// Specify the number of elements:
const int N = 5;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ extern "C" {
double API_SUFFIX(stdlib_strided_dsnannsumors)( const CBLAS_INT N, const float *X, const CBLAS_INT strideX, CBLAS_INT *n );

/**
* Computes the sum of single-precision floating-point strided array elements, ignoring `NaN` values and using ordinary recursive summation with extended accumulation and alternative indexing semantics and returning an extended precision result.
* Computes the sum of single-precision floating-point strided array elements, ignoring `NaN` values, using ordinary recursive summation with extended accumulation and alternative indexing semantics, and returning an extended precision result.
*/
double API_SUFFIX(stdlib_strided_dsnannsumors_ndarray)( const CBLAS_INT N, const float *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, CBLAS_INT *n );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,7 @@ function dsnannsumors( 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 );
}

Expand Down
18 changes: 8 additions & 10 deletions lib/node_modules/@stdlib/blas/ext/base/dsnannsumors/lib/ndarray.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,26 +50,24 @@ var isnan = require( '@stdlib/math/base/assert/is-nan' );
function dsnannsumors( 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 @@ -80,8 +78,8 @@ function dsnannsumors( 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
15 changes: 5 additions & 10 deletions lib/node_modules/@stdlib/blas/ext/base/dsnannsumors/src/addon.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
#include "stdlib/napi/argv_int64.h"
#include "stdlib/napi/argv_strided_float32array.h"
#include "stdlib/napi/argv_strided_float64array.h"
#include "stdlib/strided/base/stride2offset.h"
#include <stdint.h>
#include <node_api.h>

/**
Expand All @@ -41,13 +43,7 @@ static napi_value addon( napi_env env, napi_callback_info info ) {
STDLIB_NAPI_ARGV_STRIDED_FLOAT32ARRAY( 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_dsnannsumors)( N, X, strideX, &n );
Expand All @@ -74,11 +70,10 @@ static napi_value addon_method( napi_env env, napi_callback_info info ) {
STDLIB_NAPI_ARGV_STRIDED_FLOAT32ARRAY( 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_dsnannsumors_ndarray)( N, X, strideX, offsetX, &n );
out[ io + strideOut ] = (double)n;
out[ offsetOut ] = API_SUFFIX(stdlib_strided_dsnannsumors_ndarray)( N, X, strideX, offsetX, &n );
out[ offsetOut + strideOut ] = (double)n;

return NULL;
}
Expand Down
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_dsnannsumors)( const CBLAS_INT N, const float *X, const CBLAS_INT strideX, CBLAS_INT *n ) {
Expand All @@ -36,19 +36,19 @@ double API_SUFFIX(stdlib_strided_dsnannsumors)( const CBLAS_INT N, const float *
}

/**
* Computes the sum of single-precision floating-point strided array elements, ignoring `NaN` values and using ordinary recursive summation with extended accumulation and alternative indexing semantics and returning an extended precision result.
* Computes the sum of single-precision floating-point strided array elements, ignoring `NaN` values, using ordinary recursive summation with extended accumulation and alternative indexing semantics, and returning an extended precision result.
*
* @param N number of indexed elements
* @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_dsnannsumors_ndarray)( const CBLAS_INT N, const float *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