From fcc7f0505e39e067559208e6f3f8f4522f06dafe Mon Sep 17 00:00:00 2001 From: saurabhraghuvanshii Date: Mon, 10 Feb 2025 15:04:19 +0530 Subject: [PATCH 1/9] bench: refractor random number generation in benchmark.js and native --- 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 --- --- .../dists/lognormal/entropy/benchmark/benchmark.js | 6 +++--- .../dists/lognormal/kurtosis/benchmark/benchmark.js | 6 +++--- .../dists/lognormal/logcdf/benchmark/benchmark.js | 10 +++++----- .../base/dists/lognormal/mean/benchmark/benchmark.js | 6 +++--- .../dists/lognormal/median/benchmark/benchmark.js | 6 +++--- .../base/dists/lognormal/mode/benchmark/benchmark.js | 6 +++--- .../base/dists/lognormal/pdf/benchmark/benchmark.js | 10 +++++----- .../dists/lognormal/quantile/benchmark/benchmark.js | 10 +++++----- .../dists/lognormal/skewness/benchmark/benchmark.js | 6 +++--- .../dists/lognormal/stdev/benchmark/benchmark.js | 6 +++--- .../dists/lognormal/variance/benchmark/benchmark.js | 6 +++--- .../lognormal/variance/benchmark/benchmark.native.js | 6 +++--- .../negative-binomial/cdf/benchmark/benchmark.js | 12 ++++++------ 13 files changed, 48 insertions(+), 48 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/lognormal/entropy/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/lognormal/entropy/benchmark/benchmark.js index 6cb50c34f1e6..483a1040c988 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/lognormal/entropy/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/stats/base/dists/lognormal/entropy/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/base/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var EPS = require( '@stdlib/constants/float64/eps' ); var pkg = require( './../package.json' ).name; @@ -38,8 +38,8 @@ bench( pkg, function benchmark( b ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - mu = ( randu()*100.0 ) - 50.0; - sigma = ( randu()*20.0 ) + EPS; + mu = uniform( -50.0, 50.0 ); + sigma = uniform( EPS, 20.0 ); y = entropy( mu, sigma ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); diff --git a/lib/node_modules/@stdlib/stats/base/dists/lognormal/kurtosis/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/lognormal/kurtosis/benchmark/benchmark.js index b3526149e651..50a8db0a14b5 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/lognormal/kurtosis/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/stats/base/dists/lognormal/kurtosis/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/base/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var EPS = require( '@stdlib/constants/float64/eps' ); var pkg = require( './../package.json' ).name; @@ -38,8 +38,8 @@ bench( pkg, function benchmark( b ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - mu = ( randu()*100.0 ) - 50.0; - sigma = ( randu()*20.0 ) + EPS; + mu = uniform( -50.0, 50.0 ); + sigma = uniform( EPS, 20.0 ); y = kurtosis( mu, sigma ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); diff --git a/lib/node_modules/@stdlib/stats/base/dists/lognormal/logcdf/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/lognormal/logcdf/benchmark/benchmark.js index 56ab2fc449c7..4b4611b2ed7e 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/lognormal/logcdf/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/stats/base/dists/lognormal/logcdf/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/base/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var EPS = require( '@stdlib/constants/float64/eps' ); var pkg = require( './../package.json' ).name; @@ -39,9 +39,9 @@ bench( pkg, function benchmark( b ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*200.0 ) - 100; - mu = ( randu()*100.0 ) - 50.0; - sigma = ( randu()*20.0 ) + EPS; + x = uniform( -100.0, 100.0 ); + mu = uniform( -50.0, 50.0 ); + sigma = uniform( EPS, 20.0 ); y = logcdf( x, mu, sigma ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); @@ -69,7 +69,7 @@ bench( pkg+':factory', function benchmark( b ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*6.0 ) - 3.0; + x = uniform( -3.0, 3.0 ); y = mylogcdf( x ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); diff --git a/lib/node_modules/@stdlib/stats/base/dists/lognormal/mean/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/lognormal/mean/benchmark/benchmark.js index ba35a34723d0..a8bb65e65a1f 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/lognormal/mean/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/stats/base/dists/lognormal/mean/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/base/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var EPS = require( '@stdlib/constants/float64/eps' ); var pkg = require( './../package.json' ).name; @@ -38,8 +38,8 @@ bench( pkg, function benchmark( b ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - mu = ( randu()*100.0 ) - 50.0; - sigma = ( randu()*20.0 ) + EPS; + mu = uniform( -50.0, 50.0 ); + sigma = uniform( EPS, 20.0 ); y = mean( mu, sigma ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); diff --git a/lib/node_modules/@stdlib/stats/base/dists/lognormal/median/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/lognormal/median/benchmark/benchmark.js index 55185ccb1fdf..970bf79b5c54 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/lognormal/median/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/stats/base/dists/lognormal/median/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/base/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var EPS = require( '@stdlib/constants/float64/eps' ); var pkg = require( './../package.json' ).name; @@ -38,8 +38,8 @@ bench( pkg, function benchmark( b ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - mu = ( randu()*100.0 ) - 50.0; - sigma = ( randu()*20.0 ) + EPS; + mu = uniform( -50.0, 50.0 ); + sigma = uniform( EPS, 20.0 ); y = median( mu, sigma ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); diff --git a/lib/node_modules/@stdlib/stats/base/dists/lognormal/mode/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/lognormal/mode/benchmark/benchmark.js index efbace495dac..f1cff7932b78 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/lognormal/mode/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/stats/base/dists/lognormal/mode/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/base/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var EPS = require( '@stdlib/constants/float64/eps' ); var pkg = require( './../package.json' ).name; @@ -38,8 +38,8 @@ bench( pkg, function benchmark( b ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - mu = ( randu()*100.0 ) - 50.0; - sigma = ( randu()*20.0 ) + EPS; + mu = uniform( -50.0, 50.0 ); + sigma = uniform( EPS, 20.0 ); y = mode( mu, sigma ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); diff --git a/lib/node_modules/@stdlib/stats/base/dists/lognormal/pdf/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/lognormal/pdf/benchmark/benchmark.js index 987b828bc85e..60bf3e20ef2d 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/lognormal/pdf/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/stats/base/dists/lognormal/pdf/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/base/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var EPS = require( '@stdlib/constants/float64/eps' ); var pkg = require( './../package.json' ).name; @@ -39,9 +39,9 @@ bench( pkg, function benchmark( b ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*100.0 ) - 100; - mu = ( randu()*100.0 ) - 50.0; - sigma = ( randu()*20.0 ) + EPS; + x = uniform( -100.0, 100.0 ); + mu = uniform( -50.0, 50.0 ); + sigma = uniform( EPS, 20.0 ); y = pdf( x, mu, sigma ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); @@ -69,7 +69,7 @@ bench( pkg+':factory', function benchmark( b ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = randu() * 50.0; + x = uniform( 0.0, 50.0 ); y = mypdf( x ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); diff --git a/lib/node_modules/@stdlib/stats/base/dists/lognormal/quantile/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/lognormal/quantile/benchmark/benchmark.js index 713118b9e9b9..797b96f57bd5 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/lognormal/quantile/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/stats/base/dists/lognormal/quantile/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/base/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var EPS = require( '@stdlib/constants/float64/eps' ); var pkg = require( './../package.json' ).name; @@ -39,9 +39,9 @@ bench( pkg, function benchmark( b ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - p = randu(); - mu = ( randu()*100.0 ) - 50.0; - sigma = ( randu()*20.0 ) + EPS; + p = uniform( 0.0, 1.0 ); + mu = uniform( -50.0, 50.0 ); + sigma = uniform( EPS, 20.0 ); y = quantile( p, mu, sigma ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); @@ -69,7 +69,7 @@ bench( pkg+':factory', function benchmark( b ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - p = randu(); + p = uniform( 0.0, 1.0 ); y = myquantile( p ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); diff --git a/lib/node_modules/@stdlib/stats/base/dists/lognormal/skewness/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/lognormal/skewness/benchmark/benchmark.js index c836ff5e0ee9..fd02f959f671 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/lognormal/skewness/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/stats/base/dists/lognormal/skewness/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/base/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var EPS = require( '@stdlib/constants/float64/eps' ); var pkg = require( './../package.json' ).name; @@ -38,8 +38,8 @@ bench( pkg, function benchmark( b ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - mu = ( randu()*100.0 ) - 50.0; - sigma = ( randu()*20.0 ) + EPS; + mu = uniform( -50.0, 50.0 ); + sigma = uniform( EPS, 20.0 ); y = skewness( mu, sigma ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); diff --git a/lib/node_modules/@stdlib/stats/base/dists/lognormal/stdev/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/lognormal/stdev/benchmark/benchmark.js index 94a323a94e12..1399d443f7f4 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/lognormal/stdev/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/stats/base/dists/lognormal/stdev/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/base/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var EPS = require( '@stdlib/constants/float64/eps' ); var pkg = require( './../package.json' ).name; @@ -38,8 +38,8 @@ bench( pkg, function benchmark( b ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - mu = ( randu()*100.0 ) - 50.0; - sigma = ( randu()*20.0 ) + EPS; + mu = uniform( -50.0, 50.0 ); + sigma = uniform( EPS, 20.0 ); y = stdev( mu, sigma ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); diff --git a/lib/node_modules/@stdlib/stats/base/dists/lognormal/variance/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/lognormal/variance/benchmark/benchmark.js index 56656c756a87..bcf71db48980 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/lognormal/variance/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/stats/base/dists/lognormal/variance/benchmark/benchmark.js @@ -22,7 +22,7 @@ var bench = require( '@stdlib/bench' ); var Float64Array = require( '@stdlib/array/float64' ); -var randu = require( '@stdlib/random/base/randu' ); +var uniform = require( '@stdlib/random/base/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var EPS = require( '@stdlib/constants/float64/eps' ); var pkg = require( './../package.json' ).name; @@ -42,8 +42,8 @@ bench( pkg, function benchmark( b ) { mu = new Float64Array( len ); sigma = new Float64Array( len ); for ( i = 0; i < len; i++ ) { - mu[ i ] = ( randu() * 100.0 ) - 50.0; - sigma[ i ] = ( randu() * 20.0 ) + EPS; + mu[ i ] = uniform( -50.0, 50.0 ); + sigma[ i ] = uniform( EPS, 20.0 ); } b.tic(); diff --git a/lib/node_modules/@stdlib/stats/base/dists/lognormal/variance/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/stats/base/dists/lognormal/variance/benchmark/benchmark.native.js index 8b8da55c5b4a..3304d4d222d0 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/lognormal/variance/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/lognormal/variance/benchmark/benchmark.native.js @@ -24,7 +24,7 @@ var resolve = require( 'path' ).resolve; var bench = require( '@stdlib/bench' ); var Float64Array = require( '@stdlib/array/float64' ); var tryRequire = require( '@stdlib/utils/try-require' ); -var randu = require( '@stdlib/random/base/randu' ); +var uniform = require( '@stdlib/random/base/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var EPS = require( '@stdlib/constants/float64/eps' ); var pkg = require( './../package.json' ).name; @@ -51,8 +51,8 @@ bench( pkg+'::native', opts, function benchmark( b ) { mu = new Float64Array( len ); sigma = new Float64Array( len ); for ( i = 0; i < len; i++ ) { - mu[ i ] = ( randu() * 100.0 ) - 50.0; - sigma[ i ] = ( randu() * 20.0 ) + EPS; + mu[ i ] = uniform( -50.0, 50.0 ); + sigma[ i ] = uniform( EPS, 20.0 ); } b.tic(); diff --git a/lib/node_modules/@stdlib/stats/base/dists/negative-binomial/cdf/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/negative-binomial/cdf/benchmark/benchmark.js index 00524bb73043..6ac852e3d15d 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/negative-binomial/cdf/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/stats/base/dists/negative-binomial/cdf/benchmark/benchmark.js @@ -21,8 +21,8 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var ceil = require( '@stdlib/math/base/special/ceil' ); -var randu = require( '@stdlib/random/base/randu' ); +var uniform = require( '@stdlib/random/base/uniform' ); +var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var EPS = require( '@stdlib/constants/float64/eps' ); var pkg = require( './../package.json' ).name; @@ -40,9 +40,9 @@ bench( pkg, function benchmark( b ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = randu()*100.0; - r = ceil( randu()*100.0 ); - p = ( randu()*1.0 ) + EPS; + x = uniform( 0.0, 100.0 ); + r = discreteUniform( 1, 100.0 ); + p = uniform( EPS, 1.0 ); y = cdf( x, r, p ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); @@ -70,7 +70,7 @@ bench( pkg+':factory', function benchmark( b ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*100 ); + x = uniform( 0.0, 100.0 ); y = mycdf( x ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); From 98a742dac46cc3f5c1f441cee48cd9b68b8e6e5e Mon Sep 17 00:00:00 2001 From: saurabhraghuvanshii Date: Mon, 10 Feb 2025 15:15:08 +0530 Subject: [PATCH 2/9] chore: remove a file negative-binomial --- 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: na - 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 --- --- 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: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: na - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na --- --- .../cdf/benchmark/benchmark.js | 85 ------------------- 1 file changed, 85 deletions(-) delete mode 100644 lib/node_modules/@stdlib/stats/base/dists/negative-binomial/cdf/benchmark/benchmark.js diff --git a/lib/node_modules/@stdlib/stats/base/dists/negative-binomial/cdf/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/negative-binomial/cdf/benchmark/benchmark.js deleted file mode 100644 index 6ac852e3d15d..000000000000 --- a/lib/node_modules/@stdlib/stats/base/dists/negative-binomial/cdf/benchmark/benchmark.js +++ /dev/null @@ -1,85 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var uniform = require( '@stdlib/random/base/uniform' ); -var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ); -var isnan = require( '@stdlib/math/base/assert/is-nan' ); -var EPS = require( '@stdlib/constants/float64/eps' ); -var pkg = require( './../package.json' ).name; -var cdf = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var r; - var p; - var x; - var y; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - x = uniform( 0.0, 100.0 ); - r = discreteUniform( 1, 100.0 ); - p = uniform( EPS, 1.0 ); - y = cdf( x, r, p ); - if ( isnan( y ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( y ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':factory', function benchmark( b ) { - var mycdf; - var r; - var p; - var x; - var y; - var i; - - r = 80; - p = 0.4; - mycdf = cdf.factory( r, p ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - x = uniform( 0.0, 100.0 ); - y = mycdf( x ); - if ( isnan( y ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( y ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); From f5dd32c67a1f036703e25404e13c14d629ea0e70 Mon Sep 17 00:00:00 2001 From: saurabhraghuvanshii Date: Mon, 10 Feb 2025 15:40:26 +0530 Subject: [PATCH 3/9] chore: refractor lognormal/cdf benchmark.js and restore negative-binomial --- 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 --- --- 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: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: passed - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na --- --- .../lognormal/cdf/benchmark/benchmark.js | 10 +-- .../cdf/benchmark/benchmark.js | 85 +++++++++++++++++++ 2 files changed, 90 insertions(+), 5 deletions(-) create mode 100644 lib/node_modules/@stdlib/stats/base/dists/negative-binomial/cdf/benchmark/benchmark.js diff --git a/lib/node_modules/@stdlib/stats/base/dists/lognormal/cdf/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/lognormal/cdf/benchmark/benchmark.js index af3968a88eb8..00cab6dd5bcb 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/lognormal/cdf/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/stats/base/dists/lognormal/cdf/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/base/uniform' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var EPS = require( '@stdlib/constants/float64/eps' ); var pkg = require( './../package.json' ).name; @@ -39,9 +39,9 @@ bench( pkg, function benchmark( b ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*100.0 ) - 100; - mu = ( randu()*100.0 ) - 50.0; - sigma = ( randu()*20.0 ) + EPS; + x = uniform( -100.0, 100.0 ); + mu = uniform( -50.0, 50.0 ); + sigma = uniform( EPS, 20.0 ); y = cdf( x, mu, sigma ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); @@ -69,7 +69,7 @@ bench( pkg+':factory', function benchmark( b ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = randu() * 50.0; + x = uniform( 0.0, 50.0 ); y = mycdf( x ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); diff --git a/lib/node_modules/@stdlib/stats/base/dists/negative-binomial/cdf/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/negative-binomial/cdf/benchmark/benchmark.js new file mode 100644 index 000000000000..6c1aecbd89d3 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/negative-binomial/cdf/benchmark/benchmark.js @@ -0,0 +1,85 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var ceil = require( '@stdlib/math/base/special/ceil' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var randu = require( '@stdlib/random/base/randu' ); +var EPS = require( '@stdlib/constants/float64/eps' ); +var pkg = require( './../package.json' ).name; +var cdf = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var r; + var p; + var x; + var y; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + x = randu()*100.0; + r = ceil( randu()*100.0 ); + p = ( randu()*1.0 ) + EPS; + y = cdf( x, r, p ); + if ( isnan( y ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); + +bench( pkg+':factory', function benchmark( b ) { + var mycdf; + var r; + var p; + var x; + var y; + var i; + + r = 80; + p = 0.4; + mycdf = cdf.factory( r, p ); + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + x = ( randu()*100 ); + y = mycdf( x ); + if ( isnan( y ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); From e347ae0c2fe48cc2e971b7fb00c9fa9239ec3021 Mon Sep 17 00:00:00 2001 From: saurabhraghuvanshii Date: Mon, 10 Feb 2025 15:54:35 +0530 Subject: [PATCH 4/9] Revert "chore: remove a file negative-binomial" This reverts commit 98a742dac46cc3f5c1f441cee48cd9b68b8e6e5e. --- 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: na - 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 --- --- .../cdf/benchmark/benchmark.js | 85 ------------------- 1 file changed, 85 deletions(-) delete mode 100644 lib/node_modules/@stdlib/stats/base/dists/negative-binomial/cdf/benchmark/benchmark.js diff --git a/lib/node_modules/@stdlib/stats/base/dists/negative-binomial/cdf/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/negative-binomial/cdf/benchmark/benchmark.js deleted file mode 100644 index 6c1aecbd89d3..000000000000 --- a/lib/node_modules/@stdlib/stats/base/dists/negative-binomial/cdf/benchmark/benchmark.js +++ /dev/null @@ -1,85 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var ceil = require( '@stdlib/math/base/special/ceil' ); -var isnan = require( '@stdlib/math/base/assert/is-nan' ); -var randu = require( '@stdlib/random/base/randu' ); -var EPS = require( '@stdlib/constants/float64/eps' ); -var pkg = require( './../package.json' ).name; -var cdf = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var r; - var p; - var x; - var y; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - x = randu()*100.0; - r = ceil( randu()*100.0 ); - p = ( randu()*1.0 ) + EPS; - y = cdf( x, r, p ); - if ( isnan( y ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( y ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':factory', function benchmark( b ) { - var mycdf; - var r; - var p; - var x; - var y; - var i; - - r = 80; - p = 0.4; - mycdf = cdf.factory( r, p ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*100 ); - y = mycdf( x ); - if ( isnan( y ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( y ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); From 11e626c063b31fe5802746cc8e10f13fc716d391 Mon Sep 17 00:00:00 2001 From: saurabhraghuvanshii Date: Mon, 10 Feb 2025 15:56:25 +0530 Subject: [PATCH 5/9] chore: updating files --- 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 --- --- .../cdf/benchmark/benchmark.js | 85 +++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 lib/node_modules/@stdlib/stats/base/dists/negative-binomial/cdf/benchmark/benchmark.js diff --git a/lib/node_modules/@stdlib/stats/base/dists/negative-binomial/cdf/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/negative-binomial/cdf/benchmark/benchmark.js new file mode 100644 index 000000000000..6c1aecbd89d3 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/negative-binomial/cdf/benchmark/benchmark.js @@ -0,0 +1,85 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var ceil = require( '@stdlib/math/base/special/ceil' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var randu = require( '@stdlib/random/base/randu' ); +var EPS = require( '@stdlib/constants/float64/eps' ); +var pkg = require( './../package.json' ).name; +var cdf = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var r; + var p; + var x; + var y; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + x = randu()*100.0; + r = ceil( randu()*100.0 ); + p = ( randu()*1.0 ) + EPS; + y = cdf( x, r, p ); + if ( isnan( y ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); + +bench( pkg+':factory', function benchmark( b ) { + var mycdf; + var r; + var p; + var x; + var y; + var i; + + r = 80; + p = 0.4; + mycdf = cdf.factory( r, p ); + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + x = ( randu()*100 ); + y = mycdf( x ); + if ( isnan( y ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); From ee8ac1e70d987502d69cd51cb0a33e9a4454d7f4 Mon Sep 17 00:00:00 2001 From: saurabhraghuvanshii Date: Mon, 10 Feb 2025 15:58:23 +0530 Subject: [PATCH 6/9] chore: remove negative-binomial --- 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: na - 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 --- --- .../cdf/benchmark/benchmark.js | 85 ------------------- 1 file changed, 85 deletions(-) delete mode 100644 lib/node_modules/@stdlib/stats/base/dists/negative-binomial/cdf/benchmark/benchmark.js diff --git a/lib/node_modules/@stdlib/stats/base/dists/negative-binomial/cdf/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/negative-binomial/cdf/benchmark/benchmark.js deleted file mode 100644 index 6c1aecbd89d3..000000000000 --- a/lib/node_modules/@stdlib/stats/base/dists/negative-binomial/cdf/benchmark/benchmark.js +++ /dev/null @@ -1,85 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var ceil = require( '@stdlib/math/base/special/ceil' ); -var isnan = require( '@stdlib/math/base/assert/is-nan' ); -var randu = require( '@stdlib/random/base/randu' ); -var EPS = require( '@stdlib/constants/float64/eps' ); -var pkg = require( './../package.json' ).name; -var cdf = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var r; - var p; - var x; - var y; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - x = randu()*100.0; - r = ceil( randu()*100.0 ); - p = ( randu()*1.0 ) + EPS; - y = cdf( x, r, p ); - if ( isnan( y ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( y ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':factory', function benchmark( b ) { - var mycdf; - var r; - var p; - var x; - var y; - var i; - - r = 80; - p = 0.4; - mycdf = cdf.factory( r, p ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*100 ); - y = mycdf( x ); - if ( isnan( y ) ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( isnan( y ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); From 7f5502a88d15f787ced53942272d95943beea5f8 Mon Sep 17 00:00:00 2001 From: saurabhraghuvanshii Date: Tue, 11 Feb 2025 01:31:31 +0530 Subject: [PATCH 7/9] chore: updates files --- 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 --- --- 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: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: passed - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na --- --- .../lognormal/cdf/benchmark/benchmark.js | 26 +++- .../lognormal/ctor/benchmark/benchmark.js | 146 ++++++++++++++---- .../lognormal/entropy/benchmark/benchmark.js | 14 +- .../lognormal/kurtosis/benchmark/benchmark.js | 14 +- .../lognormal/logcdf/benchmark/benchmark.js | 26 +++- .../lognormal/logpdf/benchmark/benchmark.js | 28 +++- .../lognormal/mean/benchmark/benchmark.js | 14 +- .../lognormal/median/benchmark/benchmark.js | 14 +- .../lognormal/mode/benchmark/benchmark.js | 14 +- .../lognormal/pdf/benchmark/benchmark.js | 26 +++- .../lognormal/quantile/benchmark/benchmark.js | 26 +++- .../lognormal/skewness/benchmark/benchmark.js | 14 +- .../lognormal/stdev/benchmark/benchmark.js | 14 +- .../cdf/benchmark/benchmark.js | 85 ++++++++++ 14 files changed, 383 insertions(+), 78 deletions(-) create mode 100644 lib/node_modules/@stdlib/stats/base/dists/negative-binomial/cdf/benchmark/benchmark.js diff --git a/lib/node_modules/@stdlib/stats/base/dists/lognormal/cdf/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/lognormal/cdf/benchmark/benchmark.js index 00cab6dd5bcb..1ccbd97c559e 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/lognormal/cdf/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/stats/base/dists/lognormal/cdf/benchmark/benchmark.js @@ -22,6 +22,7 @@ var bench = require( '@stdlib/bench' ); var uniform = require( '@stdlib/random/base/uniform' ); +var Float64Array = require( '@stdlib/array/float64' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var EPS = require( '@stdlib/constants/float64/eps' ); var pkg = require( './../package.json' ).name; @@ -32,17 +33,25 @@ var cdf = require( './../lib' ); bench( pkg, function benchmark( b ) { var sigma; + var len; var mu; var x; var y; var i; + len = 100; + x = new Float64Array( len ); + mu = new Float64Array( len ); + sigma = new Float64Array( len ); + for ( i = 0; i < len; i++ ) { + x[ i ] = uniform( -100.0, 100.0 ); + mu[ i ] = uniform( -50.0, 50.0 ); + sigma[ i ] = uniform( EPS, 20.0 ); + } + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = uniform( -100.0, 100.0 ); - mu = uniform( -50.0, 50.0 ); - sigma = uniform( EPS, 20.0 ); - y = cdf( x, mu, sigma ); + y = cdf( x[ i % len ], mu[ i % len ], sigma[ i % len ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } @@ -58,6 +67,7 @@ bench( pkg, function benchmark( b ) { bench( pkg+':factory', function benchmark( b ) { var mycdf; var sigma; + var len; var mu; var x; var y; @@ -66,11 +76,15 @@ bench( pkg+':factory', function benchmark( b ) { mu = 10.0; sigma = 4.0; mycdf = cdf.factory( mu, sigma ); + len = 100; + x = new Float64Array( len ); + for ( i = 0; i < len; i++ ) { + x[ i ] = uniform( 0.0, 50.0 ); + } b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = uniform( 0.0, 50.0 ); - y = mycdf( x ); + y = mycdf( x[ i % len ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/stats/base/dists/lognormal/ctor/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/lognormal/ctor/benchmark/benchmark.js index d1c71f57213b..3de239a0384f 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/lognormal/ctor/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/stats/base/dists/lognormal/ctor/benchmark/benchmark.js @@ -21,7 +21,8 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); +var uniform = require( '@stdlib/random/base/uniform' ); +var Float64Array = require( '@stdlib/array/float64' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var EPS = require( '@stdlib/constants/float64/eps' ); var pkg = require( './../package.json' ).name; @@ -33,14 +34,21 @@ var LogNormal = require( './../lib' ); bench( pkg+'::instantiation', function benchmark( b ) { var sigma; var dist; + var len; var mu; var i; + len = 100; + mu = new Float64Array( len ); + sigma = new Float64Array( len ); + for ( i = 0; i < len; i++ ) { + mu[ i ] = uniform( EPS, 10.0 ); + sigma[ i ] = uniform( EPS, 10.0 ); + } + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - mu = ( randu() * 10.0 ) + EPS; - sigma = ( randu() * 10.0 ) + EPS; - dist = new LogNormal( mu, sigma ); + dist = new LogNormal( mu[ i % len ], sigma[ i % len ] ); if ( !( dist instanceof LogNormal ) ) { b.fail( 'should return a distribution instance' ); } @@ -82,6 +90,7 @@ bench( pkg+'::get:mu', function benchmark( b ) { bench( pkg+'::set:mu', function benchmark( b ) { var sigma; var dist; + var len; var mu; var y; var i; @@ -89,12 +98,16 @@ bench( pkg+'::set:mu', function benchmark( b ) { mu = 2.0; sigma = 3.0; dist = new LogNormal( mu, sigma ); + len = 100; + y = new Float64Array( len ); + for ( i = 0; i < len; i++ ) { + y[ i ] = uniform( EPS, 100.0 ); + } b.tic(); for ( i = 0; i < b.iterations; i++ ) { - y = ( 100.0*randu() ) + EPS; - dist.mu = y; - if ( dist.mu !== y ) { + dist.mu = y[ i % len ]; + if ( dist.mu !== y[ i % len ] ) { b.fail( 'should return set value' ); } } @@ -135,6 +148,7 @@ bench( pkg+'::get:sigma', function benchmark( b ) { bench( pkg+'::set:sigma', function benchmark( b ) { var sigma; var dist; + var len; var mu; var y; var i; @@ -142,12 +156,16 @@ bench( pkg+'::set:sigma', function benchmark( b ) { mu = 2.0; sigma = 3.0; dist = new LogNormal( mu, sigma ); + len = 100; + y = new Float64Array( len ); + for ( i = 0; i < len; i++ ) { + y[ i ] = uniform( EPS, 100.0 ); + } b.tic(); for ( i = 0; i < b.iterations; i++ ) { - y = ( 100.0*randu() ) + EPS; - dist.sigma = y; - if ( dist.sigma !== y ) { + dist.sigma = y[ i % len ]; + if ( dist.sigma !== y[ i % len ] ) { b.fail( 'should return set value' ); } } @@ -162,17 +180,24 @@ bench( pkg+'::set:sigma', function benchmark( b ) { bench( pkg+':entropy', function benchmark( b ) { var sigma; var dist; + var len; var mu; + var x; var y; var i; mu = 2.0; sigma = 3.0; dist = new LogNormal( mu, sigma ); + len = 100; + x = new Float64Array( len ); + for ( i = 0; i < len; i++ ) { + x[ i ] = uniform( EPS, 100.0 ); + } b.tic(); for ( i = 0; i < b.iterations; i++ ) { - dist.mu = ( 100.0*randu() ) + EPS; + dist.mu = x[ i % len ]; y = dist.entropy; if ( isnan( y ) ) { b.fail( 'should not return NaN' ); @@ -189,17 +214,24 @@ bench( pkg+':entropy', function benchmark( b ) { bench( pkg+':kurtosis', function benchmark( b ) { var sigma; var dist; + var len; var mu; + var x; var y; var i; mu = 2.0; sigma = 3.0; dist = new LogNormal( mu, sigma ); + len = 100; + x = new Float64Array( len ); + for ( i = 0; i < len; i++ ) { + x[ i ] = uniform( EPS, 100.0 ); + } b.tic(); for ( i = 0; i < b.iterations; i++ ) { - dist.mu = ( 100.0*randu() ) + EPS; + dist.mu = x[ i % len ]; y = dist.kurtosis; if ( isnan( y ) ) { b.fail( 'should not return NaN' ); @@ -216,17 +248,24 @@ bench( pkg+':kurtosis', function benchmark( b ) { bench( pkg+':mean', function benchmark( b ) { var sigma; var dist; + var len; var mu; + var x; var y; var i; mu = 2.0; sigma = 3.0; dist = new LogNormal( mu, sigma ); + len = 100; + x = new Float64Array( len ); + for ( i = 0; i < len; i++ ) { + x[ i ] = uniform( EPS, 100.0 ); + } b.tic(); for ( i = 0; i < b.iterations; i++ ) { - dist.mu = ( 100.0*randu() ) + EPS; + dist.mu = x[ i % len ]; y = dist.mean; if ( isnan( y ) ) { b.fail( 'should not return NaN' ); @@ -243,17 +282,24 @@ bench( pkg+':mean', function benchmark( b ) { bench( pkg+':median', function benchmark( b ) { var sigma; var dist; + var len; var mu; + var x; var y; var i; mu = 2.0; sigma = 3.0; dist = new LogNormal( mu, sigma ); + len = 100; + x = new Float64Array( len ); + for ( i = 0; i < len; i++ ) { + x[ i ] = uniform( EPS, 100.0 ); + } b.tic(); for ( i = 0; i < b.iterations; i++ ) { - dist.mu = ( 100.0*randu() ) + EPS; + dist.mu = x[ i % len ]; y = dist.median; if ( isnan( y ) ) { b.fail( 'should not return NaN' ); @@ -270,17 +316,24 @@ bench( pkg+':median', function benchmark( b ) { bench( pkg+':mode', function benchmark( b ) { var sigma; var dist; + var len; var mu; + var x; var y; var i; mu = 2.0; sigma = 3.0; dist = new LogNormal( mu, sigma ); + len = 100; + x = new Float64Array( len ); + for ( i = 0; i < len; i++ ) { + x[ i ] = uniform( EPS, 100.0 ); + } b.tic(); for ( i = 0; i < b.iterations; i++ ) { - dist.mu = ( 100.0*randu() ) + 1.0 + EPS; + dist.mu = x[ i % len ]; y = dist.mode; if ( isnan( y ) ) { b.fail( 'should not return NaN' ); @@ -297,17 +350,24 @@ bench( pkg+':mode', function benchmark( b ) { bench( pkg+':skewness', function benchmark( b ) { var sigma; var dist; + var len; var mu; + var x; var y; var i; mu = 2.0; sigma = 3.0; dist = new LogNormal( mu, sigma ); + len = 100; + x = new Float64Array( len ); + for ( i = 0; i < len; i++ ) { + x[ i ] = uniform( EPS, 100.0 ); + } b.tic(); for ( i = 0; i < b.iterations; i++ ) { - dist.mu = ( 100.0*randu() ) + EPS; + dist.mu = x[ i % len ]; y = dist.skewness; if ( isnan( y ) ) { b.fail( 'should not return NaN' ); @@ -324,17 +384,24 @@ bench( pkg+':skewness', function benchmark( b ) { bench( pkg+':stdev', function benchmark( b ) { var sigma; var dist; + var len; var mu; + var x; var y; var i; mu = 2.0; sigma = 3.0; dist = new LogNormal( mu, sigma ); + len = 100; + x = new Float64Array( len ); + for ( i = 0; i < len; i++ ) { + x[ i ] = uniform( EPS, 100.0 ); + } b.tic(); for ( i = 0; i < b.iterations; i++ ) { - dist.mu = ( 100.0*randu() ) + EPS; + dist.mu = x[ i % len ]; y = dist.stdev; if ( isnan( y ) ) { b.fail( 'should not return NaN' ); @@ -351,17 +418,24 @@ bench( pkg+':stdev', function benchmark( b ) { bench( pkg+':variance', function benchmark( b ) { var sigma; var dist; + var len; var mu; + var x; var y; var i; mu = 2.0; sigma = 3.0; dist = new LogNormal( mu, sigma ); + len = 100; + x = new Float64Array( len ); + for ( i = 0; i < len; i++ ) { + x[ i ] = uniform( EPS, 100.0 ); + } b.tic(); for ( i = 0; i < b.iterations; i++ ) { - dist.mu = ( 100.0*randu() ) + EPS; + dist.mu = x[ i % len ]; y = dist.variance; if ( isnan( y ) ) { b.fail( 'should not return NaN' ); @@ -378,6 +452,7 @@ bench( pkg+':variance', function benchmark( b ) { bench( pkg+':cdf', function benchmark( b ) { var sigma; var dist; + var len; var mu; var x; var y; @@ -386,11 +461,15 @@ bench( pkg+':cdf', function benchmark( b ) { mu = 2.0; sigma = 3.0; dist = new LogNormal( mu, sigma ); + len = 100; + x = new Float64Array( len ); + for ( i = 0; i < len; i++ ) { + x[ i ] = uniform( -3.0, 3.0 ); + } b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*6.0 ) - 3.0; - y = dist.cdf( x ); + y = dist.cdf( x[ i % len] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } @@ -406,6 +485,7 @@ bench( pkg+':cdf', function benchmark( b ) { bench( pkg+':logpdf', function benchmark( b ) { var sigma; var dist; + var len; var mu; var x; var y; @@ -414,11 +494,15 @@ bench( pkg+':logpdf', function benchmark( b ) { mu = 2.0; sigma = 3.0; dist = new LogNormal( mu, sigma ); + len = 100; + x = new Float64Array( len ); + for ( i = 0; i < len; i++ ) { + x[ i ] = uniform( -3.0, 3.0 ); + } b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*6.0 ) - 3.0; - y = dist.logpdf( x ); + y = dist.logpdf( x[ i % len ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } @@ -434,6 +518,7 @@ bench( pkg+':logpdf', function benchmark( b ) { bench( pkg+':pdf', function benchmark( b ) { var sigma; var dist; + var len; var mu; var x; var y; @@ -442,11 +527,15 @@ bench( pkg+':pdf', function benchmark( b ) { mu = 2.0; sigma = 3.0; dist = new LogNormal( mu, sigma ); + len = 100; + x = new Float64Array( len ); + for ( i = 0; i < len; i++ ) { + x[ i ] = uniform( -3.0, 3.0 ); + } b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*6.0 ) - 3.0; - y = dist.pdf( x ); + y = dist.pdf( x[ i % len ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } @@ -462,6 +551,7 @@ bench( pkg+':pdf', function benchmark( b ) { bench( pkg+':quantile', function benchmark( b ) { var sigma; var dist; + var len; var mu; var x; var y; @@ -470,11 +560,15 @@ bench( pkg+':quantile', function benchmark( b ) { mu = 2.0; sigma = 3.0; dist = new LogNormal( mu, sigma ); + len = 100; + x = new Float64Array( len ); + for ( i = 0; i < len; i++ ) { + x[ i ] = uniform( 0.0, 1.0 ); + } b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = randu(); - y = dist.quantile( x ); + y = dist.quantile( x[ i % len ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/stats/base/dists/lognormal/entropy/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/lognormal/entropy/benchmark/benchmark.js index 483a1040c988..75616204fba9 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/lognormal/entropy/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/stats/base/dists/lognormal/entropy/benchmark/benchmark.js @@ -22,6 +22,7 @@ var bench = require( '@stdlib/bench' ); var uniform = require( '@stdlib/random/base/uniform' ); +var Float64Array = require( '@stdlib/array/float64' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var EPS = require( '@stdlib/constants/float64/eps' ); var pkg = require( './../package.json' ).name; @@ -32,15 +33,22 @@ var entropy = require( './../lib' ); bench( pkg, function benchmark( b ) { var sigma; + var len; var mu; var y; var i; + len = 100; + mu = new Float64Array( len ); + sigma = new Float64Array( len ); + for ( i = 0; i < len; i++ ) { + mu[ i ] = uniform( -50.0, 50.0 ); + sigma[ i ] = uniform( EPS, 20.0 ); + } + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - mu = uniform( -50.0, 50.0 ); - sigma = uniform( EPS, 20.0 ); - y = entropy( mu, sigma ); + y = entropy( mu[ i % len ], sigma[ i % len ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/stats/base/dists/lognormal/kurtosis/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/lognormal/kurtosis/benchmark/benchmark.js index 50a8db0a14b5..1b436ab192aa 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/lognormal/kurtosis/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/stats/base/dists/lognormal/kurtosis/benchmark/benchmark.js @@ -22,6 +22,7 @@ var bench = require( '@stdlib/bench' ); var uniform = require( '@stdlib/random/base/uniform' ); +var Float64Array = require( '@stdlib/array/float64' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var EPS = require( '@stdlib/constants/float64/eps' ); var pkg = require( './../package.json' ).name; @@ -32,15 +33,22 @@ var kurtosis = require( './../lib' ); bench( pkg, function benchmark( b ) { var sigma; + var len; var mu; var y; var i; + len = 100; + mu = new Float64Array( len ); + sigma = new Float64Array( len ); + for ( i = 0; i < len; i++ ) { + mu[ i ] = uniform( -50.0, 50.0 ); + sigma[ i ] = uniform( EPS, 20.0 ); + } + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - mu = uniform( -50.0, 50.0 ); - sigma = uniform( EPS, 20.0 ); - y = kurtosis( mu, sigma ); + y = kurtosis( mu[ i % len ], sigma[ i % len ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/stats/base/dists/lognormal/logcdf/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/lognormal/logcdf/benchmark/benchmark.js index 4b4611b2ed7e..818a1cbbc9c0 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/lognormal/logcdf/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/stats/base/dists/lognormal/logcdf/benchmark/benchmark.js @@ -22,6 +22,7 @@ var bench = require( '@stdlib/bench' ); var uniform = require( '@stdlib/random/base/uniform' ); +var Float64Array = require( '@stdlib/array/float64' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var EPS = require( '@stdlib/constants/float64/eps' ); var pkg = require( './../package.json' ).name; @@ -32,17 +33,25 @@ var logcdf = require( './../lib' ); bench( pkg, function benchmark( b ) { var sigma; + var len; var mu; var x; var y; var i; + len = 100; + x = new Float64Array( len ); + mu = new Float64Array( len ); + sigma = new Float64Array( len ); + for ( i = 0; i < len; i++ ) { + x[ i ] = uniform( -100.0, 100.0 ); + mu[ i ] = uniform( -50.0, 50.0 ); + sigma[ i ] = uniform( EPS, 20.0 ); + } + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = uniform( -100.0, 100.0 ); - mu = uniform( -50.0, 50.0 ); - sigma = uniform( EPS, 20.0 ); - y = logcdf( x, mu, sigma ); + y = logcdf( x[ i % len ], mu[ i % len ], sigma[ i % len ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } @@ -58,6 +67,7 @@ bench( pkg, function benchmark( b ) { bench( pkg+':factory', function benchmark( b ) { var mylogcdf; var sigma; + var len; var mu; var x; var y; @@ -66,11 +76,15 @@ bench( pkg+':factory', function benchmark( b ) { mu = 0.0; sigma = 1.5; mylogcdf = logcdf.factory( mu, sigma ); + len = 100; + x = new Float64Array( len ); + for ( i = 0; i < len; i++ ) { + x[ i ] = uniform( -3.0, 3.0 ); + } b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = uniform( -3.0, 3.0 ); - y = mylogcdf( x ); + y = mylogcdf( x[ i % len ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/stats/base/dists/lognormal/logpdf/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/lognormal/logpdf/benchmark/benchmark.js index 4a3713d490ef..8f63037ef15e 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/lognormal/logpdf/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/stats/base/dists/lognormal/logpdf/benchmark/benchmark.js @@ -21,7 +21,8 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random/base/randu' ); +var uniform = require( '@stdlib/random/base/uniform' ); +var Float64Array = require( '@stdlib/array/float64' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var EPS = require( '@stdlib/constants/float64/eps' ); var pkg = require( './../package.json' ).name; @@ -32,17 +33,25 @@ var logpdf = require( './../lib' ); bench( pkg, function benchmark( b ) { var sigma; + var len; var mu; var x; var y; var i; + len = 100; + x = new Float64Array( len ); + mu = new Float64Array( len ); + sigma = new Float64Array( len ); + for ( i = 0; i < len; i++ ) { + x[ i ] = uniform( -100.0, 100.0 ); + mu[ i ] = uniform( -50.0, 50.0 ); + sigma[ i ] = uniform( EPS, 20.0 ); + } + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = ( randu()*100.0 ) - 100; - mu = ( randu()*100.0 ) - 50.0; - sigma = ( randu()*20.0 ) + EPS; - y = logpdf( x, mu, sigma ); + y = logpdf( x[ i % len ], mu[ i % len ], sigma[ i % len ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } @@ -58,6 +67,7 @@ bench( pkg, function benchmark( b ) { bench( pkg+':factory', function benchmark( b ) { var mylogpdf; var sigma; + var len; var mu; var x; var y; @@ -66,11 +76,15 @@ bench( pkg+':factory', function benchmark( b ) { mu = 10.0; sigma = 4.0; mylogpdf = logpdf.factory( mu, sigma ); + len = 100; + x = new Float64Array( len ); + for ( i = 0; i < len; i++ ) { + x[ i ] = uniform( 0.0, 50.0 ); + } b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = randu() * 50.0; - y = mylogpdf( x ); + y = mylogpdf( x[ i % len ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/stats/base/dists/lognormal/mean/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/lognormal/mean/benchmark/benchmark.js index a8bb65e65a1f..b8eb73f356df 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/lognormal/mean/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/stats/base/dists/lognormal/mean/benchmark/benchmark.js @@ -22,6 +22,7 @@ var bench = require( '@stdlib/bench' ); var uniform = require( '@stdlib/random/base/uniform' ); +var Float64Array = require( '@stdlib/array/float64' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var EPS = require( '@stdlib/constants/float64/eps' ); var pkg = require( './../package.json' ).name; @@ -32,15 +33,22 @@ var mean = require( './../lib' ); bench( pkg, function benchmark( b ) { var sigma; + var len; var mu; var y; var i; + len = 100; + mu = new Float64Array( len ); + sigma = new Float64Array( len ); + for ( i = 0; i < len; i++ ) { + mu[ i ] = uniform( -50.0, 50.0 ); + sigma[ i ] = uniform( EPS, 20.0 ); + } + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - mu = uniform( -50.0, 50.0 ); - sigma = uniform( EPS, 20.0 ); - y = mean( mu, sigma ); + y = mean( mu[ i % len ], sigma[ i % len ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/stats/base/dists/lognormal/median/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/lognormal/median/benchmark/benchmark.js index 970bf79b5c54..293ecb2a2b06 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/lognormal/median/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/stats/base/dists/lognormal/median/benchmark/benchmark.js @@ -22,6 +22,7 @@ var bench = require( '@stdlib/bench' ); var uniform = require( '@stdlib/random/base/uniform' ); +var Float64Array = require( '@stdlib/array/float64' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var EPS = require( '@stdlib/constants/float64/eps' ); var pkg = require( './../package.json' ).name; @@ -32,15 +33,22 @@ var median = require( './../lib' ); bench( pkg, function benchmark( b ) { var sigma; + var len; var mu; var y; var i; + len = 100; + mu = new Float64Array( len ); + sigma = new Float64Array( len ); + for ( i = 0; i < len; i++ ) { + mu[ i ] = uniform( -50.0, 50.0 ); + sigma[ i ] = uniform( EPS, 20.0 ); + } + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - mu = uniform( -50.0, 50.0 ); - sigma = uniform( EPS, 20.0 ); - y = median( mu, sigma ); + y = median( mu[ i % len ], sigma[ i % len ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/stats/base/dists/lognormal/mode/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/lognormal/mode/benchmark/benchmark.js index f1cff7932b78..beac575f834d 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/lognormal/mode/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/stats/base/dists/lognormal/mode/benchmark/benchmark.js @@ -22,6 +22,7 @@ var bench = require( '@stdlib/bench' ); var uniform = require( '@stdlib/random/base/uniform' ); +var Float64Array = require( '@stdlib/array/float64' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var EPS = require( '@stdlib/constants/float64/eps' ); var pkg = require( './../package.json' ).name; @@ -32,15 +33,22 @@ var mode = require( './../lib' ); bench( pkg, function benchmark( b ) { var sigma; + var len; var mu; var y; var i; + len = 100; + mu = new Float64Array( len ); + sigma = new Float64Array( len ); + for ( i = 0; i < len; i++ ) { + mu[ i ] = uniform( -50.0, 50.0 ); + sigma[ i ] = uniform( EPS, 20.0 ); + } + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - mu = uniform( -50.0, 50.0 ); - sigma = uniform( EPS, 20.0 ); - y = mode( mu, sigma ); + y = mode( mu[ i % len ], sigma[ i % len ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/stats/base/dists/lognormal/pdf/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/lognormal/pdf/benchmark/benchmark.js index 60bf3e20ef2d..a445a4ace829 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/lognormal/pdf/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/stats/base/dists/lognormal/pdf/benchmark/benchmark.js @@ -22,6 +22,7 @@ var bench = require( '@stdlib/bench' ); var uniform = require( '@stdlib/random/base/uniform' ); +var Float64Array = require( '@stdlib/array/float64' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var EPS = require( '@stdlib/constants/float64/eps' ); var pkg = require( './../package.json' ).name; @@ -32,17 +33,25 @@ var pdf = require( './../lib' ); bench( pkg, function benchmark( b ) { var sigma; + var len; var mu; var x; var y; var i; + len = 100; + x = new Float64Array( len ); + mu = new Float64Array( len ); + sigma = new Float64Array( len ); + for ( i = 0; i < len; i++ ) { + x[ i ] = uniform( -100.0, 100.0 ); + mu[ i ] = uniform( -50.0, 50.0 ); + sigma[ i ] = uniform( EPS, 20.0 ); + } + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = uniform( -100.0, 100.0 ); - mu = uniform( -50.0, 50.0 ); - sigma = uniform( EPS, 20.0 ); - y = pdf( x, mu, sigma ); + y = pdf( x[ i % len ], mu[ i % len ], sigma[ i % len ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } @@ -58,6 +67,7 @@ bench( pkg, function benchmark( b ) { bench( pkg+':factory', function benchmark( b ) { var mypdf; var sigma; + var len; var mu; var x; var y; @@ -66,11 +76,15 @@ bench( pkg+':factory', function benchmark( b ) { mu = 10.0; sigma = 4.0; mypdf = pdf.factory( mu, sigma ); + len = 100; + x = new Float64Array( len ); + for ( i = 0; i < len; i++ ) { + x[ i ] = uniform( 0.0, 50.0 ); + } b.tic(); for ( i = 0; i < b.iterations; i++ ) { - x = uniform( 0.0, 50.0 ); - y = mypdf( x ); + y = mypdf( x[ i % len ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/stats/base/dists/lognormal/quantile/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/lognormal/quantile/benchmark/benchmark.js index 797b96f57bd5..904f2aa506a0 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/lognormal/quantile/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/stats/base/dists/lognormal/quantile/benchmark/benchmark.js @@ -22,6 +22,7 @@ var bench = require( '@stdlib/bench' ); var uniform = require( '@stdlib/random/base/uniform' ); +var Float64Array = require( '@stdlib/array/float64' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var EPS = require( '@stdlib/constants/float64/eps' ); var pkg = require( './../package.json' ).name; @@ -32,17 +33,25 @@ var quantile = require( './../lib' ); bench( pkg, function benchmark( b ) { var sigma; + var len; var mu; var p; var y; var i; + len = 100; + p = new Float64Array( len ); + mu = new Float64Array( len ); + sigma = new Float64Array( len ); + for ( i = 0; i < len; i++ ) { + p[ i ] = uniform( 0.0, 1.0 ); + mu[ i ] = uniform( -50.0, 50.0 ); + sigma[ i ] = uniform( EPS, 20.0 ); + } + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - p = uniform( 0.0, 1.0 ); - mu = uniform( -50.0, 50.0 ); - sigma = uniform( EPS, 20.0 ); - y = quantile( p, mu, sigma ); + y = quantile( p[ i % len ], mu[ i % len ], sigma[ i % len ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } @@ -58,6 +67,7 @@ bench( pkg, function benchmark( b ) { bench( pkg+':factory', function benchmark( b ) { var myquantile; var sigma; + var len; var mu; var p; var y; @@ -66,11 +76,15 @@ bench( pkg+':factory', function benchmark( b ) { mu = 10.0; sigma = 4.0; myquantile = quantile.factory( mu, sigma ); + len = 100; + p = new Float64Array( len ); + for ( i = 0; i < len; i++ ) { + p[ i ] = uniform( 0.0, 1.0 ); + } b.tic(); for ( i = 0; i < b.iterations; i++ ) { - p = uniform( 0.0, 1.0 ); - y = myquantile( p ); + y = myquantile( p[ i % len ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/stats/base/dists/lognormal/skewness/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/lognormal/skewness/benchmark/benchmark.js index fd02f959f671..7d6bd6284ce3 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/lognormal/skewness/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/stats/base/dists/lognormal/skewness/benchmark/benchmark.js @@ -22,6 +22,7 @@ var bench = require( '@stdlib/bench' ); var uniform = require( '@stdlib/random/base/uniform' ); +var Float64Array = require( '@stdlib/array/float64' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var EPS = require( '@stdlib/constants/float64/eps' ); var pkg = require( './../package.json' ).name; @@ -32,15 +33,22 @@ var skewness = require( './../lib' ); bench( pkg, function benchmark( b ) { var sigma; + var len; var mu; var y; var i; + len = 100; + mu = new Float64Array( len ); + sigma = new Float64Array( len ); + for ( i = 0; i < len; i++ ) { + mu[ i ] = uniform( -50.0, 50.0 ); + sigma[ i ] = uniform( EPS, 20.0 ); + } + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - mu = uniform( -50.0, 50.0 ); - sigma = uniform( EPS, 20.0 ); - y = skewness( mu, sigma ); + y = skewness( mu[ i % len ], sigma[ i % len ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/stats/base/dists/lognormal/stdev/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/lognormal/stdev/benchmark/benchmark.js index 1399d443f7f4..315b24c5b851 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/lognormal/stdev/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/stats/base/dists/lognormal/stdev/benchmark/benchmark.js @@ -22,6 +22,7 @@ var bench = require( '@stdlib/bench' ); var uniform = require( '@stdlib/random/base/uniform' ); +var Float64Array = require( '@stdlib/array/float64' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var EPS = require( '@stdlib/constants/float64/eps' ); var pkg = require( './../package.json' ).name; @@ -32,15 +33,22 @@ var stdev = require( './../lib' ); bench( pkg, function benchmark( b ) { var sigma; + var len; var mu; var y; var i; + len = 100; + mu = new Float64Array( len ); + sigma = new Float64Array( len ); + for ( i = 0; i < len; i++ ) { + mu[ i ] = uniform( -50.0, 50.0 ); + sigma[ i ] = uniform( EPS, 20.0 ); + } + b.tic(); for ( i = 0; i < b.iterations; i++ ) { - mu = uniform( -50.0, 50.0 ); - sigma = uniform( EPS, 20.0 ); - y = stdev( mu, sigma ); + y = stdev( mu[ i % len ], sigma[ i % len ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/stats/base/dists/negative-binomial/cdf/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/negative-binomial/cdf/benchmark/benchmark.js new file mode 100644 index 000000000000..6c1aecbd89d3 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/negative-binomial/cdf/benchmark/benchmark.js @@ -0,0 +1,85 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var ceil = require( '@stdlib/math/base/special/ceil' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var randu = require( '@stdlib/random/base/randu' ); +var EPS = require( '@stdlib/constants/float64/eps' ); +var pkg = require( './../package.json' ).name; +var cdf = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var r; + var p; + var x; + var y; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + x = randu()*100.0; + r = ceil( randu()*100.0 ); + p = ( randu()*1.0 ) + EPS; + y = cdf( x, r, p ); + if ( isnan( y ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); + +bench( pkg+':factory', function benchmark( b ) { + var mycdf; + var r; + var p; + var x; + var y; + var i; + + r = 80; + p = 0.4; + mycdf = cdf.factory( r, p ); + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + x = ( randu()*100 ); + y = mycdf( x ); + if ( isnan( y ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( y ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); From af91388678cd9fb24befb401c5af8371ed37a8a2 Mon Sep 17 00:00:00 2001 From: saurabhraghuvanshii Date: Tue, 11 Feb 2025 02:51:47 +0530 Subject: [PATCH 8/9] chore: restore negative-binomial/cdf/benchmark.js --- 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 --- --- .../base/dists/negative-binomial/cdf/benchmark/benchmark.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/negative-binomial/cdf/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/negative-binomial/cdf/benchmark/benchmark.js index 6c1aecbd89d3..00524bb73043 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/negative-binomial/cdf/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/stats/base/dists/negative-binomial/cdf/benchmark/benchmark.js @@ -22,8 +22,8 @@ var bench = require( '@stdlib/bench' ); var ceil = require( '@stdlib/math/base/special/ceil' ); -var isnan = require( '@stdlib/math/base/assert/is-nan' ); var randu = require( '@stdlib/random/base/randu' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); var EPS = require( '@stdlib/constants/float64/eps' ); var pkg = require( './../package.json' ).name; var cdf = require( './../lib' ); From 83ed7bbeffb9193e3647152ad555a7374f6292f7 Mon Sep 17 00:00:00 2001 From: saurabhraghuvanshii Date: Tue, 18 Feb 2025 02:42:35 +0530 Subject: [PATCH 9/9] 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: 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 --- --- .../stats/base/dists/lognormal/cdf/benchmark/benchmark.js | 2 +- .../stats/base/dists/lognormal/ctor/benchmark/benchmark.js | 4 ++-- .../stats/base/dists/lognormal/logcdf/benchmark/benchmark.js | 2 +- .../stats/base/dists/lognormal/logpdf/benchmark/benchmark.js | 2 +- .../stats/base/dists/lognormal/pdf/benchmark/benchmark.js | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/base/dists/lognormal/cdf/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/lognormal/cdf/benchmark/benchmark.js index 1ccbd97c559e..449da14b1050 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/lognormal/cdf/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/stats/base/dists/lognormal/cdf/benchmark/benchmark.js @@ -44,7 +44,7 @@ bench( pkg, function benchmark( b ) { mu = new Float64Array( len ); sigma = new Float64Array( len ); for ( i = 0; i < len; i++ ) { - x[ i ] = uniform( -100.0, 100.0 ); + x[ i ] = uniform( -100.0, 0.0 ); mu[ i ] = uniform( -50.0, 50.0 ); sigma[ i ] = uniform( EPS, 20.0 ); } diff --git a/lib/node_modules/@stdlib/stats/base/dists/lognormal/ctor/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/lognormal/ctor/benchmark/benchmark.js index 3de239a0384f..bad9816541d5 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/lognormal/ctor/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/stats/base/dists/lognormal/ctor/benchmark/benchmark.js @@ -328,7 +328,7 @@ bench( pkg+':mode', function benchmark( b ) { len = 100; x = new Float64Array( len ); for ( i = 0; i < len; i++ ) { - x[ i ] = uniform( EPS, 100.0 ); + x[ i ] = uniform( 1.0 + EPS, 100.0 ); } b.tic(); @@ -469,7 +469,7 @@ bench( pkg+':cdf', function benchmark( b ) { b.tic(); for ( i = 0; i < b.iterations; i++ ) { - y = dist.cdf( x[ i % len] ); + y = dist.cdf( x[ i % len ] ); if ( isnan( y ) ) { b.fail( 'should not return NaN' ); } diff --git a/lib/node_modules/@stdlib/stats/base/dists/lognormal/logcdf/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/lognormal/logcdf/benchmark/benchmark.js index 818a1cbbc9c0..6a1c456eb706 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/lognormal/logcdf/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/stats/base/dists/lognormal/logcdf/benchmark/benchmark.js @@ -44,7 +44,7 @@ bench( pkg, function benchmark( b ) { mu = new Float64Array( len ); sigma = new Float64Array( len ); for ( i = 0; i < len; i++ ) { - x[ i ] = uniform( -100.0, 100.0 ); + x[ i ] = uniform( -100.0, 0.0 ); mu[ i ] = uniform( -50.0, 50.0 ); sigma[ i ] = uniform( EPS, 20.0 ); } diff --git a/lib/node_modules/@stdlib/stats/base/dists/lognormal/logpdf/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/lognormal/logpdf/benchmark/benchmark.js index 8f63037ef15e..8501c7a2d345 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/lognormal/logpdf/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/stats/base/dists/lognormal/logpdf/benchmark/benchmark.js @@ -44,7 +44,7 @@ bench( pkg, function benchmark( b ) { mu = new Float64Array( len ); sigma = new Float64Array( len ); for ( i = 0; i < len; i++ ) { - x[ i ] = uniform( -100.0, 100.0 ); + x[ i ] = uniform( -100.0, 0.0 ); mu[ i ] = uniform( -50.0, 50.0 ); sigma[ i ] = uniform( EPS, 20.0 ); } diff --git a/lib/node_modules/@stdlib/stats/base/dists/lognormal/pdf/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/dists/lognormal/pdf/benchmark/benchmark.js index a445a4ace829..f05256b58a27 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/lognormal/pdf/benchmark/benchmark.js +++ b/lib/node_modules/@stdlib/stats/base/dists/lognormal/pdf/benchmark/benchmark.js @@ -44,7 +44,7 @@ bench( pkg, function benchmark( b ) { mu = new Float64Array( len ); sigma = new Float64Array( len ); for ( i = 0; i < len; i++ ) { - x[ i ] = uniform( -100.0, 100.0 ); + x[ i ] = uniform( -100.0, 0.0 ); mu[ i ] = uniform( -50.0, 50.0 ); sigma[ i ] = uniform( EPS, 20.0 ); }