Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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 @@ -32,16 +32,18 @@ var mode = require( './../lib' );

bench( pkg, function benchmark( b ) {
var sigma;
var len;
var opts;
var y;
var i;

len = 100;
sigma = uniform( len, EPS, 20.0 );
opts = {
'dtype': 'float64'
};
sigma = uniform( 100, EPS, 20.0, opts );

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
y = mode( sigma[ i % len ] );
y = mode( sigma[ i%sigma.length ] );
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ var bench = require( '@stdlib/bench' );
var uniform = require( '@stdlib/random/array/uniform' );
var isnan = require( '@stdlib/math/base/assert/is-nan' );
var tryRequire = require( '@stdlib/utils/try-require' );
var format = require( '@stdlib/string/format' );
var EPS = require( '@stdlib/constants/float64/eps' );
var pkg = require( './../package.json' ).name;

Expand All @@ -39,18 +40,20 @@ var opts = {

// MAIN //

bench( pkg+'::native', opts, function benchmark( b ) {
bench( format( '%s::native', pkg ), opts, function benchmark( b ) {
var sigma;
var len;
var opts;
var y;
var i;

len = 100;
sigma = uniform( len, EPS, 20.0 );
opts = {
'dtype': 'float64'
};
sigma = uniform( 100, EPS, 20.0, opts );

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
y = mode( sigma[ i % len ] );
y = mode( sigma[ i%sigma.length ] );
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
}
Expand Down