cirq.ControlledGate

class cirq.ControlledGate(sub_gate: cirq.ops.raw_types.Gate, control_qubits: Sequence[Optional[cirq.ops.raw_types.Qid]] = None, num_controls: int = None)[source]

Augments existing gates with a control qubit.

__init__(sub_gate: cirq.ops.raw_types.Gate, control_qubits: Sequence[Optional[cirq.ops.raw_types.Qid]] = None, num_controls: int = None) → None[source]

Initializes the controlled gate.

Parameters:
  • sub_gate – The gate to add a control qubit to.
  • control_qubits – The qubits that would act as controls.
  • num_controls – Total number of control qubits.

Methods

controlled_by(*control_qubits) Returns a controlled version of this gate.
num_controls()
num_qubits() The number of qubits this gate acts on.
on(*qubits) Returns an application of this gate to the given qubits.
validate_args(qubits) Checks if this gate can be applied to the given qubits.
wrap_in_linear_combination(coefficient, …)