-
Notifications
You must be signed in to change notification settings - Fork 27
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
Added the ability to control slackness in physicality conditions. #524
base: develop
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #524 +/- ##
===========================================
- Coverage 89.84% 89.80% -0.05%
===========================================
Files 93 93
Lines 6098 6092 -6
===========================================
- Hits 5479 5471 -8
- Misses 619 621 +2
... and 1 file with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
@@ -49,10 +49,12 @@ class DM(State): | |||
|
|||
short_name = "DM" | |||
|
|||
@property | |||
def is_positive(self) -> bool: | |||
def is_positive(self, atol: float = settings.ATOL) -> bool: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than adding a parameter what if instead we encouraged users to use
with settings(ATOL=1e-8):
...
Of course we would then have to make that clear in our documentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is a good alternative. This was a fixed suggested by Eli, so let me ask his opinion on this solution as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps a global ATOL is not such a good idea though, because it affects many checks of different things
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, Eli was indifferent and open to this suggestion too. But, why do we want to opt for this more convoluted solution is maybe a concern.
Just for the context: The issue that we initially had with changing the settings globally is that some tests may be run together, and therefore, having a global settings while changing it locally seems unsafe in this situation. However, seems like Anthony's suggestion is addressing this issue as well.
Context:
Currently, the tolerance for channel CPTP conditions, density matrix positivity and trace conditions, and pure state norm conditions use
settings.ATOL
to control their slackness. This PR allows to use arbitrary slackness for them.Description of the Change:
Introduced new variable
atol: float = settings.ATOL
which is to control this slackness in all physicality conditions includingis_CP
,is_TP
, andis_physical
for Channels, andis_positive
andis_physical
for DMs, and finally,is_physical
for Kets.Benefits:
Will be convenient to set the slackness. Also, is helpful in some tests.
Possible Drawbacks:
None.
Related GitHub Issues:
None.