Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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,8 +21,8 @@
// MODULES //

var bench = require( '@stdlib/bench' );
var Float64Array = require( '@stdlib/array/float64' );
var uniform = require( '@stdlib/random/array/uniform' );
var uniform = require( '@stdlib/random/base/uniform' );

Check failure on line 25 in lib/node_modules/@stdlib/stats/base/dists/planck/median/benchmark/benchmark.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

uniform is already defined
Copy link
Member

@Neerajpathak07 Neerajpathak07 Feb 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
var uniform = require( '@stdlib/random/base/uniform' );

this should be removed as per the original implementation you will only be needing @stdlib/random/array/uniform.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@anandkaranubc what's your take on this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. The latter one needs to be removed since it is no longer in use. Thanks for pointing that out!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is lint error in line no 39 , 42

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I believe clicking on the details should provide an overview for it.

var isnan = require( '@stdlib/math/base/assert/is-nan' );
var pkg = require( './../package.json' ).name;
var median = require( './../lib' );
Expand All @@ -37,7 +37,7 @@
var i;

len =100;
lambda = new Float64Array( len );

Check failure on line 40 in lib/node_modules/@stdlib/stats/base/dists/planck/median/benchmark/benchmark.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Float64Array is used without loading it beforehand via require()
for ( i = 0; i < len; i++ ) {
lambda[ i ] = uniform( 1.0, 10.0);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,9 @@ bench( pkg+'::native', opts, function benchmark( b ) {
var i;

len = 100;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here as well!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll also want to remove

var uniform = require( '@stdlib/random/base/uniform' );

and add

var uniform = require( '@stdlib/random/array/uniform' );

lambda = new Float64Array( len );
for ( i = 0; i < len; i++ ) {
lambda[ i ] = uniform( 1.0, 10.0 );
}

lambda = uniform(len, 0.1, 10.0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
lambda = uniform(len, 0.1, 10.0);
lambda = uniform( 100, 0.1, 10.0 );

as per the suggested changes the var len should be removed as the original implementation worked just fine.
Could you pls do the same for the benchmark.js file as well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just adding on to it, once the len variable is removed, the initialization of y in the benchmark loop will be updated to:

y = median( lambda[ i % lambda.length ] );

Basically, everything that was done in the original PR, as Neeraj already pointed out.



b.tic();
for ( i = 0; i < b.iterations; i++ ) {
Expand Down
Loading