cirq.ControlledGate.validate_args

ControlledGate.validate_args(qubits: Sequence[cirq.Qid]) → None

Checks if this gate can be applied to the given qubits.

By default checks that:

  • inputs are of type Qid

  • len(qubits) == num_qubits()

  • qubit_i.dimension == qid_shape[i] for all qubits

Child classes can override. The child implementation should call
super().validate_args(qubits) then do custom checks.
Parameters

qubits – The sequence of qubits to potentially apply the gate to.

Throws:

ValueError: The gate can’t be applied to the qubits.