cirq.Operation.controlled_by

Operation.controlled_by(*control_qubits: cirq.Qid, control_values: Optional[Sequence[Union[int, Collection[int]]]] = None) → cirq.Operation[source]
Returns a controlled version of this operation. If no control_qubits
are specified, returns self.
Parameters
  • control_qubits – Qubits to control the operation by. Required.

  • control_values – For which control qubit values to apply the operation. A sequence of the same length as control_qubits where each entry is an integer (or set of integers) corresponding to the qubit value (or set of possible values) where that control is enabled. When all controls are enabled, the operation is applied. If unspecified, control values default to 1.