Standard Gates

Single Qubit Gates

MimiqCircuitsBase.GateUType
GateU(θ, ϕ, λ[, γ = 0])

Single qubit generic unitary gate $U(\theta, \phi, \lambda, \gamma = 0)$, where $\theta$, $\phi$, and $\lambda$ are the Euler angles specified in radians, and $\gamma$ is a global phase.

See also GateU3, GateP, GateU2, GateU1

Matrix representation

\[\operatorname{U}(\theta, \phi, \lambda, \gamma = 0) = \mathrm{e}^{i\gamma} \begin{pmatrix} \cos\left(\frac{\theta}{2}\right) & -\mathrm{e}^{i\lambda}\sin\left(\frac{\theta}{2}\right) \\ \mathrm{e}^{i\phi}\sin\left(\frac{\theta}{2}\right) & \mathrm{e}^{i(\phi+\lambda)}\cos\left(\frac{\theta}{2}\right) \end{pmatrix}\]

Examples

julia> @variables θ ϕ λ
3-element Vector{Symbolics.Num}:
 θ
 ϕ
 λ

julia> GateU(θ, ϕ, λ)
U(θ, ϕ, λ)

julia> matrix(GateU(2.023, 0.5, 0.1))
2×2 Matrix{ComplexF64}:
  0.53059+0.0im       -0.843394-0.0846217im
 0.743864+0.406375im   0.437915+0.299594im

julia> c = push!(Circuit(), GateU(θ, ϕ, λ), 1)
1-qubit circuit with 1 instruction:
└── U(θ,ϕ,λ) @ q[1]

julia> push!(c, GateU(π/8, π/2, π/4), 2)
2-qubit circuit with 2 instructions:
├── U(θ,ϕ,λ) @ q[1]
└── U(π/8,π/2,π/4) @ q[2]

julia> power(GateU(θ, ϕ, λ), 2), inverse(GateU(θ, ϕ, λ))
(GateU(θ, ϕ, λ, 0π)^2, GateU(-θ, -λ, -ϕ, 0π))

Decomposition

Since $U$ gate, is the most general single qubit unitary matrix, all other matrices are defined from it.

julia> decompose(GateU(θ, λ, ϕ))
1-qubit circuit with 1 instruction:
└── U(θ,λ,ϕ) @ q[1]
source
MimiqCircuitsBase.GatePType
GateP(λ)

Single qubit Phase gate.

λ is the phase angle in radians.

Matrix representation

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

Examples

julia> @variables λ
1-element Vector{Symbolics.Num}:
 λ

julia> GateP(λ)
P(λ)

julia> matrix(GateP(1.989))
2×2 Matrix{ComplexF64}:
 1.0+0.0im       0.0+0.0im
 0.0+0.0im  -0.40612+0.91382im

julia> c = push!(Circuit(), GateP(λ), 1)
1-qubit circuit with 1 instruction:
└── P(λ) @ q[1]

julia> push!(c, GateP(π/2), 2)
2-qubit circuit with 2 instructions:
├── P(λ) @ q[1]
└── P(π/2) @ q[2]

Decomposition

julia> decompose(GateP(λ))
1-qubit circuit with 1 instruction:
└── U(0,0,λ) @ q[1]
source
MimiqCircuitsBase.GateU1Type
GateU1(λ)

Single qubit rotation \operatorname{U1}(\lambda) about the Z axis.

Equivalent to GateP.

Matrix representation

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

Examples

julia> @variables λ
1-element Vector{Symbolics.Num}:
 λ

julia> GateU1(λ)
U1(λ)

julia> matrix(GateU1(0.519))
2×2 Matrix{ComplexF64}:
 1.0+0.0im       0.0+0.0im
 0.0+0.0im  0.868316+0.496012im

julia> c = push!(Circuit(), GateU1(λ), 1)
1-qubit circuit with 1 instruction:
└── U1(λ) @ q[1]

julia> push!(c, GateU1(π/2), 2)
2-qubit circuit with 2 instructions:
├── U1(λ) @ q[1]
└── U1(π/2) @ q[2]

julia> power(GateU1(λ), 2), inverse(GateU1(λ))
(GateU1(λ)^2, GateU1(-λ))

Decomposition

