Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# News

## [Unreleased]

- Add `lazy` option to `QuantumOpticsRepr` for downstream lazy QuantumOptics conversions.

## v0.4.2 - 2025-11-29

- Define `commutator` and `anticommutator`.
Expand Down
4 changes: 3 additions & 1 deletion src/express.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@ express(s, repr::AbstractRepresentation) = express(s, repr, UseAsState())
"""Representation using kets, bras, density matrices, and superoperators governed by `QuantumOptics.jl`."""
Base.@kwdef struct QuantumOpticsRepr <: AbstractRepresentation
cutoff::Int = 2
lazy::Bool = false
end
QuantumOpticsRepr(cutoff::Int) = QuantumOpticsRepr(cutoff, false)
"""Similar to `QuantumOpticsRepr`, but using trajectories instead of superoperators."""
struct QuantumMCRepr <: AbstractRepresentation end
"""Representation using tableaux governed by `QuantumClifford.jl`"""
struct CliffordRepr <: AbstractRepresentation end
"""Representation using Gaussian phase space formalism governed by `Gabs.jl`."""
struct GabsRepr{B} <: AbstractRepresentation
basis::B
end
end
4 changes: 4 additions & 0 deletions test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
LoweredCodeUtils = "6f1432cf-f94c-5a45-995e-cdbf5db27b0b"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[compat]
LoweredCodeUtils = "=3.5.3"
1 change: 1 addition & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ println("Starting tests with $(Threads.nthreads()) threads out of `Sys.CPU_THREA

@doset "sortedindices"
@doset "bases"
@doset "express"
#VERSION >= v"1.9" && @doset "doctests"
get(ENV,"JET_TEST","")=="true" && @doset "jet"
VERSION >= v"1.9" && @doset "aqua"
16 changes: 16 additions & 0 deletions test/test_express.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Test
using QuantumInterface: QuantumOpticsRepr

@testset "express representations" begin
repr = QuantumOpticsRepr()
@test repr.cutoff == 2
@test repr.lazy == false

repr = QuantumOpticsRepr(4)
@test repr.cutoff == 4
@test repr.lazy == false

repr = QuantumOpticsRepr(cutoff=5, lazy=true)
@test repr.cutoff == 5
@test repr.lazy == true
end
25 changes: 5 additions & 20 deletions test/test_jet.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,13 @@ using QuantumInterface
using Test
using JET

using JET: ReportPass, DefinitionAnalysisPass, BasicPass, InferenceErrorReport, UncaughtExceptionReport, MethodErrorReport

# We define abstract methods, so it is unsurprising that there are no matching methods unless
# we import other libraries.
# TODO find a more fine-grained way to check these.
struct NoMatchingMethodIsOK <: ReportPass end

# ignores `MethodErrorReport` analyzed by `JETAnalyzer`
(::NoMatchingMethodIsOK)(::Type{MethodErrorReport}, @nospecialize(_...)) = return

function (::NoMatchingMethodIsOK)(report_type::Type{<:InferenceErrorReport}, @nospecialize(args...))
DefinitionAnalysisPass()(report_type, args...) # Using it instead of BasePass, see https://github.com/aviatesk/JET.jl/pull/532
end
using JET: MethodErrorReport

@testset "JET checks" begin
rep = report_package("QuantumInterface";
report_pass=NoMatchingMethodIsOK(),
ignored_modules=(
#AnyFrameModule(...),
)
)
rep = report_package(QuantumInterface; target_modules=(QuantumInterface,))
@show rep
@test length(JET.get_reports(rep)) <= 3
reports = JET.get_reports(rep)
non_method_reports = filter(report -> !(report isa MethodErrorReport), reports)
@test isempty(non_method_reports)
@test_broken length(JET.get_reports(rep)) == 0
end