Skip to content

Commit 26c0176

Browse files
authored
outer product express in quantum optics (#104)
1 parent de5fba9 commit 26c0176

File tree

5 files changed

+16
-2
lines changed

5 files changed

+16
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## v0.4.7 - 2025-02-25
44

5+
- Proper expression of outer products in QuantumOptics.
6+
7+
## v0.4.7 - 2025-02-25
8+
59
- Improvements to default flattening of expressions having nested sums and scalings.
610

711
## v0.4.6 - 2025-01-18

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "QuantumSymbolics"
22
uuid = "efa7fd63-0460-4890-beb7-be1bbdfbaeae"
33
authors = ["QuantumSymbolics.jl contributors"]
4-
version = "0.4.7"
4+
version = "0.4.8"
55

66
[deps]
77
Latexify = "23fbe1c1-3f47-55db-b15f-69d7ec21a316"

ext/QuantumOpticsExt/QuantumOpticsExt.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ express_nolookup(x::IdentityOp, r::QuantumOpticsRepr) = identityoperator(finite_
9696
express_nolookup(p::PauliNoiseCPTP, ::QuantumOpticsRepr) = LazySuperSum(SpinBasis(1//2), [1-p.px-p.py-p.pz,p.px,p.py,p.pz],
9797
[LazyPrePost(_id,_id),LazyPrePost(_x,_x),LazyPrePost(_y,_y),LazyPrePost(_z,_z)])
9898

99+
express_nolookup(s::SOuterKetBra, r::QuantumOpticsRepr) = projector(express(s.ket, r), express(s.bra, r))
100+
99101
include("should_upstream.jl")
100102

101103
end

src/QSymbolicsBase/express.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,4 @@ function express_nolookup(s, repr::AbstractRepresentation)
7474
else
7575
error("Encountered an object $(s) of type $(typeof(s)) that can not be converted to $(repr) representation") # TODO make a nice error type
7676
end
77-
end
77+
end

test/test_outerprod.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
@testitem "Outer Product" begin
2+
using QuantumOpticsBase
3+
4+
@test isequal(L1*dagger(L0), SOuterKetBra(L1,dagger(L0)))
5+
6+
@test isequal(express(L1*dagger(L0)), projector(express(L1), express(dagger(L0))))
7+
8+
end

0 commit comments

Comments
 (0)