Skip to content

Commit 6f8590a

Browse files
committed
fix(logpdf): fix max-len and vars-order eslint violations in benchmark.js
1 parent d6a5567 commit 6f8590a

File tree

1 file changed

+8
-4
lines changed
  • lib/node_modules/@stdlib/stats/base/dists/lognormal/logpdf/benchmark

1 file changed

+8
-4
lines changed

lib/node_modules/@stdlib/stats/base/dists/lognormal/logpdf/benchmark/benchmark.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,11 @@ var logpdf = require( './../lib' );
3434
bench( pkg, function benchmark( b ) {
3535
var sigma;
3636
var opts;
37+
var len;
3738
var mu;
39+
var i;
3840
var x;
3941
var y;
40-
var i;
4142

4243
opts = {
4344
'dtype': 'float64'
@@ -46,9 +47,10 @@ bench( pkg, function benchmark( b ) {
4647
mu = uniform( 100, -50.0, 50.0, opts );
4748
sigma = uniform( 100, EPS, 20.0, opts );
4849

50+
len = x.length;
4951
b.tic();
5052
for ( i = 0; i < b.iterations; i++ ) {
51-
y = logpdf( x[ i % x.length ], mu[ i % mu.length ], sigma[ i % sigma.length ] );
53+
y = logpdf( x[ i % len ], mu[ i % len ], sigma[ i % len ] );
5254
if ( isnan( y ) ) {
5355
b.fail( 'should not return NaN' );
5456
}
@@ -65,10 +67,11 @@ bench( format( '%s:factory', pkg ), function benchmark( b ) {
6567
var mylogpdf;
6668
var sigma;
6769
var opts;
70+
var len;
6871
var mu;
72+
var i;
6973
var x;
7074
var y;
71-
var i;
7275

7376
mu = 10.0;
7477
sigma = 4.0;
@@ -79,9 +82,10 @@ bench( format( '%s:factory', pkg ), function benchmark( b ) {
7982
};
8083
x = uniform( 100, 0.0, 50.0, opts );
8184

85+
len = x.length;
8286
b.tic();
8387
for ( i = 0; i < b.iterations; i++ ) {
84-
y = mylogpdf( x[ i % x.length ] );
88+
y = mylogpdf( x[ i % len ] );
8589
if ( isnan( y ) ) {
8690
b.fail( 'should not return NaN' );
8791
}

0 commit comments

Comments
 (0)