Skip to content

Commit

Permalink
chore: fix by filling arrays with NaNs again
Browse files Browse the repository at this point in the history
  • Loading branch information
Planeshifter committed Mar 29, 2024
1 parent 87ccb3b commit 3080f03
Show file tree
Hide file tree
Showing 17 changed files with 172 additions and 72 deletions.
12 changes: 10 additions & 2 deletions lib/node_modules/@stdlib/blas/ext/base/dnansumkbn/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,19 @@ var v = dnansumkbn.ndarray( 4, x, 2, 1 );
<!-- eslint no-undef: "error" -->

```javascript
var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory;
var discreteUniform = require( '@stdlib/random/base/discrete-uniform' );
var bernoulli = require( '@stdlib/random/base/bernoulli' );
var filledarrayBy = require( '@stdlib/array/filled-by' );
var dnansumkbn = require( '@stdlib/blas/ext/base/dnansumkbn' );

var x = filledarrayBy( 10, 'float64', discreteUniform( 0, 100 ) );
function clbk() {
if ( bernoulli( 0.7 ) > 0 ) {
return discreteUniform( 0, 100 );
}
return NaN;
}

var x = filledarrayBy( 10, 'float64', clbk );
console.log( x );

var v = dnansumkbn( x.length, x, 1 );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,15 @@
// MODULES //

var bench = require( '@stdlib/bench' );
var uniform = require( '@stdlib/random/base/uniform' ).factory;
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 pkg = require( './../package.json' ).name;
var dnansumkbn = require( './../lib/dnansumkbn.js' );


// VARIABLES //

var rand = uniform( -10.0, 10.0 );


// FUNCTIONS //

/**
Expand All @@ -44,9 +40,16 @@ var rand = uniform( -10.0, 10.0 );
* @returns {Function} benchmark function
*/
function createBenchmark( len ) {
var x = filledarrayBy( len, 'float64', rand );
var x = filledarrayBy( len, 'float64', clbk );
return benchmark;

function clbk() {
if ( bernoulli( 0.7 ) > 0 ) {
return uniform( -10.0, 10.0 );
}
return NaN;
}

function benchmark( b ) {
var v;
var i;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@

var resolve = require( 'path' ).resolve;
var bench = require( '@stdlib/bench' );
var uniform = require( '@stdlib/random/base/uniform' ).factory;
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' );
Expand All @@ -36,7 +37,6 @@ var dnansumkbn = tryRequire( resolve( __dirname, './../lib/dnansumkbn.native.js'
var opts = {
'skip': ( dnansumkbn instanceof Error )
};
var rand = uniform( -10.0, 10.0 );


// FUNCTIONS //
Expand All @@ -49,9 +49,16 @@ var rand = uniform( -10.0, 10.0 );
* @returns {Function} benchmark function
*/
function createBenchmark( len ) {
var x = filledarrayBy( len, 'float64', rand );
var x = filledarrayBy( len, 'float64', clbk );
return benchmark;

function clbk() {
if ( bernoulli( 0.7 ) > 0 ) {
return uniform( -10.0, 10.0 );
}
return NaN;
}

function benchmark( b ) {
var v;
var i;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,15 @@
// MODULES //

var bench = require( '@stdlib/bench' );
var uniform = require( '@stdlib/random/base/uniform' ).factory;
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 pkg = require( './../package.json' ).name;
var dnansumkbn = require( './../lib/ndarray.js' );


// VARIABLES //

var rand = uniform( -10.0, 10.0 );


// FUNCTIONS //

/**
Expand All @@ -44,9 +40,16 @@ var rand = uniform( -10.0, 10.0 );
* @returns {Function} benchmark function
*/
function createBenchmark( len ) {
var x = filledarrayBy( len, 'float64', rand );
var x = filledarrayBy( len, 'float64', clbk );
return benchmark;

function clbk() {
if ( bernoulli( 0.7 ) > 0 ) {
return uniform( -10.0, 10.0 );
}
return NaN;
}

function benchmark( b ) {
var v;
var i;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@

var resolve = require( 'path' ).resolve;
var bench = require( '@stdlib/bench' );
var uniform = require( '@stdlib/random/base/uniform' ).factory;
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' );
Expand All @@ -36,7 +37,6 @@ var dnansumkbn = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' )
var opts = {
'skip': ( dnansumkbn instanceof Error )
};
var rand = uniform( -10.0, 10.0 );


// FUNCTIONS //
Expand All @@ -49,9 +49,16 @@ var rand = uniform( -10.0, 10.0 );
* @returns {Function} benchmark function
*/
function createBenchmark( len ) {
var x = filledarrayBy( len, 'float64', rand );
var x = filledarrayBy( len, 'float64', clbk );
return benchmark;

function clbk() {
if ( bernoulli( 0.7 ) > 0 ) {
return uniform( -10.0, 10.0 );
}
return NaN;
}

function benchmark( b ) {
var v;
var i;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,19 @@

'use strict';

var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory;
var discreteUniform = require( '@stdlib/random/base/discrete-uniform' );
var bernoulli = require( '@stdlib/random/base/bernoulli' );
var filledarrayBy = require( '@stdlib/array/filled-by' );
var dnansumkbn = require( './../lib' );

var x = filledarrayBy( 10, 'float64', discreteUniform( 0.0, 100.0 ) );
function clbk() {
if ( bernoulli( 0.7 ) > 0 ) {
return discreteUniform( 0, 100 );
}
return NaN;
}

var x = filledarrayBy( 10, 'float64', clbk );
console.log( x );

var v = dnansumkbn( x.length, x, 1 );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,15 @@
// MODULES //

var bench = require( '@stdlib/bench' );
var uniform = require( '@stdlib/random/base/uniform' ).factory;
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 pkg = require( './../package.json' ).name;
var dnansumkbn2 = require( './../lib/dnansumkbn2.js' );


// VARIABLES //

var rand = uniform( -10.0, 10.0 );


// FUNCTIONS //

/**
Expand All @@ -44,9 +40,16 @@ var rand = uniform( -10.0, 10.0 );
* @returns {Function} benchmark function
*/
function createBenchmark( len ) {
var x = filledarrayBy( len, 'float64', rand );
var x = filledarrayBy( len, 'float64', clbk );
return benchmark;

function clbk() {
if ( bernoulli( 0.7 ) > 0 ) {
return uniform( -10.0, 10.0 );
}
return NaN;
}

function benchmark( b ) {
var v;
var i;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@

var resolve = require( 'path' ).resolve;
var bench = require( '@stdlib/bench' );
var uniform = require( '@stdlib/random/base/uniform' ).factory;
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' );
Expand All @@ -36,7 +37,6 @@ var dnansumkbn2 = tryRequire( resolve( __dirname, './../lib/dnansumkbn2.native.j
var opts = {
'skip': ( dnansumkbn2 instanceof Error )
};
var rand = uniform( -10.0, 10.0 );


// FUNCTIONS //
Expand All @@ -49,9 +49,16 @@ var rand = uniform( -10.0, 10.0 );
* @returns {Function} benchmark function
*/
function createBenchmark( len ) {
var x = filledarrayBy( len, 'float64', rand );
var x = filledarrayBy( len, 'float64', clbk );
return benchmark;

function clbk() {
if ( bernoulli( 0.7 ) > 0 ) {
return uniform( -10.0, 10.0 );
}
return NaN;
}

function benchmark( b ) {
var v;
var i;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,15 @@
// MODULES //

var bench = require( '@stdlib/bench' );
var uniform = require( '@stdlib/random/base/uniform' ).factory;
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 pkg = require( './../package.json' ).name;
var dnansumkbn2 = require( './../lib/ndarray.js' );


// VARIABLES //

var rand = uniform( -10.0, 10.0 );


// FUNCTIONS //

/**
Expand All @@ -44,9 +40,16 @@ var rand = uniform( -10.0, 10.0 );
* @returns {Function} benchmark function
*/
function createBenchmark( len ) {
var x = filledarrayBy( len, 'float64', rand );
var x = filledarrayBy( len, 'float64', clbk );
return benchmark;

function clbk() {
if ( bernoulli( 0.7 ) > 0 ) {
return uniform( -10.0, 10.0 );
}
return NaN;
}

function benchmark( b ) {
var v;
var i;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@

var resolve = require( 'path' ).resolve;
var bench = require( '@stdlib/bench' );
var uniform = require( '@stdlib/random/base/uniform' ).factory;
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' );
Expand All @@ -36,7 +37,6 @@ var dnansumkbn2 = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' )
var opts = {
'skip': ( dnansumkbn2 instanceof Error )
};
var rand = uniform( -10.0, 10.0 );


// FUNCTIONS //
Expand All @@ -49,9 +49,16 @@ var rand = uniform( -10.0, 10.0 );
* @returns {Function} benchmark function
*/
function createBenchmark( len ) {
var x = filledarrayBy( len, 'float64', rand );
var x = filledarrayBy( len, 'float64', clbk );
return benchmark;

function clbk() {
if ( bernoulli( 0.7 ) > 0 ) {
return uniform( -10.0, 10.0 );
}
return NaN;
}

function benchmark( b ) {
var v;
var i;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,19 @@

'use strict';

var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory;
var filledarrayBy = require( '@stdlib/array/filled-by' );
var dnansumkbn2 = require( './../lib' );
var discreteUniform = require('@stdlib/random/base/discrete-uniform');
var bernoulli = require('@stdlib/random/base/bernoulli');
var filledarrayBy = require('@stdlib/array/filled-by');
var dnansumkbn2 = require('./../lib');

var x = filledarrayBy( 10, 'float64', discreteUniform( 0.0, 100.0 ) );
function clbk() {
if ( bernoulli( 0.7 ) > 0 ) {
return discreteUniform( 0, 100 );
}
return NaN;
}

var x = filledarrayBy( 10, 'float64', clbk );
console.log( x );

var v = dnansumkbn2( x.length, x, 1 );
Expand Down
12 changes: 10 additions & 2 deletions lib/node_modules/@stdlib/blas/ext/base/dnansumpw/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,19 @@ var v = dnansumpw.ndarray( 4, x, 2, 1 );
<!-- eslint no-undef: "error" -->

```javascript
var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory;
var discreteUniform = require( '@stdlib/random/base/discrete-uniform' );
var bernoulli = require( '@stdlib/random/base/bernoulli' );
var filledarrayBy = require( '@stdlib/array/filled-by' );
var dnansumpw = require( '@stdlib/blas/ext/base/dnansumpw' );

