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

Fix bug in SVD related to values near zero #1314

Merged
merged 4 commits into from
Nov 12, 2023

Conversation

rasmusgo
Copy link
Contributor

@rasmusgo rasmusgo commented Nov 9, 2023

This resolves issue #1313.

The problem was in the bidiagonalization where U and V is computed. There is a corner case where U D V doesn't agree how the sign should be handled when the reflection axis has zero magnitude.

This solution fixes the correctness but I would like some input on how to make the test for zero magnitude more efficient.

@Ralith
Copy link
Collaborator

Ralith commented Nov 9, 2023

This indeed fixes my issue 🎉

@sebcrozet
Copy link
Member

Thank you for this PR!
I pushed a small change: using norm_squared that is marginally more efficient than magnitude because it skips a sqrt.

@sebcrozet sebcrozet merged commit 2e99320 into dimforge:dev Nov 12, 2023
10 of 12 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.

3 participants