This repository was archived by the owner on Jan 16, 2026. It is now read-only.
change the purity calculation for gaussian state#747
Open
sylviemonet wants to merge 1 commit intomasterfrom
Open
change the purity calculation for gaussian state#747sylviemonet wants to merge 1 commit intomasterfrom
sylviemonet wants to merge 1 commit intomasterfrom
Conversation
elib20
reviewed
May 14, 2024
Comment on lines
+1013
to
+1014
| np.abs(np.linalg.det(self._cov)) / (self._hbar / 2) ** (2 * self._modes) | ||
| == 1.0 |
Collaborator
There was a problem hiding this comment.
What about using np.isclose?
1 task
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
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 <tolintoa/b == 1.0as 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