Skip to content

Commit

Permalink
solved errors in evolution
Browse files Browse the repository at this point in the history
  • Loading branch information
Simone-Bordoni committed Feb 28, 2024
1 parent d63fef0 commit 23ccda9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/qibo/hamiltonians/hamiltonians.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,12 @@ def __mul__(self, o):
if self.backend.np.real(o) >= 0: # TODO: check for side effects K.qnp
r._eigenvalues = o * self._eigenvalues
elif not self.backend.issparse(self.matrix):
r._eigenvalues = o * self._eigenvalues[::-1]
if self.backend.__class__.__name__ == "PyTorchBackend":
import torch

r._eigenvalues = o * torch.flip(self._eigenvalues, [0])
else:
r._eigenvalues = o * self._eigenvalues[::-1]
if self._eigenvectors is not None:
if self.backend.np.real(o) > 0: # TODO: see above
r._eigenvectors = self._eigenvectors
Expand Down

0 comments on commit 23ccda9

Please sign in to comment.