-
Notifications
You must be signed in to change notification settings - Fork 982
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
Add to_phased_xz_gate function for SingleQubitCliffordGate #4050
Conversation
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.
LGTM with typo nits
cirq-core/cirq/ops/clifford_gate.py
Outdated
a = 0.0 | ||
x = -0.5 if x_to.flip ^ z_to.flip else 0.5 | ||
z = -0.5 if x_to.flip else 0.5 | ||
# It is impossible that there are other cases. |
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.
I would maybe rephrase the last branch to:
else:
# the only possible case left
assert (x_to.to, z_to.to) == (pauli_gates.Y, pauli_gates.X)
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, that looks beter.
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.
BTW, face rotation may be ambiguous at first glance, I learn it called axis swapping rotation in some literatures.
* {middle point of xyz in 4 Quadrant} * {120, 240} --- rotation in face | ||
note 1 + 9 + 6 + 8 = 24 in total. | ||
|
||
To associate with Clifford Tableau, it can also be grouped by 4: |
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.
I don't know if this information here is useful at all...in the end we use the above axis/degree categorization.
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.
The if
branch is based on the second group while the gate name is based on the first group.
I particularly choose the second group is for preparing to switch to the Tableau-based approach.
For example, the condition (x_to.to, z_to.to) == (pauli_gates.X, pauli_gates.Z)
can be directly convert into something like tableau.matrix() == np.array([[1, 0], [0, 1]])
.
Each branch condition is corresponding one of the six symplectic matrices.
Co-authored-by: Balint Pato <balopat@users.noreply.github.com>
Co-authored-by: Balint Pato <balopat@users.noreply.github.com>
Co-authored-by: Balint Pato <balopat@users.noreply.github.com>
Co-authored-by: Balint Pato <balopat@users.noreply.github.com>
Co-authored-by: Balint Pato <balopat@users.noreply.github.com>
Co-authored-by: Balint Pato <balopat@users.noreply.github.com>
Co-authored-by: Balint Pato <balopat@users.noreply.github.com>
Co-authored-by: Balint Pato <balopat@users.noreply.github.com>
Co-authored-by: Balint Pato <balopat@users.noreply.github.com>
Co-authored-by: Balint Pato <balopat@users.noreply.github.com>
Co-authored-by: Balint Pato <balopat@users.noreply.github.com>
cirq-core/cirq/ops/clifford_gate.py
Outdated
|
||
To associate with Clifford Tableau, it can also be grouped by 4: | ||
* {I,X,Y,Z} is [[1 0], [0, 1]] | ||
* {+/- X_sqrt, 2 Hadamard-like gates acting on the XZ plane} is [[1, 0], [1, 1]] |
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.
* {+/- X_sqrt, 2 Hadamard-like gates acting on the XZ plane} is [[1, 0], [1, 1]] | |
* {+/- X_sqrt, 2 Hadamard-like gates acting on the XY plane} is [[1, 0], [1, 1]] |
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.
Sorry, I found both this one and the comment in the following Z_sqrt was wrong as well. Fixed now. (Comments under the if-else branches are correct).
Automerge cancelled: A status check is failing. |
…b#4050) Allow transferring SingleQubitCliffordGate to Phased X and Z Gates.
…b#4050) Allow transferring SingleQubitCliffordGate to Phased X and Z Gates.
Allow transferring SingleQubitCliffordGate to Phased X and Z Gates.