Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: update blas/ext/base/dnannsumkbn to follow current project conventions #5187

Merged
merged 1 commit into from
Feb 15, 2025
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/dnannsumkbn/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 @@ -146,7 +146,7 @@ var Float64Array = require( '@stdlib/array/float64' );
var dnannsumkbn = require( '@stdlib/blas/ext/base/dnannsumkbn' );

function rand() {
if ( bernoulli( 0.8 ) > 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_dnannsumkbn_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 dnannsumkbn = require( './../lib/dnannsumkbn.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.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 @@ -40,7 +40,7 @@ var dnannsumkbn = require( './../lib/ndarray.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.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 @@ -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 dnannsumkbn = 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 dnannsumkbn( 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