-
-
Notifications
You must be signed in to change notification settings - Fork 501
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 SymmetricEigen Routine #1210
base: main
Are you sure you want to change the base?
Conversation
1d64d61
to
15cfd50
Compare
I haven't yet had time to review this, but I also don't know the specific motivation for the |
@CattleProdigy: as I said on Discord, thank you so much for looking into this! I hope to be able to review soon, but in the meantime I'll try to answer one more of your questions. I think we definitely want to keep all user-submitted test cases in the test suite, with a clear reference to the issue in question, e.g. |
15cfd50
to
b028297
Compare
I've updated the name of the test and the docstrings to match the other issue/regression tests |
b028297
to
5291735
Compare
I've decided to adopt the solution that disrupts the code the least: maintaining the subdim=2 case. I synced my branch with |
Thanks for working on this @CattleProdigy, this is really great. I am not at all familiar with the code here, so given the subtlety of eigenvalue routines, I don't feel quite comfortable merging it right away, although of course the passing tests give great confidence to the solution here. Still, @sebcrozet, I think you were the original author of these routines, would you be able to take a look? |
@Andlon @sebcrozet any update on merging this? |
I've got some proposed fixes to address the issue referenced below.
The bug itself is in the the
subdim=2
special case. As best as I can tell, in that block we try to simply replace the unreduced block by its diagonalization, with the eigenvectors (calledbasis
in the code) serving a similar role as a Givens rotation does in the Implicit-Shift QR part of the algorithm.The eigenvector / eigenvalue correspondence is mismatched. Unfortunately, upon fixing that I find the proptests break regularly. The results are correct but not to within the specified threshold.I should also note that the proptests are also failing ondev
though you have to run it a few times to see a failure.There was nothing in theory wrong with the existing calculation, but it has numerical issues. In the SVD version of this algorithm, a special 2x2 SVD implementation is used which avoid catastrophic cancellation. I adjusted the
subdim=2
case to similarly select the eigenvector which bests avoid cancellation.I'm not sure
if there's a better way to salvage theif there's any advantage to doing so. In any case, I ultimately just removed it and let the Implicit-Shift QR part handle everything. That passes the test case from the user who reported the issue and proptest passes (100s of times without failing). FWIW the implementation in Eigen doesn't seem to have this special case.subdim=2
case orFor feedback:
Addresses #1109