Module: cirq.ops

Types for representing and methods for manipulating circuit operation trees.

Modules

arithmetic_operation module: Helper class for implementing classical arithmetic operations.

clifford_gate module

common_channels module: Quantum channels that are commonly used in the literature.

common_gates module: Quantum gates that are commonly used in the literature.

controlled_gate module

controlled_operation module

dense_pauli_string module

diagonal_gate module: Creates the gate instance for any number qubits diagonal gate.

eigen_gate module

fourier_transform module

fsim_gate module: Defines the fermionic simulation gate family.

gate_features module: Marker classes for indicating which additional features gates support.

gate_operation module: Basic types defining qubits, gates, and operations.

global_phase_op module: A no-qubit global phase operation.

identity module: IdentityGate.

linear_combinations module

matrix_gates module: Quantum gates defined by a matrix.

measure_util module

measurement_gate module

moment module: A simplified time-slice of operations within a sequenced circuit.

named_qubit module

op_tree module: A recursive type describing trees of operations, and utility methods for it.

parallel_gate_operation module

parity_gates module: Quantum gates that phase with respect to product-of-pauli observables.

pauli_gates module

pauli_interaction_gate module

pauli_string module

pauli_string_phasor module

pauli_string_raw_types module

pauli_sum_exponential module

permutation_gate module

phased_iswap_gate module: ISWAPPowGate conjugated by tensor product Rz(phi) and Rz(-phi).

phased_x_gate module: An XPowGate conjugated by ZPowGates.

phased_x_z_gate module

qubit_order module

qubit_order_or_list module: Any method taking a QubitOrder instance should also take raw qubit lists.

random_gate_channel module

raw_types module: Basic types defining qubits, gates, and operations.

swap_gates module: SWAP and ISWAP gates.

tags module: Canonical tags for the TaggedOperation class.

three_qubit_gates module: Common quantum gates that target three qubits.

two_qubit_diagonal_gate module: Creates the gate instance for a two qubit diagonal gate.

wait_gate module

Classes

class AmplitudeDampingChannel: Dampen qubit amplitudes through dissipation.

class ArithmeticOperation: A helper class for implementing reversible classical arithmetic.

class AsymmetricDepolarizingChannel: A channel that depolarizes asymmetrically along different directions.

class BaseDensePauliString: Parent class for DensePauliString and MutableDensePauliString.

class BitFlipChannel: Probabilistically flip a qubit from 1 to 0 state or vice versa.

class CCNotPowGate: A Toffoli (doubly-controlled-NOT) that can be raised to a power.

class CCXPowGate: A Toffoli (doubly-controlled-NOT) that can be raised to a power.

class CCZPowGate: A doubly-controlled-Z that can be raised to a power.

class CNotPowGate: A gate that applies a controlled power of an X gate.

class CSwapGate: A controlled swap gate. The Fredkin gate.

class CXPowGate: A gate that applies a controlled power of an X gate.

class CZPowGate: A gate that applies a phase to the |11⟩ state of two qubits.

class ControlledGate: Augments existing gates to have one or more control qubits.

class ControlledOperation: Augments existing operations to have one or more control qubits.

class DensePauliString: Parent class for DensePauliString and MutableDensePauliString.

class DepolarizingChannel: A channel that depolarizes one or several qubits.

class DiagonalGate: A gate given by a diagonal (2^n)\times(2^n) matrix.

class EigenGate: A gate with a known eigendecomposition.

class FSimGate: Fermionic simulation gate family.

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

class GateOperation: An application of a gate to a sequence of qubits.

class GeneralizedAmplitudeDampingChannel: Dampen qubit amplitudes through non ideal dissipation.

class GlobalPhaseOperation: An effect applied to a collection of qubits.

class HPowGate: A Gate that performs a rotation around the X+Z axis of the Bloch sphere.

class ISwapPowGate: Rotates the |01⟩ vs |10⟩ subspace of two qubits around its Bloch X-axis.

class IdentityGate: A Gate that perform no operation on qubits.

class InterchangeableQubitsGate: Indicates operations should be equal under some qubit permutations.

class LinearCombinationOfGates: Represents linear operator defined by a linear combination of gates.

class LinearCombinationOfOperations: Represents operator defined by linear combination of gate operations.

class MatrixGate: A unitary qubit or qudit gate defined entirely by its matrix.

class MeasurementGate: A gate that measures qubits in the computational basis.

class Moment: A time-slice of operations within a circuit.

class MutableDensePauliString: Parent class for DensePauliString and MutableDensePauliString.

class MutablePauliString: Abstract base class for generic types.

class NamedQid: A qid identified by name.

class NamedQubit: A qubit identified by name.

class Operation: An effect applied to a collection of qubits.

class ParallelGateOperation: An application of several copies of a gate to a group of qubits.

class Pauli: Represents the Pauli gates.

class PauliInteractionGate: A CZ conjugated by arbitrary single qubit Cliffords.

class PauliString: An effect applied to a collection of qubits.

class PauliStringGateOperation: An effect applied to a collection of qubits.

class PauliStringPhasor: An operation that phases the eigenstates of a Pauli string.

class PauliSum: Represents operator defined by linear combination of PauliStrings.

class PauliSumExponential: Represents an operator defined by the exponential of a PauliSum.

class PauliTransform: +X, -X, +Y, -Y, +Z, or -Z.

class PhaseDampingChannel: Dampen qubit phase.

class PhaseFlipChannel: Probabilistically flip the sign of the phase of a qubit.

class PhaseGradientGate: Phases each state |k⟩ out of n by e^(2piik/nexponent).

class PhasedFSimGate: General excitation-preserving two-qubit gate.

class PhasedISwapPowGate: Fractional ISWAP conjugated by Z rotations.

