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

[Bug] HamEvo with FeatureParameter gets handled as a time-dependent hamiltonian in PyQ #602

Open
jpmoutinho opened this issue Nov 6, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@jpmoutinho
Copy link
Collaborator

Short description

Currently if you do

from qadence import HamEvo, FeatureParameter, TimeParameter

phi = FeatureParameter("phi")

hamiltonian = phi * Z(0)

evo = HamEvo(hamiltonian, phi)

Qadence assumes that this is a time-independent Hamiltonian (evo.is_time_dependent = False), essentially representing exp(-i phiˆ2 Z(0)). So it will not complain that there is a duration missing. However, in pyqtorch it will instantiate something equivalent to doing:

from pyqtorch import X, HamiltonianEvolution, Scale

hamiltonian = Scale(X(0), "phi")

evo = HamiltonianEvolution(hamiltonian, "phi")

And here pyqtorch will assume that this is a time-dependent Hamiltonian (evo.has_time_param = True). On execution, it will fail because it will try to integrate this for a certain duration, which qadence provided as None.

Opening the issue in Qadence because that's where the bug originates from, but actually I think this will require a fix in PyQ.

What is the expected result?

Unclear what is the best solution for this. We don't have parameter types in PyQ and we might want to avoid adding those.

  • A possible solution is to bring back the input argument in PyQ to signal if the generator is or is not time-dependent.
  • Another solution is to make the logic in PyQ depend on if a duration is passed or not.

What is the actual result?

No response

Steps/Code to reproduce

Already above.

Tracebacks (optional)

No response

Environment details (optional)

No response

Would you like to work on this issue?

None

@jpmoutinho jpmoutinho added the bug Something isn't working label Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants