Skip to content

Commit

Permalink
Auto-generated commit
Browse files Browse the repository at this point in the history
  • Loading branch information
stdlib-bot committed Sep 2, 2024
1 parent 843068b commit 850e3bb
Show file tree
Hide file tree
Showing 22 changed files with 272 additions and 371 deletions.
1 change: 0 additions & 1 deletion .github/.keepalive

This file was deleted.

7 changes: 5 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@
<section class="release" id="unreleased">

## Unreleased (2024-09-01)
## Unreleased (2024-09-02)

<section class="commits">

### Commits

<details>

- [`7cc8bb9`](https://github.com/stdlib-js/stdlib/commit/7cc8bb9a96147bb94fe8cfddc180a6ec535fc368) - **refactor:** update `blas/ext/base/dsnannsumors` _(by HarshaNP, Philipp Burckhardt)_
- [`272ae7a`](https://github.com/stdlib-js/stdlib/commit/272ae7ac5c576c68cfab1b6e304c86407faa20cd) - **docs:** remove comment _(by Athan Reines)_
- [`2777e4b`](https://github.com/stdlib-js/stdlib/commit/2777e4be161869d09406e3b17947d24c64b47af2) - **bench:** resolve lint errors in benchmarks _(by Athan Reines)_

Expand All @@ -25,9 +26,11 @@

### Contributors

A total of 1 person contributed to this release. Thank you to this contributor:
A total of 3 people contributed to this release. Thank you to the following contributors:

- Athan Reines
- HarshaNP
- Philipp Burckhardt

</section>

Expand Down
35 changes: 14 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,18 +92,16 @@ 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**: index increment 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 in `x`,

```javascript
var Float32Array = require( '@stdlib/array-float32' );
var Float64Array = require( '@stdlib/array-float64' );
var floor = require( '@stdlib/math-base-special-floor' );

var x = new Float32Array( [ 1.0, 2.0, NaN, -7.0, NaN, 3.0, 4.0, 2.0 ] );
var out = new Float64Array( 2 );
var N = floor( x.length / 2 );

var v = dsnannsumors( N, x, 2, out, 1 );
var v = dsnannsumors( 4, x, 2, out, 1 );
// returns <Float64Array>[ 5.0, 2 ]
```

Expand All @@ -114,17 +112,14 @@ Note that indexing is relative to the first index. To introduce an offset, use [
```javascript
var Float32Array = require( '@stdlib/array-float32' );
var Float64Array = require( '@stdlib/array-float64' );
var floor = require( '@stdlib/math-base-special-floor' );

var x0 = new Float32Array( [ 2.0, 1.0, NaN, -2.0, -2.0, 2.0, 3.0, 4.0 ] );
var x1 = new Float32Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element

var out0 = new Float64Array( 4 );
var out1 = new Float64Array( out0.buffer, out0.BYTES_PER_ELEMENT*2 ); // start at 3rd element

var N = floor( x0.length / 2 );

var v = dsnannsumors( N, x1, 2, out1, 1 );
var v = dsnannsumors( 4, x1, 2, out1, 1 );
// returns <Float64Array>[ 5.0, 4 ]
```

Expand Down Expand Up @@ -153,13 +148,11 @@ While [`typed array`][mdn-typed-array] views mandate a view offset based on the
```javascript
var Float32Array = require( '@stdlib/array-float32' );
var Float64Array = require( '@stdlib/array-float64' );
var floor = require( '@stdlib/math-base-special-floor' );

var x = new Float32Array( [ 2.0, 1.0, NaN, -2.0, -2.0, 2.0, 3.0, 4.0 ] );
var out = new Float64Array( 4 );
var N = floor( x.length / 2 );

var v = dsnannsumors.ndarray( N, x, 2, 1, out, 2, 1 );
var v = dsnannsumors.ndarray( 4, x, 2, 1, out, 2, 1 );
// returns <Float64Array>[ 0.0, 5.0, 0.0, 4 ]
```

Expand All @@ -185,23 +178,23 @@ var v = dsnannsumors.ndarray( N, x, 2, 1, out, 2, 1 );
<!-- eslint no-undef: "error" -->

```javascript
var randu = require( '@stdlib/random-base-randu' );
var round = require( '@stdlib/math-base-special-round' );
var discreteUniform = require( '@stdlib/random-base-discrete-uniform' );
var bernoulli = require( '@stdlib/random-base-bernoulli' );
var filledarrayBy = require( '@stdlib/array-filled-by' );
var Float32Array = require( '@stdlib/array-float32' );
var Float64Array = require( '@stdlib/array-float64' );
var dsnannsumors = require( '@stdlib/blas-ext-base-dsnannsumors' );

var x;
var i;

x = new Float32Array( 10 );
for ( i = 0; i < x.length; i++ ) {
if ( randu() < 0.2 ) {
x[ i ] = NaN;
} else {
x[ i ] = round( randu()*100.0 );

function rand() {
if ( bernoulli( 0.5 ) < 0.2 ) {
return NaN;
}
return discreteUniform( 0, 100 );
}

x = filledarrayBy( 10, 'float32', rand );
console.log( x );

var out = new Float64Array( 2 );
Expand Down
22 changes: 11 additions & 11 deletions benchmark/benchmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@
// MODULES //

var bench = require( '@stdlib/bench-harness' );
var randu = require( '@stdlib/random-base-randu' );
var uniform = require( '@stdlib/random-base-uniform' );
var bernoulli = require( '@stdlib/random-base-bernoulli' );
var filledarrayBy = require( '@stdlib/array-filled-by' );
var isnan = require( '@stdlib/math-base-assert-is-nan' );
var pow = require( '@stdlib/math-base-special-pow' );
var Float32Array = require( '@stdlib/array-float32' );
var Float64Array = require( '@stdlib/array-float64' );
var pkg = require( './../package.json' ).name;
var dsnannsumors = require( './../lib/dsnannsumors.js' );
Expand All @@ -42,19 +43,18 @@ var dsnannsumors = require( './../lib/dsnannsumors.js' );
function createBenchmark( len ) {
var out;
var x;
var i;

x = new Float32Array( len );
for ( i = 0; i < len; i++ ) {
if ( randu() < 0.2 ) {
x[ i ] = NaN;
} else {
x[ i ] = ( randu()*10.0 ) - 20.0;
}
}
x = filledarrayBy( len, 'float32', rand );
out = new Float64Array( 2 );
return benchmark;

function rand() {
if ( bernoulli( 0.5 ) < 0.2 ) {
return NaN;
}
return uniform( -10.0, 10.0 );
}

function benchmark( b ) {
var i;

Expand Down
22 changes: 11 additions & 11 deletions benchmark/benchmark.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@

var resolve = require( 'path' ).resolve;
var bench = require( '@stdlib/bench-harness' );
var randu = require( '@stdlib/random-base-randu' );
var uniform = require( '@stdlib/random-base-uniform' );
var bernoulli = require( '@stdlib/random-base-bernoulli' );
var filledarrayBy = require( '@stdlib/array-filled-by' );
var isnan = require( '@stdlib/math-base-assert-is-nan' );
var pow = require( '@stdlib/math-base-special-pow' );
var Float32Array = require( '@stdlib/array-float32' );
var Float64Array = require( '@stdlib/array-float64' );
var tryRequire = require( '@stdlib/utils-try-require' );
var pkg = require( './../package.json' ).name;
Expand All @@ -51,19 +52,18 @@ var opts = {
function createBenchmark( len ) {
var out;
var x;
var i;

x = new Float32Array( len );
for ( i = 0; i < len; i++ ) {
if ( randu() < 0.2 ) {
x[ i ] = NaN;
} else {
x[ i ] = ( randu()*10.0 ) - 20.0;
}
}
x = filledarrayBy( len, 'float32', rand );
out = new Float64Array( 2 );
return benchmark;

function rand() {
if ( bernoulli( 0.5 ) < 0.2 ) {
return NaN;
}
return uniform( -10.0, 10.0 );
}

function benchmark( b ) {
var i;

Expand Down
22 changes: 11 additions & 11 deletions benchmark/benchmark.ndarray.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@
// MODULES //

var bench = require( '@stdlib/bench-harness' );
var randu = require( '@stdlib/random-base-randu' );
var uniform = require( '@stdlib/random-base-uniform' );
var bernoulli = require( '@stdlib/random-base-bernoulli' );
var filledarrayBy = require( '@stdlib/array-filled-by' );
var isnan = require( '@stdlib/math-base-assert-is-nan' );
var pow = require( '@stdlib/math-base-special-pow' );
var Float32Array = require( '@stdlib/array-float32' );
var Float64Array = require( '@stdlib/array-float64' );
var pkg = require( './../package.json' ).name;
var dsnannsumors = require( './../lib/ndarray.js' );
Expand All @@ -42,19 +43,18 @@ var dsnannsumors = require( './../lib/ndarray.js' );
function createBenchmark( len ) {
var out;
var x;
var i;

x = new Float32Array( len );
for ( i = 0; i < len; i++ ) {
if ( randu() < 0.2 ) {
x[ i ] = NaN;
} else {
x[ i ] = ( randu()*10.0 ) - 20.0;
}
}
x = filledarrayBy( len, 'float32', rand );
out = new Float64Array( 2 );
return benchmark;

function rand() {
if ( bernoulli( 0.5 ) < 0.2 ) {
return NaN;
}
return uniform( -10.0, 10.0 );
}

function benchmark( b ) {
var i;

Expand Down
22 changes: 11 additions & 11 deletions benchmark/benchmark.ndarray.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@

var resolve = require( 'path' ).resolve;
var bench = require( '@stdlib/bench-harness' );
var randu = require( '@stdlib/random-base-randu' );
var uniform = require( '@stdlib/random-base-uniform' );
var bernoulli = require( '@stdlib/random-base-bernoulli' );
var filledarrayBy = require( '@stdlib/array-filled-by' );
var isnan = require( '@stdlib/math-base-assert-is-nan' );
var pow = require( '@stdlib/math-base-special-pow' );
var Float32Array = require( '@stdlib/array-float32' );
var Float64Array = require( '@stdlib/array-float64' );
var tryRequire = require( '@stdlib/utils-try-require' );
var pkg = require( './../package.json' ).name;
Expand All @@ -51,19 +52,18 @@ var opts = {
function createBenchmark( len ) {
var out;
var x;
var i;

x = new Float32Array( len );
for ( i = 0; i < len; i++ ) {
if ( randu() < 0.2 ) {
x[ i ] = NaN;
} else {
x[ i ] = ( randu()*10.0 ) - 20.0;
}
}
x = filledarrayBy( len, 'float32', rand );
out = new Float64Array( 2 );
return benchmark;

function rand() {
if ( bernoulli( 0.5 ) < 0.2 ) {
return NaN;
}
return uniform( -10.0, 10.0 );
}

function benchmark( b ) {
var i;

Expand Down
4 changes: 2 additions & 2 deletions dist/index.js.map

Large diffs are not rendered by default.

13 changes: 6 additions & 7 deletions docs/repl.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
ignoring `NaN` values, using ordinary recursive summation with extended
accumulation, and returning an extended precision result.

The `N` and `stride` parameters determine which elements are accessed at
The `N` and stride parameters determine which elements are accessed at
runtime.

Indexing is relative to the first index. To introduce an offset, use a typed
Expand Down Expand Up @@ -43,11 +43,10 @@
> {{alias}}( x.length, x, 1, out, 1 )
<Float64Array>[ 1.0, 3 ]

// Using `N` and `stride` parameters:
// Using `N` and stride parameters:
> x = new {{alias:@stdlib/array/float32}}( [ -2.0, 1.0, 1.0, -5.0, 2.0, -1.0, NaN, NaN ] );
> out = new {{alias:@stdlib/array/float64}}( 2 );
> var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 );
> {{alias}}( N, x, 2, out, 1 )
> {{alias}}( 4, x, 2, out, 1 )
<Float64Array>[ 1.0, 3 ]

// Using view offsets:
Expand All @@ -58,13 +57,14 @@
> {{alias}}( N, x1, 2, out, 1 )
<Float64Array>[ 1.0, 3 ]


{{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.

While typed array views mandate a view offset based on the underlying
buffer, the `offset` parameter supports indexing semantics based on a
buffer, the offset parameter supports indexing semantics based on a
starting index.

Parameters
Expand Down Expand Up @@ -106,9 +106,8 @@

// Using offset parameter:
> var x = new {{alias:@stdlib/array/float32}}( [ 1.0, -2.0, 3.0, 2.0, 5.0, 1.0, NaN, NaN ] );
> var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 );
> out = new {{alias:@stdlib/array/float64}}( 2 );
> {{alias}}.ndarray( N, x, 2, 1, out, 1, 0 )
> {{alias}}.ndarray( 4, x, 2, 1, out, 1, 0 )
<Float64Array>[ 1.0, 3 ]

See Also
Expand Down
19 changes: 9 additions & 10 deletions examples/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,23 @@

'use strict';

var randu = require( '@stdlib/random-base-randu' );
var round = require( '@stdlib/math-base-special-round' );
var Float32Array = require( '@stdlib/array-float32' );
var discreteUniform = require( '@stdlib/random-base-discrete-uniform' );
var bernoulli = require( '@stdlib/random-base-bernoulli' );
var filledarrayBy = require( '@stdlib/array-filled-by' );
var Float64Array = require( '@stdlib/array-float64' );
var dsnannsumors = require( './../lib' );

var out;
var x;
var i;

x = new Float32Array( 10 );
for ( i = 0; i < x.length; i++ ) {
if ( randu() < 0.2 ) {
x[ i ] = NaN;
} else {
x[ i ] = round( randu()*100.0 );
function rand() {
if ( bernoulli( 0.5 ) < 0.2 ) {
return NaN;
}
return discreteUniform( 0, 100 );
}

x = filledarrayBy( 10, 'float32', rand );
console.log( x );

out = new Float64Array( 2 );
Expand Down
2 changes: 1 addition & 1 deletion include.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

# Source files:
'src_files': [
'<(src_dir)/addon.cpp',
'<(src_dir)/addon.c',
'<!@(node -e "var arr = require(\'@stdlib/utils-library-manifest\')(\'./manifest.json\',{},{\'basedir\':process.cwd(),\'paths\':\'posix\'}).src; for ( var i = 0; i < arr.length; i++ ) { console.log( arr[ i ] ); }")',
],

Expand Down
Loading

0 comments on commit 850e3bb

Please sign in to comment.