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

Support observable list for expect #374

Open
ytdHuang opened this issue Jan 24, 2025 · 4 comments
Open

Support observable list for expect #374

ytdHuang opened this issue Jan 24, 2025 · 4 comments
Labels
enhancement New feature or request

Comments

@ytdHuang
Copy link
Member

ytdHuang commented Jan 24, 2025

Problem Description

For the current implementation of expect, it only allows a single observable (Operator).
We should also support it to be the a list of observables.

Furthermore, I saw some methods of expect allow AbstractQuantumObject.
Is it reasonable to calculate expect for QobjEvo ?
I thought it will always return the value of zero. Because it uses the default value of ScalarOperator, which is 0.0 + 0.0im.

Maybe we should just support Qobj for expect

Proposed Solution

Just add more methods.

Alternate Solutions

No response

Additional Context

No response

@ytdHuang ytdHuang added the enhancement New feature or request label Jan 24, 2025
@albertomercurio
Copy link
Member

albertomercurio commented Jan 25, 2025

We should also support it to be the second argument.

Why should we support the observable to be the second argument? The qutip documentation seems to define it only as a first argument, which makes sense for me.

Is it reasonable to calculate expect for QobjEvo ?
I thought it will always return the value of zero.

If the QobjEvo called update_coefficients!, then this would not necessarily be zero. In that case the meaning is to compute the expectation value at the last computed time. Maybe we can write some comments about that in the docstring, but I think that this functionality may be useful sometimes.

@ytdHuang
Copy link
Member Author

ytdHuang commented Jan 26, 2025

@albertomercurio
I think it's just that qutip also supports specifying a list of observables.

I will make a PR later.

Regarding the QobjEvo for expect, it's okay for me.

@ytdHuang ytdHuang reopened this Jan 26, 2025
@ytdHuang
Copy link
Member Author

The observable list might contain different data types of Qobj, and thus, the return value might be Float64 or ComplexF64 (type instability).

@ytdHuang ytdHuang changed the title Support reversed order of arguments for expect Support observable list for expect Jan 26, 2025
@albertomercurio
Copy link
Member

albertomercurio commented Jan 26, 2025

But what if we have both operator list and state list?

I that case I think we return a matrix. Is that right? We can avoid type instabilities by returning a Float64 matrix only if all the operators are hermitian, and ComplexF64 otherwise.

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

No branches or pull requests

2 participants