Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
// MODULES //

var bench = require( '@stdlib/bench' );
var randu = require( '@stdlib/random/base/randu' );
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;
Expand All @@ -30,17 +30,22 @@

// MAIN //

bench( pkg+'::instantiation', function benchmark( bm ) {

Check warning on line 33 in lib/node_modules/@stdlib/stats/base/dists/kumaraswamy/ctor/benchmark/benchmark.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Use `@stdlib/string/format` instead of string concatenation for benchmark descriptions
var dist;
var opts;
var a;
var b;
var i;

opts = {
'dtype': 'float64'
};
a = uniform( 100, EPS, 10.0, opts );
b = uniform( 100, EPS, 10.0, opts );

bm.tic();
for ( i = 0; i < bm.iterations; i++ ) {
a = ( randu() * 10.0 ) + EPS;
b = ( randu() * 10.0 ) + EPS;
dist = new Kumaraswamy( a, b );
dist = new Kumaraswamy( a[ i % a.length ], b[ i % b.length ] );
if ( !( dist instanceof Kumaraswamy ) ) {
bm.fail( 'should return a distribution instance' );
}
Expand All @@ -53,7 +58,7 @@
bm.end();
});

bench( pkg+'::get:a', function benchmark( bm ) {

Check warning on line 61 in lib/node_modules/@stdlib/stats/base/dists/kumaraswamy/ctor/benchmark/benchmark.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Use `@stdlib/string/format` instead of string concatenation for benchmark descriptions
var dist;
var a;
var b;
Expand All @@ -79,8 +84,9 @@
bm.end();
});

bench( pkg+'::set:a', function benchmark( bm ) {

Check warning on line 87 in lib/node_modules/@stdlib/stats/base/dists/kumaraswamy/ctor/benchmark/benchmark.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Use `@stdlib/string/format` instead of string concatenation for benchmark descriptions
var dist;
var opts;
var a;
var b;
var y;
Expand All @@ -90,10 +96,14 @@
b = 55.54321;
dist = new Kumaraswamy( a, b );

opts = {
'dtype': 'float64'
};
y = uniform( 100, EPS, 100.0, opts );

bm.tic();
for ( i = 0; i < bm.iterations; i++ ) {
y = ( 100.0*randu() ) + EPS;
dist.a = y;
dist.a = y[ i % y.length ];
if ( dist.a !== y ) {
bm.fail( 'should return set value' );
}
Expand All @@ -106,7 +116,7 @@
bm.end();
});

bench( pkg+'::get:b', function benchmark( bm ) {

Check warning on line 119 in lib/node_modules/@stdlib/stats/base/dists/kumaraswamy/ctor/benchmark/benchmark.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Use `@stdlib/string/format` instead of string concatenation for benchmark descriptions
var dist;
var a;
var b;
Expand All @@ -132,8 +142,9 @@
bm.end();
});

bench( pkg+'::set:b', function benchmark( bm ) {

Check warning on line 145 in lib/node_modules/@stdlib/stats/base/dists/kumaraswamy/ctor/benchmark/benchmark.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Use `@stdlib/string/format` instead of string concatenation for benchmark descriptions
var dist;
var opts;
var a;
var b;
var y;
Expand All @@ -143,10 +154,14 @@
b = 55.54321;
dist = new Kumaraswamy( a, b );

opts = {
'dtype': 'float64'
};
y = uniform( 100, EPS, 100.0, opts );

bm.tic();
for ( i = 0; i < bm.iterations; i++ ) {
y = ( 100.0*randu() ) + EPS;
dist.b = y;
dist.b = y[ i % y.length ];
if ( dist.b !== y ) {
bm.fail( 'should return set value' );
}
Expand All @@ -159,20 +174,27 @@
bm.end();
});

bench( pkg+':kurtosis', function benchmark( bm ) {

Check warning on line 177 in lib/node_modules/@stdlib/stats/base/dists/kumaraswamy/ctor/benchmark/benchmark.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Use `@stdlib/string/format` instead of string concatenation for benchmark descriptions
var dist;
var opts;
var a;
var b;
var x;
var y;
var i;

a = 100.56789;
b = 55.54321;
dist = new Kumaraswamy( a, b );

opts = {
'dtype': 'float64'
};
x = uniform( 100, EPS, 100.0, opts );

bm.tic();
for ( i = 0; i < bm.iterations; i++ ) {
dist.a = ( 100.0*randu() ) + EPS;
dist.a = x[ i % x.length ];
y = dist.kurtosis;
if ( isnan( y ) ) {
bm.fail( 'should not return NaN' );
Expand All @@ -186,20 +208,27 @@
bm.end();
});

bench( pkg+':mean', function benchmark( bm ) {

Check warning on line 211 in lib/node_modules/@stdlib/stats/base/dists/kumaraswamy/ctor/benchmark/benchmark.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Use `@stdlib/string/format` instead of string concatenation for benchmark descriptions
var dist;
var opts;
var a;
var b;
var x;
var y;
var i;

a = 100.56789;
b = 55.54321;
dist = new Kumaraswamy( a, b );

opts = {
'dtype': 'float64'
};
x = uniform( 100, EPS, 100.0, opts );

bm.tic();
for ( i = 0; i < bm.iterations; i++ ) {
dist.a = ( 100.0*randu() ) + EPS;
dist.a = x[ i % x.length ];
y = dist.mean;
if ( isnan( y ) ) {
bm.fail( 'should not return NaN' );
Expand All @@ -213,20 +242,27 @@
bm.end();
});

bench( pkg+':mode', function benchmark( bm ) {

Check warning on line 245 in lib/node_modules/@stdlib/stats/base/dists/kumaraswamy/ctor/benchmark/benchmark.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Use `@stdlib/string/format` instead of string concatenation for benchmark descriptions
var dist;
var opts;
var a;
var b;
var x;
var y;
var i;

a = 100.56789;
b = 55.54321;
dist = new Kumaraswamy( a, b );

opts = {
'dtype': 'float64'
};
x = uniform( 100, EPS + 1.0, 100.0, opts );

bm.tic();
for ( i = 0; i < bm.iterations; i++ ) {
dist.a = ( 100.0*randu() ) + 1.0 + EPS;
dist.a = x[ i % x.length ];
y = dist.mode;
if ( isnan( y ) ) {
bm.fail( 'should not return NaN' );
Expand All @@ -240,20 +276,27 @@
bm.end();
});

bench( pkg+':skewness', function benchmark( bm ) {

Check warning on line 279 in lib/node_modules/@stdlib/stats/base/dists/kumaraswamy/ctor/benchmark/benchmark.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Use `@stdlib/string/format` instead of string concatenation for benchmark descriptions
var dist;
var opts;
var a;
var b;
var x;
var y;
var i;

a = 100.56789;
b = 55.54321;
dist = new Kumaraswamy( a, b );

opts = {
'dtype': 'float64'
};
x = uniform( 100, EPS, 100.0, opts );

bm.tic();
for ( i = 0; i < bm.iterations; i++ ) {
dist.a = ( 100.0*randu() ) + EPS;
dist.a = x[ i % x.length ];
y = dist.skewness;
if ( isnan( y ) ) {
bm.fail( 'should not return NaN' );
Expand All @@ -267,20 +310,27 @@
bm.end();
});

bench( pkg+':stdev', function benchmark( bm ) {

Check warning on line 313 in lib/node_modules/@stdlib/stats/base/dists/kumaraswamy/ctor/benchmark/benchmark.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Use `@stdlib/string/format` instead of string concatenation for benchmark descriptions
var dist;
var opts;
var a;
var b;
var x;
var y;
var i;

a = 100.56789;
b = 55.54321;
dist = new Kumaraswamy( a, b );

opts = {
'dtype': 'float64'
};
x = uniform( 100, EPS, 100.0, opts );

bm.tic();
for ( i = 0; i < bm.iterations; i++ ) {
dist.a = ( 100.0*randu() ) + EPS;
dist.a = x[ i % x.length ];
y = dist.stdev;
if ( isnan( y ) ) {
bm.fail( 'should not return NaN' );
Expand All @@ -296,18 +346,25 @@

bench( pkg+':variance', function benchmark( bm ) {
var dist;
var opts;
var a;
var b;
var x;
var y;
var i;

a = 100.56789;
b = 55.54321;
dist = new Kumaraswamy( a, b );

opts = {
'dtype': 'float64'
};
x = uniform( 100, EPS, 100.0, opts );

bm.tic();
for ( i = 0; i < bm.iterations; i++ ) {
dist.a = ( 100.0*randu() ) + EPS;
dist.a = x[ i % x.length ];
y = dist.variance;
if ( isnan( y ) ) {
bm.fail( 'should not return NaN' );
Expand All @@ -323,6 +380,7 @@

bench( pkg+':cdf', function benchmark( bm ) {
var dist;
var opts;
var a;
var b;
var x;
Expand All @@ -333,10 +391,14 @@
b = 55.54321;
dist = new Kumaraswamy( a, b );

opts = {
'dtype': 'float64'
};
x = uniform( 100, 0.0, 1.0, opts );

bm.tic();
for ( i = 0; i < bm.iterations; i++ ) {
x = randu();
y = dist.cdf( x );
y = dist.cdf( x[ i % x.length ] );
if ( isnan( y ) ) {
bm.fail( 'should not return NaN' );
}
Expand All @@ -351,6 +413,7 @@

bench( pkg+':logcdf', function benchmark( bm ) {
var dist;
var opts;
var a;
var b;
var x;
Expand All @@ -361,10 +424,14 @@
b = 55.54321;
dist = new Kumaraswamy( a, b );

opts = {
'dtype': 'float64'
};
x = uniform( 100, 0.0, 1.0, opts );

bm.tic();
for ( i = 0; i < bm.iterations; i++ ) {
x = randu();
y = dist.logcdf( x );
y = dist.logcdf( x[ i % x.length ] );
if ( isnan( y ) ) {
bm.fail( 'should not return NaN' );
}
Expand All @@ -379,6 +446,7 @@

bench( pkg+':logpdf', function benchmark( bm ) {
var dist;
var opts;
var a;
var b;
var x;
Expand All @@ -389,10 +457,14 @@
b = 55.54321;
dist = new Kumaraswamy( a, b );

opts = {
'dtype': 'float64'
};
x = uniform( 100, 0.0, 1.0, opts );

bm.tic();
for ( i = 0; i < bm.iterations; i++ ) {
x = randu();
y = dist.logpdf( x );
y = dist.logpdf( x[ i % x.length ] );
if ( isnan( y ) ) {
bm.fail( 'should not return NaN' );
}
Expand All @@ -407,6 +479,7 @@

bench( pkg+':pdf', function benchmark( bm ) {
var dist;
var opts;
var a;
var b;
var x;
Expand All @@ -417,10 +490,14 @@
b = 55.54321;
dist = new Kumaraswamy( a, b );

opts = {
'dtype': 'float64'
};
x = uniform( 100, 0.0, 1.0, opts );

bm.tic();
for ( i = 0; i < bm.iterations; i++ ) {
x = randu();
y = dist.pdf( x );
y = dist.pdf( x[ i % x.length ] );
if ( isnan( y ) ) {
bm.fail( 'should not return NaN' );
}
Expand All @@ -435,6 +512,7 @@

bench( pkg+':quantile', function benchmark( bm ) {
var dist;
var opts;
var a;
var b;
var x;
Expand All @@ -445,10 +523,14 @@
b = 55.54321;
dist = new Kumaraswamy( a, b );

opts = {
'dtype': 'float64'
};
x = uniform( 100, 0.0, 1.0, opts );

bm.tic();
for ( i = 0; i < bm.iterations; i++ ) {
x = randu();
y = dist.quantile( x );
y = dist.quantile( x[ i % x.length ] );
if ( isnan( y ) ) {
bm.fail( 'should not return NaN' );
}
Expand Down
Loading