-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
correctly updating global phase when removing -I gates from the circuit #13785
base: main
Are you sure you want to change the base?
Conversation
One or more of the following people are relevant to this code:
|
Update: there is another part of the pass dealing with RX, RY, RZ and RXXGate, RYYGate, RZZGate, RZXGate gates |
Pull Request Test Coverage Report for Build 13140017109Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
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.
Thanks for tackling this!
I would expect this needs to cover the full spectrum of operations that are the identity up to a global phase, i.e. exp(i phi) * I
🙂 This could be done e.g. by just looking at the first entry of the matrix and extracting the phase (similar to how it is done in Operator.equiv
).
Summary
This fixes a minor bug in the
RemoveIdentityEquivalent
transpiler pass (the pass was introduced in #12384), where unitary gates close to-I
were correctly removed from the circuit but the global phase of the circuit was not updated. This includes, for instance, unitary gates with matrix close to[[-1, 0], [0, -1]]
as well asRX(2 * pi)
and similar gates.Fixes #13778.
Thanks to @Cryoris and @ShellyGarion for joint debugging of the problem.