-
-
Notifications
You must be signed in to change notification settings - Fork 911
fix: revert uniform implementation and remove unnecessary loop #5314
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
d40face
51f1262
a9c0b31
4e770ca
01c8685
e1aab4e
d70146b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -21,8 +21,7 @@ | |||||
// MODULES // | ||||||
|
||||||
var bench = require( '@stdlib/bench' ); | ||||||
var Float64Array = require( '@stdlib/array/float64' ); | ||||||
var uniform = require( '@stdlib/random/base/uniform' ); | ||||||
var uniform = require( '@stdlib/random/array/uniform' ); | ||||||
var isnan = require( '@stdlib/math/base/assert/is-nan' ); | ||||||
var pkg = require( './../package.json' ).name; | ||||||
var median = require( './../lib' ); | ||||||
|
@@ -38,13 +37,12 @@ bench( pkg, function benchmark( b ) { | |||||
|
||||||
len =100; | ||||||
lambda = new Float64Array( len ); | ||||||
for ( i = 0; i < len; i++ ) { | ||||||
lambda[ i ] = uniform( 1.0, 10.0); | ||||||
} | ||||||
|
||||||
|
please remove this extra line.
Same for the native file.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lambda = uniform(100, 1.0, 10.0); | |
lambda = uniform( 100, 0.1, 10.0 ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need the same change for the native
version as well.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,14 +46,13 @@ bench( pkg+'::native', opts, function benchmark( b ) { | |
var i; | ||
|
||
len = 100; | ||
|
||
lambda = new Float64Array( len ); | ||
for ( i = 0; i < len; i++ ) { | ||
lambda[ i ] = uniform( 1.0, 10.0 ); | ||
} | ||
|
||
lambda = uniform(100, 0.1, 10.0); | ||
|
||
|
||
b.tic(); | ||
for ( i = 0; i < b.iterations; i++ ) { | ||
y = median( lambda[ i % len ] ); | ||
y = median( lambda[ i % lambda.length ] ); | ||
if ( isnan( y ) ) { | ||
b.fail( 'should not return NaN' ); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
won't be needing the
Float64Array
module so better to remove it