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 @@ -30,13 +30,17 @@ var cdf = require( './../lib' );
// MAIN //

bench( pkg, function benchmark( b ) {
var opts;
var x;
var c;
var y;
var i;

x = uniform( 100, 0.0, 1.0 );
c = uniform( 100, 0.1, 10.0 );
opts = {
'dtype': 'float64'
};
x = uniform( 100, 0.0, 1.0, opts );
c = uniform( 100, 0.1, 10.0, opts );

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
Expand All @@ -55,11 +59,15 @@ bench( pkg, function benchmark( b ) {

bench( pkg+':factory', function benchmark( b ) {
var mycdf;
var opts;
var x;
var y;
var i;

x = uniform( 100, 0.0, 1.0 );
opts = {
'dtype': 'float64'
};
x = uniform( 100, 0.0, 1.0, opts );
mycdf = cdf.factory( 5.0 );

b.tic();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,16 @@ tape( 'if provided a number greater than or equal to one for `x` and a finite `c
var y;

y = cdf( PINF, 0.5 );
t.equal( y, 1.0, 'returns 1' );
t.equal( y, 1.0, 'returns expected value' );

y = cdf( 100.0, 0.5 );
t.equal( y, 1.0, 'returns 1' );
t.equal( y, 1.0, 'returns expected value' );

y = cdf( 10.0, 0.5 );
t.equal( y, 1.0, 'returns 1' );
t.equal( y, 1.0, 'returns expected value' );

y = cdf( 1.0, 0.5 );
t.equal( y, 1.0, 'returns 1' );
t.equal( y, 1.0, 'returns expected value' );

t.end();
});
Expand All @@ -93,16 +93,16 @@ tape( 'if provided a number less than or equal to zero for `x` and a finite `c`,
var y;

y = cdf( NINF, 0.5 );
t.equal( y, 0.0, 'returns 0' );
t.equal( y, 0.0, 'returns expected value' );

y = cdf( -100.0, 0.5 );
t.equal( y, 0.0, 'returns 0' );
t.equal( y, 0.0, 'returns expected value' );

y = cdf( -1.0, 0.5 );
t.equal( y, 0.0, 'returns 0' );
t.equal( y, 0.0, 'returns expected value' );

y = cdf( 0.0, 0.5 );
t.equal( y, 0.0, 'returns 0' );
t.equal( y, 0.0, 'returns expected value' );

t.end();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,16 @@ tape( 'if provided a finite `c`, the function returns a function which returns `

cdf = factory( 0.5 );
y = cdf( PINF );
t.equal( y, 1.0, 'returns 1' );
t.equal( y, 1.0, 'returns expected value' );

y = cdf( 100.0 );
t.equal( y, 1.0, 'returns 1' );
t.equal( y, 1.0, 'returns expected value' );

y = cdf( 10.0 );
t.equal( y, 1.0, 'returns 1' );
t.equal( y, 1.0, 'returns expected value' );

y = cdf( 1.0 );
t.equal( y, 1.0, 'returns 1' );
t.equal( y, 1.0, 'returns expected value' );

t.end();
});
Expand All @@ -112,19 +112,19 @@ tape( 'if provided a finite `c`, the function returns a function which returns `

cdf = factory( 0.5 );
y = cdf( NINF );
t.equal( y, 0.0, 'returns 0' );
t.equal( y, 0.0, 'returns expected value' );

y = cdf( -100.0 );
t.equal( y, 0.0, 'returns 0' );
t.equal( y, 0.0, 'returns expected value' );

y = cdf( -10.0 );
t.equal( y, 0.0, 'returns 0' );
t.equal( y, 0.0, 'returns expected value' );

y = cdf( -1.0 );
t.equal( y, 0.0, 'returns 0' );
t.equal( y, 0.0, 'returns expected value' );

y = cdf( 0.0 );
t.equal( y, 0.0, 'returns 0' );
t.equal( y, 0.0, 'returns expected value' );

t.end();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,15 @@ var entropy = require( './../lib' );
// MAIN //

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

c = uniform( 100, 0.1, 10.0 );
opts = {
'dtype': 'float64'
};
c = uniform( 100, 0.1, 10.0, opts );

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,15 @@ var mean = require( './../lib' );
// MAIN //

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

c = uniform( 100, 0.1, 10.0 );
opts = {
'dtype': 'float64'
};
c = uniform( 100, 0.1, 10.0, opts );

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,15 @@ var median = require( './../lib' );
// MAIN //

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

c = uniform( 100, 0.1, 10.0 );
opts = {
'dtype': 'float64'
};
c = uniform( 100, 0.1, 10.0, opts );

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,15 @@ var mode = require( './../lib' );
// MAIN //

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

c = uniform( 100, 0.1, 10.0 );
opts = {
'dtype': 'float64'
};
c = uniform( 100, 0.1, 10.0, opts );

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