julia> decompose(GateU1(λ))
1-qubit circuit with 1 instruction:
└── U(0,0,λ) @ q[1]
source
MimiqCircuitsBase.GateU2Type
GateU2(ϕ, λ)

Single qubit rotation \operatorname{U2}(\phi, \lambda) about the X+Z axis.

Matrix representation

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

Examples

julia> @variables ϕ λ
2-element Vector{Symbolics.Num}:
 ϕ
 λ

julia> GateU2(ϕ, λ)
U2(ϕ, λ)

julia> matrix(GateU2(2.023, 0.5))
2×2 Matrix{ComplexF64}:
  0.707107+0.0im       -0.620545-0.339005im
 -0.308969+0.636033im  -0.576077+0.410044im

julia> c = push!(Circuit(), GateU2(ϕ, λ), 1)
1-qubit circuit with 1 instruction:
└── U2(ϕ,λ) @ q[1]

julia> push!(c, GateU2(π/2, π/4), 2)
2-qubit circuit with 2 instructions:
├── U2(ϕ,λ) @ q[1]
└── U2(π/2,π/4) @ q[2]

julia> power(GateU2(ϕ, λ), 2), inverse(GateU2(ϕ, λ))
(GateU2(ϕ, λ)^2, GateU2(-3.141592653589793 - λ, π - ϕ))

Decomposition

julia> decompose(GateU2(ϕ, λ))
1-qubit circuit with 1 instruction:
└── U(π/2,ϕ,λ) @ q[1]
source
MimiqCircuitsBase.GateU3Type
GateU3(θ, ϕ, λ)

Single qubit generic unitary gate U3(\theta, \phi, \lambda).

This gate is equivalent to the generic unitary gate GateU, differing from it only by a global phase of $\frac{\phi + \lambda + \theta}{2}$.

Matrix representation

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

Examples

julia> @variables θ ϕ λ
3-element Vector{Symbolics.Num}:
 θ
 ϕ
 λ

julia> GateU3(θ, ϕ, λ)
U3(θ, ϕ, λ)

julia> matrix(GateU3(2.023, 0.5, 0.1))
2×2 Matrix{ComplexF64}:
  0.53059+0.0im       -0.843394-0.0846217im
 0.743864+0.406375im   0.437915+0.299594im

julia> c = push!(Circuit(), GateU3(θ, ϕ, λ), 1)
1-qubit circuit with 1 instruction:
└── U3(θ,ϕ,λ) @ q[1]

julia> push!(c, GateU3(π/8, π/2, π/4), 2)
2-qubit circuit with 2 instructions:
├── U3(θ,ϕ,λ) @ q[1]
└── U3(π/8,π/2,π/4) @ q[2]

julia> power(GateU3(θ, ϕ, λ), 2), inverse(GateU3(θ, ϕ, λ))
(GateU3(θ, ϕ, λ)^2, GateU3(-θ, -λ, -ϕ))

Decomposition

julia> decompose(GateU3(θ, ϕ, λ))
1-qubit circuit with 1 instruction:
└── U(θ,ϕ,λ) @ q[1]
source
MimiqCircuitsBase.GateXType
GateX()

Single qubit Pauli-X gate.

Matrix representation

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

Examples

julia> GateX()
X

julia> matrix(GateX())
2×2 Matrix{Int64}:
 0  1
 1  0

julia> c = push!(Circuit(), GateX(), 1)
1-qubit circuit with 1 instruction:
└── X @ q[1]

julia> push!(c, GateX, 2)
2-qubit circuit with 2 instructions:
├── X @ q[1]
└── X @ q[2]

Decomposition

julia> decompose(GateX())
1-qubit circuit with 1 instruction:
└── U(π,0,π) @ q[1]
source
MimiqCircuitsBase.GateYType
GateY()

Single qubit Pauli-Y gate.

Matrix representation

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

Examples

julia> GateY()
Y

julia> matrix(GateY())
2×2 Matrix{ComplexF64}:
 0.0+0.0im  0.0-1.0im
 0.0+1.0im  0.0+0.0im

julia> c = push!(Circuit(), GateY(), 1)
1-qubit circuit with 1 instruction:
└── Y @ q[1]

