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

change the purity calculation for gaussian state #747

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sylviemonet
Copy link
Contributor

@sylviemonet sylviemonet commented May 14, 2024

Context: The purity calculation for gaussian state depends on the precision in SF, however, in some cases, this value can be small but the tolerance is not enough small to detect it, hence, the state which should be mixed become a "pure" tag in the gaussian backend calculation.

Description of the Change: This PR fix the calculation from a - b <tol into a/b == 1.0 as the condition.

Benefits:

Possible Drawbacks: I believe that when we set of the calculation in the way a - b <tol, there must be some considerations behind. So it may be not a good solution for all library.

Related GitHub Issues: Issue 745

Comment on lines +1013 to +1014
np.abs(np.linalg.det(self._cov)) / (self._hbar / 2) ** (2 * self._modes)
== 1.0
Copy link
Collaborator

Choose a reason for hiding this comment

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

What about using np.isclose?

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