Skip to content

Commit 0a4ea24

Browse files
committed
applied changes
1 parent b2820b1 commit 0a4ea24

File tree

2 files changed

+33
-28
lines changed

2 files changed

+33
-28
lines changed

lib/node_modules/@stdlib/stats/base/dists/logistic/ctor/benchmark/benchmark.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ bench( pkg+'::instantiation', function benchmark( bm ) {
4848

4949
bm.tic();
5050
for ( i = 0; i < bm.iterations; i++ ) {
51-
dist = new Beta( mu[ i % len ], s[ i % len ] );
51+
dist = new Logistic( mu[ i % len ], s[ i % len ] );
5252
if ( !( dist instanceof Logistic ) ) {
5353
bm.fail( 'should return a distribution instance' );
5454
}
@@ -484,6 +484,7 @@ bench( pkg+':cdf', function benchmark( bm ) {
484484

485485
bench( pkg+':logcdf', function benchmark( bm ) {
486486
var dist;
487+
var len;
487488
var mu;
488489
var s;
489490
var x;
@@ -493,11 +494,15 @@ bench( pkg+':logcdf', function benchmark( bm ) {
493494
mu = 1.0;
494495
s = 2.0;
495496
dist = new Logistic( mu, s );
497+
len = 100;
498+
x = new Float64Array(len);
499+
for (i = 0; i < len; i++) {
500+
x[ i ] = uniform( 0.0, 1.0 );
501+
}
496502

497503
bm.tic();
498504
for ( i = 0; i < bm.iterations; i++ ) {
499-
x = ( randu()*6.0 ) - 3.0;
500-
y = dist.logcdf( x );
505+
y = dist.logcdf( x[ i % len ] );
501506
if ( isnan( y ) ) {
502507
bm.fail( 'should not return NaN' );
503508
}

lib/node_modules/@stdlib/stats/base/dists/logistic/mgf/benchmark/benchmark.js

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -32,36 +32,36 @@ var mgf = require( './../lib' );
3232
// MAIN //
3333

3434
bench( pkg, function benchmark( b ) {
35-
var mu;
36-
var s;
37-
var len;
38-
var t;
39-
var y;
40-
var i;
35+
var mu;
36+
var s;
37+
var len;
38+
var t;
39+
var y;
40+
var i;
4141

4242
len = 100;
4343
t = new Float64Array( len );
4444
mu = new Float64Array( len );
4545
s = new Float64Array( len );
4646
for ( i = 0; i < len; i++ ) {
47-
s[i] = uniform( 0.1, 0.5 );
48-
t[i] = uniform( 0.0, 0.9 );
49-
mu[i] = uniform( -1.0, 1.0 );
50-
}
47+
s[i] = uniform( 0.1, 0.5 );
48+
t[i] = uniform( 0.0, 0.9 );
49+
mu[i] = uniform( -1.0, 1.0 );
50+
}
5151

52-
b.tic();
53-
for ( i = 0; i < b.iterations; i++ ) {
54-
y = mgf( t[ i % len ], mu[ i % len ], s[ i % len ] );
55-
if ( isnan( y ) ) {
56-
b.fail( 'should not return NaN' );
57-
}
58-
}
59-
b.toc();
60-
if ( isnan( y ) ) {
61-
b.fail( 'should not return NaN' );
62-
}
63-
b.pass( 'benchmark finished' );
64-
b.end();
52+
b.tic();
53+
for ( i = 0; i < b.iterations; i++ ) {
54+
y = mgf( t[ i % len ], mu[ i % len ], s[ i % len ] );
55+
if ( isnan( y ) ) {
56+
b.fail( 'should not return NaN' );
57+
}
58+
}
59+
b.toc();
60+
if ( isnan( y ) ) {
61+
b.fail( 'should not return NaN' );
62+
}
63+
b.pass( 'benchmark finished' );
64+
b.end();
6565
});
6666

6767
bench( pkg+':factory', function benchmark( b ) {
@@ -76,11 +76,11 @@ bench( pkg+':factory', function benchmark( b ) {
7676
mu = 0.0;
7777
s = 0.5; // Small s value
7878
mymgf = mgf.factory( mu, s );
79-
79+
8080
len = 100;
8181
t = new Float64Array( len );
8282
for ( i = 0; i < len; i++ ) {
83-
t[ i ] = uniform( 0.0, 0.9 );
83+
t[ i ] = uniform( 0.0, 0.9 );
8484
}
8585

8686
b.tic();

0 commit comments

Comments
 (0)