Skip to content
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

Array methods refactor #1151

Merged
merged 5 commits into from
May 30, 2024
Merged

Array methods refactor #1151

merged 5 commits into from
May 30, 2024

Conversation

nobu
Copy link
Member

@nobu nobu commented May 28, 2024

Array#sample

  • Calculate statistics in Float.
    The expected average values should be real numbers. The currently selected values (iters and size) happen to be divisible in integer, but not in general.
  • Move the invariant average value.
  • Simplify counts array initializations.
  • Simplify chi_squared calculations.
    • Use Array#sum.
    • Move the division by the invariant average outside the loop.

Array#sort

  • Adjust indents and add trailing commas.

nobu added 5 commits May 28, 2024 21:15
The expected average values should be real numbers.  The currently
selected values (`iters` and `size`) happen to be divisible in
integer, but not in general.
- Use Array#sum.
- Move the division by the invariant average outside the loop.
@nobu nobu changed the title Array#sample refactor Array class methods refactor May 28, 2024
@nobu nobu changed the title Array class methods refactor Array methods refactor May 28, 2024
Copy link
Member

@eregon eregon left a comment

Choose a reason for hiding this comment

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

Thanks!

@eregon eregon merged commit 220aa71 into ruby:master May 30, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants