Closed
Description
Reported by @sergeisakov
Description of the issue
It seems there is a bug in Cirq, which was introduced in #4167.
Adding control qubits to CCXPowGate (or to CCZPowGate) respects the global shift only for the bottom right submatrix (XPowGate or ZPowGate) and not for the full CCXPowGate (CCZPowGate) gate, see lines 210-213 and lines 522-525 in ops/three_qubit_gates.py.
How to reproduce the issue
Here is a simple example:
import cirq
q0 = cirq.LineQubit(0)
q1 = cirq.LineQubit(1)
q2 = cirq.LineQubit(2)
q3 = cirq.LineQubit(3)
g = cirq.CCXPowGate(exponent=1.0, global_shift=1.0/3.0)(q0, q1, q2)
gc = g.controlled_by(q3)
print(g._unitary_())
print(gc._unitary_())
Cirq version
1.3.0.dev