class PhasedXPowGate: A gate equivalent to the circuit ───Z^-p───X^t───Z^p───.

class PhasedXZGate: A single qubit operation expressed as $Z^z Z^a X^x Z^{-a}$.

class Qid: Identifies a quantum object such as a qubit, qudit, resonator, etc.

class QuantumFourierTransformGate: Switches from the computational basis to the frequency basis.

class QubitOrder: Defines the kronecker product order of qubits.

class QubitPermutationGate: A qubit permutation gate specified by a permutation list.

class RandomGateChannel: Applies a sub gate with some probability.

class ResetChannel: Reset a qubit back to its |0⟩ state.

class Rx: A gate, with matrix e^{-i X rads/2}, that rotates around the X axis of the Bloch sphere.

class Ry: A gate, with matrix e^{-i Y rads/2}, that rotates around the Y axis of the Bloch sphere.

class Rz: A gate, with matrix e^{-i Z rads/2}, that rotates around the Z axis of the Bloch sphere.

class SingleQubitCliffordGate: Any single qubit Clifford rotation.

class SingleQubitGate: A gate that must be applied to exactly one qubit.

class SingleQubitPauliStringGateOperation: A Pauli operation applied to a qubit.

class SwapPowGate: The SWAP gate, possibly raised to a power. Exchanges qubits.

class TaggedOperation: Operation annotated with a set of Tags.

class ThreeQubitDiagonalGate: A gate given by a diagonal 8x8 matrix.

class ThreeQubitGate: A gate that must be applied to exactly three qubits.

class TwoQubitDiagonalGate: A gate given by a diagonal 4\times 4 matrix.

class TwoQubitGate: A gate that must be applied to exactly two qubits.

class VirtualTag: A TaggedOperation tag indicating that the operation is virtual.

class WaitGate: A single-qubit idle gate that represents waiting.

class XPowGate: A gate that rotates around the X axis of the Bloch sphere.

class XXPowGate: The X-parity gate, possibly raised to a power.

class YPowGate: A gate that rotates around the Y axis of the Bloch sphere.

class YYPowGate: The Y-parity gate, possibly raised to a power.

class ZPowGate: A gate that rotates around the Z axis of the Bloch sphere.

class ZZPowGate: The Z-parity gate, possibly raised to a power.

Functions

CCNOT(...): The TOFFOLI gate, also known as the Controlled-Controlled-X gate.

CCX(...): The TOFFOLI gate, also known as the Controlled-Controlled-X gate.

CCZ(...): The Controlled-Controlled-Z gate.

CNOT(...): The controlled NOT gate.

CSWAP(...): The Controlled Swap gate, also known as the Fredkin gate.

CX(...): The controlled NOT gate.

CZ(...): The controlled Z gate.

FREDKIN(...): The Controlled Swap gate, also known as the Fredkin gate.

H(...): The Hadamard gate.

I(...): The one qubit identity gate.

ISWAP(...): The iswap gate.

S(...): The Clifford S gate.

SWAP(...): The swap gate.

T(...): The non-Clifford T gate.

TOFFOLI(...): The TOFFOLI gate, also known as the Controlled-Controlled-X gate.

X(...): The Pauli X gate.

XX(...): The tensor product of two X gates.

Y(...): The Pauli Y gate.

YY(...): The tensor product of two Y gates.

Z(...): The Pauli Z gate.

ZZ(...): The tensor product of two Z gates.

amplitude_damp(...): Returns an AmplitudeDampingChannel with the given probability gamma.

asymmetric_depolarize(...): Returns a AsymmetricDepolarizingChannel with given parameter.

bit_flip(...): Construct a BitFlipChannel that flips a qubit state

cphase(...): Returns a gate with the matrix diag(1, 1, 1, e^{i rads}.

depolarize(...): Returns a DepolarizingChannel with given probability of error.

flatten_op_tree(...): Performs an in-order iteration of the operations (leaves) in an OP_TREE.

flatten_to_ops(...): Performs an in-order iteration of the operations (leaves) in an OP_TREE.

flatten_to_ops_or_moments(...): Performs an in-order iteration OP_TREE, yielding ops and moments.

freeze_op_tree(...): Replaces all iterables in the OP_TREE with tuples.

generalized_amplitude_damp(...): Returns a GeneralizedAmplitudeDampingChannel with the given

givens(...): Returns gate with matrix exp(-i angle_rads (Y⊗X - X⊗Y) / 2).

identity_each(...): Returns a single IdentityGate applied to all the given qubits.

measure(...): Returns a single MeasurementGate applied to all the given qubits.

measure_each(...): Returns a list of operations individually measuring the given qubits.

phase_damp(...): Creates a PhaseDampingChannel with damping constant gamma.

phase_flip(...): Returns a PhaseFlipChannel that flips a qubit's phase with probability p

qft(...): The quantum Fourier transform.

reset(...): Returns a ResetChannel on the given qubit.

riswap(...): Returns gate with matrix exp(+i angle_rads (X⊗X + Y⊗Y) / 2).

rx(...): Returns a gate with the matrix e^{-i X rads / 2}.

ry(...): Returns a gate with the matrix e^{-i Y rads / 2}.

rz(...): Returns a gate with the matrix e^{-i Z rads / 2}.

transform_op_tree(...): Maps transformation functions onto the nodes of an OP_TREE.

wait(...): Creates a WaitGate applied to all the given qubits.

Type Aliases

OP_TREE: An operation or nested collections of operations.

PAULI_GATE_LIKE: An object that can be interpreted as a Pauli gate.

PAULI_STRING_LIKE: A cirq.PauliString or a value that can easily be converted into one.

PauliSumLike: Any value that can be easily translated into a sum of Pauli products.

QubitOrderOrList: Specifies a qubit ordering.