BUG: Fix error with 180 degree rotation in Rotation.align_vectors() with an infinite weight#20573
Merged
nmayorov merged 4 commits intoscipy:mainfrom Apr 28, 2024
Merged
Conversation
e56b0d1 to
ed9f2ce
Compare
nmayorov
reviewed
Apr 25, 2024
e6fd5c0 to
05bd338
Compare
nmayorov
reviewed
Apr 25, 2024
nmayorov
reviewed
Apr 25, 2024
nmayorov
reviewed
Apr 25, 2024
05bd338 to
6cb522d
Compare
Contributor
|
Solid fix @scottshambaugh! Is it necessary to mention bug fixes in the release notes? I don't see a dedicated section for that here. |
Contributor
nope |
tylerjereddy
pushed a commit
to tylerjereddy/scipy
that referenced
this pull request
May 2, 2024
…ith an infinite weight (scipy#20573) * Fix exact rotations at 180 deg, improve near 180 deg Comments * Tests for exact near 180 deg rotations * Fix tests * Code review updates --------- Co-authored-by: Scott Shambaugh <scottshambaugh@users.noreply.github.com>
10 tasks
Contributor
Author
|
Note that this also affected antiparallel single vector pairs as in #20660, since those use the infinite weight code path, but that should be covered under this fix. scipy/scipy/spatial/transform/_rotation.pyx Lines 3456 to 3459 in 0f87966 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reference issue
Closes #20555
What does this implement/fix?
There are two related issues with exact rotations near 180 degrees:
This fixes both. For the numerical instability part, near 180 degrees for the test case I'm seeing a pointing error of 2e-6 drop to 5e-9 (and now matches the non-exact code path to 1e-11). Tried to make the code path as compact as possible, but improvements welcome!