Skip to content

Commit 96ef13e

Browse files
committed
chore: minor clean-up
1 parent a59b804 commit 96ef13e

6 files changed

Lines changed: 29 additions & 14 deletions

File tree

lib/node_modules/@stdlib/stats/base/dists/wald/mode/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,14 @@ int main( void ) {
232232

233233
<!-- /.c -->
234234

235+
<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
236+
237+
<section class="references">
238+
239+
</section>
240+
241+
<!-- /.references -->
242+
235243
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
236244

237245
<section class="related">

lib/node_modules/@stdlib/stats/base/dists/wald/mode/benchmark/benchmark.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,20 @@ var mode = require( './../lib' );
3232

3333
bench( pkg, function benchmark( b ) {
3434
var lambda;
35-
var len;
35+
var opts;
3636
var mu;
3737
var y;
3838
var i;
3939

40-
len = 100;
41-
mu = uniform( len, EPS, 100.0 );
42-
lambda = uniform( len, EPS, 20.0 );
40+
opts = {
41+
'dtype': 'float64'
42+
};
43+
mu = uniform( 100, EPS, 100.0, opts );
44+
lambda = uniform( 100, EPS, 20.0, opts );
4345

4446
b.tic();
4547
for ( i = 0; i < b.iterations; i++ ) {
46-
y = mode( mu[ i%len ], lambda[ i%len ] );
48+
y = mode( mu[ i % mu.length ], lambda[ i % lambda.length ] );
4749
if ( isnan( y ) ) {
4850
b.fail( 'should not return NaN' );
4951
}

lib/node_modules/@stdlib/stats/base/dists/wald/mode/benchmark/benchmark.native.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,21 @@ var opts = {
4141
// MAIN //
4242

4343
bench( format( '%s::native', pkg ), opts, function benchmark( b ) {
44+
var arrayOpts;
4445
var lambda;
45-
var len;
4646
var mu;
4747
var y;
4848
var i;
4949

50-
len = 100;
51-
mu = uniform( len, EPS, 100.0 );
52-
lambda = uniform( len, EPS, 20.0 );
50+
arrayOpts = {
51+
'dtype': 'float64'
52+
};
53+
mu = uniform( 100, EPS, 100.0, arrayOpts );
54+
lambda = uniform( 100, EPS, 20.0, arrayOpts );
5355

5456
b.tic();
5557
for ( i = 0; i < b.iterations; i++ ) {
56-
y = mode( mu[ i%len ], lambda[ i%len ] );
58+
y = mode( mu[ i % mu.length ], lambda[ i % lambda.length ] );
5759
if ( isnan( y ) ) {
5860
b.fail( 'should not return NaN' );
5961
}

lib/node_modules/@stdlib/stats/base/dists/wald/mode/lib/main.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ function mode( mu, lambda ) {
5858
if (
5959
isnan( mu ) ||
6060
isnan( lambda ) ||
61-
lambda <= 0.0 ||
62-
mu <= 0.0
61+
mu <= 0.0 ||
62+
lambda <= 0.0
6363
) {
6464
return NaN;
6565
}

lib/node_modules/@stdlib/stats/base/dists/wald/mode/src/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ double stdlib_base_dists_wald_mode( const double mu, const double lambda ) {
3636
if (
3737
stdlib_base_is_nan( mu ) ||
3838
stdlib_base_is_nan( lambda ) ||
39-
lambda <= 0.0 ||
40-
mu <= 0.0
39+
mu <= 0.0 ||
40+
lambda <= 0.0
4141
) {
4242
return 0.0/0.0; // NaN
4343
}

lib/node_modules/@stdlib/stats/base/dists/wald/mode/test/test.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ tape( 'if provided a nonpositive `lambda`, the function returns `NaN`', function
9090
y = mode( PINF, NINF );
9191
t.strictEqual( isnan( y ), true, 'returns expected value' );
9292

93+
y = mode( PINF, 0.0 );
94+
t.strictEqual( isnan( y ), true, 'returns expected value' );
95+
9396
y = mode( NINF, NINF );
9497
t.strictEqual( isnan( y ), true, 'returns expected value' );
9598

0 commit comments

Comments
 (0)