Skip to content

Commit cc60819

Browse files
authored
Add Gaussian channel support for Gabs (#129)
1 parent d11c261 commit cc60819

File tree

3 files changed

+35
-1
lines changed

3 files changed

+35
-1
lines changed

ext/GabsExt/GabsExt.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,7 @@ for (f,g) in [(:TwoSqueezedState, :eprstate),(:TwoSqueezeOp,:twosqueeze)]
2929
end
3030
end
3131

32+
express_nolookup(x::AttenuatorCPTP, repr::GabsRepr) = attenuator(repr.basis(1), x.theta, x.noise)
33+
express_nolookup(x::AmplifierCPTP, repr::GabsRepr) = amplifier(repr.basis(1), x.r, x.noise)
34+
3235
end

src/QSymbolicsBase/predefined_CPTP.jl

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,35 @@
1-
export PauliNoiseCPTP, DephasingCPTP, DephasingCPTP, GateCPTP
1+
export PauliNoiseCPTP, DephasingCPTP, DephasingCPTP, GateCPTP, AttenuatorCPTP, AmplifierCPTP
22

33
abstract type NoiseCPTP <: Symbolic{AbstractSuperOperator} end
44
isexpr(::NoiseCPTP) = false
55
basis(x::NoiseCPTP) = x.basis
66

7+
"""
8+
AttenuatorCPTP(theta::Number, noise::Int)
9+
10+
Attenuation CPTP map, defined by the beam splitter rotation parameter `theta`
11+
and thermal noise parameter `noise`.
12+
"""
13+
@withmetadata struct AttenuatorCPTP <: NoiseCPTP
14+
theta::Real
15+
noise::Real
16+
end
17+
basis(x::AttenuatorCPTP) = inf_fock_basis
18+
symbollabel(x::AttenuatorCPTP) = "𝒜𝓉𝓉"
19+
20+
"""
21+
AmplifierCPTP(r::Number, noise::Int)
22+
23+
Amplification CPTP map, defined by the squeezing amplitude parameter `r`
24+
and thermal noise parameter `noise`.
25+
"""
26+
@withmetadata struct AmplifierCPTP <: NoiseCPTP
27+
r::Real
28+
noise::Real
29+
end
30+
basis(x::AmplifierCPTP) = inf_fock_basis
31+
symbollabel(x::AmplifierCPTP) = "𝒜𝓂𝓅"
32+
733
"""Single-qubit Pauli noise CPTP map
834
935
```jldoctest

test/test_gabs.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@
2323
@test express(BeamSplitterOp(τ), GabsRepr(basis)) beamsplitter(basis(2), τ)
2424
end
2525

26+
@testset "Gaussian channels - $(basis)" begin
27+
@test express(AttenuatorCPTP(θ, τ), GabsRepr(basis)) attenuator(basis(1), θ, τ)
28+
@test express(AmplifierCPTP(r, τ), GabsRepr(basis)) amplifier(basis(1), r, τ)
29+
end
30+
2631
@testset "Linear algebra operations" begin
2732
@test express(CoherentState(α) TwoSqueezedState(r*exp(im*θ)) vac, GabsRepr(basis)) coherentstate(basis(1), α) eprstate(basis(2), r, θ) vacuumstate(basis(1))
2833
@test express(DisplaceOp(α) * vac, GabsRepr(basis)) coherentstate(basis(1), α)

0 commit comments

Comments
 (0)