diff --git a/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn/README.md b/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn/README.md index 63b09df931e8..0a18eb319242 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn/README.md +++ b/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn/README.md @@ -129,11 +129,19 @@ var v = dnansumkbn.ndarray( 4, x, 2, 1 ); ```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 ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn/benchmark/benchmark.js index 247eecd0d24a..6cd1f2cb7e34 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn/benchmark/benchmark.js @@ -21,7 +21,8 @@ // 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' ); @@ -29,11 +30,6 @@ var pkg = require( './../package.json' ).name; var dnansumkbn = require( './../lib/dnansumkbn.js' ); -// VARIABLES // - -var rand = uniform( -10.0, 10.0 ); - - // FUNCTIONS // /** @@ -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; diff --git a/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn/benchmark/benchmark.native.js index 9cb69fa5e6d7..add1384cbcfb 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn/benchmark/benchmark.native.js @@ -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' ); @@ -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 // @@ -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; diff --git a/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn/benchmark/benchmark.ndarray.js index 99fc95353703..9ca0964241c3 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn/benchmark/benchmark.ndarray.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn/benchmark/benchmark.ndarray.js @@ -21,7 +21,8 @@ // 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' ); @@ -29,11 +30,6 @@ var pkg = require( './../package.json' ).name; var dnansumkbn = require( './../lib/ndarray.js' ); -// VARIABLES // - -var rand = uniform( -10.0, 10.0 ); - - // FUNCTIONS // /** @@ -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; diff --git a/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn/benchmark/benchmark.ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn/benchmark/benchmark.ndarray.native.js index 00d18e317a2f..a94480e508c1 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn/benchmark/benchmark.ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn/benchmark/benchmark.ndarray.native.js @@ -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' ); @@ -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 // @@ -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; diff --git a/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn/examples/index.js b/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn/examples/index.js index 14fda9a5593d..b9ffc3bd1bdb 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn/examples/index.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn/examples/index.js @@ -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 ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn2/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn2/benchmark/benchmark.js index fdb5aa5b68c4..dcf1ee6c4044 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn2/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn2/benchmark/benchmark.js @@ -21,7 +21,8 @@ // 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' ); @@ -29,11 +30,6 @@ var pkg = require( './../package.json' ).name; var dnansumkbn2 = require( './../lib/dnansumkbn2.js' ); -// VARIABLES // - -var rand = uniform( -10.0, 10.0 ); - - // FUNCTIONS // /** @@ -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; diff --git a/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn2/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn2/benchmark/benchmark.native.js index b6ef5757d090..36eb7f676b79 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn2/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn2/benchmark/benchmark.native.js @@ -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' ); @@ -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 // @@ -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; diff --git a/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn2/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn2/benchmark/benchmark.ndarray.js index edfc5d945ae1..298cc596440b 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn2/benchmark/benchmark.ndarray.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn2/benchmark/benchmark.ndarray.js @@ -21,7 +21,8 @@ // 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' ); @@ -29,11 +30,6 @@ var pkg = require( './../package.json' ).name; var dnansumkbn2 = require( './../lib/ndarray.js' ); -// VARIABLES // - -var rand = uniform( -10.0, 10.0 ); - - // FUNCTIONS // /** @@ -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; diff --git a/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn2/benchmark/benchmark.ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn2/benchmark/benchmark.ndarray.native.js index d4cfb74d722f..4304214caca5 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn2/benchmark/benchmark.ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn2/benchmark/benchmark.ndarray.native.js @@ -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' ); @@ -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 // @@ -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; diff --git a/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn2/examples/index.js b/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn2/examples/index.js index 766e1f487875..fcfe1f21cddd 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn2/examples/index.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dnansumkbn2/examples/index.js @@ -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 ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dnansumpw/README.md b/lib/node_modules/@stdlib/blas/ext/base/dnansumpw/README.md index 161407399f32..e8c3943ccf1b 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dnansumpw/README.md +++ b/lib/node_modules/@stdlib/blas/ext/base/dnansumpw/README.md @@ -131,11 +131,19 @@ var v = dnansumpw.ndarray( 4, x, 2, 1 ); ```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 ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/dnansumpw/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/ext/base/dnansumpw/benchmark/benchmark.js index 80065ceef521..5b7185350a29 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dnansumpw/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dnansumpw/benchmark/benchmark.js @@ -21,7 +21,8 @@ // 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' ); @@ -29,11 +30,6 @@ var pkg = require( './../package.json' ).name; var dnansumpw = require( './../lib/dnansumpw.js' ); -// VARIABLES // - -var rand = uniform( -100.0, 100.0 ); - - // FUNCTIONS // /** @@ -44,9 +40,16 @@ var rand = uniform( -100.0, 100.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( -100.0, 100.0 ); + } + return NaN; + } + function benchmark( b ) { var v; var i; diff --git a/lib/node_modules/@stdlib/blas/ext/base/dnansumpw/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/blas/ext/base/dnansumpw/benchmark/benchmark.native.js index 621b92960f5e..6f7b3bcb347d 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dnansumpw/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dnansumpw/benchmark/benchmark.native.js @@ -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' ); @@ -36,7 +37,6 @@ var dnansumpw = tryRequire( resolve( __dirname, './../lib/dnansumpw.native.js' ) var opts = { 'skip': ( dnansumpw instanceof Error ) }; -var rand = uniform( -100.0, 100.0 ); // FUNCTIONS // @@ -49,9 +49,16 @@ var rand = uniform( -100.0, 100.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( -100.0, 100.0 ); + } + return NaN; + } + function benchmark( b ) { var v; var i; diff --git a/lib/node_modules/@stdlib/blas/ext/base/dnansumpw/benchmark/benchmark.ndarray.js b/lib/node_modules/@stdlib/blas/ext/base/dnansumpw/benchmark/benchmark.ndarray.js index 147689202088..304ce5655c40 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dnansumpw/benchmark/benchmark.ndarray.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dnansumpw/benchmark/benchmark.ndarray.js @@ -21,7 +21,8 @@ // 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' ); @@ -29,11 +30,6 @@ var pkg = require( './../package.json' ).name; var dnansumpw = require( './../lib/ndarray.js' ); -// VARIABLES // - -var rand = uniform( -100.0, 100.0 ); - - // FUNCTIONS // /** @@ -44,9 +40,16 @@ var rand = uniform( -100.0, 100.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( -100.0, 100.0 ); + } + return NaN; + } + function benchmark( b ) { var v; var i; diff --git a/lib/node_modules/@stdlib/blas/ext/base/dnansumpw/benchmark/benchmark.ndarray.native.js b/lib/node_modules/@stdlib/blas/ext/base/dnansumpw/benchmark/benchmark.ndarray.native.js index d5dab327ad0e..b53d32e4f7de 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dnansumpw/benchmark/benchmark.ndarray.native.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dnansumpw/benchmark/benchmark.ndarray.native.js @@ -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' ); @@ -36,7 +37,6 @@ var dnansumpw = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ) var opts = { 'skip': ( dnansumpw instanceof Error ) }; -var rand = uniform( -100.0, 100.0 ); // FUNCTIONS // @@ -49,9 +49,16 @@ var rand = uniform( -100.0, 100.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( -100.0, 100.0 ); + } + return NaN; + } + function benchmark( b ) { var v; var i; diff --git a/lib/node_modules/@stdlib/blas/ext/base/dnansumpw/examples/index.js b/lib/node_modules/@stdlib/blas/ext/base/dnansumpw/examples/index.js index d1a11a4bab3e..36e1fc90bf17 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/dnansumpw/examples/index.js +++ b/lib/node_modules/@stdlib/blas/ext/base/dnansumpw/examples/index.js @@ -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 dnansumpw = require( './../lib' ); -var x = filledarrayBy( 10, 'float64', discreteUniform( -100.0, 100.0 ) ); +function clbk() { + if ( bernoulli( 0.7 ) > 0 ) { + return discreteUniform( -100, 100 ); + } + return NaN; +} + +var x = filledarrayBy( 10, 'float64', clbk ); console.log( x ); var v = dnansumpw( x.length, x, 1 );