Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
12 changes: 6 additions & 6 deletions lib/node_modules/@stdlib/blas/ext/base/dnannsum/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ The function has the following parameters:
- **out**: output [`Float64Array`][@stdlib/array/float64] whose first element is the sum and whose second element is the number of non-NaN elements.
- **strideOut**: stride length for `out`.

The `N` and stride parameters determine which elements in the strided array are accessed at runtime. For example, to compute the sum of every other element in the strided array:
The `N` and stride parameters determine which elements in the strided array are accessed at runtime. For example, to compute the sum of every other element:

```javascript
var Float64Array = require( '@stdlib/array/float64' );
Expand Down Expand Up @@ -146,7 +146,7 @@ var Float64Array = require( '@stdlib/array/float64' );
var dnannsum = require( '@stdlib/blas/ext/base/dnannsum' );

function rand() {
if ( bernoulli( 0.7 ) > 0 ) {
if ( bernoulli( 0.5 ) < 1 ) {
return discreteUniform( 0, 100 );
}
return NaN;
Expand Down Expand Up @@ -208,7 +208,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`.
- **strideX**: `[in] CBLAS_INT` stride length.
- **n**: `[out] CBLAS_INT*` pointer for storing the number of non-NaN elements.

```c
Expand All @@ -223,7 +223,7 @@ Computes the sum of double-precision floating-point strided array elements, igno
#include "stdlib/blas/base/shared.h"

const double x[] = { 1.0, 2.0, 0.0/0.0, 4.0 };
CBLAS_INT n = 0;
CBLAS_INT n = 0;

double v = stdlib_strided_dnannsum_ndarray( 4, x, 1, 0, &n );
// returns 7.0
Expand All @@ -233,8 +233,8 @@ 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`.
- **offsetX**: `[in] CBLAS_INT` starting index for `X`.
- **strideX**: `[in] CBLAS_INT` stride length.
- **offsetX**: `[in] CBLAS_INT` starting index.
- **n**: `[out] CBLAS_INT*` pointer for storing the number of non-NaN elements.