julia> push!(c, GateY, 2)
2-qubit circuit with 2 instructions:
├── Y @ q[1]
└── Y @ q[2]

Decomposition

julia> decompose(GateY())
1-qubit circuit with 1 instruction:
└── U(π,π/2,π/2) @ q[1]
source
MimiqCircuitsBase.GateZType
GateZ()

Single qubit Pauli-Z gate.

Matrix representation

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

Examples

julia> GateZ()
Z

julia> matrix(GateZ())
2×2 Matrix{Float64}:
 1.0   0.0
 0.0  -1.0

julia> c = push!(Circuit(), GateZ(), 1)
1-qubit circuit with 1 instruction:
└── Z @ q[1]

julia> push!(c, GateZ, 2)
2-qubit circuit with 2 instructions:
├── Z @ q[1]
└── Z @ q[2]

Decomposition

julia> decompose(GateZ())
1-qubit circuit with 1 instruction:
└── U(0,0,π) @ q[1]
source
MimiqCircuitsBase.GateHType
GateH()

Single qubit Hadamard gate.

Matrix representation

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

Examples

julia> GateH()
H

julia> matrix(GateH())
2×2 Matrix{Float64}:
 0.707107   0.707107
 0.707107  -0.707107

julia> c = push!(Circuit(), GateH(), 1)
1-qubit circuit with 1 instruction:
└── H @ q[1]

julia> push!(c, GateH, 1)
1-qubit circuit with 2 instructions:
├── H @ q[1]
└── H @ q[1]

julia> power(GateH(), 2), inverse(GateH())
(GateH()^2, GateH())

Decomposition

julia> decompose(GateH())
1-qubit circuit with 1 instruction:
└── U(π/2,0,π) @ q[1]
source
MimiqCircuitsBase.GateHXYType
GateHXY()

Single qubit HXY gate.

Matrix representation

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

Examples

julia> GateHXY()
HXY

julia> matrix(GateHXY())
2×2 Matrix{ComplexF64}:
      0.0+0.0im       0.707107-0.707107im
 0.707107+0.707107im       0.0+0.0im

julia> c = push!(Circuit(), GateHXY(), 1)
1-qubit circuit with 1 instruction:
└── HXY @ q[1]

julia> power(GateHXY(), 2), inverse(GateHXY())
(GateHXY()^2, GateHXY())

Decomposition

julia> decompose(GateHXY())
1-qubit circuit with 5 instructions:
├── U(π/2,0,π) @ q[1]
├── U(0,0,π) @ q[1]
├── U(π/2,0,π) @ q[1]
├── U(0,0,π/2) @ q[1]
└── U(0,0,0,-1π/4) @ q[1]
source
MimiqCircuitsBase.GateHXZType
GateHXZ()

The HXZ gate is an alias for the Hadamard gate. It applies a transformation that puts the qubit in an equal superposition of |0⟩ and |1⟩.

Matrix representation

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

Examples

julia> GateHXZ()
H

julia> matrix(GateHXZ())
2×2 Matrix{Float64}:
 0.707107   0.707107
 0.707107  -0.707107

julia> c = push!(Circuit(), GateHXZ(), 1)
1-qubit circuit with 1 instruction:
└── H @ q[1]

julia> power(GateHXZ(), 2), inverse(GateHXZ())
(GateH()^2, GateH())

Decomposition

julia> decompose(GateHXZ())
1-qubit circuit with 1 instruction:
└── U(π/2,0,π) @ q[1]
source
MimiqCircuitsBase.GateHYZType
GateHYZ()

Single qubit HYZ gate.

Matrix representation

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

Examples

julia> GateHYZ()
HYZ

julia> matrix(GateHYZ())
2×2 Matrix{ComplexF64}:
 0.707107+0.0im             0.0-0.707107im
      0.0+0.707107im  -0.707107+0.0im

julia> c = push!(Circuit(), GateHYZ(), 1)
1-qubit circuit with 1 instruction:
└── HYZ @ q[1]

julia> power(GateHYZ(), 2), inverse(GateHYZ())
(GateHYZ()^2, GateHYZ())

Decomposition

