Skip to content

Commit

Permalink
change naming convention
Browse files Browse the repository at this point in the history
  • Loading branch information
ba2tro committed Nov 2, 2023
1 parent eb3b604 commit 5c50963
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 31 deletions.
2 changes: 1 addition & 1 deletion src/StatesZoo/StatesZoo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import QuantumSymbolics: express_nolookup
using LinearAlgebra
import LinearAlgebra: tr

export SingleRailMidSwapBellU, SingleRailMidSwapBellN, DualRailMidSwapBellU, DualRailMidSwapBellN, ZALMSpinPairU, ZALMSpinPairN, tr
export SingleRailMidSwapBellW, SingleRailMidSwapBell, DualRailMidSwapBellW, DualRailMidSwapBell, ZALMSpinPairW, ZALMSpinPair, tr

abstract type AbstractTwoQubitState <: QuantumSymbolics.AbstractTwoQubitOp end #For representing density matrices
Base.show(io::IO, x::AbstractTwoQubitState) = print(io, "$(symbollabel(x))")
Expand Down
44 changes: 24 additions & 20 deletions src/StatesZoo/single_dual_rail_midswap/single_dual_rail_midswap.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ Fields:
$FIELDS
Generates the unnormalized spin-spin density matrix for linear photonic entanglement swap
with emissive memories emitting single rail photonic qubits from the paper [prajit2023entangling](@cite)
with emissive memories emitting single rail photonic qubits from the paper [prajit2023entangling](@cite).
Since the matrix is 'weighted' by the probability for success, it is suffixed with a W to distinguish it
from the normalized object `SingleRailMidSwapBell`.
It takes the following parameters:
- eA, eB: Link efficiencies for memories A and B upto the swap (include link loss, detector efficiency, etc.)
- gA, gB: Memory initialization parameter for memories A and B
Expand All @@ -45,12 +47,12 @@ It takes the following parameters:
```jldoctest
julia> r = Register(2)
julia> initialize!(r[1:2], SingleRailMidSwapBellU(0.9, 0.9, 0.5, 0.5, 1e-8, 0.99))
julia> initialize!(r[1:2], SingleRailMidSwapBellW(0.9, 0.9, 0.5, 0.5, 1e-8, 0.99))
julia> observable(r[1:2], Z⊗Z)
```
"""
@withmetadata struct SingleRailMidSwapBellU <: AbstractTwoQubitState
@withmetadata struct SingleRailMidSwapBellW <: AbstractTwoQubitState
eA::Float64
eB::Float64
gA::Float64
Expand All @@ -59,7 +61,7 @@ julia> observable(r[1:2], Z⊗Z)
Vis::Float64
end

symbollabel(x::SingleRailMidSwapBellU) = "ρˢʳᵐˢᵁ"
symbollabel(x::SingleRailMidSwapBellW) = "ρˢʳᵐˢᵂ"


"""
Expand All @@ -80,12 +82,12 @@ It takes the following parameters:
```jldoctest
julia> r = Register(2)
julia> initialize!(r[1:2], SingleRailMidSwapBellN(0.9, 0.9, 0.5, 0.5, 1e-8, 0.99))
julia> initialize!(r[1:2], SingleRailMidSwapBell(0.9, 0.9, 0.5, 0.5, 1e-8, 0.99))
julia> observable(r[1:2], Z⊗Z)
```
"""
@withmetadata struct SingleRailMidSwapBellN <: AbstractTwoQubitState
@withmetadata struct SingleRailMidSwapBell <: AbstractTwoQubitState
eA::Float64
eB::Float64
gA::Float64
Expand All @@ -94,7 +96,7 @@ julia> observable(r[1:2], Z⊗Z)
Vis::Float64
end

symbollabel(x::SingleRailMidSwapBellN) = "ρˢʳᵐˢᴺ"
symbollabel(x::SingleRailMidSwapBell) = "ρˢʳᵐˢ"


"""
Expand All @@ -105,7 +107,9 @@ Fields:
$FIELDS
Generates the unnormalized spin-spin density matrix for linear photonic entanglement swap with emissive
memories emitting dual rail photonic qubits from the paper [prajit2023entangling](@cite).
memories emitting dual rail photonic qubits from the paper [prajit2023entangling](@cite).
Since the matrix is 'weighted' by the probability for success, it is suffixed with a W to distinguish it
from the normalized object `DualRailMidSwapBell`.
It takes the following parameters:
- eA, eB: Link efficiencies for memories A and B upto the swap (include link loss, detector efficiency, etc.)
- gA, gB: Memory initialization parameter for memories A and B
Expand All @@ -115,12 +119,12 @@ Generates the unnormalized spin-spin density matrix for linear photonic entangle
```jldoctest
julia> r = Register(2)
julia> initialize!(r[1:2], DualRailMidSwapBellU(0.9, 0.9, 0.5, 0.5, 1e-8, 0.99))
julia> initialize!(r[1:2], DualRailMidSwapBellW(0.9, 0.9, 0.5, 0.5, 1e-8, 0.99))
julia> observable(r[1:2], Z⊗Z)
```
"""
@withmetadata struct DualRailMidSwapBellU <: AbstractTwoQubitState
@withmetadata struct DualRailMidSwapBellW <: AbstractTwoQubitState
eA::Float64
eB::Float64
gA::Float64
Expand All @@ -129,7 +133,7 @@ julia> observable(r[1:2], Z⊗Z)
Vis::Float64
end

symbollabel(x::DualRailMidSwapBellU) = "ρᵈʳᵐˢᵁ"
symbollabel(x::DualRailMidSwapBellW) = "ρᵈʳᵐˢᵂ"


"""
Expand All @@ -150,12 +154,12 @@ Generates the normalized spin-spin density matrix for linear photonic entangleme
```jldoctest
julia> r = Register(2)
julia> initialize!(r[1:2], DualRailMidSwapBellN(0.9, 0.9, 0.5, 0.5, 1e-8, 0.99))
julia> initialize!(r[1:2], DualRailMidSwapBell(0.9, 0.9, 0.5, 0.5, 1e-8, 0.99))
julia> observable(r[1:2], Z⊗Z)
```
"""
@withmetadata struct DualRailMidSwapBellN <: AbstractTwoQubitState
@withmetadata struct DualRailMidSwapBell <: AbstractTwoQubitState
eA::Float64
eB::Float64
gA::Float64
Expand All @@ -164,32 +168,32 @@ julia> observable(r[1:2], Z⊗Z)
Vis::Float64
end

symbollabel(x::DualRailMidSwapBellN) = "ρᵈʳᵐˢᴺ"
symbollabel(x::DualRailMidSwapBell) = "ρᵈʳᵐˢ"


## express

function express_nolookup(x::SingleRailMidSwapBellU, ::QuantumOpticsRepr)
function express_nolookup(x::SingleRailMidSwapBellW, ::QuantumOpticsRepr)
data = midswap_single_rail(x.eA, x.eB, x.gA, x.gB, x.Pd, x.Vis)
return SparseOperator(_bspin_bspin, Complex.(data))
end

function express_nolookup(x::SingleRailMidSwapBellN, ::QuantumOpticsRepr)
function express_nolookup(x::SingleRailMidSwapBell, ::QuantumOpticsRepr)
data = midswap_single_rail(x.eA, x.eB, x.gA, x.gB, x.Pd, x.Vis)
return SparseOperator(_bspin_bspin, Complex.(data/tr(data)))
end

function express_nolookup(x::DualRailMidSwapBellU, ::QuantumOpticsRepr)
function express_nolookup(x::DualRailMidSwapBellW, ::QuantumOpticsRepr)
data = midswap_dual_rail(x.eA, x.eB, x.gA, x.gB, x.Pd, x.Vis)
return SparseOperator(_bspin_bspin, Complex.(data))
end

function express_nolookup(x::DualRailMidSwapBellN, ::QuantumOpticsRepr)
function express_nolookup(x::DualRailMidSwapBell, ::QuantumOpticsRepr)
data = midswap_dual_rail(x.eA, x.eB, x.gA, x.gB, x.Pd, x.Vis)
return SparseOperator(_bspin_bspin, Complex.(data/tr(data)))
end

# Symbolic trace

tr(::SingleRailMidSwapBellN) = 1
tr(::DualRailMidSwapBellN) = 1
tr(::SingleRailMidSwapBell) = 1
tr(::DualRailMidSwapBell) = 1
21 changes: 11 additions & 10 deletions src/StatesZoo/zalm_pair/zalm_pair.jl
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,8 @@ Fields:
$FIELDS
Generate symbolic object for the unnormalized spin-spin density matrix for a
cascaded source swapped with emissive spin memories. The cascaded
cascaded source swapped with emissive spin memories. Since the matrix is 'weighted' by the probability for
success, it is suffixed with a W to distinguish it from the normalized object `ZALMSpinPair`. The cascaded
source from papers [prajit2022heralded](@cite) and [kevin2023zero](@cite)
is stored in spin memories as discussed in [prajit2023entangling](@cite).
It takes the following parameters:
Expand All @@ -589,12 +590,12 @@ It takes the following parameters:
```jldoctest
julia> r = Register(2)
julia> initialize!(r[1:2], ZALMSpinPairU(1e-3, 0.5, 0.5, 1, 1, 1, 1, 0.9, 1e-8, 1e-8, 1e-8, 0.99))
julia> initialize!(r[1:2], ZALMSpinPairW(1e-3, 0.5, 0.5, 1, 1, 1, 1, 0.9, 1e-8, 1e-8, 1e-8, 0.99))
juilia> observable(r[1:2], Z⊗Z)
```
"""
@withmetadata struct ZALMSpinPairU <: AbstractTwoQubitState
@withmetadata struct ZALMSpinPairW <: AbstractTwoQubitState
Ns::Float64
gA::Float64
gB::Float64
Expand All @@ -609,7 +610,7 @@ juilia> observable(r[1:2], Z⊗Z)
VisF::Float64
end

