diff --git a/lib/node_modules/@stdlib/math/base/special/binet/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/binet/benchmark/benchmark.js index 00754796f643..5dfda482fef5 100644 --- a/lib/node_modules/@stdlib/math/base/special/binet/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/binet/benchmark/benchmark.js @@ -21,8 +21,7 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); -var floor = require( '@stdlib/math/base/special/floor' ); +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var pkg = require( './../package.json' ).name; var binet = require( './../lib' ); @@ -35,10 +34,11 @@ bench( pkg, function benchmark( b ) { var y; var i; + x = discreteUniform( 100, 0, 79 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = floor( randu()*79.0 ); - y = binet( x ); + y = binet( x[ i%x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/binet/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/binet/benchmark/benchmark.native.js index 103f5ac4464f..0d98b9afa942 100644 --- a/lib/node_modules/@stdlib/math/base/special/binet/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/binet/benchmark/benchmark.native.js @@ -22,8 +22,7 @@ var resolve = require( 'path' ).resolve; var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); -var floor = require( '@stdlib/math/base/special/floor' ); +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var tryRequire = require( '@stdlib/utils/try-require' ); var pkg = require( './../package.json' ).name; @@ -44,10 +43,11 @@ bench( pkg+'::native', opts, function benchmark( b ) { var y; var i; + x = discreteUniform( 100, 0, 79 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = floor( randu() * 79.0 ); - y = binet( x ); + y = binet( x[ i%x.length ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/binet/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/math/base/special/binet/benchmark/c/benchmark.c index 5fad8b33b13a..b86cc7628650 100644 --- a/lib/node_modules/@stdlib/math/base/special/binet/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/binet/benchmark/c/benchmark.c @@ -16,6 +16,7 @@ * limitations under the License. */ +#include "stdlib/math/base/special/binet.h" #include #include #include @@ -99,16 +100,19 @@ double binet( double x ) { * @return elapsed time in seconds */ static double benchmark( void ) { + double x[ 100 ]; double elapsed; double t; - double x; double y; int i; + for ( i = 0; i < 100; i++ ) { + x[ i ] = floor( 79.0*rand_double() ); + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = floor( 79.0*rand_double() ); - y = binet( x ); + y = stdlib_base_binet( x[ i%100 ] ); if ( y < 0 ) { printf( "should return a nonnegative number\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/binet/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/binet/benchmark/c/native/benchmark.c index 61ddfcf5ecbe..8f2e01a8dd0a 100644 --- a/lib/node_modules/@stdlib/math/base/special/binet/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/binet/benchmark/c/native/benchmark.c @@ -90,16 +90,19 @@ static double rand_double( void ) { * @return elapsed time in seconds */ static double benchmark( void ) { + double x[ 100 ]; double elapsed; - double x; double y; double t; int i; + for ( i = 0; i < 100; i++ ) { + x[ i ] = floor( 79.0*rand_double() ); + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = floor( 79.0 * rand_double() ); - y = stdlib_base_binet( x ); + y = stdlib_base_binet( x[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/binet/test/test.js b/lib/node_modules/@stdlib/math/base/special/binet/test/test.js index d7bc378f7255..f020a5bf9097 100644 --- a/lib/node_modules/@stdlib/math/base/special/binet/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/binet/test/test.js @@ -41,19 +41,19 @@ tape( 'main export is a function', function test( t ) { tape( 'if provided `NaN`, the function returns `NaN`', function test( t ) { var v = binet( NaN ); - t.strictEqual( isnan( v ), true, 'returns NaN when provided a NaN' ); + t.strictEqual( isnan( v ), true, 'returns expected value' ); t.end(); }); tape( 'if provided `+infinity`, the function returns `NaN`', function test( t ) { var v = binet( PINF ); - t.strictEqual( isnan( v ), true, 'returns NaN' ); + t.strictEqual( isnan( v ), true, 'returns expected value' ); t.end(); }); tape( 'if provided `-infinity`, the function returns `NaN`', function test( t ) { var v = binet( NINF ); - t.strictEqual( isnan( v ), true, 'returns NaN' ); + t.strictEqual( isnan( v ), true, 'returns expected value' ); t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/binomcoef/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/binomcoef/benchmark/benchmark.js index c57fefa90192..483943949e99 100644 --- a/lib/node_modules/@stdlib/math/base/special/binomcoef/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/binomcoef/benchmark/benchmark.js @@ -34,15 +34,13 @@ bench( pkg, function benchmark( b ) { var y; var z; var i; - var j; x = discreteUniform( 100, 20, 70 ); - y = discreteUniform( x.length, 0, 20 ); + y = discreteUniform( 100, 0, 20 ); b.tic(); for ( i = 0; i < b.iterations; i++ ) { - j = i % x.length; - z = binomcoef( x[ j ], y[ j ] ); + z = binomcoef( x[ i%x.length ], y[ i%y.length ] ); if ( isnan( z ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/binomcoef/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/binomcoef/benchmark/benchmark.native.js index bd7f92526494..020a10f66d1b 100644 --- a/lib/node_modules/@stdlib/math/base/special/binomcoef/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/binomcoef/benchmark/benchmark.native.js @@ -43,15 +43,13 @@ bench( pkg+'::native', opts, function benchmark( b ) { var y; var z; var i; - var j; x = discreteUniform( 100, 20, 70 ); - y = discreteUniform( x.length, 0, 20 ); + y = discreteUniform( 100, 0, 20 ); b.tic(); for ( i = 0; i < b.iterations; i++ ) { - j = i % x.length; - z = binomcoef( x[ j ], y[ j ] ); + z = binomcoef( x[ i%x.length ], y[ i%y.length ] ); if ( isnan( z ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/binomcoef/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/binomcoef/benchmark/c/native/benchmark.c index 96d1831ef01a..549dea957044 100644 --- a/lib/node_modules/@stdlib/math/base/special/binomcoef/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/binomcoef/benchmark/c/native/benchmark.c @@ -90,18 +90,21 @@ static double rand_double( void ) { * @return elapsed time in seconds */ static double benchmark( void ) { + int64_t n[ 100 ]; + int64_t k[ 100 ]; double elapsed; - int64_t n; - int64_t k; double y; double t; int i; + for ( i = 0; i < 100; i++ ) { + n[ i ] = (int64_t)round( 500.0 * rand_double() ); + k[ i ] = (int64_t)round( 500.0 * rand_double() ); + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - n = (int64_t)round( 500.0 * rand_double() ); - k = (int64_t)round( 500.0 * rand_double() ); - y = stdlib_base_binomcoef( n, k ); + y = stdlib_base_binomcoef( n[ i%100 ], k[ i%100 ] ); if ( y != y ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/binomcoef/test/test.js b/lib/node_modules/@stdlib/math/base/special/binomcoef/test/test.js index 66f4cabc3eaf..466622199d75 100644 --- a/lib/node_modules/@stdlib/math/base/special/binomcoef/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/binomcoef/test/test.js @@ -43,10 +43,10 @@ tape( 'main export is a function', function test( t ) { tape( 'the function returns `NaN` if provided `NaN` for any parameter', function test( t ) { var v = binomcoef( 3, NaN ); - t.strictEqual( isnan( v ), true, 'returns NaN' ); + t.strictEqual( isnan( v ), true, 'returns expected value' ); v = binomcoef( NaN, 2 ); - t.strictEqual( isnan( v ), true, 'returns NaN' ); + t.strictEqual( isnan( v ), true, 'returns expected value' ); t.end(); }); @@ -101,7 +101,7 @@ tape( 'the function returns `NaN` if the `n` value is not an integer', function ]; for ( i = 0; i < values.length; i++ ) { - t.strictEqual( isnan( binomcoef( values[i], 2 ) ), true, 'returns NaN when provided '+values[i] ); + t.strictEqual( isnan( binomcoef( values[i], 2 ) ), true, 'returns expected value when provided '+values[i] ); } t.end(); }); @@ -122,7 +122,7 @@ tape( 'the function returns `NaN` if the `k` value is not an integer', function ]; for ( i = 0; i < values.length; i++ ) { - t.strictEqual( isnan( binomcoef( 2, values[i] ) ), true, 'returns NaN when provided '+values[i] ); + t.strictEqual( isnan( binomcoef( 2, values[i] ) ), true, 'returns expected value when provided '+values[i] ); } t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/boxcox/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/boxcox/benchmark/benchmark.js index 646cf82b2d5e..2d5f6a6ecc48 100644 --- a/lib/node_modules/@stdlib/math/base/special/boxcox/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/boxcox/benchmark/benchmark.js @@ -21,7 +21,7 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); +var uniform = require( '@stdlib/random/array/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var pkg = require( './../package.json' ).name; var boxcox = require( './../lib' ); @@ -35,11 +35,12 @@ bench( pkg, function benchmark( b ) { var r; var i; + x = uniform( 100, 1.0, 11.0 ); + y = uniform( 100, 1.0, 11.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*10.0 ) + 1.0; - y = ( randu()*10.0 ) + 1.0; - r = boxcox( x, y ); + r = boxcox( x[ i%x.length ], y[ i%y.length ] ); if ( isnan( r ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/boxcox/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/boxcox/benchmark/benchmark.native.js index 76864b545343..db5801037035 100644 --- a/lib/node_modules/@stdlib/math/base/special/boxcox/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/boxcox/benchmark/benchmark.native.js @@ -22,7 +22,7 @@ var resolve = require( 'path' ).resolve; var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); +var uniform = require( '@stdlib/random/array/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var tryRequire = require( '@stdlib/utils/try-require' ); var pkg = require( './../package.json' ).name; @@ -44,11 +44,12 @@ bench( pkg+'::native', opts, function benchmark( b ) { var r; var i; + x = uniform( 100, 1.0, 11.0 ); + y = uniform( 100, 1.0, 11.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu() * 10.0 ) + 1.0; - y = ( randu() * 10.0 ) + 1.0; - r = boxcox( x, y ); + r = boxcox( x[ i%x.length ], y[ i%y.length ] ); if ( isnan( r ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/boxcox/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/boxcox/benchmark/c/native/benchmark.c index 26f0877f8aa0..31f0570eebbc 100644 --- a/lib/node_modules/@stdlib/math/base/special/boxcox/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/boxcox/benchmark/c/native/benchmark.c @@ -90,18 +90,21 @@ static double rand_double( void ) { * @return elapsed time in seconds */ static double benchmark( void ) { + double x[ 100 ]; + double y[ 100 ]; double elapsed; - double x; - double y; double r; double t; int i; + for ( i = 0; i < 100; i++ ) { + x[ i ] = ( rand_double() * 10.0 ) + 1.0; + y[ i ] = ( rand_double() * 10.0 ) + 1.0; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( ( rand_double() * 10.0 ) + 1.0 ); - y = ( ( rand_double() * 10.0 ) + 1.0 ); - r = stdlib_base_boxcox( x, y ); + r = stdlib_base_boxcox( x[ i%100 ], y[ i%100 ] ); if ( r != r ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/boxcox/test/test.js b/lib/node_modules/@stdlib/math/base/special/boxcox/test/test.js index 296413da88db..191b6c830c48 100644 --- a/lib/node_modules/@stdlib/math/base/special/boxcox/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/boxcox/test/test.js @@ -49,13 +49,13 @@ tape( 'the function returns `NaN` if provided `NaN`', function test( t ) { var b; b = boxcox( NaN, 1.0 ); - t.equal( isnan( b ), true, 'returns NaN' ); + t.equal( isnan( b ), true, 'returns expected value' ); b = boxcox( 1.0, NaN ); - t.equal( isnan( b ), true, 'returns NaN' ); + t.equal( isnan( b ), true, 'returns expected value' ); b = boxcox( NaN, NaN ); - t.equal( isnan( b ), true, 'returns NaN' ); + t.equal( isnan( b ), true, 'returns expected value' ); t.end(); }); @@ -87,7 +87,7 @@ tape( 'the function returns `NaN` if `x` is negative', function test( t ) { x = -1.0 * ( (randu()*100.0) + 1.0 ); y = randu() * 10.0; b = boxcox( x, y ); - t.equal( isnan( b ), true, 'returns NaN' ); + t.equal( isnan( b ), true, 'returns expected value' ); } t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/boxcox/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/boxcox/test/test.native.js index 21331670e081..913b781c671e 100644 --- a/lib/node_modules/@stdlib/math/base/special/boxcox/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/boxcox/test/test.native.js @@ -58,13 +58,13 @@ tape( 'the function returns `NaN` if provided `NaN`', opts, function test( t ) { var b; b = boxcox( NaN, 1.0 ); - t.equal( isnan( b ), true, 'returns NaN' ); + t.equal( isnan( b ), true, 'returns expected value' ); b = boxcox( 1.0, NaN ); - t.equal( isnan( b ), true, 'returns NaN' ); + t.equal( isnan( b ), true, 'returns expected value' ); b = boxcox( NaN, NaN ); - t.equal( isnan( b ), true, 'returns NaN' ); + t.equal( isnan( b ), true, 'returns expected value' ); t.end(); }); @@ -96,7 +96,7 @@ tape( 'the function returns `NaN` if `x` is negative', opts, function test( t ) x = -1.0 * ( (randu()*100.0) + 1.0 ); y = randu() * 10.0; b = boxcox( x, y ); - t.equal( isnan( b ), true, 'returns NaN' ); + t.equal( isnan( b ), true, 'returns expected value' ); } t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/boxcox1p/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/boxcox1p/benchmark/benchmark.js index 4c9271111651..9ddbd040b493 100644 --- a/lib/node_modules/@stdlib/math/base/special/boxcox1p/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/boxcox1p/benchmark/benchmark.js @@ -21,7 +21,7 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); +var uniform = require( '@stdlib/random/array/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var pkg = require( './../package.json' ).name; var boxcox1p = require( './../lib' ); @@ -35,11 +35,12 @@ bench( pkg, function benchmark( b ) { var r; var i; + x = uniform( 100, 0.0, 10.0 ); + y = uniform( 100, 0.0, 10.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = randu() * 10.0; - y = randu() * 10.0; - r = boxcox1p( x, y ); + r = boxcox1p( x[ i%x.length ], y[ i%y.length ] ); if ( isnan( r ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/boxcox1p/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/boxcox1p/benchmark/benchmark.native.js index dccfa9d487bd..4329c7a41269 100644 --- a/lib/node_modules/@stdlib/math/base/special/boxcox1p/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/boxcox1p/benchmark/benchmark.native.js @@ -22,7 +22,7 @@ var resolve = require( 'path' ).resolve; var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); +var uniform = require( '@stdlib/random/array/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var tryRequire = require( '@stdlib/utils/try-require' ); var pkg = require( './../package.json' ).name; @@ -44,11 +44,12 @@ bench( pkg+'::native', opts, function benchmark( b ) { var r; var i; + x = uniform( 100, 0.0, 10.0 ); + y = uniform( 100, 0.0, 10.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = randu() * 10.0; - y = randu() * 10.0; - r = boxcox1p( x, y ); + r = boxcox1p( x[ i%x.length ], y[ i%y.length ] ); if ( isnan( r ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/boxcox1p/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/boxcox1p/benchmark/c/native/benchmark.c index 508c4e5dc667..e9482e3367e7 100644 --- a/lib/node_modules/@stdlib/math/base/special/boxcox1p/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/boxcox1p/benchmark/c/native/benchmark.c @@ -90,18 +90,21 @@ static double rand_double( void ) { * @return elapsed time in seconds */ static double benchmark( void ) { + double x[ 100 ]; + double y[ 100 ]; double elapsed; - double x; - double y; double r; double t; int i; + for ( i = 0; i < 100; i++ ) { + x[ i ] = rand_double() * 10.0; + y[ i ] = rand_double() * 10.0; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( ( rand_double() * 10.0 ) ); - y = ( ( rand_double() * 10.0 ) ); - r = stdlib_base_boxcox1p( x, y ); + r = stdlib_base_boxcox1p( x[ i%100 ], y[ i%100 ] ); if ( r != r ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/boxcox1p/test/test.js b/lib/node_modules/@stdlib/math/base/special/boxcox1p/test/test.js index 0b9307ea9311..9a9b23124a4c 100644 --- a/lib/node_modules/@stdlib/math/base/special/boxcox1p/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/boxcox1p/test/test.js @@ -51,13 +51,13 @@ tape( 'the function returns `NaN` if provided `NaN`', function test( t ) { var b; b = boxcox1p( NaN, 1.0 ); - t.equal( isnan( b ), true, 'returns NaN' ); + t.equal( isnan( b ), true, 'returns expected value' ); b = boxcox1p( 1.0, NaN ); - t.equal( isnan( b ), true, 'returns NaN' ); + t.equal( isnan( b ), true, 'returns expected value' ); b = boxcox1p( NaN, NaN ); - t.equal( isnan( b ), true, 'returns NaN' ); + t.equal( isnan( b ), true, 'returns expected value' ); t.end(); }); @@ -85,7 +85,7 @@ tape( 'the function returns `NaN` if `x` is less than negative one', function te x = -1.0 * ( (randu()*100.0) + 1.0 + EPS ); y = randu() * 10.0; b = boxcox1p( x, y ); - t.equal( isnan( b ), true, 'returns NaN' ); + t.equal( isnan( b ), true, 'returns expected value' ); } t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/boxcox1p/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/boxcox1p/test/test.native.js index 31f934263a96..8d28784924c2 100644 --- a/lib/node_modules/@stdlib/math/base/special/boxcox1p/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/boxcox1p/test/test.native.js @@ -60,13 +60,13 @@ tape( 'the function returns `NaN` if provided `NaN`', opts, function test( t ) { var b; b = boxcox1p( NaN, 1.0 ); - t.equal( isnan( b ), true, 'returns NaN' ); + t.equal( isnan( b ), true, 'returns expected value' ); b = boxcox1p( 1.0, NaN ); - t.equal( isnan( b ), true, 'returns NaN' ); + t.equal( isnan( b ), true, 'returns expected value' ); b = boxcox1p( NaN, NaN ); - t.equal( isnan( b ), true, 'returns NaN' ); + t.equal( isnan( b ), true, 'returns expected value' ); t.end(); }); @@ -94,7 +94,7 @@ tape( 'the function returns `NaN` if `x` is less than negative one', opts, funct x = -1.0 * ( ( randu() * 100.0 ) + 1.0 + EPS ); y = randu() * 10.0; b = boxcox1p( x, y ); - t.equal( isnan( b ), true, 'returns NaN' ); + t.equal( isnan( b ), true, 'returns expected value' ); } t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/boxcox1pinv/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/boxcox1pinv/benchmark/benchmark.js index 8d4224e14afb..1f5c40ad9b53 100644 --- a/lib/node_modules/@stdlib/math/base/special/boxcox1pinv/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/boxcox1pinv/benchmark/benchmark.js @@ -21,7 +21,7 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); +var uniform = require( '@stdlib/random/array/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var pkg = require( './../package.json' ).name; var boxcox1pinv = require( './../lib' ); @@ -35,11 +35,12 @@ bench( pkg, function benchmark( b ) { var r; var i; + x = uniform( 100, 0.0, 10.0 ); + y = uniform( 100, 0.0, 10.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = randu() * 10.0; - y = randu() * 10.0; - r = boxcox1pinv( x, y ); + r = boxcox1pinv( x[ i%x.length ], y[ i%y.length ] ); if ( isnan( r ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/boxcox1pinv/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/boxcox1pinv/benchmark/benchmark.native.js index 78bdb834afce..5714ca70d2a5 100644 --- a/lib/node_modules/@stdlib/math/base/special/boxcox1pinv/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/boxcox1pinv/benchmark/benchmark.native.js @@ -22,7 +22,7 @@ var resolve = require( 'path' ).resolve; var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); +var uniform = require( '@stdlib/random/array/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var tryRequire = require( '@stdlib/utils/try-require' ); var pkg = require( './../package.json' ).name; @@ -44,11 +44,12 @@ bench( pkg+'::native', opts, function benchmark( b ) { var r; var i; + x = uniform( 100, 0.0, 10.0 ); + y = uniform( 100, 0.0, 10.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = randu() * 10.0; - y = randu() * 10.0; - r = boxcox1pinv( x, y ); + r = boxcox1pinv( x[ i%x.length ], y[ i%y.length ] ); if ( isnan( r ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/boxcox1pinv/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/boxcox1pinv/benchmark/c/native/benchmark.c index eedbcfabfbc4..7bef7430d23e 100644 --- a/lib/node_modules/@stdlib/math/base/special/boxcox1pinv/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/boxcox1pinv/benchmark/c/native/benchmark.c @@ -90,18 +90,21 @@ static double rand_double( void ) { * @return elapsed time in seconds */ static double benchmark( void ) { + double x[ 100 ]; + double y[ 100 ]; double elapsed; - double x; - double y; double r; double t; int i; + for ( i = 0; i < 100; i++ ) { + x[ i ] = rand_double() * 10.0; + y[ i ] = rand_double() * 10.0; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = ( ( rand_double() * 10.0 ) ); - y = ( ( rand_double() * 10.0 ) ); - r = stdlib_base_boxcox1pinv( x, y ); + r = stdlib_base_boxcox1pinv( x[ i%100 ], y[ i%100 ] ); if ( r != r ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/boxcox1pinv/test/test.js b/lib/node_modules/@stdlib/math/base/special/boxcox1pinv/test/test.js index ffa20f3e9cf6..3cf31a86b275 100644 --- a/lib/node_modules/@stdlib/math/base/special/boxcox1pinv/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/boxcox1pinv/test/test.js @@ -51,13 +51,13 @@ tape( 'the function returns `NaN` if provided `NaN`', function test( t ) { var b; b = boxcox1pinv( NaN, 1.0 ); - t.equal( isnan( b ), true, 'returns NaN' ); + t.equal( isnan( b ), true, 'returns expected value' ); b = boxcox1pinv( 1.0, NaN ); - t.equal( isnan( b ), true, 'returns NaN' ); + t.equal( isnan( b ), true, 'returns expected value' ); b = boxcox1pinv( NaN, NaN ); - t.equal( isnan( b ), true, 'returns NaN' ); + t.equal( isnan( b ), true, 'returns expected value' ); t.end(); }); @@ -72,7 +72,7 @@ tape( 'the function returns `NaN` if `x` is negative and `lambda` is positive (f x = -1.0 * ( ( randu()*100.0 ) + 1.0 + EPS ); y = i + 1.0; b = boxcox1pinv( x, y ); - t.equal( isnan( b ), true, 'returns NaN' ); + t.equal( isnan( b ), true, 'returns expected value' ); } t.end(); }); @@ -87,7 +87,7 @@ tape( 'the function returns `NaN` if `x` is positive and `lambda` is negative (f x = ( randu()*100.0 ) + 1.0 + EPS; y = -1.0 * ( i + 1.0 ); b = boxcox1pinv( x, y ); - t.equal( isnan( b ), true, 'returns NaN' ); + t.equal( isnan( b ), true, 'returns expected value' ); } t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/boxcox1pinv/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/boxcox1pinv/test/test.native.js index 3cfafba1e689..3482bb51d9af 100644 --- a/lib/node_modules/@stdlib/math/base/special/boxcox1pinv/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/boxcox1pinv/test/test.native.js @@ -60,13 +60,13 @@ tape( 'the function returns `NaN` if provided `NaN`', opts, function test( t ) { var b; b = boxcox1pinv( NaN, 1.0 ); - t.equal( isnan( b ), true, 'returns NaN' ); + t.equal( isnan( b ), true, 'returns expected value' ); b = boxcox1pinv( 1.0, NaN ); - t.equal( isnan( b ), true, 'returns NaN' ); + t.equal( isnan( b ), true, 'returns expected value' ); b = boxcox1pinv( NaN, NaN ); - t.equal( isnan( b ), true, 'returns NaN' ); + t.equal( isnan( b ), true, 'returns expected value' ); t.end(); }); @@ -81,7 +81,7 @@ tape( 'the function returns `NaN` if `x` is negative and `lambda` is positive (f x = -1.0 * ( ( randu()*100.0 ) + 1.0 + EPS ); y = i + 1.0; b = boxcox1pinv( x, y ); - t.equal( isnan( b ), true, 'returns NaN' ); + t.equal( isnan( b ), true, 'returns expected value' ); } t.end(); }); @@ -96,7 +96,7 @@ tape( 'the function returns `NaN` if `x` is positive and `lambda` is negative (f x = ( randu()*100.0 ) + 1.0 + EPS; y = -1.0 * ( i + 1.0 ); b = boxcox1pinv( x, y ); - t.equal( isnan( b ), true, 'returns NaN' ); + t.equal( isnan( b ), true, 'returns expected value' ); } t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/boxcoxinv/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/boxcoxinv/benchmark/benchmark.js index 90088c0260ef..a340bf7136e2 100644 --- a/lib/node_modules/@stdlib/math/base/special/boxcoxinv/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/math/base/special/boxcoxinv/benchmark/benchmark.js @@ -21,7 +21,7 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); +var uniform = require( '@stdlib/random/array/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var pkg = require( './../package.json' ).name; var boxcoxinv = require( './../lib' ); @@ -35,11 +35,12 @@ bench( pkg, function benchmark( b ) { var r; var i; + x = uniform( 100, 0.0, 10.0 ); + y = uniform( 100, 0.0, 10.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = randu() * 10.0; - y = randu() * 10.0; - r = boxcoxinv( x, y ); + r = boxcoxinv( x[ i%x.length ], y[ i%y.length ] ); if ( isnan( r ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/boxcoxinv/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/math/base/special/boxcoxinv/benchmark/benchmark.native.js index d78591913de8..18826c033160 100644 --- a/lib/node_modules/@stdlib/math/base/special/boxcoxinv/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/math/base/special/boxcoxinv/benchmark/benchmark.native.js @@ -22,7 +22,7 @@ var resolve = require( 'path' ).resolve; var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); +var uniform = require( '@stdlib/random/array/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var tryRequire = require( '@stdlib/utils/try-require' ); var pkg = require( './../package.json' ).name; @@ -44,11 +44,12 @@ bench( pkg+'::native', opts, function benchmark( b ) { var r; var i; + x = uniform( 100, 0.0, 10.0 ); + y = uniform( 100, 0.0, 10.0 ); + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = randu() * 10.0; - y = randu() * 10.0; - r = boxcoxinv( x, y ); + r = boxcoxinv( x[ i%x.length ], y[ i%y.length ] ); if ( isnan( r ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/math/base/special/boxcoxinv/benchmark/c/native/benchmark.c b/lib/node_modules/@stdlib/math/base/special/boxcoxinv/benchmark/c/native/benchmark.c index ad4fdad52c68..1130ceaacefe 100644 --- a/lib/node_modules/@stdlib/math/base/special/boxcoxinv/benchmark/c/native/benchmark.c +++ b/lib/node_modules/@stdlib/math/base/special/boxcoxinv/benchmark/c/native/benchmark.c @@ -90,18 +90,21 @@ static double rand_double( void ) { * @return elapsed time in seconds */ static double benchmark( void ) { + double x[ 100 ]; + double y[ 100 ]; double elapsed; - double x; - double y; double r; double t; int i; + for ( i = 0; i < 100; i++ ) { + x[ i ] = rand_double() * 10.0; + y[ i ] = rand_double() * 10.0; + } + t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - x = rand_double() * 10.0; - y = rand_double() * 10.0; - r = stdlib_base_boxcoxinv( x, y ); + r = stdlib_base_boxcoxinv( x[ i%100 ], y[ i%100 ] ); if ( r != r ) { printf( "should not return NaN\n" ); break; diff --git a/lib/node_modules/@stdlib/math/base/special/boxcoxinv/test/test.js b/lib/node_modules/@stdlib/math/base/special/boxcoxinv/test/test.js index f5d2a603fa82..42b25061464b 100644 --- a/lib/node_modules/@stdlib/math/base/special/boxcoxinv/test/test.js +++ b/lib/node_modules/@stdlib/math/base/special/boxcoxinv/test/test.js @@ -50,13 +50,13 @@ tape( 'the function returns `NaN` if provided `NaN`', function test( t ) { var b; b = boxcoxinv( NaN, 1.0 ); - t.equal( isnan( b ), true, 'returns NaN' ); + t.equal( isnan( b ), true, 'returns expected value' ); b = boxcoxinv( 1.0, NaN ); - t.equal( isnan( b ), true, 'returns NaN' ); + t.equal( isnan( b ), true, 'returns expected value' ); b = boxcoxinv( NaN, NaN ); - t.equal( isnan( b ), true, 'returns NaN' ); + t.equal( isnan( b ), true, 'returns expected value' ); t.end(); }); @@ -71,7 +71,7 @@ tape( 'the function returns `NaN` if `x` is negative and `lambda` is greater tha x = -1.0 * ( ( randu()*100.0 ) + 1.0 ); y = i + 1.0; b = boxcoxinv( x, y ); - t.equal( isnan( b ), true, 'returns NaN' ); + t.equal( isnan( b ), true, 'returns expected value' ); } t.end(); }); @@ -86,7 +86,7 @@ tape( 'the function returns `NaN` if `x` is positive and `lambda` is less than n x = ( ( randu()*100.0 ) + 1.0 ); y = -1.0 * ( i+1.0 ); b = boxcoxinv( x, y ); - t.equal( isnan( b ), true, 'returns NaN' ); + t.equal( isnan( b ), true, 'returns expected value' ); } t.end(); }); diff --git a/lib/node_modules/@stdlib/math/base/special/boxcoxinv/test/test.native.js b/lib/node_modules/@stdlib/math/base/special/boxcoxinv/test/test.native.js index ada83bafe164..50e83d81c538 100644 --- a/lib/node_modules/@stdlib/math/base/special/boxcoxinv/test/test.native.js +++ b/lib/node_modules/@stdlib/math/base/special/boxcoxinv/test/test.native.js @@ -59,13 +59,13 @@ tape( 'the function returns `NaN` if provided `NaN`', opts, function test( t ) { var b; b = boxcoxinv( NaN, 1.0 ); - t.equal( isnan( b ), true, 'returns NaN' ); + t.equal( isnan( b ), true, 'returns expected value' ); b = boxcoxinv( 1.0, NaN ); - t.equal( isnan( b ), true, 'returns NaN' ); + t.equal( isnan( b ), true, 'returns expected value' ); b = boxcoxinv( NaN, NaN ); - t.equal( isnan( b ), true, 'returns NaN' ); + t.equal( isnan( b ), true, 'returns expected value' ); t.end(); }); @@ -80,7 +80,7 @@ tape( 'the function returns `NaN` if `x` is negative and `lambda` is greater tha x = -1.0 * ( ( randu()*100.0 ) + 1.0 ); y = i + 1.0; b = boxcoxinv( x, y ); - t.equal( isnan( b ), true, 'returns NaN' ); + t.equal( isnan( b ), true, 'returns expected value' ); } t.end(); }); @@ -95,7 +95,7 @@ tape( 'the function returns `NaN` if `x` is positive and `lambda` is less than n x = ( ( randu()*100.0 ) + 1.0 ); y = -1.0 * ( i+1.0 ); b = boxcoxinv( x, y ); - t.equal( isnan( b ), true, 'returns NaN' ); + t.equal( isnan( b ), true, 'returns expected value' ); } t.end(); });