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/dnannsumpw/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 the strided array,
The `N` and stride parameters determine which elements are accessed at runtime. For example, to compute the sum of every other element in the strided array:

```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 @@ -147,7 +147,7 @@ var Float64Array = require( '@stdlib/array/float64' );
var dnannsumpw = require( '@stdlib/blas/ext/base/dnannsumpw' );

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

```c
Expand All @@ -224,7 +224,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_dnannsumpw_ndarray( 4, x, 1, 0, &n );
// returns 7.0
Expand All @@ -234,8 +234,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 dnannsumpw = require( './../lib/dnannsumpw.js' );
* @returns {number} random number
*/
function rand() {
if ( bernoulli( 0.8 ) > 0 ) {
if ( bernoulli( 0.5 ) < 1 ) {
return uniform( -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 uniform( -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 dnannsumpw = require( './../lib/ndarray.js' );
* @returns {number} random number
*/
function rand() {
if ( bernoulli( 0.8 ) > 0 ) {
if ( bernoulli( 0.5 ) < 1 ) {
return uniform( -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 uniform( -10.0, 10.0 );
}
return NaN;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
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 dnannsumpw = 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,14 +54,7 @@ var ndarray = require( './ndarray.js' );
* // returns <Float64Array>[ 1.0, 3 ]
*/
function dnannsumpw( N, x, strideX, out, strideOut ) {
var ix;
var io;

ix = stride2offset( N, strideX );
io = stride2offset( 2, strideOut );
out[ io ] = 0.0;
out[ io+strideOut ] = 0;
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 @@ -38,11 +38,11 @@ var sumpw = require( './sumpw.js' );
*
* @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
11 changes: 5 additions & 6 deletions lib/node_modules/@stdlib/blas/ext/base/dnannsumpw/lib/sumpw.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,24 +46,23 @@
* @private
* @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 - two-element output array whose first element is the accumulated sum and whose second element is the accumulated number of summed values
* @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( [ 0.0, 0 ] );
*
* var v = sumpw( 5.0, x, 2, 1, out, 1, 0 );
* // returns <Float64Array>[ 5.0, 4 ]
*/
function sumpw( N, x, strideX, offsetX, out, strideOut, offsetOut ) {

Check warning on line 65 in lib/node_modules/@stdlib/blas/ext/base/dnannsumpw/lib/sumpw.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Function 'sumpw' has too many statements (102). Maximum allowed is 100
var ix;
var s0;
var s1;
Expand Down