QuantumCumulants.jl
QuantumCumulants.jl copied to clipboard
metadata function for QAdd
The package defines a function to extract the metadata of the QAdd type but QAdd does not have a metadata field.
https://github.com/qojulia/QuantumCumulants.jl/blob/1d144b1811596057a4bd57eee601669db61cc8ac/src/qnumber.jl#L232
The function is used when you try to use Symbolics.expand on a QAdd expression:
using QuantumCumulant
using Symbolics
h = FockSpace(:cavity)
@qnumbers a::Destroy(h)
expr = (a'+a) |> simplify
expr |> expand
Thanks for the report! The fact that the metadata is missing here is definitely an oversight on our end. However, that's not the whole story. I wouldn't expect expand to work properly on QNumber types right now. What we also need is an overload to expand similar to what we are doing with simplify so Symbolics can work on numbers. Something like this:
function Symbolics.expand(q::QTerm)
q |> average |> expand |> undo_average
end