pytket.circuit.OpType

Enum for available operations compatible with the tket Circuit class.

Warning

All parametrised OpTypes which take angles (e.g. Rz, CPhase, FSim) expect parameters in multiples of pi (half-turns). This may differ from other quantum programming tools you have used, which have specified angles in radians, or perhaps even degrees. Therefore, for instance circuit.add_gate(OpType.Rx, 1, [0]) is equivalent in terms of the unitary to circuit.add_gate(OpType.X, [0])

class pytket._tket.circuit.OpType

Enum for available operations compatible with tket Circuit s.

Members:

Phase : Global phase: (α)[eiπα]

Z : Pauli Z: [1001]

X : Pauli X: [0110]

Y : Pauli Y: [0ii0]

S : [100i]=U1(12)

Sdg : S=[100i]=U1(12)

T : [100eiπ/4]=U1(14)

Tdg : T=[100eiπ/4]=U1(14)

V : 12[1ii1]=Rx(12)

Vdg : V=12[1ii1]=Rx(12)

SX : 12[1+i1i1i1+i]=eiπ4Rx(12)

SXdg : SX=12[1i1+i1+i1i]=eiπ4Rx(12)

H : Hadamard gate: 12[1111]

Rx : (α)e12iπαX=[cosπα2isinπα2isinπα2cosπα2]

Ry : (α)e12iπαY=[cosπα2sinπα2sinπα2cosπα2]

Rz : (α)e12iπαZ=[e12iπα00e12iπα]

U1 : (λ)U3(0,0,λ)=e12iπλRz(λ). U-gates are used by IBM. See https://qiskit.org/documentation/tutorials/circuits/3_summary_of_quantum_operations.html for more information on U-gates.

U2 : (ϕ,λ)U3(12,ϕ,λ)=e12iπ(λ+ϕ)Rz(ϕ)Ry(12)Rz(λ), defined by matrix multiplication

U3 : (θ,ϕ,λ)[cosπθ2eiπλsinπθ2eiπϕsinπθ2eiπ(λ+ϕ)cosπθ2]=e12iπ(λ+ϕ)Rz(ϕ)Ry(θ)Rz(λ)

GPI : (ϕ)[0eiπϕeiπϕ0]

GPI2 : (ϕ)12[1ieiπϕieiπϕ1]

AAMS : (θ,ϕ0,ϕ1)[cosπθ200ieiπ(ϕ0+ϕ1)sinπθ20cosπθ2ieiπ(ϕ1ϕ0)sinπθ200ieiπ(ϕ0ϕ1)sinπθ2cosπθ20ieiπ(ϕ0+ϕ1)sinπθ200cosπθ2]

TK1 : (α,β,γ)Rz(α)Rx(β)Rz(γ)

TK2 : (α,β,γ)XXPhase(α)YYPhase(β)ZZPhase(γ)

CX : Controlled X gate

CY : Controlled Y gate

CZ : Controlled Z gate

CH : Controlled H gate

CV : Controlled V gate

CVdg : Controlled V gate

CSX : Controlled SX gate

CSXdg : Controlled SX gate

CS : Controlled S gate

CSdg : Controlled S gate

CRz : (α) Controlled Rz(α) gate

CRx : (α) Controlled Rx(α) gate

CRy : (α) Controlled Ry(α) gate

CU1 : (λ) Controlled U1(λ) gate. Note that this is not equivalent to a CRz(λ) up to global phase, differing by an extra Rz(λ2) on the control qubit.

CU3 : (θ,ϕ,λ) Controlled U3(θ,ϕ,λ) gate. Similar rules apply.

CCX : Toffoli gate

ECR : 12[001i00i11i00i100]

SWAP : Swap gate

CSWAP : Controlled swap gate

noop : Identity gate. These gates are not permanent and are automatically stripped by the compiler

Barrier : Meta-operation preventing compilation through it. Not automatically stripped by the compiler

Label : Label for control flow jumps. Does not appear within a circuit

Branch : A control flow jump to a label dependent on the value of a given Bit. Does not appear within a circuit

Goto : An unconditional control flow jump to a Label. Does not appear within a circuit.

Stop : Halts execution immediately. Used to terminate a program. Does not appear within a circuit.

BRIDGE : A CX Bridge over 3 qubits. Used to apply a logical CX between the first and third qubits when they are not adjacent on the device, but both neighbour the second qubit. Acts as the identity on the second qubit

Measure : Z-basis projective measurement, storing the measurement outcome in a specified bit

Reset : Resets the qubit to |0

CircBox : Represents an arbitrary subcircuit

PhasePolyBox : An operation representing arbitrary circuits made up of CX and Rz gates, represented as a phase polynomial together with a boolean matrix representing an additional linear transformation.

