# cirq.Gate¶

class cirq.Gate[source]

An operation type that can be applied to a collection of qubits.

Gates can be applied to qubits by calling their on() method with
the qubits to be applied to supplied, or, alternatively, by simply
calling the gate on the qubits. In other words calling MyGate.on(q1, q2)
to create an Operation on q1 and q2 is equivalent to MyGate(q1,q2).
Gates operate on a certain number of qubits. All implementations of gate
must implement the num_qubits method declaring how many qubits they
act on. The gate feature classes SingleQubitGate and TwoQubitGate
can be used to avoid writing this boilerplate.
Linear combinations of gates can be created by adding gates together and
multiplying them by scalars.
__init__()

Initialize self. See help(type(self)) for accurate signature.

Methods

 controlled_by(*control_qubits) Returns a controlled version of this gate. 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, …)