-
-
Notifications
You must be signed in to change notification settings - Fork 910
fix: revert uniform implementation and remove unnecessary loop #5314
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
fix: revert uniform implementation and remove unnecessary loop #5314
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 ---
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.
👋 Hi there! 👋
And thank you for opening your first pull request! We will review it shortly. 🏃 💨
Coverage Report
The above coverage report was generated for the changes in this PR. |
lambda[ i ] = uniform( 1.0, 10.0 ); | ||
} | ||
|
||
lambda = uniform(len, 0.1, 10.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.
lambda = uniform(len, 0.1, 10.0); | |
lambda = uniform( 100, 0.1, 10.0 ); |
as per the suggested changes the var len
should be removed as the original implementation worked just fine.
Could you pls do the same for the benchmark.js
file as well.
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.
Just adding on to it, once the len
variable is removed, the initialization of y
in the benchmark loop will be updated to:
y = median( lambda[ i % lambda.length ] );
Basically, everything that was done in the original PR, as Neeraj already pointed out.
var bench = require( '@stdlib/bench' ); | ||
var Float64Array = require( '@stdlib/array/float64' ); | ||
var uniform = require( '@stdlib/random/array/uniform' ); | ||
var uniform = require( '@stdlib/random/base/uniform' ); |
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.
var uniform = require( '@stdlib/random/base/uniform' ); |
this should be removed as per the original implementation you will only be needing @stdlib/random/array/uniform
.
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.
@anandkaranubc what's your take on this?
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.
I agree. The latter one needs to be removed since it is no longer in use. Thanks for pointing that out!
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.
there is lint error in line no 39 , 42
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.
Yes, I believe clicking on the details should provide an overview for it.
var bench = require( '@stdlib/bench' ); | ||
var Float64Array = require( '@stdlib/array/float64' ); | ||
var uniform = require( '@stdlib/random/array/uniform' ); | ||
var uniform = require( '@stdlib/random/base/uniform' ); |
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.
I agree. The latter one needs to be removed since it is no longer in use. Thanks for pointing that out!
lambda[ i ] = uniform( 1.0, 10.0 ); | ||
} | ||
|
||
lambda = uniform(len, 0.1, 10.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.
Just adding on to it, once the len
variable is removed, the initialization of y
in the benchmark loop will be updated to:
y = median( lambda[ i % lambda.length ] );
Basically, everything that was done in the original PR, as Neeraj already pointed out.
Hi @Neerajpathak07 , my PR is ready, and I have made all the requested changes. Could you please approve the workflows? Thanks! |
@abhishekblue have you committed and pushed those changes cause they don't reflect here?? |
--- 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 ---
Hi @Neerajpathak07, |
len =100; | ||
lambda = new Float64Array( 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.
len =100; | |
lambda = new Float64Array( len ); |
won't be needing the Float64Array
module so better to remove it
lambda[ i ] = uniform( 1.0, 10.0); | ||
} | ||
|
||
lambda = uniform(100, 1.0, 10.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.
lambda = uniform(100, 1.0, 10.0); | |
lambda = uniform( 100, 0.1, 10.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.
Need the same change for the native
version as well.
var y; | ||
var i; | ||
|
||
len = 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.
here as well!
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.
You'll also want to remove
var uniform = require( '@stdlib/random/base/uniform' );
and add
var uniform = require( '@stdlib/random/array/uniform' );
@abhishekblue Just a few changes rest everything looks in line to me. Thank you for your efforts to correct them!! |
--- 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 ---
@Neerajpathak07 I've made the suggested formatting changes and also removed unused variables. Let me know if anything else is required. |
--- 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 ---
for ( i = 0; i < len; i++ ) { | ||
lambda[ i ] = uniform( 1.0, 10.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.
please remove this extra line.
Same for the native file.
--- 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 ---
for ( i = 0; i < len; i++ ) { | ||
lambda[ i ] = uniform( 1.0, 10.0); | ||
} | ||
lambda = uniform( 100, 1.0, 10.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.
lambda = uniform( 100, 1.0, 10.0 ); | |
lambda = uniform( 100, 0.1, 10.0 ); |
Something that doesn’t make a huge difference but would be better to have the same range as the original for consistency. :)
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.
absolutely! had suggested something similar in this suggestion must have been overlooked.
--- 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 ---
LGTM!! |
Thanks @abhishekblue for your PR and to @saurabhraghuvanshii, @Neerajpathak07 and @anandkaranubc for review comments! |
PR Commit Message
Please review the above commit message and make any necessary adjustments. |
type: pre_push_report
description: Results of running various checks prior to pushing changes.
report:
Resolves #5228
Description
This pull request:
@stdlib/random/base/uniform
back to@stdlib/random/array/uniform
as per review feedback in fb90f93#r152597788.benchmark.native.js
to match the expected implementation.Related Issues
This pull request:
Questions
No.
Other
make lint
produced filename errors in unrelated files. These files were not modified as part of this PR.Checklist
@stdlib-js/reviewers