-
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
Global phase uc #6226
Global phase uc #6226
Conversation
Adds optional phase (figure 3 of arXiv:quant-ph/0410066)
If it doesn't break anything I think we should just always add the correct global phase. It looks more like a bug to me and not a feature we want to preserve 🙂 |
Hi @Cryoris , it breaks test_isometry_inverse in test/python/circuit/test_isometry.py |
That's odd, nothing should work based off the global phase not being conserved. I think we should try get to the bottom of this and then hopefully remove the argument. |
I converted the isometry into a gate (instead of Instruction). With this modification the isometry.inverse works as expected. The change from instruction to gate will not break anyone's code because a gate is also an instruction and isometry is a unitary operation. Let me know if this is the best strategy. |
|
||
def _define(self): | ||
# TODO The inverse().inverse() is because there is code to uncompute (_gates_to_uncompute) | ||
# an isometry, but not for generating its decomposition. It would be cheaper to do the | ||
# later here instead. | ||
gate = self.inverse().inverse() | ||
gate = self.iso_inverse() |
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.
could this be something like inv_gate
for clarity?
Since generally speaking an isometry is not always unitary could you keep this as an instruction? |
Thanks for the comment @ewinston. I reverted isometry to an instruction. I thought that the isometry should be a gate, because its implementation contains only unitary parts. |
Thanks for the update @adjs. |
I made a commit that messed up this PR. Then I'll open another one in place of this one. |
I'm closing this PR in favour of PR #8231 |
Summary
QuantumCircuit.uc does not preserve global phase. This PR adds the gate$P = e^{-i\pi/4}$ (see fig. 3 of arXiv:quant-ph/0410066).
Details and comments