BloqadeExpr.N_1Constant
N_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_rConstant
N_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_01Constant
Pd_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_1rConstant
Pd_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_01Constant
Pu_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_1rConstant
Pu_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_01Constant
X_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_1rConstant
X_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_01Constant
Z_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_1rConstant
Z_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.AbstractTermType
AbstractTerm{D} <: PrimitiveBlock{D}

Abstract term for local hamiltonian terms on D-level system.

BloqadeExpr.Lowlevel.HamiltonianMethod
Hamiltonian(::Type{Tv}, expr[, space=fullspace])

Create a Hamiltonian from hamiltonian expr that has matrix element of type Tv.

BloqadeExpr.OpN_1Type
N_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_rType
N_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_01Type
Pd_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_1rType
Pd_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_01Type
Pu_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_1rType
Pu_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_01Type
X_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_1rType
X_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_01Type
Z_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_1rType
Z_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.RydInteractType
struct 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 type RydAtom, default unit is μm.
  • C: the interaction strength, default unit is MHz⋅μm^6. default value is 2π * 862690 * MHz*µm^6.
BloqadeExpr.SubspaceType
Subspace{S <: AbstractVector} <: AbstractSpace

A Dict-like object stores the mapping between subspace and full space.

BloqadeExpr.SubspaceMethod
Subspace(nqubits::Int, subspace_v::AbstractVector)

Create a Subspace from given list of subspace indices in the corresponding full space.

BloqadeExpr.SumOfNType
struct 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_1Type
struct SumOfN_1 <: AbstractTerm{3}
SumOfN_1(;nsites[, Δ=1])

Sum of N_1 operators.

Expression

\[\sum_i Δ ⋅ n^r_i\]

BloqadeExpr.SumOfN_rType
struct SumOfN_r <: AbstractTerm{3}
SumOfN_1(;nsites[, Δ=1])

Sum of N_r operators.

Expression

\[\sum_i Δ ⋅ n^r_i\]

BloqadeExpr.SumOfXType
struct 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.SumOfXPhaseType
struct 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_01Type
struct 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_1rType
struct 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_01Type
struct SumOfX_01 <: AbstractTerm{3}
SumOfX_01(nsites, Ω)

Term for sum of X_01 operators.

Expression

\[\sum_i Ω σ^{x,\mathrm{hf}}_i\]

BloqadeExpr.SumOfX_1rType
struct SumOfX_1r <: AbstractTerm{3}
SumOfX_1r(nsites, Ω)

Term for sum of X_1r operators.

Expression

\[\sum_i Ω σ^{x,\mathrm{r}}_i\]

BloqadeExpr.SumOfZType
struct 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_01Type
struct SumOfZ_01 <: AbstractTerm{2}
SumOfZ_01(;nsites, Δ=1)

Sum of Pauli Z_01 operators.

Expression

\[\sum_i Δ ⋅ σ^{z,\mathrm{hf}}_i\]

BloqadeExpr.SumOfZ_1rType
struct SumOfZ_1r <: AbstractTerm{2}
SumOfZ_1r(;nsites, Δ=1)

Sum of Pauli Z_1r operators.

Expression

\[\sum_i Δ ⋅ σ^{z,\mathrm{r}}_i\]

BloqadeExpr.XPhaseType
XPhase{T} <: PrimitiveBlock{2}

XPhase operator for 2-level Rydberg system.

\[e^{ϕ ⋅ i} |0⟩⟨1| + e^{-ϕ ⋅ i} |1⟩⟨0|\]

BloqadeExpr.XPhase_01Type
XPhase_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_1rType
XPhase_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.attimeMethod
attime(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.get_rydberg_paramsMethod
get_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_functionMethod
is_time_function(f)

Check if a function has method whose signature is of Tuple{Real} or Tuple{T} where {T <: Real}.

BloqadeExpr.matrix_to_positionsMethod
matrix_to_positions(locs::AbstractMatrix{T}) -> Vector{NTuple{D, T}}

Convert a dxn location matrix to a list of positions.

BloqadeExpr.rydberg_hMethod
rydberg_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 is MHz*µm^6, interation parameter, see also RydInteract.
  • Ω: optional, default unit is MHz, Rabi frequencies, divided by 2, see also SumOfX.
  • Δ: optional, default unit is MHz, detuning parameter, see SumOfN.
  • ϕ: optional, does not have unit, the phase, see SumOfXPhase.
Tips

The rabi frequencies are divided by two in the Rydberg hamiltonian unlike directly constructing via SumOfX or SumOfXPhase.

Tips

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_3Method
rydberg_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.HamiltonianType
struct 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!Method
bmul!(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