julia> decompose(GateHYZ())
1-qubit circuit with 5 instructions:
├── U(π/2,0,π) @ q[1]
├── U(0,0,π/2) @ q[1]
├── U(π/2,0,π) @ q[1]
├── U(0,0,π) @ q[1]
└── U(0,0,0,-1π/4) @ q[1]
source
MimiqCircuitsBase.GateIDType
GateID()

Single qubit identity gate

Matrix representation

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

Examples

julia> GateID()
ID

julia> matrix(GateID())
2×2 Matrix{Float64}:
 1.0  -0.0
 0.0   1.0

julia> c = push!(Circuit(), GateID(), 1)
1-qubit circuit with 1 instruction:
└── ID @ q[1]

julia> power(GateID(), 2), inverse(GateID())
(GateID(), GateID())

Decomposition

julia> decompose(GateID())
1-qubit circuit with 1 instruction:
└── U(0,0,0) @ q[1]
source
MimiqCircuitsBase.GateSType
GateS()

Single qubit $S$ gate (or phase gate). It is defined as the square root of the $Z$ gate.

See also GateSDG, GateZ, Power

Matrix representation

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

Examples

julia> GateS()
S

julia> matrix(GateS())
2×2 Matrix{Complex{Int64}}:
 1+0im  0+0im
 0+0im  0+1im

julia> c = push!(Circuit(), GateS(), 1)
1-qubit circuit with 1 instruction:
└── S @ q[1]

julia> push!(c, GateS, 2)
2-qubit circuit with 2 instructions:
├── S @ q[1]
└── S @ q[2]

julia> power(GateS(), 2), inverse(GateS())
(GateZ(), Inverse(GateS()))

Decomposition

julia> decompose(GateS())
1-qubit circuit with 1 instruction:
└── U(0,0,π/2) @ q[1]
source
MimiqCircuitsBase.GateSDGType
GateSDG()

Single qubit S-dagger gate (conjugate transpose of the S gate).

See also GateS, GateZ, Power, Inverse

Matrix representation

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

Examples

julia> GateSDG()
S†

julia> matrix(GateSDG())
2×2 Matrix{Complex{Int64}}:
 1+0im  0+0im
 0+0im  0-1im

julia> c = push!(Circuit(), GateSDG(), 1)
1-qubit circuit with 1 instruction:
└── S† @ q[1]

julia> push!(c, GateSDG, 2)
2-qubit circuit with 2 instructions:
├── S† @ q[1]
└── S† @ q[2]

julia> power(GateSDG(), 2), inverse(GateSDG())
((Inverse(GateS()))^2, GateS())

Decomposition

julia> decompose(GateSDG())
1-qubit circuit with 1 instruction:
└── U(0,0,-1π/2) @ q[1]
source
MimiqCircuitsBase.GateTType
GateT()

Single qubit T gate. It is defined as the square root of the $S$ gate, $Z^{\frac{1}{4}}$.

See also GateTDG, GateS, GateZ, Power

Matrix representation

\[\operatorname{Z} = \operatorname{Z}^{\frac{1}{4}} = \begin{pmatrix} 1 & 0 \\ 0 & \exp(\frac{i\pi}{4}) \end{pmatrix}\]

Examples

julia> GateT()
T

julia> matrix(GateT())
2×2 Matrix{ComplexF64}:
 1.0+0.0im       0.0+0.0im
 0.0+0.0im  0.707107+0.707107im

julia> c = push!(Circuit(), GateT(), 1)
1-qubit circuit with 1 instruction:
└── T @ q[1]

julia> push!(c, GateT, 2)
2-qubit circuit with 2 instructions:
├── T @ q[1]
└── T @ q[2]

julia> power(GateT(), 2), power(GateT(), 4), inverse(GateT())
(GateS(), GateZ(), Inverse(GateT()))

Decomposition

julia> decompose(GateT())
1-qubit circuit with 1 instruction:
└── U(0,0,π/4) @ q[1]
source
MimiqCircuitsBase.GateTDGType
GateTDG()

Single qubit T-dagger gate (conjugate transpose of the T gate).

See also GateT

Matrix Representation

\[\operatorname{T}^\dagger = \begin{pmatrix} 1 & 0 \\ 0 & \exp(\frac{-i\pi}{4}) \end{pmatrix}\]

Examples

julia> GateTDG()
T†

