From fffb21dad7cc94bb4842dbd0b2d098b6a0568dca Mon Sep 17 00:00:00 2001 From: saurabhraghuvanshii Date: Thu, 27 Feb 2025 00:24:20 +0530 Subject: [PATCH 1/4] bench: refactor random generation --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: passed - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: passed - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../math/base/special/binet/benchmark/benchmark.js | 8 ++++---- .../special/binet/benchmark/benchmark.native.js | 8 ++++---- .../math/base/special/binet/benchmark/c/benchmark.c | 10 +++++++--- .../special/binet/benchmark/c/native/benchmark.c | 9 ++++++--- .../@stdlib/math/base/special/binet/test/test.js | 6 +++--- .../binomcoef/benchmark/c/native/benchmark.c | 13 ++++++++----- .../math/base/special/binomcoef/test/test.js | 8 ++++---- .../math/base/special/boxcox/benchmark/benchmark.js | 11 +++++++---- .../special/boxcox/benchmark/benchmark.native.js | 11 +++++++---- .../special/boxcox/benchmark/c/native/benchmark.c | 13 ++++++++----- .../@stdlib/math/base/special/boxcox/test/test.js | 8 ++++---- .../math/base/special/boxcox/test/test.native.js | 8 ++++---- .../base/special/boxcox1p/benchmark/benchmark.js | 11 +++++++---- .../special/boxcox1p/benchmark/benchmark.native.js | 11 +++++++---- .../special/boxcox1p/benchmark/c/native/benchmark.c | 13 ++++++++----- .../@stdlib/math/base/special/boxcox1p/test/test.js | 8 ++++---- .../math/base/special/boxcox1p/test/test.native.js | 8 ++++---- .../base/special/boxcox1pinv/benchmark/benchmark.js | 11 +++++++---- .../boxcox1pinv/benchmark/benchmark.native.js | 11 +++++++---- .../boxcox1pinv/benchmark/c/native/benchmark.c | 13 ++++++++----- .../math/base/special/boxcox1pinv/test/test.js | 10 +++++----- .../base/special/boxcox1pinv/test/test.native.js | 10 +++++----- .../base/special/boxcoxinv/benchmark/benchmark.js | 11 +++++++---- .../special/boxcoxinv/benchmark/benchmark.native.js | 11 +++++++---- .../boxcoxinv/benchmark/c/native/benchmark.c | 13 ++++++++----- .../math/base/special/boxcoxinv/test/test.js | 10 +++++----- .../math/base/special/boxcoxinv/test/test.native.js | 10 +++++----- 27 files changed, 160 insertions(+), 114 deletions(-) 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..747e4c0a7ade 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.0, 79.0 ); + 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..ca7ead184a9c 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.0, 79.0 ); + 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..9ce8f02ec6b9 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..7b09b987b81a 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..606b0216919e 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 when provided a NaN' ); 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/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..c52a2e194433 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' ); @@ -34,12 +34,15 @@ bench( pkg, function benchmark( b ) { var y; var r; var i; + var j; + + x = uniform( 100, 1.0, 11.0 ); + y = uniform( x.length, 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 ); + j = i % x.length; + r = boxcox( x[ j ], y[ j ] ); 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..161f3cdf685e 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; @@ -43,12 +43,15 @@ bench( pkg+'::native', opts, function benchmark( b ) { var y; var r; var i; + var j; + + x = uniform( 100, 1.0, 11.0 ); + y = uniform( x.length, 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 ); + j = i % x.length; + r = boxcox( x[ j ], y[ j ] ); 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..ac90d6b9bae2 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' ); @@ -34,12 +34,15 @@ bench( pkg, function benchmark( b ) { var y; var r; var i; + var j; + + x = uniform( 100, 0.0, 10.0 ); + y = uniform( x.length, 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 ); + j = i % x.length; + r = boxcox1p( x[ j ], y[ j ] ); 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..f4e828516445 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; @@ -43,12 +43,15 @@ bench( pkg+'::native', opts, function benchmark( b ) { var y; var r; var i; + var j; + + x = uniform( 100, 0.0, 10.0 ); + y = uniform( x.length, 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 ); + j = i % x.length; + r = boxcox1p( x[ j ], y[ j ] ); 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..af013c1a9709 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..d0fd4c0366c3 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' ); @@ -34,12 +34,15 @@ bench( pkg, function benchmark( b ) { var y; var r; var i; + var j; + + x = uniform( 100, 0.0, 10.0 ); + y = uniform( x.length, 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 ); + j = i % x.length; + r = boxcox1pinv( x[ j ], y[ j ]); 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..a46f4bf4bbb6 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; @@ -43,12 +43,15 @@ bench( pkg+'::native', opts, function benchmark( b ) { var y; var r; var i; + var j; + + x = uniform( 100, 0.0, 10.0 ); + y = uniform( x.length, 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 ); + j = i % x.length; + r = boxcox1pinv( x[ j ], y[ j ]); 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..d9b951459828 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..86c15e9f2786 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' ); @@ -34,12 +34,15 @@ bench( pkg, function benchmark( b ) { var y; var r; var i; + var j; + + x = uniform( 100, 0.0, 10.0 ); + y = uniform( x.length, 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 ); + j = i % x.length; + r = boxcoxinv( x[ j ], y[ j ] ); 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..1b65abf02ef1 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; @@ -43,12 +43,15 @@ bench( pkg+'::native', opts, function benchmark( b ) { var y; var r; var i; + var j; + + x = uniform( 100, 0.0, 10.0 ); + y = uniform( x.length, 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 ); + j = i % x.length; + r = boxcoxinv( x[ j ], y[ j ] ); 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(); }); From acadf4b92fe9c15e7893cc58a075af749f195ba0 Mon Sep 17 00:00:00 2001 From: saurabhraghuvanshii Date: Sat, 1 Mar 2025 22:32:50 +0530 Subject: [PATCH 2/4] chore: updates values --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: passed - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: passed - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: failed --- --- .../math/base/special/binet/benchmark/benchmark.js | 2 +- .../math/base/special/binet/benchmark/benchmark.native.js | 2 +- .../math/base/special/binet/benchmark/c/benchmark.c | 2 +- .../base/special/binet/benchmark/c/native/benchmark.c | 2 +- .../@stdlib/math/base/special/binet/test/test.js | 2 +- .../math/base/special/boxcox/benchmark/benchmark.js | 8 +++----- .../base/special/boxcox/benchmark/benchmark.native.js | 8 +++----- .../math/base/special/boxcox1p/benchmark/benchmark.js | 8 +++----- .../base/special/boxcox1p/benchmark/benchmark.native.js | 8 +++----- .../base/special/boxcox1p/benchmark/c/native/benchmark.c | 4 ++-- .../math/base/special/boxcox1pinv/benchmark/benchmark.js | 8 +++----- .../special/boxcox1pinv/benchmark/benchmark.native.js | 8 +++----- .../special/boxcox1pinv/benchmark/c/native/benchmark.c | 4 ++-- .../math/base/special/boxcoxinv/benchmark/benchmark.js | 8 +++----- .../base/special/boxcoxinv/benchmark/benchmark.native.js | 8 +++----- 15 files changed, 33 insertions(+), 49 deletions(-) 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 747e4c0a7ade..68636bd80eba 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 @@ -34,7 +34,7 @@ bench( pkg, function benchmark( b ) { var y; var i; - x = discreteUniform( 100, 0.0, 79.0 ); + x = discreteUniform( 100, 0, 79 ); b.tic(); for ( i = 0; i < b.iterations; i++ ) { 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 ca7ead184a9c..68823479b5dc 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 @@ -43,7 +43,7 @@ bench( pkg+'::native', opts, function benchmark( b ) { var y; var i; - x = discreteUniform( 100, 0.0, 79.0 ); + x = discreteUniform( 100, 0, 79 ); b.tic(); for ( i = 0; i < b.iterations; i++ ) { 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 9ce8f02ec6b9..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 @@ -112,7 +112,7 @@ static double benchmark( void ) { t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - y = stdlib_base_binet( x[ i % 100 ] ); + 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 7b09b987b81a..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 @@ -102,7 +102,7 @@ static double benchmark( void ) { t = tic(); for ( i = 0; i < ITERATIONS; i++ ) { - y = stdlib_base_binet( x[ i % 100 ] ); + 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 606b0216919e..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,7 +41,7 @@ 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 expected value when provided a NaN' ); + t.strictEqual( isnan( v ), true, 'returns expected value' ); 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 c52a2e194433..f0920aff91f2 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 @@ -34,15 +34,13 @@ bench( pkg, function benchmark( b ) { var y; var r; var i; - var j; - x = uniform( 100, 1.0, 11.0 ); - y = uniform( x.length, 1.0, 11.0 ); + x = uniform( 100, 1, 11 ); + y = uniform( 100, 1, 11 ); b.tic(); for ( i = 0; i < b.iterations; i++ ) { - j = i % x.length; - r = boxcox( x[ j ], y[ j ] ); + 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 161f3cdf685e..d20c2e4f50ad 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 @@ -43,15 +43,13 @@ bench( pkg+'::native', opts, function benchmark( b ) { var y; var r; var i; - var j; - x = uniform( 100, 1.0, 11.0 ); - y = uniform( x.length, 1.0, 11.0 ); + x = uniform( 100, 1, 11 ); + y = uniform( 100, 1, 11 ); b.tic(); for ( i = 0; i < b.iterations; i++ ) { - j = i % x.length; - r = boxcox( x[ j ], y[ j ] ); + 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/boxcox1p/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/boxcox1p/benchmark/benchmark.js index ac90d6b9bae2..b19ab0d234f4 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 @@ -34,15 +34,13 @@ bench( pkg, function benchmark( b ) { var y; var r; var i; - var j; - x = uniform( 100, 0.0, 10.0 ); - y = uniform( x.length, 0.0, 10.0 ); + x = uniform( 100, 0, 10 ); + y = uniform( 100, 0, 10 ); b.tic(); for ( i = 0; i < b.iterations; i++ ) { - j = i % x.length; - r = boxcox1p( x[ j ], y[ j ] ); + 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 f4e828516445..11c3c1ba77ad 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 @@ -43,15 +43,13 @@ bench( pkg+'::native', opts, function benchmark( b ) { var y; var r; var i; - var j; - x = uniform( 100, 0.0, 10.0 ); - y = uniform( x.length, 0.0, 10.0 ); + x = uniform( 100, 0, 10 ); + y = uniform( 100, 0, 10 ); b.tic(); for ( i = 0; i < b.iterations; i++ ) { - j = i % x.length; - r = boxcox1p( x[ j ], y[ j ] ); + 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 af013c1a9709..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 @@ -98,8 +98,8 @@ static double benchmark( void ) { int i; for ( i = 0; i < 100; i++ ) { - x[ i ] = ( rand_double() * 10.0 ); - y[ i ] = ( rand_double() * 10.0 ); + x[ i ] = rand_double() * 10.0; + y[ i ] = rand_double() * 10.0; } t = tic(); 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 d0fd4c0366c3..ca377a210134 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 @@ -34,15 +34,13 @@ bench( pkg, function benchmark( b ) { var y; var r; var i; - var j; - x = uniform( 100, 0.0, 10.0 ); - y = uniform( x.length, 0.0, 10.0 ); + x = uniform( 100, 0, 10 ); + y = uniform( 100, 0, 10 ); b.tic(); for ( i = 0; i < b.iterations; i++ ) { - j = i % x.length; - r = boxcox1pinv( x[ j ], y[ j ]); + 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 a46f4bf4bbb6..5749083f51bf 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 @@ -43,15 +43,13 @@ bench( pkg+'::native', opts, function benchmark( b ) { var y; var r; var i; - var j; - x = uniform( 100, 0.0, 10.0 ); - y = uniform( x.length, 0.0, 10.0 ); + x = uniform( 100, 0, 10 ); + y = uniform( 100, 0, 10 ); b.tic(); for ( i = 0; i < b.iterations; i++ ) { - j = i % x.length; - r = boxcox1pinv( x[ j ], y[ j ]); + 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 d9b951459828..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 @@ -98,8 +98,8 @@ static double benchmark( void ) { int i; for ( i = 0; i < 100; i++ ) { - x[ i ] = ( rand_double() * 10.0 ); - y[ i ] = ( rand_double() * 10.0 ); + x[ i ] = rand_double() * 10.0; + y[ i ] = rand_double() * 10.0; } t = tic(); 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 86c15e9f2786..464afb7cb97d 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 @@ -34,15 +34,13 @@ bench( pkg, function benchmark( b ) { var y; var r; var i; - var j; - x = uniform( 100, 0.0, 10.0 ); - y = uniform( x.length, 0.0, 10.0 ); + x = uniform( 100, 0, 10 ); + y = uniform( 100, 0, 10 ); b.tic(); for ( i = 0; i < b.iterations; i++ ) { - j = i % x.length; - r = boxcoxinv( x[ j ], y[ j ] ); + 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 1b65abf02ef1..30e9fd1943b5 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 @@ -43,15 +43,13 @@ bench( pkg+'::native', opts, function benchmark( b ) { var y; var r; var i; - var j; - x = uniform( 100, 0.0, 10.0 ); - y = uniform( x.length, 0.0, 10.0 ); + x = uniform( 100, 0, 10 ); + y = uniform( 100, 0, 10 ); b.tic(); for ( i = 0; i < b.iterations; i++ ) { - j = i % x.length; - r = boxcoxinv( x[ j ], y[ j ] ); + r = boxcoxinv( x[ i%x.length ], y[ i%y.length ] ); if ( isnan( r ) ) { b.fail( 'should not return NaN' ); } From 03eea81746690c10bd2ca2744b47219ea935c3f4 Mon Sep 17 00:00:00 2001 From: saurabhraghuvanshii Date: Mon, 3 Mar 2025 00:21:49 +0530 Subject: [PATCH 3/4] chore: update values --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: passed - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/math/base/special/binet/benchmark/benchmark.js | 2 +- .../math/base/special/binet/benchmark/benchmark.native.js | 2 +- .../math/base/special/binomcoef/benchmark/benchmark.js | 6 ++---- .../base/special/binomcoef/benchmark/benchmark.native.js | 6 ++---- .../math/base/special/boxcox1p/benchmark/benchmark.js | 4 ++-- .../base/special/boxcox1p/benchmark/benchmark.native.js | 4 ++-- .../math/base/special/boxcox1pinv/benchmark/benchmark.js | 4 ++-- .../base/special/boxcox1pinv/benchmark/benchmark.native.js | 4 ++-- .../math/base/special/boxcoxinv/benchmark/benchmark.js | 4 ++-- .../base/special/boxcoxinv/benchmark/benchmark.native.js | 4 ++-- 10 files changed, 18 insertions(+), 22 deletions(-) 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 68636bd80eba..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 @@ -38,7 +38,7 @@ bench( pkg, function benchmark( b ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - y = binet( x[ i % x.length ] ); + 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 68823479b5dc..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 @@ -47,7 +47,7 @@ bench( pkg+'::native', opts, function benchmark( b ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - y = binet( x[ i % x.length ] ); + 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/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/boxcox1p/benchmark/benchmark.js b/lib/node_modules/@stdlib/math/base/special/boxcox1p/benchmark/benchmark.js index b19ab0d234f4..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 @@ -35,8 +35,8 @@ bench( pkg, function benchmark( b ) { var r; var i; - x = uniform( 100, 0, 10 ); - y = uniform( 100, 0, 10 ); + x = uniform( 100, 0.0, 10.0 ); + y = uniform( 100, 0.0, 10.0 ); b.tic(); for ( i = 0; i < b.iterations; i++ ) { 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 11c3c1ba77ad..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 @@ -44,8 +44,8 @@ bench( pkg+'::native', opts, function benchmark( b ) { var r; var i; - x = uniform( 100, 0, 10 ); - y = uniform( 100, 0, 10 ); + x = uniform( 100, 0.0, 10.0 ); + y = uniform( 100, 0.0, 10.0 ); b.tic(); for ( i = 0; i < b.iterations; i++ ) { 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 ca377a210134..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 @@ -35,8 +35,8 @@ bench( pkg, function benchmark( b ) { var r; var i; - x = uniform( 100, 0, 10 ); - y = uniform( 100, 0, 10 ); + x = uniform( 100, 0.0, 10.0 ); + y = uniform( 100, 0.0, 10.0 ); b.tic(); for ( i = 0; i < b.iterations; i++ ) { 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 5749083f51bf..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 @@ -44,8 +44,8 @@ bench( pkg+'::native', opts, function benchmark( b ) { var r; var i; - x = uniform( 100, 0, 10 ); - y = uniform( 100, 0, 10 ); + x = uniform( 100, 0.0, 10.0 ); + y = uniform( 100, 0.0, 10.0 ); b.tic(); for ( i = 0; i < b.iterations; i++ ) { 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 464afb7cb97d..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 @@ -35,8 +35,8 @@ bench( pkg, function benchmark( b ) { var r; var i; - x = uniform( 100, 0, 10 ); - y = uniform( 100, 0, 10 ); + x = uniform( 100, 0.0, 10.0 ); + y = uniform( 100, 0.0, 10.0 ); b.tic(); for ( i = 0; i < b.iterations; i++ ) { 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 30e9fd1943b5..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 @@ -44,8 +44,8 @@ bench( pkg+'::native', opts, function benchmark( b ) { var r; var i; - x = uniform( 100, 0, 10 ); - y = uniform( 100, 0, 10 ); + x = uniform( 100, 0.0, 10.0 ); + y = uniform( 100, 0.0, 10.0 ); b.tic(); for ( i = 0; i < b.iterations; i++ ) { From 2cff239519bf0a248e3cfb416cf396cb86241778 Mon Sep 17 00:00:00 2001 From: saurabhraghuvanshii Date: Tue, 4 Mar 2025 22:14:57 +0530 Subject: [PATCH 4/4] chore: improve precision --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: passed - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/math/base/special/boxcox/benchmark/benchmark.js | 4 ++-- .../math/base/special/boxcox/benchmark/benchmark.native.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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 f0920aff91f2..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 @@ -35,8 +35,8 @@ bench( pkg, function benchmark( b ) { var r; var i; - x = uniform( 100, 1, 11 ); - y = uniform( 100, 1, 11 ); + x = uniform( 100, 1.0, 11.0 ); + y = uniform( 100, 1.0, 11.0 ); b.tic(); for ( i = 0; i < b.iterations; i++ ) { 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 d20c2e4f50ad..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 @@ -44,8 +44,8 @@ bench( pkg+'::native', opts, function benchmark( b ) { var r; var i; - x = uniform( 100, 1, 11 ); - y = uniform( 100, 1, 11 ); + x = uniform( 100, 1.0, 11.0 ); + y = uniform( 100, 1.0, 11.0 ); b.tic(); for ( i = 0; i < b.iterations; i++ ) {