From b807e34c1a53367fec4bc63790fa1812df2411ca Mon Sep 17 00:00:00 2001 From: Dennis Wayo <117969019+DennisWayo@users.noreply.github.com> Date: Thu, 11 Jun 2026 13:45:58 +0500 Subject: [PATCH 1/3] Add lazy option to QuantumOpticsRepr --- src/express.jl | 4 +++- test/runtests.jl | 1 + test/test_express.jl | 16 ++++++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 test/test_express.jl diff --git a/src/express.jl b/src/express.jl index c088c27..00c201f 100644 --- a/src/express.jl +++ b/src/express.jl @@ -25,7 +25,9 @@ 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`""" @@ -33,4 +35,4 @@ struct CliffordRepr <: AbstractRepresentation end """Representation using Gaussian phase space formalism governed by `Gabs.jl`.""" struct GabsRepr{B} <: AbstractRepresentation basis::B -end \ No newline at end of file +end diff --git a/test/runtests.jl b/test/runtests.jl index 826fe33..3c2359d 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -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" diff --git a/test/test_express.jl b/test/test_express.jl new file mode 100644 index 0000000..d70308d --- /dev/null +++ b/test/test_express.jl @@ -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 From 978c1cc2d6303ae86c08c6b4c78a9edce416b095 Mon Sep 17 00:00:00 2001 From: Dennis Wayo <117969019+DennisWayo@users.noreply.github.com> Date: Thu, 11 Jun 2026 16:39:41 +0500 Subject: [PATCH 2/3] Update changelog for lazy QuantumOptics repr --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fa9af19..e25c942 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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`. From ddf72a98e1257a573ba2916b7e0b23fa5d55f0dc Mon Sep 17 00:00:00 2001 From: Dennis Wayo <117969019+DennisWayo@users.noreply.github.com> Date: Thu, 11 Jun 2026 20:05:56 +0500 Subject: [PATCH 3/3] Fix JET test dependency resolution --- test/Project.toml | 4 ++++ test/test_jet.jl | 25 +++++-------------------- 2 files changed, 9 insertions(+), 20 deletions(-) diff --git a/test/Project.toml b/test/Project.toml index c111471..2954374 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -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" diff --git a/test/test_jet.jl b/test/test_jet.jl index 09baef8..05785eb 100644 --- a/test/test_jet.jl +++ b/test/test_jet.jl @@ -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