Quantum Circuits Library: Single-qubit gates
IGate
QuantumCircuitOpt.IGate
— FunctionIGate(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}\]
U3Gate
QuantumCircuitOpt.U3Gate
— FunctionU3Gate(θ::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}\]
U2Gate
QuantumCircuitOpt.U2Gate
— FunctionU2Gate(ϕ::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}\]
U1Gate
QuantumCircuitOpt.U1Gate
— FunctionU1Gate(λ::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}\]
RGate
QuantumCircuitOpt.RGate
— FunctionRGate(θ::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}\]
RXGate
QuantumCircuitOpt.RXGate
— FunctionRXGate(θ::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}\]
RYGate
QuantumCircuitOpt.RYGate
— FunctionRYGate(θ::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}\]
RZGate
QuantumCircuitOpt.RZGate
— FunctionRZGate(θ::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}\]
HGate
QuantumCircuitOpt.HGate
— FunctionHGate()
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}\]
XGate
QuantumCircuitOpt.XGate
— FunctionXGate()
Single-qubit Pauli-X gate ($\sigma_x$), equivalent to U3Gate($\pi,0,\pi$)
Matrix Representation
\[X = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}\]
YGate
QuantumCircuitOpt.YGate
— FunctionYGate()
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}\]
ZGate
QuantumCircuitOpt.ZGate
— FunctionZGate()
Single-qubit Pauli-Z gate ($\sigma_z$), equivalent to U3Gate($0,0,\pi$)
Matrix Representation
\[Z = \begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix}\]
SGate
QuantumCircuitOpt.SGate
— FunctionSGate()
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}\]
SdaggerGate
QuantumCircuitOpt.SdaggerGate
— FunctionSdaggerGate()
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}\]
TGate
QuantumCircuitOpt.TGate
— FunctionTGate()
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}\]
TdaggerGate
QuantumCircuitOpt.TdaggerGate
— FunctionTdaggerGate()
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}\]
SXGate
QuantumCircuitOpt.SXGate
— FunctionSXGate()
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}\]
SXdaggerGate
QuantumCircuitOpt.SXdaggerGate
— FunctionSXdaggerGate()
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}\]
PhaseGate
QuantumCircuitOpt.PhaseGate
— FunctionPhaseGate(λ::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}\]