julia> matrix(GateTDG())
2×2 Matrix{ComplexF64}:
 1.0+0.0im       0.0+0.0im
 0.0+0.0im  0.707107-0.707107im

julia> c = push!(Circuit(), GateTDG(), 1)
1-qubit circuit with 1 instruction:
└── T† @ q[1]

julia> push!(c, GateTDG, 2)
2-qubit circuit with 2 instructions:
├── T† @ q[1]
└── T† @ q[2]

julia> power(GateTDG(), 2), power(GateTDG(), 4), inverse(GateTDG())
((Inverse(GateT()))^2, (Inverse(GateT()))^4, GateT())

Decomposition

julia> decompose(GateTDG())
1-qubit circuit with 1 instruction:
└── U(0,0,-1π/4) @ q[1]
source
MimiqCircuitsBase.GateSXType
GateSX()

Single qubit $\sqrt{X}$ gate.

See also GateSXDG, GateX, Power

Matrix representation

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

Examples

julia> GateSX()
SX

julia> matrix(GateSX())
2×2 Matrix{ComplexF64}:
 0.5+0.5im  0.5-0.5im
 0.5-0.5im  0.5+0.5im

julia> c = push!(Circuit(), GateSX(), 1)
1-qubit circuit with 1 instruction:
└── SX @ q[1]

julia> push!(c, GateSX, 2)
2-qubit circuit with 2 instructions:
├── SX @ q[1]
└── SX @ q[2]

julia> power(GateSX(), 2), inverse(GateSX())
(GateX(), Inverse(GateSX()))

Decomposition

julia> decompose(GateSX())
1-qubit circuit with 4 instructions:
├── U(0,0,-1π/2) @ q[1]
├── U(π/2,0,π) @ q[1]
├── U(0,0,-1π/2) @ q[1]
└── U(0,0,0,π/4) @ q[1]
source
MimiqCircuitsBase.GateSXDGType
GateSXDG()

Single qubit $\sqrt{X}^\dagger$ gate (conjugate transpose of the $\sqrt{X}$ gate)

See also GateSX, GateX, Power, Inverse

Matrix representation

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

Examples

julia> GateSXDG()
SX†

julia> matrix(GateSXDG())
2×2 Matrix{ComplexF64}:
 0.5-0.5im  0.5+0.5im
 0.5+0.5im  0.5-0.5im

julia> c = push!(Circuit(), GateSXDG(), 1)
1-qubit circuit with 1 instruction:
└── SX† @ q[1]

julia> push!(c, GateSXDG, 2)
2-qubit circuit with 2 instructions:
├── SX† @ q[1]
└── SX† @ q[2]

julia> power(GateSXDG(), 2), inverse(GateSXDG())
((Inverse(GateSX()))^2, GateSX())
source
MimiqCircuitsBase.GateRType
GateR(θ, ϕ)

Single qubit parametric rotation $\operatorname{R}(\theta, \lambda)$ gate.

It performs a rotation of $\theta$ radians for the target qubit around an XY-plane axis of the Bloch sphere determined by $\cos(\phi)\mathbf{x} + \sin(\phi)\mathbf{y}$.

Matrix representation

\[\operatorname{R}(\theta,\phi) = \begin{pmatrix} \cos\frac{\theta}{2} & -ie^{-i\phi}\sin\frac{\theta}{2} \\ -ie^{i\phi}\sin\frac{\theta}{2} & \cos\frac{\theta}{2} \end{pmatrix}\]

Examples

julia> @variables θ ϕ
2-element Vector{Symbolics.Num}:
 θ
 ϕ

julia> GateR(θ, ϕ)
R(θ, ϕ)

julia> matrix(GateR(2.023, 1.989))
2×2 Matrix{ComplexF64}:
 0.53059+0.0im       -0.77458+0.344239im
 0.77458+0.344239im   0.53059+0.0im

julia> c = push!(Circuit(), GateR(θ, ϕ), 1)
1-qubit circuit with 1 instruction:
└── R(θ,ϕ) @ q[1]

julia> push!(c, GateR(π/2, π/4), 2)
2-qubit circuit with 2 instructions:
├── R(θ,ϕ) @ q[1]
└── R(π/2,π/4) @ q[2]