```c
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ var dnannsum = require( './../lib/dnannsum.js' );
* @returns {number} random number
*/
function rand() {
if ( bernoulli( 0.7 ) > 0 ) {
if ( bernoulli( 0.5 ) < 1 ) {
return discreteUniform( -10, 10 );
}
return NaN;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ var opts = {
* @returns {number} random number
*/
function rand() {
if ( bernoulli( 0.7 ) > 0 ) {
if ( bernoulli( 0.5 ) < 1 ) {
return discreteUniform( -10, 10 );
}
return NaN;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ var dnannsum = require( './../lib/ndarray.js' );
* @returns {number} random number
*/
function rand() {
if ( bernoulli( 0.7 ) > 0 ) {
if ( bernoulli( 0.5 ) < 1 ) {
return discreteUniform( -10, 10 );
}
return NaN;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ var opts = {
* @returns {number} random number
*/
function rand() {
if ( bernoulli( 0.7 ) > 0 ) {
if ( bernoulli( 0.5 ) < 1 ) {
return discreteUniform( -10, 10 );
}
return NaN;
Expand Down
4 changes: 2 additions & 2 deletions lib/node_modules/@stdlib/blas/ext/base/dnannsum/docs/repl.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@
ignoring `NaN` values and using alternative indexing semantics.

While typed array views mandate a view offset based on the underlying
buffer, the offset parameters support indexing semantics based on
starting indices.
buffer, the offset parameters support indexing semantics based on starting
indices.

Parameters
----------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ interface Routine {
*
* @param N - number of indexed elements
* @param x - input array
* @param strideX - `x` stride length
* @param strideX - stride length for `x`
* @param out - output array whose first element is the sum and whose second element is the number of non-NaN elements
* @param strideOut - `out` stride length
* @param strideOut - stride length for `out`
* @returns output array
*
* @example
Expand All @@ -48,11 +48,11 @@ interface Routine {
*
* @param N - number of indexed elements
* @param x - input array
* @param strideX - `x` stride length
* @param offsetX - `x` starting index
* @param strideX - stride length for `x`
* @param offsetX - starting index for `x`
* @param out - output array whose first element is the sum and whose second element is the number of non-NaN elements
* @param strideOut - `out` stride length
* @param offsetOut - `out` starting index
* @param strideOut - stride length for `out`
* @param offsetOut - starting index for `out`
* @returns output array
*
* @example
Expand All @@ -72,9 +72,9 @@ interface Routine {
*
* @param N - number of indexed elements
* @param x - input array
* @param strideX - `x` stride length
* @param strideX - stride length for `x`
* @param out - output array whose first element is the sum and whose second element is the number of non-NaN elements
* @param strideOut - `out` stride length
* @param strideOut - stride length for `out`
* @returns output array
*
* @example
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var Float64Array = require( '@stdlib/array/float64' );
var dnannsum = require( './../lib' );

function rand() {
if ( bernoulli( 0.7 ) > 0 ) {
if ( bernoulli( 0.5 ) < 1 ) {
return discreteUniform( 0, 100 );
}
return NaN;
Expand Down
11 changes: 3 additions & 8 deletions lib/node_modules/@stdlib/blas/ext/base/dnannsum/lib/dnannsum.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ var ndarray = require( './ndarray.js' );
*
* @param {PositiveInteger} N - number of indexed elements
* @param {Float64Array} x - input array
* @param {integer} strideX - `x` stride length
* @param {integer} strideX - stride length for `x`
* @param {Float64Array} out - output array
* @param {integer} strideOut - `out` stride length
* @param {integer} strideOut - stride length for `out`
* @returns {Float64Array} output array
*
* @example
Expand All @@ -46,12 +46,7 @@ var ndarray = require( './ndarray.js' );
* // returns <Float64Array>[ 1.0, 3 ]
*/
function dnannsum( N, x, strideX, out, strideOut ) {
var ix;
var io;

ix = stride2offset( N, strideX );
io = stride2offset( 2, strideOut );
return ndarray( N, x, strideX, ix, out, strideOut, io );
return ndarray( N, x, strideX, stride2offset( N, strideX ), out, strideOut, stride2offset( 2, strideOut ) ); // eslint-disable-line max-len
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ var addon = require( './../src/addon.node' );
*
* @param {PositiveInteger} N - number of indexed elements
* @param {Float64Array} x - input array
* @param {integer} strideX - `x` stride length
* @param {integer} strideX - stride length for `x`
* @param {Float64Array} out - output array
* @param {integer} strideOut - `out` stride length
* @param {integer} strideOut - stride length for `out`
* @returns {Float64Array} output array
*
* @example
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ var dnannsumkbn = require( '@stdlib/blas/ext/base/dnannsumkbn' ).ndarray;
*
* @param {PositiveInteger} N - number of indexed elements
* @param {Float64Array} x - input array
* @param {integer} strideX - `x` stride length
* @param {NonNegativeInteger} offsetX - `x` starting index
* @param {integer} strideX - stride length for `x`
* @param {NonNegativeInteger} offsetX - starting index for `x`
* @param {Float64Array} out - output array
* @param {integer} strideOut - `out` stride length
* @param {NonNegativeInteger} offsetOut - `out` starting index
* @param {integer} strideOut - stride length for `out`
* @param {NonNegativeInteger} offsetOut - starting index for `out`
* @returns {Float64Array} output array
*
* @example
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,20 @@ var addon = require( './../src/addon.node' );
*
* @param {PositiveInteger} N - number of indexed elements
* @param {Float64Array} x - input array
* @param {integer} strideX - `x` stride length
* @param {NonNegativeInteger} offsetX - `x` starting index
* @param {integer} strideX - stride length for `x`
* @param {NonNegativeInteger} offsetX - starting index for `x`
* @param {Float64Array} out - output array
* @param {integer} strideOut - `out` stride length
* @param {NonNegativeInteger} offsetOut - `out` starting index
* @param {integer} strideOut - stride length for `out`
* @param {NonNegativeInteger} offsetOut - starting index for `out`
* @returns {Float64Array} output array
*
* @example
* var Float64Array = require( '@stdlib/array/float64' );
* var floor = require( '@stdlib/math/base/special/floor' );
*
* var x = new Float64Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0, NaN, NaN ] );
* var out = new Float64Array( 2 );
*
* var N = floor( x.length / 2 );
*
* var v = dnannsum( N, x, 2, 1, out, 1, 0 );
* var v = dnannsum( 5, x, 2, 1, out, 1, 0 );
* // returns <Float64Array>[ 5.0, 4 ]
*/
function dnannsum( N, x, strideX, offsetX, out, strideOut, offsetOut ) {
Expand Down