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 simdiag not returning orthonormal eigenvectors #2269

Merged
merged 4 commits into from Nov 27, 2023

Conversation

Sola85
Copy link
Contributor

@Sola85 Sola85 commented Nov 24, 2023

Description
Use scipy.linalg.eigh instead of scipy.linalg.eig for qutip.simdiag in order to ensure returned eigenvectors are always orthonormal. Since simdiag requires operands to be commuting and hermitian, this change should be justified.

I did not add any new tests as this bug only occured in very rare circumstances. If desired, I could add the reproducing code from the related issue as a test case.

Related issues or PRs
Fixes issue #2268

@Sola85 Sola85 marked this pull request as ready for review November 24, 2023 14:20
@coveralls
Copy link

coveralls commented Nov 27, 2023

Coverage Status

coverage: 84.358% (-0.02%) from 84.382%
when pulling b954cd3 on Sola85:simdiag-eigh-fix
into f0c507e on qutip:master.

Copy link
Member

@Ericgig Ericgig left a comment

Choose a reason for hiding this comment

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

Thank you for the fix.

Could you add a test that would fail if simdiag did not return orthonormal vector?
The example in the issue would work.

@Sola85
Copy link
Contributor Author

Sola85 commented Nov 27, 2023

Sure! I just added the example from the issue, which gets fixed by this PR.

@Ericgig Ericgig merged commit e841a89 into qutip:master Nov 27, 2023
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.

None yet

3 participants