symbollabel(x::ZALMSpinPairU) = "ρᶻᵃˡᵐᵁ"
symbollabel(x::ZALMSpinPairW) = "ρᶻᵃˡᵐᵂ"


"""
Expand Down Expand Up @@ -640,12 +641,12 @@ It takes the following parameters:
```jldoctest
julia> r = Register(2)
julia> initialize!(r[1:2], ZALMSpinPairN(1e-3, 0.5, 0.5, 1, 1, 1, 1, 0.9, 1e-8, 1e-8, 1e-8, 0.99))
julia> initialize!(r[1:2], ZALMSpinPair(1e-3, 0.5, 0.5, 1, 1, 1, 1, 0.9, 1e-8, 1e-8, 1e-8, 0.99))
juilia> observable(r[1:2], Z⊗Z)
```
"""
@withmetadata struct ZALMSpinPairN <: AbstractTwoQubitState
@withmetadata struct ZALMSpinPair <: AbstractTwoQubitState
Ns::Float64
gA::Float64
gB::Float64
Expand All @@ -660,19 +661,19 @@ juilia> observable(r[1:2], Z⊗Z)
VisF::Float64
end

symbollabel(x::ZALMSpinPairN) = "ρᶻᵃˡᵐᴺ"
symbollabel(x::ZALMSpinPair) = "ρᶻᵃˡᵐ"

## express

function express_nolookup(x::ZALMSpinPairU, ::QuantumOpticsRepr)
function express_nolookup(x::ZALMSpinPairW, ::QuantumOpticsRepr)
data = cascaded_source_spin(x.Ns, x.gA, x.gB, x.eAm, x.eBm, x.eAs, x.eBs, x.eD, x.Pd, x.Pdo1, x.Pdo2, x.VisF)
return SparseOperator(_bspin_bspin, Complex.(data))
end

function express_nolookup(x::ZALMSpinPairN, ::QuantumOpticsRepr)
function express_nolookup(x::ZALMSpinPair, ::QuantumOpticsRepr)
data = cascaded_source_spin(x.Ns, x.gA, x.gB, x.eAm, x.eBm, x.eAs, x.eBs, x.eD, x.Pd, x.Pdo1, x.Pdo2, x.VisF)
return SparseOperator(_bspin_bspin, Complex.(data/tr(data)))
end

## Symbolic trace
tr(::ZALMSpinPairN) = 1
tr(::ZALMSpinPair) = 1

0 comments on commit 5c50963

Please sign in to comment.