From bb19f8a16ff046c40de7455d1ca37afe2dbf0858 Mon Sep 17 00:00:00 2001 From: mk0dz Date: Tue, 16 Jun 2026 05:24:32 +0530 Subject: [PATCH] Add lazy field to QuantumOpticsRepr (qojulia/QuantumOptics.jl#521) --- src/express.jl | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/express.jl b/src/express.jl index c088c27..a4f93b9 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 +"""Representation using kets, bras, density matrices, and superoperators governed by `QuantumOptics.jl`. + +When `lazy=true`, composite symbolic expressions (sums, products, tensor products) +are expressed into structure-preserving lazy operators (`LazySum`, `LazyProduct`, +`LazyTensor`) instead of eagerly-materialised dense/sparse operators.""" +Base.@kwdef struct QuantumOpticsRepr <: AbstractRepresentation cutoff::Int = 2 + lazy::Bool = false end +# preserve the historical positional one-argument constructor QuantumOpticsRepr(cutoff) +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`"""