An application of several copies of a gate to a group of qubits.

Inherits From: Operation

gate The single qubit gate applied by the operation.
qubits The qubits targeted by the operation.
tags Returns a tuple of the operation's tags.
untagged Returns the underlying operation without any tags.



View source

Returns a controlled version of this operation. If no control_qubits are specified, returns self.

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.


View source

Returns the same operation, but with different qubits.

func The function to use to turn each current qubit into a desired new qubit.

The receiving operation but with qubits transformed by the given function.


View source

Raises an exception if the qubits don't match this operation's qid shape.

Call this method from a subclass's with_qubits method.

qubits The new qids for the operation.

ValueError The operation had qids that don't match it's qid shape.


View source

ParallelGateOperation with same qubits but a new gate


View source


View source

ParallelGateOperation with same the gate but new qubits


View source

Creates a new TaggedOperation, with this op and the specified tags.

This method can be used to attach meta-data to specific operations without affecting their functionality. The intended usage is to attach classes intended for this purpose or strings to mark operations for specific usage that will be recognized by consumers. Specific examples include ignoring this operation in optimization passes, hardware-specific functionality, or circuit diagram customizability.

Tags can be a list of any type of object that is useful to identify this operation as long as the type is hashable. If you wish the resulting operation to be eventually serialized into JSON, you should also restrict the operation to be JSON serializable.

new_tags The tags to wrap this operation in.


View source


View source


View source

Raise gate to a power, then reapply to the same qubits.

Only works if the gate implements cirq.ExtrapolatableEffect.

For extrapolatable gate G this means the following two are equivalent:

(G ** 1.5)(qubit)  or  G(qubit) ** 1.5

exponent The amount to scale the gate's effect by.

A new operation on the same qubits with the scaled gate.