Say we have a custom gate CG
, defined by a unitary matrix U
, and line qubits qubits
in Cirq. Something like this:
import numpy
import cirq
U = np.eye(8) # The custom unitary matrix goes here
CG = cirq.MatrixGate(U)
qubits = cirq.LineQubit.range(3)
We build the circuit as follows:
circuit = cirq.Circuit()
circuit.append(CG(qubits[0], qubits[1], qubits[2]))
Is it possible to build the circuit without explicitly specifying all the qubits? Something like circuit.append(CG(qubits))
, which would apply the CG
gate to all the qubits?