BloqadeExpr.N_1
— ConstantN_1
OpN_1 <: YaoBlocks.ConstantGate{1, 3}
Projection operator onto |1⟩ for 3-level Rydberg system.
Matrix expression:
\[n^1 = |1⟩⟨1| = \begin{pmatrix} 0 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 0 \end{pmatrix}\]
BloqadeExpr.N_r
— ConstantN_r
OpN_r <: YaoBlocks.ConstantGate{1, 3}
Projection operator onto |r⟩ for 3-level Rydberg system.
Matrix expression:
\[n^{\mathrm{r}} = |r⟩⟨r| = \begin{pmatrix} 0 & 0 & 0 \\ 0 & 0 & 0 \\ 0 & 0 & 1 \end{pmatrix}\]
BloqadeExpr.Pd_01
— ConstantPd_01
OpPd_01 <: YaoBlocks.ConstantGate{1, 3}
Matrix expression:
\[\mathrm{Pd}^{\mathrm{hf}} = \begin{pmatrix} 0 & 0 & 0 \\ 1 & 0 & 0 \\ 0 & 0 & 0 \end{pmatrix}\]
BloqadeExpr.Pd_1r
— ConstantPd_1r
OpPd_1r <: YaoBlocks.ConstantGate{1, 3}
Matrix expression:
\[\mathrm{Pd}^{\mathrm{r}} = \begin{pmatrix} 0 & 0 & 0 \\ 0 & 0 & 0 \\ 0 & 1 & 0 \end{pmatrix}\]
BloqadeExpr.Pu_01
— ConstantPu_01
OpPu_01 <: YaoBlocks.ConstantGate{1, 3}
Matrix expression:
\[\mathrm{Pu}^{\mathrm{hf}} = \begin{pmatrix} 0 & 1 & 0 \\ 0 & 0 & 0 \\ 0 & 0 & 0 \end{pmatrix}\]
BloqadeExpr.Pu_1r
— ConstantPu_1r
OpPu_1r <: YaoBlocks.ConstantGate{1, 3}
Matrix expression:
\[\mathrm{Pu}^{\mathrm{r}} = \begin{pmatrix} 0 & 0 & 0 \\ 0 & 0 & 1 \\ 0 & 0 & 0 \end{pmatrix}\]
BloqadeExpr.X_01
— ConstantX_01
OpX_01 <: YaoBlocks.ConstantGate{1, 3}
Pauli X operator act on |0⟩ and |1⟩ for 3-level Rydberg system.
Matrix expression:
\[\sigma^{x,\mathrm{hf}} = \begin{pmatrix} 0 & 1 & 0 \\ 1 & 0 & 0 \\ 0 & 0 & 0 \end{pmatrix}\]
BloqadeExpr.X_1r
— ConstantX_1r
OpX_1r <: YaoBlocks.ConstantGate{1, 3}
Pauli X operator act on |1⟩ and |r⟩ for 3-level Rydberg system.
Matrix expression:
\[\sigma^{x,\mathrm{r}} = \begin{pmatrix} 0 & 0 & 0 \\ 0 & 0 & 1 \\ 0 & 1 & 0 \end{pmatrix}\]
BloqadeExpr.Z_01
— ConstantZ_01
OpZ_01 <: YaoBlocks.ConstantGate{1, 3}
Pauli Z operator act on |0⟩ and |1⟩ for 3-level Rydberg system.
Matrix expression:
\[\sigma^{z,\mathrm{hf}} = \begin{pmatrix} 1 & 0 & 0 \\ 0 & -1 & 0 \\ 0 & 0 & 0 \end{pmatrix}\]
BloqadeExpr.Z_1r
— ConstantZ_1r
OpZ_1r <: YaoBlocks.ConstantGate{1, 3}
Pauli Z operator act on |1⟩ and |r⟩ for 3-level Rydberg system.
Matrix expression:
\[\sigma^{z,\mathrm{r}} = \begin{pmatrix} 0 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & -1 \end{pmatrix}\]
BloqadeExpr.fullspace
— Constantfullspace
A constant for the FullSpace
.
BloqadeExpr.AbstractSpace
— TypeAbstractSpace
Abstract type for spaces.
BloqadeExpr.AbstractTerm
— TypeAbstractTerm{D} <: PrimitiveBlock{D}
Abstract term for local hamiltonian terms on D-level system.
BloqadeExpr.FullSpace
— TypeFullSpace <: AbstractSpace
A trait for the full space.
BloqadeExpr.Lowlevel.Hamiltonian
— MethodHamiltonian(::Type{Tv}, expr[, space=fullspace])
Create a Hamiltonian
from hamiltonian expr that has matrix element of type Tv
.
BloqadeExpr.OpN_1
— TypeN_1
OpN_1 <: YaoBlocks.ConstantGate{1, 3}
Projection operator onto |1⟩ for 3-level Rydberg system.
Matrix expression:
\[n^1 = |1⟩⟨1| = \begin{pmatrix} 0 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 0 \end{pmatrix}\]
BloqadeExpr.OpN_r
— TypeN_r
OpN_r <: YaoBlocks.ConstantGate{1, 3}
Projection operator onto |r⟩ for 3-level Rydberg system.
Matrix expression:
\[n^{\mathrm{r}} = |r⟩⟨r| = \begin{pmatrix} 0 & 0 & 0 \\ 0 & 0 & 0 \\ 0 & 0 & 1 \end{pmatrix}\]
BloqadeExpr.OpPd_01
— TypePd_01
OpPd_01 <: YaoBlocks.ConstantGate{1, 3}
Matrix expression:
\[\mathrm{Pd}^{\mathrm{hf}} = \begin{pmatrix} 0 & 0 & 0 \\ 1 & 0 & 0 \\ 0 & 0 & 0 \end{pmatrix}\]
BloqadeExpr.OpPd_1r
— TypePd_1r
OpPd_1r <: YaoBlocks.ConstantGate{1, 3}
Matrix expression:
\[\mathrm{Pd}^{\mathrm{r}} = \begin{pmatrix} 0 & 0 & 0 \\ 0 & 0 & 0 \\ 0 & 1 & 0 \end{pmatrix}\]
BloqadeExpr.OpPu_01
— TypePu_01
OpPu_01 <: YaoBlocks.ConstantGate{1, 3}
Matrix expression:
\[\mathrm{Pu}^{\mathrm{hf}} = \begin{pmatrix} 0 & 1 & 0 \\ 0 & 0 & 0 \\ 0 & 0 & 0 \end{pmatrix}\]
BloqadeExpr.OpPu_1r
— TypePu_1r
OpPu_1r <: YaoBlocks.ConstantGate{1, 3}
Matrix expression:
\[\mathrm{Pu}^{\mathrm{r}} = \begin{pmatrix} 0 & 0 & 0 \\ 0 & 0 & 1 \\ 0 & 0 & 0 \end{pmatrix}\]
BloqadeExpr.OpX_01
— TypeX_01
OpX_01 <: YaoBlocks.ConstantGate{1, 3}
Pauli X operator act on |0⟩ and |1⟩ for 3-level Rydberg system.
Matrix expression:
\[\sigma^{x,\mathrm{hf}} = \begin{pmatrix} 0 & 1 & 0 \\ 1 & 0 & 0 \\ 0 & 0 & 0 \end{pmatrix}\]
BloqadeExpr.OpX_1r
— TypeX_1r
OpX_1r <: YaoBlocks.ConstantGate{1, 3}
Pauli X operator act on |1⟩ and |r⟩ for 3-level Rydberg system.
Matrix expression:
\[\sigma^{x,\mathrm{r}} = \begin{pmatrix} 0 & 0 & 0 \\ 0 & 0 & 1 \\ 0 & 1 & 0 \end{pmatrix}\]
BloqadeExpr.OpZ_01
— TypeZ_01
OpZ_01 <: YaoBlocks.ConstantGate{1, 3}
Pauli Z operator act on |0⟩ and |1⟩ for 3-level Rydberg system.
Matrix expression:
\[\sigma^{z,\mathrm{hf}} = \begin{pmatrix} 1 & 0 & 0 \\ 0 & -1 & 0 \\ 0 & 0 & 0 \end{pmatrix}\]
BloqadeExpr.OpZ_1r
— TypeZ_1r
OpZ_1r <: YaoBlocks.ConstantGate{1, 3}
Pauli Z operator act on |1⟩ and |r⟩ for 3-level Rydberg system.
Matrix expression:
\[\sigma^{z,\mathrm{r}} = \begin{pmatrix} 0 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & -1 \end{pmatrix}\]
BloqadeExpr.RydInteract
— Typestruct RydInteract{D} <: AbstractTerm{D}
RydInteract(;atoms, C=2π * 862690MHz⋅μm^6)
Type for Rydberg interactive term.
Expression
\[\sum_{i, j} \frac{C}{|x_i - x_j|^6} n_i n_j\]
Keyword Arguments
atoms
: a list of atom positions, must be typeRydAtom
, default unit isμm
.C
: the interaction strength, default unit isMHz⋅μm^6
. default value is2π * 862690 * MHz*µm^6
.
BloqadeExpr.Subspace
— TypeSubspace{S <: AbstractVector} <: AbstractSpace
A Dict
-like object stores the mapping between subspace and full space.
BloqadeExpr.Subspace
— MethodSubspace(nqubits::Int, subspace_v::AbstractVector)
Create a Subspace from given list of subspace indices in the corresponding full space.
BloqadeExpr.SumOfN
— Typestruct SumOfN <: AbstractTerm{2}
SumOfN(;nsites[, Δ=1])
Sum of N operators.
The following two expression are equivalent
julia> SumOfN(nsites=5)
∑ n_i
julia> sum([Op.n for _ in 1:5])
nqudits: 1
+
├─ P1
├─ P1
├─ P1
├─ P1
└─ P1
But may provide extra speed up.
Expression
\[\sum_i Δ ⋅ n_i\]
BloqadeExpr.SumOfN_1
— Typestruct SumOfN_1 <: AbstractTerm{3}
SumOfN_1(;nsites[, Δ=1])
Sum of N_1 operators.
Expression
\[\sum_i Δ ⋅ n^r_i\]
BloqadeExpr.SumOfN_r
— Typestruct SumOfN_r <: AbstractTerm{3}
SumOfN_1(;nsites[, Δ=1])
Sum of N_r operators.
Expression
\[\sum_i Δ ⋅ n^r_i\]
BloqadeExpr.SumOfX
— Typestruct SumOfX <: AbstractTerm{2}
SumOfX(nsites, Ω)
Term for sum of X operators.
The following two expressions are equivalent
julia> SumOfX(nsites=5)
∑ σ^x_i
julia> sum([X for _ in 1:5])
nqudits: 1
+
├─ X
├─ X
├─ X
├─ X
└─ X
Expression
\[\sum_i Ω σ^x_i\]
BloqadeExpr.SumOfXPhase
— Typestruct SumOfXPhase <: AbstractTerm{2}
SumOfXPhase(;nsites, Ω=1, ϕ)
Sum of XPhase
operators.
The following two expressions are equivalent
julia> SumOfXPhase(nsites=5, ϕ=0.1)
1.0 ⋅ ∑ e^{0.1 ⋅ im} |0⟩⟨1| + e^{-0.1 ⋅ im} |1⟩⟨0|
julia> sum([XPhase(0.1) for _ in 1:5])
nqudits: 1
+
├─ XPhase(0.1)
├─ XPhase(0.1)
├─ XPhase(0.1)
├─ XPhase(0.1)
└─ XPhase(0.1)
But may provide extra speed up.
Expression
\[\sum_i Ω ⋅ (e^{ϕ ⋅ i} |0⟩⟨1| + e^{-ϕ ⋅ i} |1⟩⟨0|)\]
BloqadeExpr.SumOfXPhase_01
— Typestruct SumOfXPhase_01 <: AbstractTerm{3}
SumOfXPhase_01(nsites, Ω, ϕ)
Term for sum of XPhase_01
operators.
Expression
\[\sum_i Ω ⋅ (e^{ϕ ⋅ i} |0⟩⟨1| + e^{-ϕ ⋅ i} |1⟩⟨0|)\]
BloqadeExpr.SumOfXPhase_1r
— Typestruct SumOfXPhase_1r <: AbstractTerm{3}
SumOfXPhase_1r(nsites, Ω, ϕ)
Term for sum of XPhase_1r
operators.
Expression
\[\sum_i Ω ⋅ (e^{ϕ ⋅ i} |1⟩⟨r| + e^{-ϕ ⋅ i} |r⟩⟨1|)\]
BloqadeExpr.SumOfX_01
— Typestruct SumOfX_01 <: AbstractTerm{3}
SumOfX_01(nsites, Ω)
Term for sum of X_01
operators.
Expression
\[\sum_i Ω σ^{x,\mathrm{hf}}_i\]
BloqadeExpr.SumOfX_1r
— Typestruct SumOfX_1r <: AbstractTerm{3}
SumOfX_1r(nsites, Ω)
Term for sum of X_1r
operators.
Expression
\[\sum_i Ω σ^{x,\mathrm{r}}_i\]
BloqadeExpr.SumOfZ
— Typestruct SumOfZ <: AbstractTerm{2}
SumOfZ(;nsites, Δ=1)
Sum of Pauli Z operators.
The following two expression are equivalent
julia> SumOfZ(nsites=5)
∑ σ^z_i
julia> sum([Z for _ in 1:5])
nqudits: 1
+
├─ Z
├─ Z
├─ Z
├─ Z
└─ Z
Expression
\[\sum_i Δ ⋅ σ^z_i\]
BloqadeExpr.SumOfZ_01
— Typestruct SumOfZ_01 <: AbstractTerm{2}
SumOfZ_01(;nsites, Δ=1)
Sum of Pauli Z_01 operators.
Expression
\[\sum_i Δ ⋅ σ^{z,\mathrm{hf}}_i\]
BloqadeExpr.SumOfZ_1r
— Typestruct SumOfZ_1r <: AbstractTerm{2}
SumOfZ_1r(;nsites, Δ=1)
Sum of Pauli Z_1r operators.
Expression
\[\sum_i Δ ⋅ σ^{z,\mathrm{r}}_i\]
BloqadeExpr.XPhase
— TypeXPhase{T} <: PrimitiveBlock{2}
XPhase operator for 2-level Rydberg system.
\[e^{ϕ ⋅ i} |0⟩⟨1| + e^{-ϕ ⋅ i} |1⟩⟨0|\]
BloqadeExpr.XPhase_01
— TypeXPhase_01{T} <: PrimitiveBlock{3}
XPhase operator act on |0⟩ and |1⟩ for 3-level Rydberg system.
\[e^{ϕ ⋅ i} |0⟩⟨1| + e^{-ϕ ⋅ i} |1⟩⟨0| = \begin{pmatrix} 0 & e^{ϕ ⋅ im} & 0 \\ e^{-ϕ ⋅ im} & 0 & 0 \\ 0 & 0 & 0 \end{pmatrix}\]
BloqadeExpr.XPhase_1r
— TypeXPhase_1r{T} <: PrimitiveBlock{3}
XPhase operator act on |1⟩ and |r⟩ for 3-level Rydberg system.
\[e^{ϕ ⋅ i} |1⟩⟨r| + e^{-ϕ ⋅ i} |r⟩⟨1| = \begin{pmatrix} 0 & 0 & 0 \\ 0 & 0 & e^{ϕ ⋅ im} \\ 0 & e^{-ϕ ⋅ im} & 0 \end{pmatrix}\]
BloqadeExpr.attime
— Methodattime(h, t)
attime(t)
Return the hamiltonian at time t
.
Example
julia> h = rydberg_h(atoms; Ω=sin)
nqudits: 4
+
├─ ∑ 5.42e6/|x_i-x_j|^6 n_i n_j
└─ Ω(t) ⋅ ∑ σ^x_i
julia> h |> attime(0.1)
nqudits: 4
+
├─ ∑ 5.42e6/|x_i-x_j|^6 n_i n_j
└─ 0.0499 ⋅ ∑ σ^x_i
BloqadeExpr.emulate!
— Functionemulate!(prob)
Run emulation of a given problem.
BloqadeExpr.get_rydberg_params
— Methodget_rydberg_params(h)
Returns a named tuple containing the fields atoms
, ϕ
, Ω
, and Δ
for the RydbergHamiltonian, h
.
See also rydberg_h
Example
julia (atoms,ϕ,Ω,Δ) = get_rydberg_params(h)
`
BloqadeExpr.is_time_function
— Methodis_time_function(f)
Check if a function has method whose signature is of Tuple{Real}
or Tuple{T} where {T <: Real}
.
BloqadeExpr.matrix_to_positions
— Methodmatrix_to_positions(locs::AbstractMatrix{T}) -> Vector{NTuple{D, T}}
Convert a dxn location matrix to a list of positions.
BloqadeExpr.rydberg_h
— Methodrydberg_h(atoms; [C=2π * 862690 * MHz*µm^6], Ω[, ϕ, Δ])
Create a rydberg hamiltonian
\[∑ \frac{C}{|x_i - x_j|^6} n_i n_j + \frac{Ω}{2} σ_x - Δ σ_n\]
shorthand for
RydInteract(C, atoms) + SumOfXPhase(length(atoms), Ω, ϕ) - SumOfN(length(atoms), Δ)
Arguments
atoms
: a collection of atom positions.
Keyword Arguments
C
: optional, default unit isMHz*µm^6
, interation parameter, see alsoRydInteract
.Ω
: optional, default unit isMHz
, Rabi frequencies, divided by 2, see alsoSumOfX
.Δ
: optional, default unit isMHz
, detuning parameter, seeSumOfN
.ϕ
: optional, does not have unit, the phase, seeSumOfXPhase
.
The rabi frequencies are divided by two in the Rydberg hamiltonian unlike directly constructing via SumOfX
or SumOfXPhase
.
The parameters of Hamiltonian have their own default units to match hardware, one can use Unitful.jl
to specify their units explicitly. If the units are specified explicitly, they will be converted to default units automatically.
Example
julia> using Bloqade
julia> atoms = [(1, ), (2, ), (3, ), (4, )]
4-element Vector{Tuple{Int64}}:
(1,)
(2,)
(3,)
(4,)
julia> rydberg_h(atoms)
∑ 5.42e6/|x_i-x_j|^6 n_i n_j
julia> rydberg_h(atoms; Ω=0.1)
nqubits: 4
+
├─ ∑ 5.42e6/|x_i-x_j|^6 n_i n_j
└─ 0.05 ⋅ ∑ σ^x_i
BloqadeExpr.rydberg_h_3
— Methodrydberg_h_3(atoms; [C=2π * 862690 * MHz*µm^6,
Ω_hf = nothing, ϕ_hf = nothing, Δ_hf = nothing,
Ω_r = nothing, ϕ_r = nothing, Δ_r = nothing])
Create a 3-level Rydberg Hamiltonian
\[\sum_{i<j} \frac{C}{|x_i - x_j|^6} n^r_i n^r_j + \sum_{i} \left[\frac{Ω^{\mathrm{hf}}}{2} (e^{iϕ^\mathrm{hf}}|0⟩⟨1| + e^{-iϕ^\mathrm{hf}}|1⟩⟨0|) - Δ^{\mathrm{hf}} n^{1}_i + \frac{Ω^{\mathrm{r}}}{2} (e^{iϕ^\mathrm{r}}|1⟩⟨r| + e^{-iϕ^\mathrm{r}}|r⟩⟨1|) - (Δ^{\mathrm{hf}} + Δ^{\mathrm{r}}) n^{\mathrm{r}}_i \right]\]
shorthand for
RydInteract(C, atoms; nlevel = 3) +
SumOfXPhase_01(length(atoms), Ω_hf/2, ϕ_hf) - SumOfN(length(atoms), Δ_hf) +
SumOfXPhase_1r(length(atoms), Ω_r/2, ϕ_r) - SumOfN(length(atoms), Δ_r + Δ_hf)
BloqadeExpr.Lowlevel.Hamiltonian
— Typestruct Hamiltonian
Hamiltonian
stores the dynamic prefactors of each term. The actual hamiltonian is the sum of f_i(t) * t_i
where f_i
and t_i
are entries of fs
and ts
.
BloqadeExpr.Lowlevel.bmul!
— Methodbmul!(y::AbstractVector, A::SparseMatrixCSR, x::AbstractVector, alpha::Number, beta::Number)
bmul!(y::AbstractVector, A::SparseMatrixCSR, x::AbstractVector)
Evaluates y = alpha*A*x + beta*y
(y = A*x
) In-place multithreaded version of sparse csr matrix - vector multiplication, using the threading provided by Polyester.jl