diff --git a/CHANGELOG.md b/CHANGELOG.md index fa9af19..0836d3b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # News +## v0.4.3 - 2026-06-08 + +- Add a `lazy` option to `QuantumOpticsRepr`. + ## v0.4.2 - 2025-11-29 - Define `commutator` and `anticommutator`. diff --git a/Project.toml b/Project.toml index 2029043..4b0e668 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "QuantumInterface" uuid = "5717a53b-5d69-4fa3-b976-0bf2f97ca1e5" authors = ["QuantumInterface.jl contributors"] -version = "0.4.2" +version = "0.4.3" [deps] LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" diff --git a/src/express.jl b/src/express.jl index c088c27..1c304fd 100644 --- a/src/express.jl +++ b/src/express.jl @@ -22,10 +22,17 @@ express(s, repr::AbstractRepresentation) = express(s, repr, UseAsState()) # Commonly used representations -- interfaces for each one defined in separate packages ## -"""Representation using kets, bras, density matrices, and superoperators governed by `QuantumOptics.jl`.""" -Base.@kwdef struct QuantumOpticsRepr <: AbstractRepresentation - cutoff::Int = 2 +"""Representation using kets, bras, density matrices, and superoperators governed by `QuantumOptics.jl`. + +Set `lazy=true` to request structure-preserving lazy operators where supported by +the target package. +""" +struct QuantumOpticsRepr <: AbstractRepresentation + cutoff::Int + lazy::Bool end +QuantumOpticsRepr(; cutoff::Int=2, lazy::Bool=false) = QuantumOpticsRepr(cutoff, lazy) +QuantumOpticsRepr(cutoff::Int) = QuantumOpticsRepr(cutoff=cutoff) """Similar to `QuantumOpticsRepr`, but using trajectories instead of superoperators.""" struct QuantumMCRepr <: AbstractRepresentation end """Representation using tableaux governed by `QuantumClifford.jl`""" @@ -33,4 +40,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/test_bases.jl b/test/test_bases.jl index c480d41..3dc00cd 100644 --- a/test/test_bases.jl +++ b/test/test_bases.jl @@ -1,6 +1,6 @@ using Test using QuantumInterface: tensor, ⊗, ptrace, reduced, permutesystems, multiplicable -using QuantumInterface: GenericBasis, CompositeBasis, NLevelBasis, FockBasis +using QuantumInterface: GenericBasis, CompositeBasis, NLevelBasis, FockBasis, QuantumOpticsRepr @testset "basis" begin @@ -53,3 +53,14 @@ comp2 = tensor(b2, b1, b3) @test !multiplicable(comp1, b1 ⊗ b2 ⊗ NLevelBasis(prod(b3.shape))) end # testset + +@testset "representations" begin + @test QuantumOpticsRepr().cutoff == 2 + @test QuantumOpticsRepr().lazy == false + @test QuantumOpticsRepr(5).cutoff == 5 + @test QuantumOpticsRepr(5).lazy == false + @test QuantumOpticsRepr(lazy=true).cutoff == 2 + @test QuantumOpticsRepr(lazy=true).lazy == true + @test QuantumOpticsRepr(cutoff=4, lazy=true).cutoff == 4 + @test QuantumOpticsRepr(cutoff=4, lazy=true).lazy == true +end