Skip to content

Controlled CCX / CCZ gates do not respect global shift #6235

Closed
@tanujkhattar

Description

@tanujkhattar

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

Metadata

Metadata

Assignees

Labels

kind/bug-reportSomething doesn't seem to work.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions