Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

metadata function for QAdd #204

Open
oameye opened this issue Apr 28, 2024 · 1 comment
Open

metadata function for QAdd #204

oameye opened this issue Apr 28, 2024 · 1 comment

Comments

@oameye
Copy link

oameye commented Apr 28, 2024

The package defines a function to extract the metadata of the QAdd type but QAdd does not have a metadata field.

SymbolicUtils.metadata(q::QAdd) = q.metadata

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
@david-pl
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants