diff --git a/lib/node_modules/@stdlib/stats/base/dists/cosine/cdf/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/cosine/cdf/benchmark/benchmark.js index c56308852d7b..208c2bd2996d 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/cosine/cdf/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/stats/base/dists/cosine/cdf/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; @@ -32,26 +31,23 @@ var cdf = require( './../lib' ); // MAIN // bench( pkg, function benchmark( b ) { - var len; + var opts; var mu; var s; var x; var y; var i; - len = 100; - x = new Float64Array( len ); - mu = new Float64Array( len ); - s = new Float64Array( len ); - for ( i = 0; i < len; i++ ) { - x[ i ] = uniform( -50.0, 50.0 ); - mu[ i ] = uniform( -10.0, 10.0 ); - s[ i ] = uniform( EPS, 5.0 ); - } + opts = { + 'dtype': 'float64' + }; + x = uniform( 100, -50.0, 50.0, opts ); + mu = uniform( 100, -10.0, 10.0, opts ); + s = uniform( 100, EPS, 5.0, opts ); b.tic(); for ( i = 0; i < b.iterations; i++ ) { - y = cdf( x[ i % len ], mu[ i % len ], s[ i % len ] ); + y = cdf( x[ i % x.length ], mu[ i % mu.length ], s[ i % s.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } @@ -66,25 +62,25 @@ bench( pkg, function benchmark( b ) { bench( pkg+':factory', function benchmark( b ) { var mycdf; - var len; + var opts; var mu; var s; var x; var y; var i; + opts = { + 'dtype': 'float64' + }; + x = uniform( 100, 0.0, 50.0, opts ); + mu = 10.0; s = 4.0; mycdf = cdf.factory( mu, s ); - len = 100; - x = new Float64Array( len ); - for ( i = 0; i < len; i++ ) { - x[ i ] = uniform( 0.0, 50.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/cosine/cdf/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/stats/base/dists/cosine/cdf/benchmark/benchmark.native.js index 62e17ce9dc29..17787237d50a 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/cosine/cdf/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/cosine/cdf/benchmark/benchmark.native.js @@ -22,8 +22,7 @@ var resolve = require( 'path' ).resolve; 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 EPS = require( '@stdlib/constants/float64/eps' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var tryRequire = require( '@stdlib/utils/try-require' ); @@ -41,26 +40,23 @@ var opts = { // MAIN // bench( pkg+'::native', opts, function benchmark( b ) { - var len; + var opts; var mu; var s; var x; var y; var i; - len = 100; - x = new Float64Array( len ); - mu = new Float64Array( len ); - s = new Float64Array( len ); - for ( i = 0; i < len; i++ ) { - x[ i ] = uniform( -50.0, 50.0 ); - mu[ i ] = uniform( -10.0, 10.0 ); - s[ i ] = uniform( EPS, 5.0 ); - } + opts = { + 'dtype': 'float64' + }; + x = uniform( 100, -50.0, 50.0, opts ); + mu = uniform( 100, -10.0, 10.0, opts ); + s = uniform( 100, EPS, 5.0, opts ); b.tic(); for ( i = 0; i < b.iterations; i++ ) { - y = cdf( x[ i % len ], mu[ i % len ], s[ i % len ] ); + y = cdf( x[ i % x.length ], mu[ i % mu.length ], s[ i % s.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/stats/base/dists/cosine/cdf/test/test.cdf.js b/lib/node_modules/@stdlib/stats/base/dists/cosine/cdf/test/test.cdf.js index 0165515a217f..e64aca2337b8 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/cosine/cdf/test/test.cdf.js +++ b/lib/node_modules/@stdlib/stats/base/dists/cosine/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 `mu` and `s`, 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 `mu` and `s`, 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,22 +70,22 @@ tape( 'if provided a negative `s`, the function returns `NaN`', function test( t var y; y = cdf( 2.0, 2.0, -1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = cdf( 0.0, 2.0, -1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = cdf( 2.0, 1.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(); }); @@ -94,13 +94,13 @@ tape( 'if provided `s` equals `0`, the function evaluates a degenerate distribut var y; y = cdf( 2.0, 2.0, 0.0 ); - t.equal( y, 1.0, 'returns 1 for x equal to mu' ); + t.equal( y, 1.0, 'returns expected value' ); y = cdf( 3.0, 2.0, 0.0 ); - t.equal( y, 1.0, 'returns 1 for x greater than mu' ); + t.equal( y, 1.0, 'returns expected value' ); y = cdf( 1.0, 2.0, 0.0 ); - t.equal( y, 0.0, 'returns 0 for x smaller than mu' ); + t.equal( y, 0.0, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/stats/base/dists/cosine/cdf/test/test.factory.js b/lib/node_modules/@stdlib/stats/base/dists/cosine/cdf/test/test.factory.js index 766c28c7a59a..3116f000e49d 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/cosine/cdf/test/test.factory.js +++ b/lib/node_modules/@stdlib/stats/base/dists/cosine/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 `mu` and `s`, the function returns a function which r 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 `mu` and `s`, the function returns a function which r 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(); }); @@ -106,26 +106,26 @@ tape( 'if provided a negative `s`, the created function always returns `NaN`', f 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(); }); @@ -137,13 +137,13 @@ tape( 'if `s` equals `0`, the created function evaluates a degenerate distributi cdf = factory( 2.0, 0.0 ); y = cdf( 2.0, 2.0, 0.0 ); - t.equal( y, 1.0, 'returns 1 for x equal to mu' ); + t.equal( y, 1.0, 'returns expected value' ); y = cdf( 3.0, 2.0, 0.0 ); - t.equal( y, 1.0, 'returns 1 for x greater than mu' ); + t.equal( y, 1.0, 'returns expected value' ); y = cdf( 1.0, 2.0, 0.0 ); - t.equal( y, 0.0, 'returns 0 for x smaller than mu' ); + t.equal( y, 0.0, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/stats/base/dists/cosine/cdf/test/test.native.js b/lib/node_modules/@stdlib/stats/base/dists/cosine/cdf/test/test.native.js index 1e3ec2da7cff..82e0ae43a34f 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/cosine/cdf/test/test.native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/cosine/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 `mu` and `s`, 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 `mu` and `s`, 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,22 +79,22 @@ tape( 'if provided a negative `s`, the function returns `NaN`', opts, function t var y; y = cdf( 2.0, 2.0, -1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = cdf( 0.0, 2.0, -1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = cdf( 2.0, 1.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(); }); @@ -103,13 +103,13 @@ tape( 'if provided `s` equals `0`, the function evaluates a degenerate distribut var y; y = cdf( 2.0, 2.0, 0.0 ); - t.equal( y, 1.0, 'returns 1 for x equal to mu' ); + t.equal( y, 1.0, 'returns expected value' ); y = cdf( 3.0, 2.0, 0.0 ); - t.equal( y, 1.0, 'returns 1 for x greater than mu' ); + t.equal( y, 1.0, 'returns expected value' ); y = cdf( 1.0, 2.0, 0.0 ); - t.equal( y, 0.0, 'returns 0 for x smaller than mu' ); + t.equal( y, 0.0, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/stats/base/dists/cosine/ctor/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/cosine/ctor/benchmark/benchmark.js index 479bec8237f3..89aa6bf906e5 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/cosine/ctor/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/stats/base/dists/cosine/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; @@ -33,22 +32,20 @@ var Cosine = require( './../lib' ); bench( pkg+'::instantiation', function benchmark( bm ) { var dist; - var len; + var opts; var mu; var s; var i; - len = 100; - mu = new Float64Array( len ); - s = new Float64Array( len ); - for ( i = 0; i < len; i++ ) { - mu[ i ] = uniform( EPS, 10.0 ); - s[ i ] = uniform( EPS, 10.0 ); - } + opts = { + 'dtype': 'float64' + }; + mu = uniform( 100, EPS, 10.0, opts ); + s = uniform( 100, EPS, 10.0, opts ); bm.tic(); for ( i = 0; i < bm.iterations; i++ ) { - dist = new Cosine( mu[ i % len ], s[ i % len ] ); + dist = new Cosine( mu[ i % mu.length ], s[ i % s.length ] ); if ( !( dist instanceof Cosine ) ) { bm.fail( 'should return a distribution instance' ); } @@ -89,25 +86,25 @@ bench( pkg+'::get:mu', function benchmark( bm ) { bench( pkg+'::set:mu', function benchmark( bm ) { var dist; - var len; + var opts; var mu; var s; var y; var i; + opts = { + 'dtype': 'float64' + }; + y = uniform( 100, EPS, 100.0, opts ); + mu = 2.0; s = 3.0; dist = new Cosine( mu, s ); - len = 100; - y = new Float64Array( len ); - for ( i = 0; i < len; i++ ) { - y[ i ] = uniform( EPS, 100.0 ); - } bm.tic(); for ( i = 0; i < bm.iterations; i++ ) { - dist.mu = y[ i % len ]; - if ( dist.mu !== y[ i % len ] ) { + dist.mu = y[ i % y.length ]; + if ( dist.mu !== y[ i % y.length ] ) { bm.fail( 'should return set value' ); } } @@ -147,25 +144,25 @@ bench( pkg+'::get:s', function benchmark( bm ) { bench( pkg+'::set:s', function benchmark( bm ) { var dist; - var len; + var opts; var mu; var s; var y; var i; + opts = { + 'dtype': 'float64' + }; + y = uniform( 100, EPS, 100.0, opts ); + mu = 2.0; s = 3.0; dist = new Cosine( mu, s ); - len = 100; - y = new Float64Array( len ); - for ( i = 0; i < len; i++ ) { - y[ i ] = uniform( EPS, 100.0 ); - } bm.tic(); for ( i = 0; i < bm.iterations; i++ ) { - dist.s = y[ i % len ]; - if ( dist.s !== y[ i % len ] ) { + dist.s = y[ i % y.length ]; + if ( dist.s !== y[ i % y.length ] ) { bm.fail( 'should return set value' ); } } @@ -179,25 +176,25 @@ bench( pkg+'::set:s', function benchmark( bm ) { bench( pkg+':kurtosis', function benchmark( bm ) { var dist; - var len; + var opts; var mu; var x; var s; var y; var i; + opts = { + 'dtype': 'float64' + }; + x = uniform( 100, EPS, 100.0, opts ); + mu = 2.0; s = 3.0; dist = new Cosine( mu, s ); - len = 100; - x = new Float64Array( len ); - for ( i = 0; i < len; i++ ) { - x[ i ] = uniform( EPS, 100.0 ); - } bm.tic(); for ( i = 0; i < bm.iterations; i++ ) { - dist.mu = x[ i % len ]; + dist.mu = x[ i % x.length ]; y = dist.kurtosis; if ( isnan( y ) ) { bm.fail( 'should not return NaN' ); @@ -213,25 +210,25 @@ bench( pkg+':kurtosis', function benchmark( bm ) { bench( pkg+':mean', function benchmark( bm ) { var dist; - var len; + var opts; var mu; var x; var s; var y; var i; + opts = { + 'dtype': 'float64' + }; + x = uniform( 100, EPS, 100.0, opts ); + mu = 2.0; s = 3.0; dist = new Cosine( mu, s ); - len = 100; - x = new Float64Array( len ); - for ( i = 0; i < len; i++ ) { - x[ i ] = uniform( EPS, 100.0 ); - } bm.tic(); for ( i = 0; i < bm.iterations; i++ ) { - dist.mu = x[ i % len ]; + dist.mu = x[ i % x.length ]; y = dist.mean; if ( isnan( y ) ) { bm.fail( 'should not return NaN' ); @@ -247,25 +244,25 @@ bench( pkg+':mean', function benchmark( bm ) { bench( pkg+':median', function benchmark( bm ) { var dist; - var len; + var opts; var mu; var x; var s; var y; var i; + opts = { + 'dtype': 'float64' + }; + x = uniform( 100, EPS, 100.0, opts ); + mu = 2.0; s = 3.0; dist = new Cosine( mu, s ); - len = 100; - x = new Float64Array( len ); - for ( i = 0; i < len; i++ ) { - x[ i ] = uniform( EPS, 100.0 ); - } bm.tic(); for ( i = 0; i < bm.iterations; i++ ) { - dist.mu = x[ i % len ]; + dist.mu = x[ i % x.length ]; y = dist.median; if ( isnan( y ) ) { bm.fail( 'should not return NaN' ); @@ -281,25 +278,25 @@ bench( pkg+':median', function benchmark( bm ) { bench( pkg+':mode', function benchmark( bm ) { var dist; - var len; + var opts; var mu; var x; var s; var y; var i; + opts = { + 'dtype': 'float64' + }; + x = uniform( 100, 1.0 + EPS, 100.0, opts ); + mu = 2.0; s = 3.0; dist = new Cosine( mu, s ); - len = 100; - x = new Float64Array( len ); - for ( i = 0; i < len; i++ ) { - x[ i ] = uniform( 1.0 + EPS, 100.0 ); - } bm.tic(); for ( i = 0; i < bm.iterations; i++ ) { - dist.mu = x[ i % len ]; + dist.mu = x[ i % x.length ]; y = dist.mode; if ( isnan( y ) ) { bm.fail( 'should not return NaN' ); @@ -315,25 +312,25 @@ bench( pkg+':mode', function benchmark( bm ) { bench( pkg+':skewness', function benchmark( bm ) { var dist; - var len; + var opts; var mu; var x; var s; var y; var i; + opts = { + 'dtype': 'float64' + }; + x = uniform( 100, EPS, 100.0, opts ); + mu = 2.0; s = 3.0; dist = new Cosine( mu, s ); - len = 100; - x = new Float64Array( len ); - for ( i = 0; i < len; i++ ) { - x[ i ] = uniform( EPS, 100.0 ); - } bm.tic(); for ( i = 0; i < bm.iterations; i++ ) { - dist.mu = x[ i % len ]; + dist.mu = x[ i % x.length ]; y = dist.skewness; if ( isnan( y ) ) { bm.fail( 'should not return NaN' ); @@ -349,25 +346,25 @@ bench( pkg+':skewness', function benchmark( bm ) { bench( pkg+':stdev', function benchmark( bm ) { var dist; - var len; + var opts; var mu; var x; var s; var y; var i; + opts = { + 'dtype': 'float64' + }; + x = uniform( 100, EPS, 100.0, opts ); + mu = 2.0; s = 3.0; dist = new Cosine( mu, s ); - len = 100; - x = new Float64Array( len ); - for ( i = 0; i < len; i++ ) { - x[ i ] = uniform( EPS, 100.0 ); - } bm.tic(); for ( i = 0; i < bm.iterations; i++ ) { - dist.mu = x[ i % len ]; + dist.mu = x[ i % x.length ]; y = dist.stdev; if ( isnan( y ) ) { bm.fail( 'should not return NaN' ); @@ -383,25 +380,25 @@ bench( pkg+':stdev', function benchmark( bm ) { bench( pkg+':variance', function benchmark( bm ) { var dist; - var len; + var opts; var mu; var x; var s; var y; var i; + opts = { + 'dtype': 'float64' + }; + x = uniform( 100, EPS, 100.0, opts ); + mu = 2.0; s = 3.0; dist = new Cosine( mu, s ); - len = 100; - x = new Float64Array( len ); - for ( i = 0; i < len; i++ ) { - x[ i ] = uniform( EPS, 100.0 ); - } bm.tic(); for ( i = 0; i < bm.iterations; i++ ) { - dist.mu = x[ i % len ]; + dist.mu = x[ i % x.length ]; y = dist.variance; if ( isnan( y ) ) { bm.fail( 'should not return NaN' ); @@ -417,25 +414,25 @@ bench( pkg+':variance', function benchmark( bm ) { bench( pkg+':cdf', function benchmark( bm ) { var dist; - var len; + var opts; var mu; var s; var x; var y; var i; + opts = { + 'dtype': 'float64' + }; + x = uniform( 100, -3.0, 3.0, opts ); + mu = 2.0; s = 3.0; dist = new Cosine( mu, s ); - len = 100; - x = new Float64Array( len ); - for ( i = 0; i < len; i++ ) { - x[ i ] = uniform( -3.0, 3.0 ); - } bm.tic(); for ( i = 0; i < bm.iterations; i++ ) { - y = dist.cdf( x[ i % len ] ); + y = dist.cdf( x[ i % x.length ] ); if ( isnan( y ) ) { bm.fail( 'should not return NaN' ); } @@ -450,25 +447,25 @@ bench( pkg+':cdf', function benchmark( bm ) { bench( pkg+':logpdf', function benchmark( bm ) { var dist; - var len; + var opts; var mu; var s; var x; var y; var i; + opts = { + 'dtype': 'float64' + }; + x = uniform( 100, -3.0, 3.0, opts ); + mu = 1.0; s = 2.0; dist = new Cosine( mu, s ); - len = 100; - x = new Float64Array( len ); - for ( i = 0; i < len; i++ ) { - x[ i ] = uniform( -3.0, 3.0 ); - } bm.tic(); for ( i = 0; i < bm.iterations; i++ ) { - y = dist.logpdf( x[ i % len ] ); + y = dist.logpdf( x[ i % x.length ] ); if ( isnan( y ) ) { bm.fail( 'should not return NaN' ); } @@ -483,25 +480,25 @@ bench( pkg+':logpdf', function benchmark( bm ) { bench( pkg+':mgf', function benchmark( bm ) { var dist; - var len; + var opts; var mu; var s; var x; var y; var i; + opts = { + 'dtype': 'float64' + }; + x = uniform( 100, 0.0, 1.0, opts ); + mu = 2.0; s = 0.2; dist = new Cosine( mu, s ); - len = 100; - x = new Float64Array( len ); - for ( i = 0; i < len; i++ ) { - x[ i ] = uniform( 0.0, 1.0 ); - } bm.tic(); for ( i = 0; i < bm.iterations; i++ ) { - y = dist.mgf( x[ i % len ] ); + y = dist.mgf( x[ i % x.length ] ); if ( isnan( y ) ) { bm.fail( 'should not return NaN' ); } @@ -516,25 +513,25 @@ bench( pkg+':mgf', function benchmark( bm ) { bench( pkg+':pdf', function benchmark( bm ) { var dist; - var len; + var opts; var mu; var s; var x; var y; var i; + opts = { + 'dtype': 'float64' + }; + x = uniform( 100, -3.0, 3.0, opts ); + mu = 2.0; s = 3.0; dist = new Cosine( mu, s ); - len = 100; - x = new Float64Array( len ); - for ( i = 0; i < len; i++ ) { - x[ i ] = uniform( -3.0, 3.0 ); - } bm.tic(); for ( i = 0; i < bm.iterations; i++ ) { - y = dist.pdf( x[ i % len ] ); + y = dist.pdf( x[ i % x.length ] ); if ( isnan( y ) ) { bm.fail( 'should not return NaN' ); } @@ -549,25 +546,25 @@ bench( pkg+':pdf', function benchmark( bm ) { bench( pkg+':quantile', function benchmark( bm ) { var dist; - var len; + var opts; var mu; var s; var x; var y; var i; + opts = { + 'dtype': 'float64' + }; + x = uniform( 100, 0.0, 1.0, opts ); + mu = 2.0; s = 3.0; dist = new Cosine( mu, s ); - len = 100; - x = new Float64Array( len ); - for ( i = 0; i < len; i++ ) { - x[ i ] = uniform( 0.0, 1.0 ); - } bm.tic(); for ( i = 0; i < bm.iterations; i++ ) { - y = dist.quantile( x[ i % len ] ); + y = dist.quantile( x[ i % x.length ] ); if ( isnan( y ) ) { bm.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/stats/base/dists/cosine/kurtosis/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/cosine/kurtosis/benchmark/benchmark.js index 20b217d1d6ce..e2bb6f750e67 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/cosine/kurtosis/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/stats/base/dists/cosine/kurtosis/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; @@ -32,23 +31,21 @@ var kurtosis = require( './../lib' ); // MAIN // bench( pkg, function benchmark( b ) { - var len; + var opts; var mu; var s; var y; var i; - len = 100; - mu = new Float64Array( len ); - s = new Float64Array( len ); - for ( i = 0; i < len; i++ ) { - mu[ i ] = uniform( -50.0, 50.0 ); - s[ i ] = uniform( EPS, 20.0 ); - } + opts = { + 'dtype': 'float64' + }; + mu = uniform( 100, -50.0, 50.0, opts ); + s = uniform( 100, EPS, 20.0, opts ); b.tic(); for ( i = 0; i < b.iterations; i++ ) { - y = kurtosis( mu[ i % len ], s[ i % len ] ); + y = kurtosis( mu[ i % mu.length ], s[ i % s.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/stats/base/dists/cosine/kurtosis/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/stats/base/dists/cosine/kurtosis/benchmark/benchmark.native.js index 3065fbb77fc2..74b451d15fb5 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/cosine/kurtosis/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/cosine/kurtosis/benchmark/benchmark.native.js @@ -22,8 +22,7 @@ var resolve = require( 'path' ).resolve; 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 EPS = require( '@stdlib/constants/float64/eps' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var tryRequire = require( '@stdlib/utils/try-require' ); @@ -41,23 +40,21 @@ var opts = { // MAIN // bench( pkg+'::native', opts, function benchmark( b ) { - var len; + var opts; var mu; var s; var y; var i; - len = 100; - mu = new Float64Array( len ); - s = new Float64Array( len ); - for ( i = 0; i < len; i++ ) { - mu[ i ] = uniform( -50.0, 50.0 ); - s[ i ] = uniform( EPS, 20.0 ); - } + opts = { + 'dtype': 'float64' + }; + mu = uniform( 100, -50.0, 50.0, opts ); + s = uniform( 100, EPS, 20.0, opts ); b.tic(); for ( i = 0; i < b.iterations; i++ ) { - y = kurtosis( mu[ i % len ], s[ i % len ] ); + y = kurtosis( mu[ i % mu.length ], s[ i % s.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/stats/base/dists/cosine/kurtosis/test/test.js b/lib/node_modules/@stdlib/stats/base/dists/cosine/kurtosis/test/test.js index cdf8ed17b4f6..8e1e585a667e 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/cosine/kurtosis/test/test.js +++ b/lib/node_modules/@stdlib/stats/base/dists/cosine/kurtosis/test/test.js @@ -42,9 +42,9 @@ 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 = kurtosis( NaN, 1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = kurtosis( 1.0, NaN ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); @@ -52,25 +52,25 @@ tape( 'if provided a nonpositive `s`, the function returns `NaN`', function test var y; y = kurtosis( 2.0, 0.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = kurtosis( 2.0, -1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = kurtosis( 2.0, -1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = kurtosis( 1.0, NINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = kurtosis( PINF, NINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = kurtosis( NINF, NINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = kurtosis( 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/cosine/kurtosis/test/test.native.js b/lib/node_modules/@stdlib/stats/base/dists/cosine/kurtosis/test/test.native.js index 497ef2a2c41a..71e484e716d6 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/cosine/kurtosis/test/test.native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/cosine/kurtosis/test/test.native.js @@ -51,9 +51,9 @@ 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 = kurtosis( NaN, 1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = kurtosis( 1.0, NaN ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); @@ -61,25 +61,25 @@ tape( 'if provided a nonpositive `s`, the function returns `NaN`', opts, functio var y; y = kurtosis( 2.0, 0.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = kurtosis( 2.0, -1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = kurtosis( 2.0, -1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = kurtosis( 1.0, NINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = kurtosis( PINF, NINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = kurtosis( NINF, NINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = kurtosis( 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/cosine/logcdf/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/cosine/logcdf/benchmark/benchmark.js index fed8b0f345e4..558345c06df6 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/cosine/logcdf/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/stats/base/dists/cosine/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; @@ -32,26 +31,23 @@ var logcdf = require( './../lib' ); // MAIN // bench( pkg, function benchmark( b ) { - var len; + var opts; var mu; var s; var x; var y; var i; - len = 100; - x = new Float64Array( len ); - mu = new Float64Array( len ); - s = new Float64Array( len ); - for ( i = 0; i < len; i++ ) { - x[ i ] = uniform( -50.0, 50.0 ); - mu[ i ] = uniform( -10.0, 10.0 ); - s[ i ] = uniform( EPS, 5.0 ); - } + opts = { + 'dtype': 'float64' + }; + x = uniform( 100, -50.0, 50.0, opts ); + mu = uniform( 100, -10.0, 10.0, opts ); + s = uniform( 100, EPS, 5.0, opts ); b.tic(); for ( i = 0; i < b.iterations; i++ ) { - y = logcdf( x[ i % len ], mu[ i % len ], s[ i % len ] ); + y = logcdf( x[ i % x.length ], mu[ i % mu.length ], s[ i % s.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } @@ -66,25 +62,25 @@ bench( pkg, function benchmark( b ) { bench( pkg+':factory', function benchmark( b ) { var mylogcdf; - var len; + var opts; var mu; var s; var x; var y; var i; + opts = { + 'dtype': 'float64' + }; + x = uniform( 100, 0.0, 50.0, opts ); + mu = 10.0; s = 4.0; mylogcdf = logcdf.factory( mu, s ); - len = 100; - x = new Float64Array( len ); - for ( i = 0; i < len; i++ ) { - x[ i ] = uniform( 0.0, 50.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/cosine/logcdf/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/stats/base/dists/cosine/logcdf/benchmark/benchmark.native.js index 608a2bfb655f..ef742819f1fd 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/cosine/logcdf/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/cosine/logcdf/benchmark/benchmark.native.js @@ -22,8 +22,7 @@ var resolve = require( 'path' ).resolve; 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 EPS = require( '@stdlib/constants/float64/eps' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var tryRequire = require( '@stdlib/utils/try-require' ); @@ -41,26 +40,23 @@ var opts = { // MAIN // bench( pkg+'::native', opts, function benchmark( b ) { - var len; + var opts; var mu; var s; var x; var y; var i; - len = 100; - x = new Float64Array( len ); - mu = new Float64Array( len ); - s = new Float64Array( len ); - for ( i = 0; i < len; i++ ) { - x[ i ] = uniform( -50.0, 50.0 ); - mu[ i ] = uniform( -10.0, 10.0 ); - s[ i ] = uniform( EPS, 5.0 ); - } + opts = { + 'dtype': 'float64' + }; + x = uniform( 100, -50.0, 50.0, opts ); + mu = uniform( 100, -10.0, 10.0, opts ); + s = uniform( 100, EPS, 5.0, opts ); b.tic(); for ( i = 0; i < b.iterations; i++ ) { - y = logcdf( x[ i % len ], mu[ i % len ], s[ i % len ] ); + y = logcdf( x[ i % x.length ], mu[ i % mu.length ], s[ i % s.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/stats/base/dists/cosine/logcdf/test/test.factory.js b/lib/node_modules/@stdlib/stats/base/dists/cosine/logcdf/test/test.factory.js index 8705edb38a8c..50c7890268e4 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/cosine/logcdf/test/test.factory.js +++ b/lib/node_modules/@stdlib/stats/base/dists/cosine/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 `mu` and `s`, the function returns a function which r 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 `mu` and `s`, the function returns a function which r logcdf = factory( 0.0, 1.0 ); y = logcdf( NINF ); - t.equal( y, NINF, 'returns -infinity' ); + t.equal( y, NINF, 'returns expected value' ); t.end(); }); @@ -106,26 +106,26 @@ tape( 'if provided a negative `s`, the created function always returns `NaN`', f 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(); }); @@ -137,13 +137,13 @@ tape( 'if `s` equals `0`, the created function evaluates a degenerate distributi logcdf = factory( 2.0, 0.0 ); y = logcdf( 2.0, 2.0, 0.0 ); - t.equal( y, 0.0, 'returns 0 for x equal to mu' ); + t.equal( y, 0.0, 'returns expected value' ); y = logcdf( 3.0, 2.0, 0.0 ); - t.equal( y, 0.0, 'returns 0 for x greater than mu' ); + t.equal( y, 0.0, 'returns expected value' ); y = logcdf( 1.0, 2.0, 0.0 ); - t.equal( y, NINF, 'returns -infinity for x smaller than mu' ); + t.equal( y, NINF, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/stats/base/dists/cosine/logcdf/test/test.logcdf.js b/lib/node_modules/@stdlib/stats/base/dists/cosine/logcdf/test/test.logcdf.js index dc3d5b2a872e..b7b1c92d9890 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/cosine/logcdf/test/test.logcdf.js +++ b/lib/node_modules/@stdlib/stats/base/dists/cosine/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 `mu` and `s`, 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 `mu` and `s`, 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,22 +70,22 @@ tape( 'if provided a negative `s`, the function returns `NaN`', function test( t var y; y = logcdf( 2.0, 2.0, -1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = logcdf( 0.0, 2.0, -1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = logcdf( 2.0, 1.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(); }); @@ -94,13 +94,13 @@ tape( 'if provided `s` equals `0`, the function evaluates a degenerate distribut var y; y = logcdf( 2.0, 2.0, 0.0 ); - t.equal( y, 0.0, 'returns 0 for x equal to mu' ); + t.equal( y, 0.0, 'returns expected value' ); y = logcdf( 3.0, 2.0, 0.0 ); - t.equal( y, 0.0, 'returns 0 for x greater than mu' ); + t.equal( y, 0.0, 'returns expected value' ); y = logcdf( 1.0, 2.0, 0.0 ); - t.equal( y, NINF, 'returns -infinity for x smaller than mu' ); + t.equal( y, NINF, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/stats/base/dists/cosine/logcdf/test/test.native.js b/lib/node_modules/@stdlib/stats/base/dists/cosine/logcdf/test/test.native.js index 50c6f14fdfd0..cba2f2cb820e 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/cosine/logcdf/test/test.native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/cosine/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 `mu` and `s`, 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 `mu` and `s`, 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,22 +79,22 @@ tape( 'if provided a negative `s`, the function returns `NaN`', opts, function t var y; y = logcdf( 2.0, 2.0, -1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = logcdf( 0.0, 2.0, -1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = logcdf( 2.0, 1.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(); }); @@ -103,13 +103,13 @@ tape( 'if provided `s` equals `0`, the function evaluates a degenerate distribut var y; y = logcdf( 2.0, 2.0, 0.0 ); - t.equal( y, 0.0, 'returns 0 for x equal to mu' ); + t.equal( y, 0.0, 'returns expected value' ); y = logcdf( 3.0, 2.0, 0.0 ); - t.equal( y, 0.0, 'returns 0 for x greater than mu' ); + t.equal( y, 0.0, 'returns expected value' ); y = logcdf( 1.0, 2.0, 0.0 ); - t.equal( y, NINF, 'returns -infinity for x smaller than mu' ); + t.equal( y, NINF, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/stats/base/dists/cosine/logpdf/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/cosine/logpdf/benchmark/benchmark.js index 56d7396d4893..932befa3884f 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/cosine/logpdf/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/stats/base/dists/cosine/logpdf/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; @@ -32,26 +31,23 @@ var logpdf = require( './../lib' ); // MAIN // bench( pkg, function benchmark( b ) { - var len; + var opts; var mu; var s; var x; var y; var i; - len = 100; - x = new Float64Array( len ); - mu = new Float64Array( len ); - s = new Float64Array( len ); - for ( i = 0; i < len; i++ ) { - x[ i ] = uniform( -50.0, 50.0 ); - mu[ i ] = uniform( -10.0, 10.0 ); - s[ i ] = uniform( EPS, 5.0 ); - } + opts = { + 'dtype': 'float64' + }; + x = uniform( 100, -50.0, 50.0, opts ); + mu = uniform( 100, -10.0, 10.0, opts ); + s = uniform( 100, EPS, 5.0, opts ); b.tic(); for ( i = 0; i < b.iterations; i++ ) { - y = logpdf( x[ i % len ], mu[ i % len ], s[ i % len ] ); + y = logpdf( x[ i % x.length ], mu[ i % mu.length ], s[ i % s.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } @@ -66,25 +62,25 @@ bench( pkg, function benchmark( b ) { bench( pkg+':factory', function benchmark( b ) { var mylogpdf; - var len; + var opts; var mu; var s; var x; var y; var i; + opts = { + 'dtype': 'float64' + }; + x = uniform( 100, 0.0, 50.0, opts ); + mu = 10.0; s = 4.0; mylogpdf = logpdf.factory( mu, s ); - len = 100; - x = new Float64Array( len ); - for ( i = 0; i < len; i++ ) { - x[ i ] = uniform( 0.0, 50.0 ); - } b.tic(); for ( i = 0; i < b.iterations; i++ ) { - y = mylogpdf( x[ i % len ] ); + y = mylogpdf( x[ i % x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/stats/base/dists/cosine/logpdf/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/stats/base/dists/cosine/logpdf/benchmark/benchmark.native.js index e1885a36e469..4d220cab1226 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/cosine/logpdf/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/cosine/logpdf/benchmark/benchmark.native.js @@ -22,8 +22,7 @@ var resolve = require( 'path' ).resolve; 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 EPS = require( '@stdlib/constants/float64/eps' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var tryRequire = require( '@stdlib/utils/try-require' ); @@ -41,26 +40,23 @@ var opts = { // MAIN // bench( pkg+'::native', opts, function benchmark( b ) { - var len; + var opts; var mu; var s; var x; var y; var i; - len = 100; - x = new Float64Array( len ); - mu = new Float64Array( len ); - s = new Float64Array( len ); - for ( i = 0; i < len; i++ ) { - x[ i ] = uniform( -50.0, 50.0 ); - mu[ i ] = uniform( -10.0, 10.0 ); - s[ i ] = uniform( EPS, 5.0 ); - } + opts = { + 'dtype': 'float64' + }; + x = uniform( 100, -50.0, 50.0, opts ); + mu = uniform( 100, -10.0, 10.0, opts ); + s = uniform( 100, EPS, 5.0, opts ); b.tic(); for ( i = 0; i < b.iterations; i++ ) { - y = logpdf( x[ i % len ], mu[ i % len ], s[ i % len ] ); + y = logpdf( x[ i % x.length ], mu[ i % mu.length ], s[ i % s.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/stats/base/dists/cosine/logpdf/test/test.factory.js b/lib/node_modules/@stdlib/stats/base/dists/cosine/logpdf/test/test.factory.js index 2ed4e0240c3d..b76c9a1029ff 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/cosine/logpdf/test/test.factory.js +++ b/lib/node_modules/@stdlib/stats/base/dists/cosine/logpdf/test/test.factory.js @@ -56,23 +56,23 @@ tape( 'if provided `NaN` for any parameter, the created function returns `NaN`', logpdf = factory( 0.0, 1.0 ); y = logpdf( NaN ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); logpdf = factory( NaN, 1.0 ); y = logpdf( 0.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); logpdf = factory( 1.0, NaN ); y = logpdf( 0.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); logpdf = factory( NaN, NaN ); y = logpdf( 0.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); logpdf = factory( NaN, NaN ); y = logpdf( NaN ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); @@ -84,13 +84,13 @@ tape( 'if provided a finite `mu` and `s`, the function returns a function which logpdf = factory( 0.0, 1.0 ); y = logpdf( PINF ); - t.equal( y, NINF, 'returns -infinity' ); + t.equal( y, NINF, 'returns expected value' ); y = logpdf( 2.0 ); - t.equal( y, NINF, 'returns -infinity' ); + t.equal( y, NINF, 'returns expected value' ); y = logpdf( 20.0 ); - t.equal( y, NINF, 'returns -infinity' ); + t.equal( y, NINF, 'returns expected value' ); t.end(); }); @@ -101,13 +101,13 @@ tape( 'if provided a finite `mu` and `s`, the function returns a function which logpdf = factory( 0.0, 1.0 ); y = logpdf( NINF ); - t.equal( y, NINF, 'returns -infinity' ); + t.equal( y, NINF, 'returns expected value' ); y = logpdf( -2.0 ); - t.equal( y, NINF, 'returns -infinity' ); + t.equal( y, NINF, 'returns expected value' ); y = logpdf( -20.0 ); - t.equal( y, NINF, 'returns -infinity' ); + t.equal( y, NINF, 'returns expected value' ); t.end(); }); @@ -119,26 +119,26 @@ tape( 'if provided a negative `s`, the created function always returns `NaN`', f logpdf = factory( 0.0, -1.0 ); y = logpdf( 2.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = logpdf( 0.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); logpdf = factory( 0.0, NINF ); y = logpdf( 2.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); logpdf = factory( PINF, NINF ); y = logpdf( 2.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); logpdf = factory( NINF, NINF ); y = logpdf( 2.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); logpdf = factory( NaN, NINF ); y = logpdf( 2.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); @@ -150,19 +150,19 @@ tape( 'if `s` equals `0`, the created function evaluates a degenerate distributi logpdf = factory( 2.0, 0.0 ); y = logpdf( 2.0 ); - t.equal( y, PINF, 'returns +Infinity for x equal to mu' ); + t.equal( y, PINF, 'returns expected value' ); y = logpdf( 1.0 ); - t.equal( y, NINF, 'returns -Infinity' ); + t.equal( y, NINF, 'returns expected value' ); y = logpdf( PINF ); - t.equal( y, NINF, 'returns -Infinity' ); + t.equal( y, NINF, 'returns expected value' ); y = logpdf( NINF ); - t.equal( y, NINF, 'returns -Infinity' ); + t.equal( y, NINF, 'returns expected value' ); y = logpdf( NaN ); - 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/cosine/logpdf/test/test.logpdf.js b/lib/node_modules/@stdlib/stats/base/dists/cosine/logpdf/test/test.logpdf.js index 0c8569078272..0ff9b30d133f 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/cosine/logpdf/test/test.logpdf.js +++ b/lib/node_modules/@stdlib/stats/base/dists/cosine/logpdf/test/test.logpdf.js @@ -46,36 +46,36 @@ 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 = logpdf( NaN, 0.0, 1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = logpdf( 0.0, NaN, 1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = logpdf( 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 `x` greater than `mu + s`, the function returns `-infinity`', function test( t ) { var y = logpdf( PINF, 0.0, 1.0 ); - t.equal( y, NINF, 'returns -infinity' ); + t.equal( y, NINF, 'returns expected value' ); y = logpdf( 20.0, 0.0, 1.0 ); - t.equal( y, NINF, 'returns -infinity' ); + t.equal( y, NINF, 'returns expected value' ); y = logpdf( 2.0, 0.0, 1.0 ); - t.equal( y, NINF, 'returns -infinity' ); + t.equal( y, NINF, 'returns expected value' ); t.end(); }); tape( 'if provided `x` smaller than `mu - s`, the function returns `-infinity`', function test( t ) { var y = logpdf( NINF, 0.0, 1.0 ); - t.equal( y, NINF, 'returns -infinity' ); + t.equal( y, NINF, 'returns expected value' ); logpdf( -20.0, 0.0, 1.0 ); - t.equal( y, NINF, 'returns -infinity' ); + t.equal( y, NINF, 'returns expected value' ); logpdf( -2.0, 0.0, 1.0 ); - t.equal( y, NINF, 'returns -infinity' ); + t.equal( y, NINF, 'returns expected value' ); t.end(); }); @@ -84,22 +84,22 @@ tape( 'if provided a negative `s`, the function returns `NaN`', function test( t var y; y = logpdf( 2.0, 2.0, -1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = logpdf( 0.0, 2.0, -1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = logpdf( 2.0, 1.0, NINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = logpdf( 2.0, PINF, NINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = logpdf( 2.0, NINF, NINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = logpdf( 2.0, NaN, NINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); @@ -108,19 +108,19 @@ tape( 'if provided `s` equal to `0`, the function evaluates a degenerate distrib var y; y = logpdf( 2.0, 2.0, 0.0 ); - t.equal( y, PINF, 'returns +infinity for x equal to mu' ); + t.equal( y, PINF, 'returns expected value' ); y = logpdf( 1.0, 2.0, 0.0 ); - t.equal( y, NINF, 'returns -infinity ' ); + t.equal( y, NINF, 'returns expected value ' ); y = logpdf( PINF, 2.0, 0.0 ); - t.equal( y, NINF, 'returns -infinity ' ); + t.equal( y, NINF, 'returns expected value ' ); y = logpdf( NINF, 2.0, 0.0 ); - t.equal( y, NINF, 'returns -infinity ' ); + t.equal( y, NINF, 'returns expected value ' ); y = logpdf( NaN, 2.0, 0.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/cosine/logpdf/test/test.native.js b/lib/node_modules/@stdlib/stats/base/dists/cosine/logpdf/test/test.native.js index 058a1f458376..a20dc4903202 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/cosine/logpdf/test/test.native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/cosine/logpdf/test/test.native.js @@ -55,36 +55,36 @@ 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 = logpdf( NaN, 0.0, 1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = logpdf( 0.0, NaN, 1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = logpdf( 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 `x` greater than `mu + s`, the function returns `-infinity`', opts, function test( t ) { var y = logpdf( PINF, 0.0, 1.0 ); - t.equal( y, NINF, 'returns -infinity' ); + t.equal( y, NINF, 'returns expected value' ); y = logpdf( 20.0, 0.0, 1.0 ); - t.equal( y, NINF, 'returns -infinity' ); + t.equal( y, NINF, 'returns expected value' ); y = logpdf( 2.0, 0.0, 1.0 ); - t.equal( y, NINF, 'returns -infinity' ); + t.equal( y, NINF, 'returns expected value' ); t.end(); }); tape( 'if provided `x` smaller than `mu - s`, the function returns `-infinity`', opts, function test( t ) { var y = logpdf( NINF, 0.0, 1.0 ); - t.equal( y, NINF, 'returns -infinity' ); + t.equal( y, NINF, 'returns expected value' ); logpdf( -20.0, 0.0, 1.0 ); - t.equal( y, NINF, 'returns -infinity' ); + t.equal( y, NINF, 'returns expected value' ); logpdf( -2.0, 0.0, 1.0 ); - t.equal( y, NINF, 'returns -infinity' ); + t.equal( y, NINF, 'returns expected value' ); t.end(); }); @@ -93,22 +93,22 @@ tape( 'if provided a negative `s`, the function returns `NaN`', opts, function t var y; y = logpdf( 2.0, 2.0, -1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = logpdf( 0.0, 2.0, -1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = logpdf( 2.0, 1.0, NINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = logpdf( 2.0, PINF, NINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = logpdf( 2.0, NINF, NINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = logpdf( 2.0, NaN, NINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); @@ -117,19 +117,19 @@ tape( 'if provided `s` equal to `0`, the function evaluates a degenerate distrib var y; y = logpdf( 2.0, 2.0, 0.0 ); - t.equal( y, PINF, 'returns +infinity for x equal to mu' ); + t.equal( y, PINF, 'returns expected value' ); y = logpdf( 1.0, 2.0, 0.0 ); - t.equal( y, NINF, 'returns -infinity ' ); + t.equal( y, NINF, 'returns expected value ' ); y = logpdf( PINF, 2.0, 0.0 ); - t.equal( y, NINF, 'returns -infinity ' ); + t.equal( y, NINF, 'returns expected value ' ); y = logpdf( NINF, 2.0, 0.0 ); - t.equal( y, NINF, 'returns -infinity ' ); + t.equal( y, NINF, 'returns expected value ' ); y = logpdf( NaN, 2.0, 0.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/cosine/mean/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/cosine/mean/benchmark/benchmark.js index b7485a2706bf..a2b47538fd3d 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/cosine/mean/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/stats/base/dists/cosine/mean/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; @@ -32,23 +31,21 @@ var mean = require( './../lib' ); // MAIN // bench( pkg, function benchmark( b ) { - var len; + var opts; var mu; var s; var y; var i; - len = 100; - mu = new Float64Array( len ); - s = new Float64Array( len ); - for ( i = 0; i < len; i++ ) { - mu[ i ] = uniform( -50.0, 50.0 ); - s[ i ] = uniform( EPS, 20.0 ); - } + opts = { + 'dtype': 'float64' + }; + mu = uniform( 100, -50.0, 50.0, opts ); + s = uniform( 100, EPS, 20.0, opts ); b.tic(); for ( i = 0; i < b.iterations; i++ ) { - y = mean( mu[ i % len ], s[ i % len ] ); + y = mean( mu[ i % mu.length ], s[ i % s.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/stats/base/dists/cosine/mean/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/stats/base/dists/cosine/mean/benchmark/benchmark.native.js index 9381eb3d4989..91cf176a7131 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/cosine/mean/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/cosine/mean/benchmark/benchmark.native.js @@ -22,8 +22,7 @@ var resolve = require( 'path' ).resolve; 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 tryRequire = require( '@stdlib/utils/try-require' ); @@ -41,23 +40,21 @@ var opts = { // MAIN // bench( pkg+'::native', opts, function benchmark( b ) { - var len; + var opts; var mu; var s; var y; var i; - len = 100; - mu = new Float64Array( len ); - s = new Float64Array( len ); - for ( i = 0; i < len; i++ ) { - mu[ i ] = uniform( -50.0, 50.0 ); - s[ i ] = uniform( EPS, 20.0 ); - } + opts = { + 'dtype': 'float64' + }; + mu = uniform( 100, -50.0, 50.0, opts ); + s = uniform( 100, EPS, 20.0, opts ); b.tic(); for ( i = 0; i < b.iterations; i++ ) { - y = mean( mu[ i % len ], s[ i % len ] ); + y = mean( mu[ i % mu.length ], s[ i % s.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/stats/base/dists/cosine/mean/test/test.js b/lib/node_modules/@stdlib/stats/base/dists/cosine/mean/test/test.js index ce9e2383f38d..590b9a8aa995 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/cosine/mean/test/test.js +++ b/lib/node_modules/@stdlib/stats/base/dists/cosine/mean/test/test.js @@ -42,9 +42,9 @@ 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 = mean( NaN, 1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = mean( 1.0, NaN ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); @@ -52,25 +52,25 @@ tape( 'if provided a nonpositive `s`, the function returns `NaN`', function test var y; y = mean( 2.0, 0.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = mean( 2.0, -1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = mean( 2.0, -1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = mean( 1.0, NINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = mean( PINF, NINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = mean( NINF, NINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = mean( 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/cosine/mean/test/test.native.js b/lib/node_modules/@stdlib/stats/base/dists/cosine/mean/test/test.native.js index 4dfec99b8ebf..c47c4c1e8475 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/cosine/mean/test/test.native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/cosine/mean/test/test.native.js @@ -51,10 +51,10 @@ 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 = mean( NaN, 0.5 ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); v = mean( 10.0, NaN ); - t.equal( isnan( v ), true, 'returns NaN' ); + t.equal( isnan( v ), true, 'returns expected value' ); t.end(); }); @@ -63,19 +63,19 @@ tape( 'if provided `s <= 0.0`, the function returns `NaN`', opts, function test( var y; y = mean( 3.0, 0.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = mean( 0.0, 0.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = mean( 2.0, -2.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = mean( NINF, NINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = mean( 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/cosine/median/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/cosine/median/benchmark/benchmark.js index 229962be470c..4db0865cdcce 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/cosine/median/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/stats/base/dists/cosine/median/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; @@ -32,23 +31,21 @@ var median = require( './../lib' ); // MAIN // bench( pkg, function benchmark( b ) { - var len; + var opts; var mu; var s; var y; var i; - len = 100; - mu = new Float64Array( len ); - s = new Float64Array( len ); - for ( i = 0; i < len; i++ ) { - mu[ i ] = uniform( -50.0, 50.0 ); - s[ i ] = uniform( EPS, 20.0 ); - } + opts = { + 'dtype': 'float64' + }; + mu = uniform( 100, -50.0, 50.0, opts ); + s = uniform( 100, EPS, 20.0, opts ); b.tic(); for ( i = 0; i < b.iterations; i++ ) { - y = median( mu[ i % len ], s[ i % len ] ); + y = median( mu[ i % mu.length ], s[ i % s.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/stats/base/dists/cosine/median/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/stats/base/dists/cosine/median/benchmark/benchmark.native.js index f9018140d892..df41c34524a3 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/cosine/median/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/cosine/median/benchmark/benchmark.native.js @@ -22,8 +22,7 @@ var resolve = require( 'path' ).resolve; 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 EPS = require( '@stdlib/constants/float64/eps' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var tryRequire = require( '@stdlib/utils/try-require' ); @@ -41,23 +40,21 @@ var opts = { // MAIN // bench( pkg+'::native', opts, function benchmark( b ) { - var len; + var opts; var mu; var s; var y; var i; - len = 100; - mu = new Float64Array( len ); - s = new Float64Array( len ); - for ( i = 0; i < len; i++ ) { - mu[ i ] = uniform( -50.0, 50.0 ); - s[ i ] = uniform( EPS, 20.0 ); - } + opts = { + 'dtype': 'float64' + }; + mu = uniform( 100, -50.0, 50.0, opts ); + s = uniform( 100, EPS, 20.0, opts ); b.tic(); for ( i = 0; i < b.iterations; i++ ) { - y = median( mu[ i % len ], s[ i % len ] ); + y = median( mu[ i % mu.length ], s[ i % s.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/stats/base/dists/cosine/median/test/test.js b/lib/node_modules/@stdlib/stats/base/dists/cosine/median/test/test.js index 94145b6e63b7..b0872b523117 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/cosine/median/test/test.js +++ b/lib/node_modules/@stdlib/stats/base/dists/cosine/median/test/test.js @@ -42,9 +42,9 @@ 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 = median( NaN, 1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = median( 1.0, NaN ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); @@ -52,25 +52,25 @@ tape( 'if provided a nonpositive `s`, the function returns `NaN`', function test var y; y = median( 2.0, 0.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = median( 2.0, -1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = median( 2.0, -1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = median( 1.0, NINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = median( PINF, NINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = median( NINF, NINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = median( 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/cosine/median/test/test.native.js b/lib/node_modules/@stdlib/stats/base/dists/cosine/median/test/test.native.js index 3219565ec020..d8e70fa28c57 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/cosine/median/test/test.native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/cosine/median/test/test.native.js @@ -51,9 +51,9 @@ 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 = median( NaN, 1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = median( 1.0, NaN ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); }); @@ -61,25 +61,25 @@ tape( 'if provided a nonpositive `s`, the function returns `NaN`', opts, functio var y; y = median( 2.0, 0.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = median( 2.0, -1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = median( 2.0, -1.0 ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = median( 1.0, NINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = median( PINF, NINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = median( NINF, NINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); y = median( NaN, NINF ); - t.equal( isnan( y ), true, 'returns NaN' ); + t.equal( isnan( y ), true, 'returns expected value' ); t.end(); });