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.
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
Constructing Cliffords from quantum circuits with other Cliffords #9169
Constructing Cliffords from quantum circuits with other Cliffords #9169
Changes from 14 commits
064735e
f8c0067
055d5ed
899b111
42ecdc2
c5189b6
194e308
b98bc62
66a18d4
14d5bd5
0f7990f
449cfcd
e779ff9
17f7ce0
e5b9850
d9d9c17
704d385
468d4ed
4effb64
76fb841
bb02719
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
These tests use
equiv
rather than==
- the former normalises global phase, so==
is a strong condition. Do we need the global-phase fuzziness here? If so, it seems a bit unnerving, since the transpiler is supposed to maintain the global phase entirely.(Comment repeats for all the tests here.)
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.
Ouch, your comment points to a real problem with
OptimizeCliffords
transpiler pass, that I should have but did not think about.The problem is that Cliffords are only defined up to a global phase: while "in the real world"
XY = iZ
, when using Clifford's stabilizer/destabilizer tableaus, the multiplication byi
get dropped, i.e. "in the Clifford world"XY=Z
. This is also the reason why most of the tests that construct anOperator
out ofClifford
intest_clifford.py
check forequiv
and not for==
.The above in code:
print the value
False
.So right now replacing a block of Clifford gates by a Clifford may drop the global phase, which is indeed the problem to "the transpiler maintaining the global phase". That is, the
OptimizeCliffords
transpiler pass can only guarantee equivalence up to a global phase.Note: I do believe that when optimizing Cliffords over a subset of qubits the problem is still only with global and not local phases.
BTW, I thought there was an effort to incorporate the full phase into the
Clifford
class, maybe @ShellyGarion or @ikkoham can comment? This would immediately solve our problems here.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.
So I don't think we should replace
equiv
by==
in these tests. However, we should see if there is already a solution for maintaining the global phase. And if not we should clearly document this caveat in the documentation forOptimizeCliffords
transpiler pass. What do you think?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 sounds like a sensible plan to me. If the phase non-equivalence is already in the pass and in Terra 0.22, then there's no massive rush to fix it now before the release, and anyway, we can treat it as a bug fix. Let's open a new issue and discuss the right way forwards.