def __init__(self, gate: raw_types.Gate, qubits: Sequence[raw_types.Qid]) -> None: """ Args: gate: The gate to apply. qubits: The qubits to operate on. """ gate.validate_args(qubits) self._gate = gate self._qubits = tuple(qubits)
def __init__(self, gate: raw_types.Gate, qubits: Sequence[raw_types.Qid]) -> None: """ Args: gate: the gate to apply qubits: lists of lists of qubits to apply the gate to. """ if gate.num_qubits() != 1: raise ValueError("gate must be a single qubit gate") if len(set(qubits)) != len(qubits): raise ValueError("repeated qubits are not allowed") for qubit in qubits: gate.validate_args([qubit]) self._gate = gate self._qubits = tuple(qubits)