Skip to content

Conversation

abhishekblue
Copy link
Contributor


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

Resolves #5228

Description

What is the purpose of this pull request?

This pull request:

  • Reverts @stdlib/random/base/uniform back to @stdlib/random/array/uniform as per review feedback in fb90f93#r152597788.
  • Updates benchmark.native.js to match the expected implementation.
  • Removes unnecessary for loop and directly initializes the uniform array.

Related Issues

Does this pull request have any related issues?

This pull request:

  • Address commit comments (commit fb90f93).

Questions

Any questions for reviewers?

No.

Other

Any other relevant information?

  • make lint produced filename errors in unrelated files. These files were not modified as part of this PR.
  • Skipping lint fixes since they are unrelated to this issue.

Checklist


@stdlib-js/reviewers

---
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
---
@stdlib-bot stdlib-bot added Statistics Issue or pull request related to statistical functionality. First-time Contributor A pull request from a contributor who has never previously committed to the project repository. Needs Review A pull request which needs code review. labels Feb 19, 2025
Copy link
Contributor

@stdlib-bot stdlib-bot left a 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. 🏃 💨

@stdlib-bot
Copy link
Contributor

stdlib-bot commented Feb 19, 2025

Coverage Report

Package Statements Branches Functions Lines
stats/base/dists/planck/median $\color{green}163/163$
$\color{green}+100.00\%$
$\color{green}8/8$
$\color{green}+100.00\%$
$\color{green}2/2$
$\color{green}+100.00\%$
$\color{green}163/163$
$\color{green}+100.00\%$

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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.

Copy link
Contributor

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' );
Copy link
Member

@Neerajpathak07 Neerajpathak07 Feb 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.

Copy link
Member

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?

Copy link
Contributor

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!

Copy link
Contributor

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

Copy link
Member

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' );
Copy link
Contributor

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);
Copy link
Contributor

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.

@anandkaranubc anandkaranubc removed the Needs Review A pull request which needs code review. label Feb 19, 2025
@abhishekblue
Copy link
Contributor Author

Hi @Neerajpathak07 , my PR is ready, and I have made all the requested changes. Could you please approve the workflows? Thanks!

@Neerajpathak07
Copy link
Member

@abhishekblue have you committed and pushed those changes cause they don't reflect here??
And the workflow approvals lie with the maintainers.

@kgryte kgryte added the Needs Changes Pull request which needs changes before being merged. label Feb 20, 2025
---
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
---
@abhishekblue
Copy link
Contributor Author

Hi @Neerajpathak07,
Apologies for the confusion earlier! I had committed the changes but mistakenly thought they were already pushed.
I have now pushed the latest changes. Could you please check if they reflect correctly and approve the workflows if everything looks good?
I also have to remove for loop from benchmark.js as well.
Thanks for your patience!

Comment on lines 38 to 39
len =100;
lambda = new Float64Array( len );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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);
Copy link
Member

@Neerajpathak07 Neerajpathak07 Feb 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
lambda = uniform(100, 1.0, 10.0);
lambda = uniform( 100, 0.1, 10.0 );

Copy link
Member

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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here as well!

Copy link
Member

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' );

@Neerajpathak07
Copy link
Member

@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
---
@abhishekblue
Copy link
Contributor Author

@Neerajpathak07 I've made the suggested formatting changes and also removed unused variables. Let me know if anything else is required.
Thanks!

---
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);
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

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 );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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. :)

Copy link
Member

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
---
@Neerajpathak07
Copy link
Member

LGTM!!
@kgryte Kindly take a look at this and merge it eventually.

@Planeshifter
Copy link
Member

Thanks @abhishekblue for your PR and to @saurabhraghuvanshii, @Neerajpathak07 and @anandkaranubc for review comments!

@Planeshifter Planeshifter added the Ready To Merge A pull request which is ready to be merged. label Feb 22, 2025
@stdlib-bot stdlib-bot removed the Needs Changes Pull request which needs changes before being merged. label Feb 22, 2025
@stdlib-bot
Copy link
Contributor

stdlib-bot commented Feb 22, 2025

PR Commit Message

bench: revert uniform implementation and remove unnecessary loop

PR-URL: https://github.com/stdlib-js/stdlib/pull/5314
Closes: https://github.com/stdlib-js/stdlib/issues/5228

Co-authored-by: Philipp Burckhardt <[email protected]>
Reviewed-by: Neeraj Pathak <[email protected]>
Reviewed-by: Karan Anand <[email protected]>
Reviewed-by: Saurabh Singh <[email protected]>

Please review the above commit message and make any necessary adjustments.

@Planeshifter Planeshifter merged commit 576bd4b into stdlib-js:develop Feb 22, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

First-time Contributor A pull request from a contributor who has never previously committed to the project repository. Ready To Merge A pull request which is ready to be merged. Statistics Issue or pull request related to statistical functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Address commit comments (commit fb90f93)

7 participants