-
Notifications
You must be signed in to change notification settings - Fork 21
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
[Refactoring] Avoid calling block to tensor on diagonal Hamiltonians #368
Comments
Dear all,
|
Hey @neogyk, thanks for your interest in completing this issue! The solution should be along those lines, but there is no need to use Feel free to open an MR and add me as a reviewer, then we can discuss it there. |
Dear @jpmoutinho, could you please review the changes. I made the PR - #441 |
Dear @neogyk, just for your information, @jpmoutinho is off today. He will catch-up as soon as he's back, ie. tomorrow. Thanks. |
When calling
HamEvo
on diagonal Hamiltonians the dense matrix is built but then only the diagonal is taken.This is currently done in the
PyQHamiltonianEvolution
class inqadence/backends/pyqtorch/convert_ops.py
, where the__init__
method first builds the full matrixhmat
, and then the_unitary
method defines the evolution function for diagonal operators which runsdiagonal()
on the full hamiltonian matrix.We should instead build only the diagonal. For non-parametric block this is directly possible with the function
block_to_diagonal
, as done in thePyQObservable
class in the same file.Handling parametric blocks is out of the scope of this issue, and can be done separately. It requires further development in the
block_to_tensor
side as detailed in #394.NOTE: Due to ongoing changes in the codebase, we might need to implement this directly in the PyQTorch backend (pasqal-io/pyqtorch#175).
The text was updated successfully, but these errors were encountered: