You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import cirq
class G(cirq.TwoQubitGate):
def _decompose_(self, qubits):
a, b = qubits
yield cirq.X(a)**0.5
yield cirq.H(b)
yield cirq.CZ(a, b)
cg = cirq.ControlledGate(G())
x, y, z = cirq.LineQubit.range(3)
c = cirq.Circuit.from_ops(cg(x, y, z))
print(c.to_unitary_matrix())
but currently it raises an exception:
Operation without a known matrix or decomposition: cirq.ControlledGate(sub_gate=[...G...].on(cirq.LineQubit(0), cirq.LineQubit(1), cirq.LineQubit(2))
because ControlledGate doesn't have a _decompose_ method. This issue is to add that method.