var x = filledarrayBy( 10, 'float64', discreteUniform( 0, 100 ) );
function clbk() {
if ( bernoulli( 0.7 ) > 0 ) {
return discreteUniform( 0, 100 );
}
return NaN;
}

var x = filledarrayBy( 10, 'float64', clbk );
console.log( x );

var v = dnansumpw( x.length, x, 1 );
Expand Down
Loading

1 comment on commit 3080f03

@stdlib-bot
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage Report

Package Statements Branches Functions Lines
blas/ext/base/dnansumkbn $\color{green}440/440$
$\color{green}+100.00\%$
$\color{green}40/40$
$\color{green}+100.00\%$
$\color{green}4/4$
$\color{green}+100.00\%$
$\color{green}440/440$
$\color{green}+100.00\%$
blas/ext/base/dnansumkbn2 $\color{green}462/462$
$\color{green}+100.00\%$
$\color{green}45/45$
$\color{green}+100.00\%$
$\color{green}4/4$
$\color{green}+100.00\%$
$\color{green}462/462$
$\color{green}+100.00\%$
blas/ext/base/dnansumpw $\color{green}493/493$
$\color{green}+100.00\%$
$\color{green}75/75$
$\color{green}+100.00\%$
$\color{green}4/4$
$\color{green}+100.00\%$
$\color{green}493/493$
$\color{green}+100.00\%$

The above coverage report was generated for the changes in this push.

Please sign in to comment.