-
-
Notifications
You must be signed in to change notification settings - Fork 612
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bench: refactor random number generation in stats/base/dists/negative-binomial
#5025
base: develop
Are you sure you want to change the base?
bench: refactor random number generation in stats/base/dists/negative-binomial
#5025
Conversation
--- 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 ---
Coverage Report
The above coverage report was generated for the changes in this PR. |
Thanks, @yuvi-mittal, for working on this. I left a few comments for you to review. These suggestions are applicable throughout the PR. Also, can you change the title to: bench: refactor random number generation in |
stats/base/dists/negative-binomial
stats/base/dists/negative-binomial
lib/node_modules/@stdlib/stats/base/dists/negative-binomial/cdf/benchmark/benchmark.js
Show resolved
Hide resolved
lib/node_modules/@stdlib/stats/base/dists/negative-binomial/cdf/benchmark/benchmark.js
Outdated
Show resolved
Hide resolved
lib/node_modules/@stdlib/stats/base/dists/negative-binomial/variance/benchmark/benchmark.js
Outdated
Show resolved
Hide resolved
lib/node_modules/@stdlib/stats/base/dists/negative-binomial/variance/benchmark/benchmark.js
Outdated
Show resolved
Hide resolved
--- 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 ---
lib/node_modules/@stdlib/stats/base/dists/negative-binomial/cdf/benchmark/benchmark.js
Show resolved
Hide resolved
p = new Float64Array( len ); | ||
for ( i = 0; i < len; i++ ) { | ||
x[ i ] = uniform( 0, 100.0 ); | ||
r[ i ] = discreteUniform( 1.0, 100 ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r[ i ] = discreteUniform( 1.0, 100 ); | |
r[ i ] = discreteUniform( 1, 100 ); |
r = new Float64Array( len ); | ||
p = new Float64Array( len ); | ||
for ( i = 0; i < len; i++ ) { | ||
r[ i ] = discreteUniform( 1.0, 50 ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r[ i ] = discreteUniform( 1.0, 50 ); | |
r[ i ] = discreteUniform( 1, 50 ); |
This change is consistent throughout the PR.
len = 100; | ||
y = new Float64Array( len ); | ||
for ( i = 0; i < len; i++ ) { | ||
y[ i ] = discreteUniform( 1.0, 100.0 ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
y[ i ] = discreteUniform( 1.0, 100.0 ); | |
y[ i ] = discreteUniform( 1, 50 ); |
Make sure the range is still the same for consistency.
dist.p = y[i % len]; | ||
if ( dist.p !== y[i % len] ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dist.p = y[i % len]; | |
if ( dist.p !== y[i % len] ) { | |
dist.p = y[ i % len ]; | |
if ( dist.p !== y[ i % len ] ) { |
|
||
b.tic(); | ||
for ( i = 0; i < b.iterations; i++ ) { | ||
dist.r = ceil( ( 100.0*randu() ) + EPS ); | ||
dist.r = x[i % 100]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dist.r = x[i % 100]; | |
dist.r = x[ i % len ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is consistent throughout the PR.
Resolves #4980
Description
This pull request:
Related Issues
This pull request:
stats/base/dists/negative-binomial
#4980Questions
No.
Other
No.
Checklist
@stdlib-js/reviewers