# pytket.circuit.OpType¶

Enum for available operations compatible with the $$\mathrm{t|ket}\rangle$$ Circuit class.

class pytket.circuit.OpType

Enum for available operations compatible with $$\mathrm{t|ket}\rangle$$ Circuit s.

Members:

Z : Pauli $$Z$$

X : Pauli $$X$$

Y : Pauli $$Y$$

S : $$\mathrm{Rz}(\frac{1}{2})$$

Sdg : $$S^{\dagger} = \mathrm{Rz}(-\frac{1}{2})$$

T : $$\mathrm{Rz}(\frac{1}{4})$$

Tdg : $$T^{\dagger} = \mathrm{Rz}(-\frac{1}{4})$$

V : $$\mathrm{Rx}(\frac{1}{2})$$

Vdg : $$V^{\dagger} = \mathrm{Rx}(-\frac{1}{2})$$

H : Hadamard gate

Rx : $$(\alpha) \mapsto e^{- \frac{i \pi \alpha}{2} X}$$

Ry : $$(\alpha) \mapsto e^{- \frac{i \pi \alpha}{2} Y}$$

Rz : $$(\alpha) \mapsto e^{- \frac{i \pi \alpha}{2} Z}$$

U1 : $$(\lambda) \mapsto \mathrm{Rz}(\lambda)$$, up to global phase. U-gates are used by IBM. See https://github.com/Qiskit/qiskit-iqx-tutorials/blob/master/qiskit/fundamentals/7_summary_of_quantum_operations.ipynb for more information on U-gates.

U2 : $$(\phi, \lambda) \mapsto \mathrm{Rz}(\phi)\mathrm{Ry}(\frac{1}{2})\mathrm{Rz}(\lambda)$$, defined by matrix multiplication, up to global phase.

U3 : $$(\theta, \phi, \lambda) \mapsto \mathrm{U1}(\phi)\mathrm{Ry}(\theta)\mathrm{U1}(\lambda)$$, up to global phase.

TK1 : $$(\alpha, \beta, \gamma) \mapsto \mathrm{Rz}(\gamma) \mathrm{Rx}(\beta) \mathrm{Rz}(\alpha)$$

CX : Controlled $$X$$ gate

CY : Controlled $$Y$$ gate

CZ : Controlled $$Z$$ gate

CH : Controlled $$H$$ gate

CRz : $$(\alpha) \mapsto$$ Controlled $$\mathrm{Rz}(\alpha)$$ gate

CU1 : $$(\lambda) \mapsto$$ Controlled $$\mathrm{U1}(\lambda)$$ gate. Note that this is not equivalent to a $$\mathrm{CRz}(\lambda)$$ up to global phase, differing by an extra $$\mathrm{Rz}(\frac{\alpha}{2})$$ on the control qubit.

CU3 : $$(\theta, \phi, \lambda) \mapsto$$ Controlled $$\mathrm{U3}(\theta, \phi, \lambda)$$ gate. Similar rules apply.

CCX : Toffoli gate

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 $$\left|0\right>$$

CircBox : Represents an arbitrary subcircuit

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

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

ExpBox : A two-qubit operation corresponding to a unitary matrix defined as the exponential $$e^{itA}$$ of an arbitrary 4x4 hermitian matrix $$A$$.

PauliExpBox : An operation defined as the exponential $$e^{-\frac{i\pi\alpha}{2} P}$$ of a tensor $$P$$ of Pauli operations.

Custom : $$(\alpha, \beta, \ldots) \mapsto$$ A user-defined operation, based on a Circuit $$C$$ with parameters $$\alpha, \beta, \ldots$$ substituted in place of bound symbolic variables in $$C$$, as defined by the CustomGateDef.

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

ISWAP : $$(\alpha) \mapsto e^{\frac{i\pi \alpha}{4} (X \otimes X + Y \otimes Y)}$$

XXPhase : $$(\alpha) \mapsto e^{- \frac{i \pi \alpha}{2} (X \otimes X)}$$

YYPhase : $$(\alpha) \mapsto e^{- \frac{i \pi \alpha}{2} (Y \otimes Y)}$$

ZZPhase : $$(\alpha) \mapsto e^{- \frac{i \pi \alpha}{2} (Z \otimes Z)}$$

PhasedX : $$(\alpha,\beta) \mapsto \mathrm{Rz}(\beta)\mathrm{Rx}(\alpha)\mathrm{Rz}(-\beta)$$ (matrix-multiplication order)

CnRy : $$(\alpha)$$ := n-controlled $$\mathrm{Ry}(\alpha)$$ gate.

CnX : n-controlled X gate.

ZZMax : $$e^{-\frac{i\pi}{4}(Z \otimes Z)}$$, a maximally entangling ZZPhase

ESWAP : $$\alpha \mapsto e^{-\frac12 i\pi\alpha \cdot \mathrm{SWAP}} = \left[ \begin{array}{cccc} e^{-\frac12 i \pi\alpha} & 0 & 0 & 0 \\ 0 & \cos\frac{\pi\alpha}{2} & -i\sin\frac{\pi\alpha}{2} & 0 \\ 0 & -i\sin\frac{\pi\alpha}{2} & \cos\frac{\pi\alpha}{2} & 0 \\ 0 & 0 & 0 & e^{-\frac12 i \pi\alpha} \end{array} \right]$$

FSim : $$(\alpha, \beta) \mapsto \left[ \begin{array}{cccc} 1 & 0 & 0 & 0 \\ 0 & \cos\frac{\pi\alpha}{2} & -i\sin\frac{\pi\alpha}{2} & 0 \\ 0 & -i\sin\frac{\pi\alpha}{2} & \cos\frac{\pi\alpha}{2} & 0 \\ 0 & 0 & 0 & e^{-i\pi\beta} \end{array} \right]$$ (with $$\alpha = 1$$ and $$\beta = \frac16$$ this is the ‘Sycamore gate’)

property name

(self: handle) -> str