-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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 tolerance check on DiagonalGate to match UnitaryGate. #4375
Conversation
can you apply this to the new location for the diagonal gate in |
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.
Is there already a test covering #3842 ?
Could you add the same tolerance change to Then I think we can merge this. |
Yes can you deprecate the old location. It is leading to confusion. |
Yeah I'll open a PR for that 👍 |
Summary
This fixes a bug where it was possible to create a valid UnitaryGate which could be converted to an Isometry but would fail to decompose. The error was due to a difference in tolerances used for validating UnitaryGate and DiagonalGate.
Fixes #4369
Fixes #3842
Details and comments
In the case of UnitaryGate, numpy.allclose with atol=1e-8 and rtol=1e-5 was used while DiagonalGate used it's own implementation with a tolerance of 1e-10. This PR has DiagonalGate use numpy.allclose and references the same tolerances referenced by UnitaryGate.