Skip to content

Commit 8f8c0e2

Browse files
authored
Merge pull request #46 from apkille/express
Migrate `express` and `AbstractRepresentation` type from QuantumSymbolics
2 parents f22adb7 + 7ce478a commit 8f8c0e2

File tree

5 files changed

+39
-2
lines changed

5 files changed

+39
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# News
22

3+
## v0.3.7 - 2025-01-16
4+
5+
- Migrate `express` functionalities and representation types from QuantumSymbolics.
6+
37
## v0.3.6 - 2024-09-08
48

59
- Add `coherentstate`, `thermalstate`, `displace`, `squeeze`, `wigner`, previously from QuantumOptics.

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "QuantumInterface"
22
uuid = "5717a53b-5d69-4fa3-b976-0bf2f97ca1e5"
33
authors = ["QuantumInterface.jl contributors"]
4-
version = "0.3.6"
4+
version = "0.3.7"
55

66
[deps]
77
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"

src/QuantumInterface.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,5 +100,6 @@ include("julia_linalg.jl")
100100
include("sparse.jl")
101101

102102
include("sortedindices.jl")
103+
include("express.jl")
103104

104105
end # module

src/express.jl

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
"""
2+
express(obj, repr::AbstractRepresentation)
3+
express(obj, repr::AbstractRepresentation, use::AbstractUse)
4+
5+
Translate a quantum object `obj` to a backend representation `repr`. It is relevant to define `use`
6+
for formalism-specific cases, e.g., for `QuantumCliffordRepr`.
7+
"""
8+
function express end
9+
10+
"""An abstract type for the supported representation of quantum objects."""
11+
abstract type AbstractRepresentation end
12+
abstract type AbstractUse end
13+
struct UseAsState <: AbstractUse end
14+
struct UseAsOperation <: AbstractUse end
15+
struct UseAsObservable <: AbstractUse end
16+
17+
express(obj) = express(obj, QuantumOpticsRepr()) # The default representation
18+
express(s::Number, repr::AbstractRepresentation, use::AbstractUse) = s
19+
express(s, repr::AbstractRepresentation) = express(s, repr, UseAsState())
20+
21+
##
22+
# Commonly used representations -- interfaces for each one defined in separate packages
23+
##
24+
25+
"""Representation using kets, bras, density matrices, and superoperators governed by `QuantumOptics.jl`."""
26+
Base.@kwdef struct QuantumOpticsRepr <: AbstractRepresentation
27+
cutoff::Int = 2
28+
end
29+
"""Similar to `QuantumOpticsRepr`, but using trajectories instead of superoperators."""
30+
struct QuantumMCRepr <: AbstractRepresentation end
31+
"""Representation using tableaux governed by `QuantumClifford.jl`"""
32+
struct CliffordRepr <: AbstractRepresentation end

test/test_jet.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,6 @@ end
4949
)
5050
)
5151
@show rep
52-
@test length(JET.get_reports(rep)) <= 2
52+
@test length(JET.get_reports(rep)) <= 3
5353
@test_broken length(JET.get_reports(rep)) == 0
5454
end

0 commit comments

Comments
 (0)