diff --git a/lib/node_modules/@stdlib/stats/base/dists/cauchy/cdf/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/cauchy/cdf/benchmark/benchmark.js index b7d81a226dfb..590d25206933 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/cauchy/cdf/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/stats/base/dists/cauchy/cdf/benchmark/benchmark.js @@ -21,10 +21,9 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var Float64Array = require( '@stdlib/array/float64' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var EPS = require( '@stdlib/constants/float64/eps' ); -var uniform = require( '@stdlib/random/base/uniform' ); +var uniform = require( '@stdlib/random/array/uniform' ); var pkg = require( './../package.json' ).name; var cdf = require( './../lib' ); @@ -33,25 +32,22 @@ var cdf = require( './../lib' ); bench( pkg, function benchmark( b ) { var gamma; - var len; + var opts; var x0; var x; var y; var i; - len = 100; - x = new Float64Array( len ); - x0 = new Float64Array( len ); - gamma = new Float64Array( len ); - for ( i = 0; i < len; i++ ) { - x[ i ] = uniform( -100.0, 100.0 ); - x0[ i ] = uniform( -50.0, 50.0 ); - gamma[ i ] = uniform( EPS, 20.0 ); - } + opts = { + 'dtype': 'float64' + }; + x = uniform( 100, -100.0, 100.0, opts ); + x0 = uniform( 100, -50.0, 50.0, opts ); + gamma = uniform( 100, EPS, 20.0, opts ); b.tic(); for ( i = 0; i < b.iterations; i++ ) { - y = cdf( x[ i % len ], x0[ i % len ], gamma[ i % len ] ); + y = cdf( x[ i % x.length ], x0[ i % x0.length ], gamma[ i % gamma.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } @@ -67,24 +63,24 @@ bench( pkg, function benchmark( b ) { bench( pkg+':factory', function benchmark( b ) { var mycdf; var gamma; - var len; + var opts; var x0; var x; var y; var i; + opts = { + 'dtype': 'float64' + }; + x = uniform( 100, EPS, 100.0, opts ); + x0 = 0.0; gamma = 1.5; mycdf = cdf.factory( x0, gamma ); - len = 100; - x = new Float64Array( len ); - for ( i = 0; i < len; i++ ) { - x[ i ] = uniform( EPS, 100.0 ); - } b.tic(); for ( i = 0; i < b.iterations; i++ ) { - y = mycdf( x[ i % len ] ); + y = mycdf( x[ i % x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/stats/base/dists/cauchy/cdf/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/stats/base/dists/cauchy/cdf/benchmark/benchmark.native.js index 99608e07253d..8be0b307a24b 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/cauchy/cdf/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/cauchy/cdf/benchmark/benchmark.native.js @@ -22,9 +22,8 @@ var resolve = require( 'path' ).resolve; var bench = require( '@stdlib/bench' ); -var Float64Array = require( '@stdlib/array/float64' ); var EPS = require( '@stdlib/constants/float64/eps' ); -var uniform = require( '@stdlib/random/base/uniform' ); +var uniform = require( '@stdlib/random/array/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var tryRequire = require( '@stdlib/utils/try-require' ); var pkg = require( './../package.json' ).name; @@ -42,25 +41,22 @@ var opts = { bench( pkg+'::native', opts, function benchmark( b ) { var gamma; - var len; + var opts; var x0; var x; var y; var i; - len = 100; - x = new Float64Array( len ); - x0 = new Float64Array( len ); - gamma = new Float64Array( len ); - for ( i = 0; i < len; i++ ) { - x[ i ] = uniform( -100.0, 100.0 ); - x0[ i ] = uniform( -50.0, 50.0 ); - gamma[ i ] = uniform( EPS, 20.0 ); - } + opts = { + 'dtype': 'float64' + }; + x = uniform( 100, -100.0, 100.0, opts ); + x0 = uniform( 100, -50.0, 50.0, opts ); + gamma = uniform( 100, EPS, 20.0, opts ); b.tic(); for ( i = 0; i < b.iterations; i++ ) { - y = cdf( x[ i % len ], x0[ i % len ], gamma[ i % len ] ); + y = cdf( x[ i % x.length ], x0[ i % x0.length ], gamma[ i % gamma.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/stats/base/dists/cauchy/cdf/test/test.cdf.js b/lib/node_modules/@stdlib/stats/base/dists/cauchy/cdf/test/test.cdf.js index 9d43b70a33da..874a5f9ae7d8 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/cauchy/cdf/test/test.cdf.js +++ b/lib/node_modules/@stdlib/stats/base/dists/cauchy/cdf/test/test.cdf.js @@ -46,23 +46,23 @@ tape( 'main export is a function', function test( t ) { tape( 'if provided `NaN` for any parameter, the function returns `NaN`', function test( t ) { var y = cdf( NaN, 0.0, 1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = cdf( 0.0, NaN, 1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = cdf( 0.0, 1.0, NaN ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); tape( 'if provided `+infinity` for `x` and a finite `x0` and `gamma`, the function returns `1`', function test( t ) { var y = cdf( PINF, 0.0, 1.0 ); - t.equal( y, 1.0, 'returns 1' ); + t.equal( y, 1.0, 'returns expected value' ); t.end(); }); tape( 'if provided `-infinity` for `x` and a finite `x0` and `gamma`, the function returns `0`', function test( t ) { var y = cdf( NINF, 0.0, 1.0 ); - t.equal( y, 0.0, 'returns 0' ); + t.equal( y, 0.0, 'returns expected value' ); t.end(); }); @@ -70,25 +70,25 @@ tape( 'if provided a nonpositive `gamma`, the function always returns `NaN`', fu var y; y = cdf( 2.0, 0.0, 0.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = cdf( 2.0, 0.0, -1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = cdf( 0.0, 0.0, -1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = cdf( 2.0, 0.0, NINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = cdf( 2.0, PINF, NINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = cdf( 2.0, NINF, NINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = cdf( 2.0, NaN, NINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/stats/base/dists/cauchy/cdf/test/test.factory.js b/lib/node_modules/@stdlib/stats/base/dists/cauchy/cdf/test/test.factory.js index dfcbb7c8b703..a2081b73cc9e 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/cauchy/cdf/test/test.factory.js +++ b/lib/node_modules/@stdlib/stats/base/dists/cauchy/cdf/test/test.factory.js @@ -56,23 +56,23 @@ tape( 'if provided `NaN` for any parameter, the created function returns `NaN`', cdf = factory( 0.0, 1.0 ); y = cdf( NaN ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); cdf = factory( NaN, 1.0 ); y = cdf( 0.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); cdf = factory( 1.0, NaN ); y = cdf( 0.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); cdf = factory( NaN, NaN ); y = cdf( 0.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); cdf = factory( NaN, NaN ); y = cdf( NaN ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); @@ -83,7 +83,7 @@ tape( 'if provided a valid `x0` and `gamma`, the function returns a function whi cdf = factory( 0.0, 1.0 ); y = cdf( PINF ); - t.equal( y, 1.0, 'returns 1' ); + t.equal( y, 1.0, 'returns expected value' ); t.end(); }); @@ -94,7 +94,7 @@ tape( 'if provided a valid `x0` and `gamma`, the function returns a function whi cdf = factory( 0.0, 1.0 ); y = cdf( NINF ); - t.equal( y, 0.0, 'returns 0' ); + t.equal( y, 0.0, 'returns expected value' ); t.end(); }); @@ -105,33 +105,33 @@ tape( 'if provided a nonpositive `gamma`, the created function always returns `N cdf = factory( 0.0, 0.0 ); y = cdf( 2.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = cdf( 0.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); cdf = factory( 0.0, -1.0 ); y = cdf( 2.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = cdf( 0.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); cdf = factory( 0.0, NINF ); y = cdf( 2.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); cdf = factory( PINF, NINF ); y = cdf( 2.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); cdf = factory( NINF, NINF ); y = cdf( 2.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); cdf = factory( NaN, NINF ); y = cdf( 2.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/stats/base/dists/cauchy/cdf/test/test.native.js b/lib/node_modules/@stdlib/stats/base/dists/cauchy/cdf/test/test.native.js index d5666ae59fa2..f7e47752c5f8 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/cauchy/cdf/test/test.native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/cauchy/cdf/test/test.native.js @@ -55,23 +55,23 @@ tape( 'main export is a function', opts, function test( t ) { tape( 'if provided `NaN` for any parameter, the function returns `NaN`', opts, function test( t ) { var y = cdf( NaN, 0.0, 1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = cdf( 0.0, NaN, 1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = cdf( 0.0, 1.0, NaN ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); tape( 'if provided `+infinity` for `x` and a finite `x0` and `gamma`, the function returns `1`', opts, function test( t ) { var y = cdf( PINF, 0.0, 1.0 ); - t.equal( y, 1.0, 'returns 1' ); + t.equal( y, 1.0, 'returns expected value' ); t.end(); }); tape( 'if provided `-infinity` for `x` and a finite `x0` and `gamma`, the function returns `0`', opts, function test( t ) { var y = cdf( NINF, 0.0, 1.0 ); - t.equal( y, 0.0, 'returns 0' ); + t.equal( y, 0.0, 'returns expected value' ); t.end(); }); @@ -79,25 +79,25 @@ tape( 'if provided a nonpositive `gamma`, the function always returns `NaN`', op var y; y = cdf( 2.0, 0.0, 0.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = cdf( 2.0, 0.0, -1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = cdf( 0.0, 0.0, -1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = cdf( 2.0, 0.0, NINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = cdf( 2.0, PINF, NINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = cdf( 2.0, NINF, NINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = cdf( 2.0, NaN, NINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/stats/base/dists/cauchy/ctor/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/cauchy/ctor/benchmark/benchmark.js index 3e99e9c4fe0d..187ba56683bf 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/cauchy/ctor/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/stats/base/dists/cauchy/ctor/benchmark/benchmark.js @@ -21,8 +21,7 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var Float64Array = require( '@stdlib/array/float64' ); -var uniform = require( '@stdlib/random/base/uniform' ); +var uniform = require( '@stdlib/random/array/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var EPS = require( '@stdlib/constants/float64/eps' ); var pkg = require( './../package.json' ).name; @@ -34,21 +33,19 @@ var Cauchy = require( './../lib' ); bench( pkg+'::instantiation', function benchmark( b ) { var gamma; var dist; - var len; + var opts; var x0; var i; - len = 100; - x0 = new Float64Array( len ); - gamma = new Float64Array( len ); - for ( i = 0; i < len; i++ ) { - x0[ i ] = uniform( EPS, 10.0 ); - gamma[ i ] = uniform( EPS, 10.0 ); - } + opts = { + 'dtype': 'float64' + }; + x0 = uniform( 100, EPS, 10.0, opts ); + gamma = uniform( 100, EPS, 10.0, opts ); b.tic(); for ( i = 0; i < b.iterations; i++ ) { - dist = new Cauchy( x0[ i % len ], gamma[ i % len ] ); + dist = new Cauchy( x0[ i % x0.length ], gamma[ i % gamma.length ] ); if ( !( dist instanceof Cauchy ) ) { b.fail( 'should return a distribution instance' ); } @@ -90,24 +87,24 @@ bench( pkg+'::get:x0', function benchmark( b ) { bench( pkg+'::set:x0', function benchmark( b ) { var gamma; var dist; - var len; + var opts; var x0; var y; var i; + opts = { + 'dtype': 'float64' + }; + y = uniform( 100, EPS, 100.0, opts ); + x0 = 10.0; gamma = 6.0; dist = new Cauchy( x0, gamma ); - len = 100; - y = new Float64Array( len ); - for ( i = 0; i < len; i++ ) { - y[ i ] = uniform( EPS, 100.0 ); - } b.tic(); for ( i = 0; i < b.iterations; i++ ) { - dist.x0 = y[ i % len ]; - if ( dist.x0 !== y[ i % len ] ) { + dist.x0 = y[ i % y.length ]; + if ( dist.x0 !== y[ i % y.length ] ) { b.fail( 'should return set value' ); } } @@ -148,24 +145,24 @@ bench( pkg+'::get:gamma', function benchmark( b ) { bench( pkg+'::set:gamma', function benchmark( b ) { var gamma; var dist; - var len; + var opts; var x0; var y; var i; + opts = { + 'dtype': 'float64' + }; + y = uniform( 100, EPS, 100.0, opts ); + x0 = 10.0; gamma = 6.0; dist = new Cauchy( x0, gamma ); - len = 100; - y = new Float64Array( len ); - for ( i = 0; i < len; i++ ) { - y[ i ] = uniform( EPS, 100.0 ); - } b.tic(); for ( i = 0; i < b.iterations; i++ ) { - dist.gamma = y[ i % len ]; - if ( dist.gamma !== y[ i % len ] ) { + dist.gamma = y[ i % y.length ]; + if ( dist.gamma !== y[ i % y.length ] ) { b.fail( 'should return set value' ); } } @@ -180,24 +177,24 @@ bench( pkg+'::set:gamma', function benchmark( b ) { bench( pkg+':entropy', function benchmark( b ) { var gamma; var dist; - var len; + var opts; var x0; var x; var y; var i; + opts = { + 'dtype': 'float64' + }; + x = uniform( 100, EPS, 100.0, opts ); + x0 = 10.0; gamma = 6.0; dist = new Cauchy( x0, gamma ); - len = 100; - x = new Float64Array( len ); - for ( i = 0; i < len; i++ ) { - x[ i ] = uniform( EPS, 100.0 ); - } b.tic(); for ( i = 0; i < b.iterations; i++ ) { - dist.x0 = x[ i % len ]; + dist.x0 = x[ i % x.length ]; y = dist.entropy; if ( isnan( y ) ) { b.fail( 'should not return NaN' ); @@ -214,24 +211,24 @@ bench( pkg+':entropy', function benchmark( b ) { bench( pkg+':median', function benchmark( b ) { var gamma; var dist; - var len; + var opts; var x0; var x; var y; var i; + opts = { + 'dtype': 'float64' + }; + x = uniform( 100, EPS, 100.0, opts ); + x0 = 10.0; gamma = 6.0; dist = new Cauchy( x0, gamma ); - len = 100; - x = new Float64Array( len ); - for ( i = 0; i < len; i++ ) { - x[ i ] = uniform( EPS, 100.0 ); - } b.tic(); for ( i = 0; i < b.iterations; i++ ) { - dist.x0 = x[ i % len ]; + dist.x0 = x[ i % x.length ]; y = dist.median; if ( isnan( y ) ) { b.fail( 'should not return NaN' ); @@ -248,24 +245,24 @@ bench( pkg+':median', function benchmark( b ) { bench( pkg+':mode', function benchmark( b ) { var gamma; var dist; - var len; + var opts; var x0; var x; var y; var i; + opts = { + 'dtype': 'float64' + }; + x = uniform( 100, 1.0 + EPS, 100.0, opts ); + x0 = 10.0; gamma = 6.0; dist = new Cauchy( x0, gamma ); - len = 100; - x = new Float64Array( len ); - for ( i = 0; i < len; i++ ) { - x[ i ] = uniform( 1.0 + EPS, 100.0 ); - } b.tic(); for ( i = 0; i < b.iterations; i++ ) { - dist.x0 = x[ i % len ]; + dist.x0 = x[ i % x.length ]; y = dist.mode; if ( isnan( y ) ) { b.fail( 'should not return NaN' ); @@ -282,24 +279,24 @@ bench( pkg+':mode', function benchmark( b ) { bench( pkg+':cdf', function benchmark( b ) { var gamma; var dist; - var len; + var opts; var x0; var x; var y; var i; + opts = { + 'dtype': 'float64' + }; + x = uniform( 100, 0.0, 1.0, opts ); + x0 = 10.0; gamma = 6.0; dist = new Cauchy( x0, gamma ); - len = 100; - x = new Float64Array( len ); - for ( i = 0; i < len; i++ ) { - x[ i ] = uniform( 0.0, 1.0 ); - } b.tic(); for ( i = 0; i < b.iterations; i++ ) { - y = dist.cdf( x[ i % len ] ); + y = dist.cdf( x[ i % x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } @@ -315,24 +312,24 @@ bench( pkg+':cdf', function benchmark( b ) { bench( pkg+':logcdf', function benchmark( b ) { var gamma; var dist; - var len; + var opts; var x0; var x; var y; var i; + opts = { + 'dtype': 'float64' + }; + x = uniform( 100, 0.0, 1.0, opts ); + x0 = 10.0; gamma = 6.0; dist = new Cauchy( x0, gamma ); - len = 100; - x = new Float64Array( len ); - for ( i = 0; i < len; i++ ) { - x[ i ] = uniform( 0.0, 1.0 ); - } b.tic(); for ( i = 0; i < b.iterations; i++ ) { - y = dist.logcdf( x[ i % len ] ); + y = dist.logcdf( x[ i % x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } @@ -348,24 +345,24 @@ bench( pkg+':logcdf', function benchmark( b ) { bench( pkg+':logpdf', function benchmark( b ) { var gamma; var dist; - var len; + var opts; var x0; var x; var y; var i; + opts = { + 'dtype': 'float64' + }; + x = uniform( 100, 0.0, 1.0, opts ); + x0 = 10.0; gamma = 6.0; dist = new Cauchy( x0, gamma ); - len = 100; - x = new Float64Array( len ); - for ( i = 0; i < len; i++ ) { - x[ i ] = uniform( 0.0, 1.0 ); - } b.tic(); for ( i = 0; i < b.iterations; i++ ) { - y = dist.logpdf( x[ i % len ] ); + y = dist.logpdf( x[ i % x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } @@ -381,24 +378,24 @@ bench( pkg+':logpdf', function benchmark( b ) { bench( pkg+':pdf', function benchmark( b ) { var gamma; var dist; - var len; + var opts; var x0; var x; var y; var i; + opts = { + 'dtype': 'float64' + }; + x = uniform( 100, 0.0, 1.0, opts ); + x0 = 10.0; gamma = 6.0; dist = new Cauchy( x0, gamma ); - len = 100; - x = new Float64Array( len ); - for ( i = 0; i < len; i++ ) { - x[ i ] = uniform( 0.0, 1.0 ); - } b.tic(); for ( i = 0; i < b.iterations; i++ ) { - y = dist.pdf( x[ i % len ] ); + y = dist.pdf( x[ i % x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } @@ -414,24 +411,24 @@ bench( pkg+':pdf', function benchmark( b ) { bench( pkg+':quantile', function benchmark( b ) { var gamma; var dist; - var len; + var opts; var x0; var x; var y; var i; + opts = { + 'dtype': 'float64' + }; + x = uniform( 100, 0.0, 1.0, opts ); + x0 = 10.0; gamma = 6.0; dist = new Cauchy( x0, gamma ); - len = 100; - x = new Float64Array( len ); - for ( i = 0; i < len; i++ ) { - x[ i ] = uniform( 0.0, 1.0 ); - } b.tic(); for ( i = 0; i < b.iterations; i++ ) { - y = dist.quantile( x[ i % len ] ); + y = dist.quantile( x[ i % x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/stats/base/dists/cauchy/entropy/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/cauchy/entropy/benchmark/benchmark.js index 58beb16dfdc8..548e26b8a4dd 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/cauchy/entropy/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/stats/base/dists/cauchy/entropy/benchmark/benchmark.js @@ -21,8 +21,7 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var Float64Array = require( '@stdlib/array/float64' ); -var uniform = require( '@stdlib/random/base/uniform' ); +var uniform = require( '@stdlib/random/array/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var EPS = require( '@stdlib/constants/float64/eps' ); var pkg = require( './../package.json' ).name; @@ -33,22 +32,20 @@ var entropy = require( './../lib' ); bench( pkg, function benchmark( b ) { var gamma; - var len; + var opts; var x0; var y; var i; - len = 100; - gamma = new Float64Array( len ); - x0 = new Float64Array( len ); - for ( i = 0; i < len; i++ ) { - x0[ i ] = uniform( -50.0, 50.0 ); - gamma[ i ] = uniform( EPS, 20.0 ); - } + opts = { + 'dtype': 'float64' + }; + x0 = uniform( 100, -50.0, 50.0, opts ); + gamma = uniform( 100, EPS, 20.0, opts ); b.tic(); for ( i = 0; i < b.iterations; i++ ) { - y = entropy( x0[ i % len ], gamma[ i % len ] ); + y = entropy( x0[ i % x0.length ], gamma[ i % gamma.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/stats/base/dists/cauchy/entropy/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/stats/base/dists/cauchy/entropy/benchmark/benchmark.native.js index 35e282203ce8..4e167393a16a 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/cauchy/entropy/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/cauchy/entropy/benchmark/benchmark.native.js @@ -23,8 +23,7 @@ var resolve = require( 'path' ).resolve; var bench = require( '@stdlib/bench' ); var EPS = require( '@stdlib/constants/float64/eps' ); -var Float64Array = require( '@stdlib/array/float64' ); -var uniform = require( '@stdlib/random/base/uniform' ); +var uniform = require( '@stdlib/random/array/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var tryRequire = require( '@stdlib/utils/try-require' ); var pkg = require( './../package.json' ).name; @@ -42,22 +41,20 @@ var opts = { bench( pkg+'::native', opts, function benchmark( b ) { var gamma; - var len; + var opts; var x0; var y; var i; - len = 100; - gamma = new Float64Array( len ); - x0 = new Float64Array( len ); - for ( i = 0; i < len; i++ ) { - x0[ i ] = uniform( -50.0, 50.0 ); - gamma[ i ] = uniform( EPS, 20.0 ); - } + opts = { + 'dtype': 'float64' + }; + x0 = uniform( 100, -50.0, 50.0, opts ); + gamma = uniform( 100, EPS, 20.0, opts ); b.tic(); for ( i = 0; i < b.iterations; i++ ) { - y = entropy( x0[ i % len ], gamma[ i % len ] ); + y = entropy( x0[ i % x0.length ], gamma[ i % gamma.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/stats/base/dists/cauchy/entropy/test/test.js b/lib/node_modules/@stdlib/stats/base/dists/cauchy/entropy/test/test.js index ee15bd2a63ab..e8113ba818f7 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/cauchy/entropy/test/test.js +++ b/lib/node_modules/@stdlib/stats/base/dists/cauchy/entropy/test/test.js @@ -42,13 +42,13 @@ tape( 'main export is a function', function test( t ) { tape( 'if provided `NaN` for any parameter, the function returns `NaN`', function test( t ) { var v = entropy( NaN, 0.5 ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); v = entropy( 10, NaN ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); v = entropy( NaN, NaN ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); t.end(); }); @@ -57,16 +57,16 @@ tape( 'if provided a nonpositive `gamma`, the function always returns `NaN`', fu var y; y = entropy( 0.0, 0.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = entropy( 0.0, -1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = entropy( 0.0, NINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = entropy( PINF, NINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/stats/base/dists/cauchy/entropy/test/test.native.js b/lib/node_modules/@stdlib/stats/base/dists/cauchy/entropy/test/test.native.js index f109590ead00..8e076c784bd0 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/cauchy/entropy/test/test.native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/cauchy/entropy/test/test.native.js @@ -51,13 +51,13 @@ tape( 'main export is a function', opts, function test( t ) { tape( 'if provided `NaN` for any parameter, the function returns `NaN`', opts, function test( t ) { var v = entropy( NaN, 0.5 ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); v = entropy( 10, NaN ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); v = entropy( NaN, NaN ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); t.end(); }); @@ -66,16 +66,16 @@ tape( 'if provided a nonpositive `gamma`, the function always returns `NaN`', op var y; y = entropy( 0.0, 0.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = entropy( 0.0, -1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = entropy( 0.0, NINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = entropy( PINF, NINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/stats/base/dists/cauchy/logcdf/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/cauchy/logcdf/benchmark/benchmark.js index 289dcead5e06..e7bd58dca44c 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/cauchy/logcdf/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/stats/base/dists/cauchy/logcdf/benchmark/benchmark.js @@ -21,8 +21,7 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var Float64Array = require( '@stdlib/array/float64' ); -var uniform = require( '@stdlib/random/base/uniform' ); +var uniform = require( '@stdlib/random/array/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var EPS = require( '@stdlib/constants/float64/eps' ); var pkg = require( './../package.json' ).name; @@ -33,25 +32,22 @@ var logcdf = require( './../lib' ); bench( pkg, function benchmark( b ) { var gamma; - var len; + var opts; var x0; var x; var y; var i; - len = 100; - x = new Float64Array( len ); - x0 = new Float64Array( len ); - gamma = new Float64Array( len ); - for ( i = 0; i < len; i++ ) { - x[ i ] = uniform( -100.0, 0.0 ); - x0[ i ] = uniform( -50.0, 50.0 ); - gamma[ i ] = uniform( EPS, 20.0 ); - } + opts = { + 'dtype': 'float64' + }; + x = uniform( 100, -100.0, 0.0, opts ); + x0 = uniform( 100, -50.0, 50.0, opts ); + gamma = uniform( 100, EPS, 20.0, opts ); b.tic(); for ( i = 0; i < b.iterations; i++ ) { - y = logcdf( x[ i % len ], x0[ i % len ], gamma[ i % len ] ); + y = logcdf( x[ i % x.length ], x0[ i % x0.length ], gamma[ i % gamma.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } @@ -67,24 +63,24 @@ bench( pkg, function benchmark( b ) { bench( pkg+':factory', function benchmark( b ) { var mylogcdf; var gamma; - var len; + var opts; var x0; var x; var y; var i; + opts = { + 'dtype': 'float64' + }; + x = uniform( 100, EPS, 100.0, opts ); + x0 = 0.0; gamma = 1.5; mylogcdf = logcdf.factory( x0, gamma ); - len = 100; - x = new Float64Array( len ); - for ( i = 0; i < len; i++ ) { - x[ i ] = uniform( EPS, 100.0 ); - } b.tic(); for ( i = 0; i < b.iterations; i++ ) { - y = mylogcdf( x[ i % len ] ); + y = mylogcdf( x[ i % x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/stats/base/dists/cauchy/logcdf/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/stats/base/dists/cauchy/logcdf/benchmark/benchmark.native.js index 788483dc63c8..ed2c552256d9 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/cauchy/logcdf/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/cauchy/logcdf/benchmark/benchmark.native.js @@ -22,9 +22,8 @@ var resolve = require( 'path' ).resolve; var bench = require( '@stdlib/bench' ); -var Float64Array = require( '@stdlib/array/float64' ); var EPS = require( '@stdlib/constants/float64/eps' ); -var uniform = require( '@stdlib/random/base/uniform' ); +var uniform = require( '@stdlib/random/array/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var tryRequire = require( '@stdlib/utils/try-require' ); var pkg = require( './../package.json' ).name; @@ -42,25 +41,22 @@ var opts = { bench( pkg+'::native', opts, function benchmark( b ) { var gamma; - var len; + var opts; var x0; var x; var y; var i; - len = 100; - x = new Float64Array( len ); - x0 = new Float64Array( len ); - gamma = new Float64Array( len ); - for ( i = 0; i < len; i++ ) { - x[ i ] = uniform( -100.0, 0.0 ); - x0[ i ] = uniform( -100.0, 50.0 ); - gamma[ i ] = uniform( EPS, 20.0 ); - } + opts = { + 'dtype': 'float64' + }; + x = uniform( 100, -100.0, 0.0, opts ); + x0 = uniform( 100, -50.0, 50.0, opts ); + gamma = uniform( 100, EPS, 20.0, opts ); b.tic(); for ( i = 0; i < b.iterations; i++ ) { - y = logcdf( x[ i % len ], x0[ i % len ], gamma[ i % len ] ); + y = logcdf( x[ i % x.length ], x0[ i % x0.length ], gamma[ i % gamma.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/stats/base/dists/cauchy/logcdf/test/test.factory.js b/lib/node_modules/@stdlib/stats/base/dists/cauchy/logcdf/test/test.factory.js index 13bcd72a86d3..2a02e3b313d6 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/cauchy/logcdf/test/test.factory.js +++ b/lib/node_modules/@stdlib/stats/base/dists/cauchy/logcdf/test/test.factory.js @@ -56,23 +56,23 @@ tape( 'if provided `NaN` for any parameter, the created function returns `NaN`', logcdf = factory( 0.0, 1.0 ); y = logcdf( NaN ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); logcdf = factory( NaN, 1.0 ); y = logcdf( 0.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); logcdf = factory( 1.0, NaN ); y = logcdf( 0.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); logcdf = factory( NaN, NaN ); y = logcdf( 0.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); logcdf = factory( NaN, NaN ); y = logcdf( NaN ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); @@ -83,7 +83,7 @@ tape( 'if provided a valid `x0` and `gamma`, the function returns a function whi logcdf = factory( 0.0, 1.0 ); y = logcdf( PINF ); - t.equal( y, 0.0, 'returns 0' ); + t.equal( y, 0.0, 'returns expected value' ); t.end(); }); @@ -94,7 +94,7 @@ tape( 'if provided a valid `x0` and `gamma`, the function returns a function whi logcdf = factory( 0.0, 1.0 ); y = logcdf( NINF ); - t.equal( y, NINF, 'returns -Infinity' ); + t.equal( y, NINF, 'returns expected value' ); t.end(); }); @@ -105,33 +105,33 @@ tape( 'if provided a nonpositive `gamma`, the created function always returns `N logcdf = factory( 0.0, 0.0 ); y = logcdf( 2.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = logcdf( 0.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); logcdf = factory( 0.0, -1.0 ); y = logcdf( 2.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = logcdf( 0.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); logcdf = factory( 0.0, NINF ); y = logcdf( 2.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); logcdf = factory( PINF, NINF ); y = logcdf( 2.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); logcdf = factory( NINF, NINF ); y = logcdf( 2.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); logcdf = factory( NaN, NINF ); y = logcdf( 2.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/stats/base/dists/cauchy/logcdf/test/test.logcdf.js b/lib/node_modules/@stdlib/stats/base/dists/cauchy/logcdf/test/test.logcdf.js index cb84cfd2783e..e7a762a622a4 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/cauchy/logcdf/test/test.logcdf.js +++ b/lib/node_modules/@stdlib/stats/base/dists/cauchy/logcdf/test/test.logcdf.js @@ -46,23 +46,23 @@ tape( 'main export is a function', function test( t ) { tape( 'if provided `NaN` for any parameter, the function returns `NaN`', function test( t ) { var y = logcdf( NaN, 0.0, 1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = logcdf( 0.0, NaN, 1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = logcdf( 0.0, 1.0, NaN ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); tape( 'if provided `+infinity` for `x` and a finite `x0` and `gamma`, the function returns `0`', function test( t ) { var y = logcdf( PINF, 0.0, 1.0 ); - t.equal( y, 0.0, 'returns 0' ); + t.equal( y, 0.0, 'returns expected value' ); t.end(); }); tape( 'if provided `-infinity` for `x` and a finite `x0` and `gamma`, the function returns `-Infinity`', function test( t ) { var y = logcdf( NINF, 0.0, 1.0 ); - t.equal( y, NINF, 'returns -Infinity' ); + t.equal( y, NINF, 'returns expected value' ); t.end(); }); @@ -70,25 +70,25 @@ tape( 'if provided a nonpositive `gamma`, the function always returns `NaN`', fu var y; y = logcdf( 2.0, 0.0, 0.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = logcdf( 2.0, 0.0, -1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = logcdf( 0.0, 0.0, -1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = logcdf( 2.0, 0.0, NINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = logcdf( 2.0, PINF, NINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = logcdf( 2.0, NINF, NINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = logcdf( 2.0, NaN, NINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/stats/base/dists/cauchy/logcdf/test/test.native.js b/lib/node_modules/@stdlib/stats/base/dists/cauchy/logcdf/test/test.native.js index 2a08312e4b81..36a2f760dc2e 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/cauchy/logcdf/test/test.native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/cauchy/logcdf/test/test.native.js @@ -55,23 +55,23 @@ tape( 'main export is a function', opts, function test( t ) { tape( 'if provided `NaN` for any parameter, the function returns `NaN`', opts, function test( t ) { var y = logcdf( NaN, 0.0, 1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = logcdf( 0.0, NaN, 1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = logcdf( 0.0, 1.0, NaN ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); tape( 'if provided `+infinity` for `x` and a finite `x0` and `gamma`, the function returns `0`', opts, function test( t ) { var y = logcdf( PINF, 0.0, 1.0 ); - t.equal( y, 0.0, 'returns 0' ); + t.equal( y, 0.0, 'returns expected value' ); t.end(); }); tape( 'if provided `-infinity` for `x` and a finite `x0` and `gamma`, the function returns `-Infinity`', opts, function test( t ) { var y = logcdf( NINF, 0.0, 1.0 ); - t.equal( y, NINF, 'returns -Infinity' ); + t.equal( y, NINF, 'returns expected value' ); t.end(); }); @@ -79,25 +79,25 @@ tape( 'if provided a nonpositive `gamma`, the function always returns `NaN`', op var y; y = logcdf( 2.0, 0.0, 0.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = logcdf( 2.0, 0.0, -1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = logcdf( 0.0, 0.0, -1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = logcdf( 2.0, 0.0, NINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = logcdf( 2.0, PINF, NINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = logcdf( 2.0, NINF, NINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = logcdf( 2.0, NaN, NINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); });