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
14 changes: 7 additions & 7 deletions lib/node_modules/@stdlib/blas/ext/base/dnannsumkbn2/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 are accessed at runtime. For example, to compute the sum of every other element in `x`,
The `N` and stride parameters determine which elements 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 @@ -106,7 +106,7 @@ The function has the following additional parameters:
- **offsetX**: starting index for `x`.
- **offsetOut**: starting index for `out`.

While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, offset parameters support indexing semantics based on starting indices. For example, to calculate the sum of every other element starting from the second element:
While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameters support indexing semantics based on starting indices. For example, to calculate the sum of every other element starting from the second element:

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

function rand() {
if ( bernoulli( 0.8 ) > 0 ) {
if ( bernoulli( 0.5 ) < 1 ) {
return discreteUniform( 0, 100 );
}
return NaN;
Expand Down Expand Up @@ -206,7 +206,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 @@ -219,7 +219,7 @@ Computes the sum of double-precision floating-point strided array elements, igno

```c
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_dnannsumkbn2_ndarray( 4, x, 1, 0, &n );
// returns 7.0
Expand All @@ -229,8 +229,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 dnannsumkbn2 = require( './../lib/dnannsumkbn2.js' );
* @returns {number} random number
*/
function rand() {
if ( bernoulli( 0.7 ) > 0 ) {
if ( bernoulli( 0.5 ) < 1 ) {
return discreteUniform( -10.0, 10.0 );
}
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.8 ) > 0 ) {
if ( bernoulli( 0.5 ) < 1 ) {
return discreteUniform( -10.0, 10.0 );
}
return NaN;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ var dnannsumkbn2 = require( './../lib/ndarray.js' );
* @returns {number} random number
*/
function rand() {
if ( bernoulli( 0.8 ) > 0 ) {
if ( bernoulli( 0.5 ) < 1 ) {
return discreteUniform( -10.0, 10.0 );
}
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.8 ) > 0 ) {
if ( bernoulli( 0.5 ) < 1 ) {
return discreteUniform( -10.0, 10.0 );
}
return NaN;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
ignoring `NaN` values and using a second-order iterative Kahan–Babuška
algorithm.

The `N` and stride parameters determine which elements in the strided
array are accessed at runtime.
The `N` and stride parameters determine which elements in the strided array
are accessed at runtime.

Indexing is relative to the first index. To introduce an offset, use a typed
array view.
Expand Down Expand Up @@ -63,7 +63,7 @@
algorithm and alternative indexing semantics.

While typed array views mandate a view offset based on the underlying
buffer, offset parameters support indexing semantics based on starting
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 dnannsumkbn2 = require( './../lib' );

function rand() {
if ( bernoulli( 0.8 ) > 0 ) {
if ( bernoulli( 0.5 ) < 1 ) {
return discreteUniform( 0, 100 );
}
return NaN;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,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 @@ -54,12 +54,7 @@ var ndarray = require( './ndarray.js' );
* // returns <Float64Array>[ 1.0, 3 ]
*/
function dnannsumkbn2( 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 @@ -39,11 +39,11 @@ var abs = require( '@stdlib/math/base/special/abs' );
*
* @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,11 +30,11 @@ 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
Expand Down