change the purity calculation for gaussian state #747
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 <tol
intoa/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