Unitary1qBox : Represents an arbitrary one-qubit unitary operation by its matrix

Unitary2qBox : Represents an arbitrary two-qubit unitary operation by its matrix

Unitary3qBox : Represents an arbitrary three-qubit unitary operation by its matrix

ExpBox : A two-qubit operation corresponding to a unitary matrix defined as the exponential eitA of an arbitrary 4x4 hermitian matrix A.

PauliExpBox : An operation defined as the exponential eiπα2P of a tensor P of Pauli operations.

PauliExpPairBox : A pair of (not necessarily commuting) Pauli exponentials eiπα2P performed in sequence.

PauliExpCommutingSetBox : An operation defined as a setof commuting exponentials of the form eiπα2P of a tensor P of Pauli operations.

TermSequenceBox : An unordered collection of Pauli exponentials that can be synthesised in any order, causing a change in the unitary operation. Synthesis order depends on the synthesis strategy chosen only.

QControlBox : An arbitrary n-controlled operation

ToffoliBox : A permutation of classical basis states

ConjugationBox : An operation composed of ‘action’, ‘compute’ and ‘uncompute’ circuits

DummyBox : A placeholder operation that holds resource data

CustomGate : (α,β,) A user-defined operation, based on a Circuit C with parameters α,β, substituted in place of bound symbolic variables in C, as defined by the CustomGateDef.

Conditional : An operation to be applied conditionally on the value of some classical register

ISWAP : (α)e14iπα(XX+YY)=[10000cosπα2isinπα200isinπα2cosπα200001]

PhasedISWAP : (p,t)[10000cosπt2isinπt2e2iπp00isinπt2e2iπpcosπt200001] (equivalent to: Rz(p)[0]; Rz(-p)[1]; ISWAP(t); Rz(-p)[0]; Rz(p)[1])

XXPhase : (α)e12iπα(XX)=[cosπα200isinπα20cosπα2isinπα200isinπα2cosπα20isinπα200cosπα2]

YYPhase : (α)e12iπα(YY)=[cosπα200isinπα20cosπα2isinπα200isinπα2cosπα20isinπα200cosπα2]

ZZPhase : (α)e12iπα(ZZ)=[e12iπα0000e12iπα0000e12iπα0000e12iπα]

XXPhase3 : A 3-qubit gate XXPhase3(α) consists of pairwise 2-qubit XXPhase(α) interactions. Equivalent to XXPhase(α)[0, 1] XXPhase(α)[1, 2] XXPhase(α)[0, 2].

PhasedX : (α,β)Rz(β)Rx(α)Rz(β) (matrix-multiplication order)

NPhasedX : (α,β)PhasedX(α,β)n (n-qubit gate composed of identical PhasedX in parallel.

CnRx : (α) := n-controlled Rx(α) gate.

CnRy : (α) := n-controlled Ry(α) gate.

CnRz : (α) := n-controlled Rz(α) gate.

CnX : n-controlled X gate.

CnY : n-controlled Y gate.

CnZ : n-controlled Z gate.

ZZMax : eiπ4(ZZ), a maximally entangling ZZPhase

ESWAP : αe12iπαSWAP=[e12iπα0000cosπα2isinπα200isinπα2cosπα20000e12iπα]

FSim : (α,β)[10000cosπαisinπα00isinπαcosπα0000eiπβ]

Sycamore : FSim(12,16)

ISWAPMax : ISWAP(1)=[100000i00i000001]

ClassicalTransform : A general classical operation where all inputs are also outputs

WASM : Op containing a classical wasm function call

SetBits : An operation to set some bits to specified values

CopyBits : An operation to copy some bit values

RangePredicate : A classical predicate defined by a range of values in binary encoding

ExplicitPredicate : A classical predicate defined by a truth table

ExplicitModifier : An operation defined by a truth table that modifies one bit

MultiBit : A classical operation applied to multiple bits simultaneously

ClassicalExpBox : A box for holding compound classical operations on Bits.

MultiplexorBox : A multiplexor (i.e. uniformly controlled operations)

MultiplexedRotationBox : A multiplexed rotation gate (i.e. uniformly controlled single-axis rotations)

MultiplexedU2Box : A multiplexed U2 gate (i.e. uniformly controlled U2 gate)

MultiplexedTensoredU2Box : A multiplexed tensored-U2 gate

StatePreparationBox : A box for preparing quantum states using multiplexed-Ry and multiplexed-Rz gates

DiagonalBox : A box for synthesising a diagonal unitary matrix into a sequence of multiplexed-Rz gates

ClExpr : A classical expression

static from_name(arg0: str) pytket._tket.circuit.OpType

Construct from name

property name