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

Remove zeros after LtsCoefficients arithmetic #6308

Merged
merged 2 commits into from
Oct 2, 2024

Conversation

wthrowe
Copy link
Member

@wthrowe wthrowe commented Sep 25, 2024

Proposed changes

Remove zeros after LtsCoefficients arithmetic. These are the coefficients in a linear combination of Variables objects, so avoiding terms with zero coefficients is a worthwhile minor optimization.

Upgrade instructions

Code review checklist

  • The code is documented and the documentation renders correctly. Run
    make doc to generate the documentation locally into BUILD_DIR/docs/html.
    Then open index.html.
  • The code follows the stylistic and code quality guidelines listed in the
    code review guide.
  • The PR lists upgrade instructions and is labeled bugfix or
    new feature if appropriate.

Further comments

@wthrowe wthrowe changed the title Lts zeros Remove zeros after LtsCoefficients arithmetic Sep 25, 2024
nilsdeppe
nilsdeppe previously approved these changes Sep 30, 2024
{
auto write = a.begin();
for (const auto& entry : a) {
if (get<2>(entry) != 0.0) {
Copy link
Member

Choose a reason for hiding this comment

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

Is there any reason to think that these numbers might be approximately zero to the level we don't care about?

Copy link
Member Author

Choose a reason for hiding this comment

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

You're right, these aren't exact. This should have a roundoff check of some sort.

@wthrowe wthrowe added the in progress Don't review, used for sharing code and getting feedback label Sep 30, 2024
@wthrowe wthrowe removed the in progress Don't review, used for sharing code and getting feedback label Oct 1, 2024
@nilsdeppe
Copy link
Member

fixup LGTM. Please squash. I should've said you can squash directly on this :)

Avoids multiplying large objects by zero later.
Already worked, but not obviously from the implementation.
@wthrowe
Copy link
Member Author

wthrowe commented Oct 1, 2024

I almost did, but decided since the change I made was nowhere near the PR comment it was better to make it obvious.

@nilsdeppe nilsdeppe merged commit 9193725 into sxs-collaboration:develop Oct 2, 2024
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants