Quantum Circuits Library: Single-qubit gates

IGate

QuantumCircuitOpt.IGateFunction
IGate(num_qubits::Int64)

Identity matrix for an input number of qubits.

Matrix Representation (num_qubits = 1)

\[I = \begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix}\]

source

U3Gate

QuantumCircuitOpt.U3GateFunction
U3Gate(θ::Number, ϕ::Number, λ::Number)

Universal single-qubit rotation gate with three Euler angles, $\theta$, $\phi$ and $\lambda$.

Matrix Representation

\[\newcommand{\th}{\frac{\theta}{2}} U3(\theta, \phi, \lambda) = \begin{pmatrix} \cos(\th) & -e^{i\lambda}\sin(\th) \\ e^{i\phi}\sin(\th) & e^{i(\phi+\lambda)}\cos(\th) \end{pmatrix}\]

source

U2Gate

QuantumCircuitOpt.U2GateFunction
U2Gate(ϕ::Number, λ::Number)

Universal single-qubit rotation gate with two Euler angles, $\phi$ and $\lambda$. U2Gate is the special case of U3Gate.

Matrix Representation

\[U2(\phi, \lambda) = \frac{1}{\sqrt{2}} \begin{pmatrix} 1 & -e^{i\lambda} \\ e^{i\phi} & e^{i(\phi+\lambda)} \end{pmatrix}\]

source

U1Gate

QuantumCircuitOpt.U1GateFunction
U1Gate(λ::Number)

Universal single-qubit rotation gate with one Euler angle, $\lambda$. U1Gate represents rotation about the Z axis and is the special case of U3Gate, which also known as the PhaseGate. Also note that $U1(\pi) =$ZGate, $U1(\pi/2) =$SGate and $U1(\pi/4) =$TGate.

Matrix Representation

\[U1(\lambda) = \begin{pmatrix} 1 & 0 \\ 0 & e^{i\lambda} \end{pmatrix}\]

source

RGate

QuantumCircuitOpt.RGateFunction
RGate(θ::Number, ϕ::Number)

A single-qubit rotation gate with two Euler angles, $\theta$ and $\phi$, about the $\cos(\phi)x + \sin(\phi)y$ axis.

Matrix Representation

\[R(\theta, \phi) = e^{-i \theta \left(\cos{\phi} x + \sin{\phi} y\right)} = \begin{pmatrix} \cos{\theta} & -i e^{-i \phi} \sin{\theta} \\ -i e^{i \phi} \sin{\theta} & \cos{\theta} \end{pmatrix}\]

source

RXGate

QuantumCircuitOpt.RXGateFunction
RXGate(θ::Number)

A single-qubit Pauli gate which represents rotation about the X axis.

Matrix Representation

\[\newcommand{\th}{\frac{\theta}{2}} RX(\theta) = exp(-i \th X) = \begin{pmatrix} \cos{\th} & -i\sin{\th} \\ -i\sin{\th} & \cos{\th} \end{pmatrix}\]

source

RYGate

QuantumCircuitOpt.RYGateFunction
RYGate(θ::Number)

A single-qubit Pauli gate which represents rotation about the Y axis.

Matrix Representation

\[\newcommand{\th}{\frac{\theta}{2}} RY(\theta) = exp(-i \th Y) = \begin{pmatrix} \cos{\th} & -\sin{\th} \\ \sin{\th} & \cos{\th} \end{pmatrix}\]

source

RZGate

QuantumCircuitOpt.RZGateFunction
RZGate(θ::Number)

A single-qubit Pauli gate which represents rotation about the Z axis. This gate is also equivalent to U1Gate up to a phase factor, that is, $RZ(\theta) = e^{-i{\theta}/2}U1(\theta)$.

Matrix Representation

\[\newcommand{\th}{\frac{\theta}{2}} RZ(\theta) = exp(-i\th Z) = \begin{pmatrix} e^{-i\th} & 0 \\ 0 & e^{i\th} \end{pmatrix}\]

source

HGate

QuantumCircuitOpt.HGateFunction
HGate()

Single-qubit Hadamard gate, which is a $\pi$ rotation about the X+Z axis, thus equivalent to U3Gate($\frac{\pi}{2},0,\pi$)

Matrix Representation

\[H = \frac{1}{\sqrt{2}} \begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix}\]

source

XGate

QuantumCircuitOpt.XGateFunction
XGate()

Single-qubit Pauli-X gate ($\sigma_x$), equivalent to U3Gate($\pi,0,\pi$)

Matrix Representation

\[X = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}\]

source

YGate

QuantumCircuitOpt.YGateFunction
YGate()

Single-qubit Pauli-Y gate ($\sigma_y$), equivalent to U3Gate($\pi,\frac{\pi}{2},\frac{\pi}{2}$)

Matrix Representation

\[Y = \begin{pmatrix} 0 & -i \\ i & 0 \end{pmatrix}\]

source

ZGate

QuantumCircuitOpt.ZGateFunction
ZGate()

Single-qubit Pauli-Z gate ($\sigma_z$), equivalent to U3Gate($0,0,\pi$)

Matrix Representation

\[Z = \begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix}\]

source

SGate

QuantumCircuitOpt.SGateFunction
SGate()

Single-qubit S gate, equivalent to U3Gate($0,0,\frac{\pi}{2}$). This gate is also referred to as a Clifford gate, P gate or a square-root of Pauli-ZGate. Historically, this is also called as the phase gate (denoted by P), since it shifts the phase of the one state relative to the zero state.

Matrix Representation

\[S = \begin{pmatrix} 1 & 0 \\ 0 & i \end{pmatrix}\]

source

SdaggerGate

QuantumCircuitOpt.SdaggerGateFunction
SdaggerGate()

Single-qubit, hermitian conjugate of the SGate. This is also an alternative square root of the ZGate.

Matrix Representation

\[S = \begin{pmatrix} 1 & 0 \\ 0 & -i \end{pmatrix}\]

source

TGate

QuantumCircuitOpt.TGateFunction
TGate()

Single-qubit T gate, equivalent to U3Gate($0,0,\frac{\pi}{4}$). This gate is also referred to as a $\frac{\pi}{8}$ gate or as a fourth-root of Pauli-ZGate.

Matrix Representation

\[T = \begin{pmatrix} 1 & 0 \\ 0 & e^{i\pi/4} \end{pmatrix}\]

source

TdaggerGate

QuantumCircuitOpt.TdaggerGateFunction
TdaggerGate()

Single-qubit, hermitian conjugate of the TGate. This gate is equivalent to U3Gate($0,0,-\frac{\pi}{4}$). This gate is also referred to as the fourth-root of Pauli-ZGate.

Matrix Representation

\[T^{\dagger} = \begin{pmatrix} 1 & 0 \\ 0 & e^{-i\pi/4} \end{pmatrix}\]

source

SXGate

QuantumCircuitOpt.SXGateFunction
SXGate()

Single-qubit square root of pauli-XGate.

Matrix Representation

\[\sqrt{X} = \frac{1}{2} \begin{pmatrix} 1 + i & 1 - i \\ 1 - i & 1 + i \end{pmatrix}\]

source

SXdaggerGate

QuantumCircuitOpt.SXdaggerGateFunction
SXdaggerGate()

Single-qubit hermitian conjugate of the square root of pauli-XGate, or the SXGate.

Matrix Representation

\[\sqrt{X}^{\dagger} = \frac{1}{2} \begin{pmatrix} 1 - i & 1 + i \\ 1 + i & 1 - i \end{pmatrix}\]

source

PhaseGate

QuantumCircuitOpt.PhaseGateFunction
PhaseGate(λ::Number)

Single-qubit rotation gate about the Z axis. This is also equivalent to U3Gate($0,0,\lambda$). This gate is also referred to as the U1Gate.

Matrix Representation

\[P(\lambda) = \begin{pmatrix} 1 & 0 \\ 0 & e^{i\lambda} \end{pmatrix}\]

source