diff --git a/src/qibo/hamiltonians/hamiltonians.py b/src/qibo/hamiltonians/hamiltonians.py index 2c527df0ba..8e17e88fbb 100644 --- a/src/qibo/hamiltonians/hamiltonians.py +++ b/src/qibo/hamiltonians/hamiltonians.py @@ -250,7 +250,8 @@ 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.backend.np.flip(self._eigenvalues, (0,)) + axis = (0,) if isinstance(self.backend, PyTorchBackend) else 0 + r._eigenvalues = o * self.backend.np.flip(self._eigenvalues, axis) if self._eigenvectors is not None: if self.backend.np.real(o) > 0: # TODO: see above r._eigenvectors = self._eigenvectors