Decomposition

julia> decompose(GateR(θ, ϕ))
1-qubit circuit with 1 instruction:
└── U(θ,-1.5707963267948966 + ϕ,1.5707963267948966 - ϕ) @ q[1]
source
MimiqCircuitsBase.GateRXType
GateRX(θ)

Single qubit parametric rotation $\operatorname{R}_X(\theta)$ gate.

It performs a rotation of $\theta$ radians around the X-axis of the Bloch sphere of the target qubit.

Matrix representation

\[\operatorname{R}_X(\theta) = \begin{pmatrix} \cos\frac{\theta}{2} & -i\sin\frac{\theta}{2} \\ -i\sin\frac{\theta}{2} & \cos\frac{\theta}{2} \end{pmatrix}\]

Examples

julia> @variables θ
1-element Vector{Symbolics.Num}:
 θ

julia> GateRX(θ)
RX(θ)

julia> matrix(GateRX(1.989))
2×2 Matrix{ComplexF64}:
 0.544922+0.0im            0.0-0.838487im
      0.0-0.838487im  0.544922+0.0im

julia> c = push!(Circuit(), GateRX(θ), 1)
1-qubit circuit with 1 instruction:
└── RX(θ) @ q[1]

julia> push!(c, GateRX(π/2), 2)
2-qubit circuit with 2 instructions:
├── RX(θ) @ q[1]
└── RX(π/2) @ q[2]

Decomposition

julia> decompose(GateRX(θ))
1-qubit circuit with 1 instruction:
└── U(θ,-1π/2,π/2) @ q[1]
source
MimiqCircuitsBase.GateRYType
GateRY(θ)

Single qubit parametric rotation $\operatorname{R}_Y(\theta)$ gate.

It performss a rotation of $\theta$ radians around the Y-axis of the Bloch sphere of the target qubit.

Matrix representation

\[\operatorname{R}_Y(\theta) = \begin{pmatrix} \cos\frac{\theta}{2} & -\sin\frac{\theta}{2} \\ \sin\frac{\theta}{2} & \cos\frac{\theta}{2} \end{pmatrix}\]

Examples

julia> @variables θ
1-element Vector{Symbolics.Num}:
 θ

julia> GateRY(θ)
RY(θ)

julia> matrix(GateRY(1.989))
2×2 Matrix{Float64}:
 0.544922  -0.838487
 0.838487   0.544922

julia> c = push!(Circuit(), GateRY(θ), 1)
1-qubit circuit with 1 instruction:
└── RY(θ) @ q[1]

julia> push!(c, GateRY(π/2), 2)
2-qubit circuit with 2 instructions:
├── RY(θ) @ q[1]
└── RY(π/2) @ q[2]

Decomposition

julia> decompose(GateRY(θ))
1-qubit circuit with 1 instruction:
└── U(θ,0,0) @ q[1]
source
MimiqCircuitsBase.GateRZType
GateRZ(λ)

Single qubit parametric rotation $\operatorname{R}_Z(\lambda)$ gate.

It performs a rotation of $\lambda$ radians around the Z-axis of the Bloch sphere for the target qubit.

Matrix representation

\[\operatorname{RZ}(\lambda) = \begin{pmatrix} e^{-i\frac{\lambda}{2}} & 0 \\ 0 & e^{i\frac{\lambda}{2}} \end{pmatrix}\]

Examples

julia> @variables θ
1-element Vector{Symbolics.Num}:
 θ

julia> GateRZ(θ)
RZ(θ)

julia> matrix(GateRZ(1.989))
2×2 Matrix{ComplexF64}:
 0.544922-0.838487im       0.0+0.0im
      0.0+0.0im       0.544922+0.838487im

julia> c = push!(Circuit(), GateRZ(θ), 1)
1-qubit circuit with 1 instruction:
└── RZ(θ) @ q[1]

julia> push!(c, GateRZ(π/2), 2)
2-qubit circuit with 2 instructions:
├── RZ(θ) @ q[1]
└── RZ(π/2) @ q[2]

Decomposition

julia> decompose(GateRZ(θ))
1-qubit circuit with 1 instruction:
└── U(0,0,θ,(-1//2)*θ) @ q[1]
source