Skip to content

Commit

Permalink
restore signs
Browse files Browse the repository at this point in the history
  • Loading branch information
Edoardo-Pedicillo committed Jun 5, 2024
1 parent b94a203 commit 0fa4818
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/qibo/models/dbi/double_bracket.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def __call__(
operator_dagger = self.backend.cast(
np.matrix(self.backend.to_numpy(operator)).getH()
)
self.h.matrix = operator @ self.h.matrix @ operator_dagger
self.h.matrix = operator_dagger @ self.h.matrix @ operator
return operator

def eval_dbr_unitary(
Expand Down Expand Up @@ -137,24 +137,25 @@ def eval_dbr_unitary(

if mode is DoubleBracketGeneratorType.canonical:
operator = self.backend.calculate_matrix_exp(
1.0j * step,
-1.0j * step,
self.commutator(self.diagonal_h_matrix, self.h.matrix),
)
elif mode is DoubleBracketGeneratorType.single_commutator:
if d is None:
d = self.diagonal_h_matrix
operator = self.backend.calculate_matrix_exp(
1.0j * step,
-1.0j * step,
self.commutator(self.backend.cast(d), self.h.matrix),
)
elif mode is DoubleBracketGeneratorType.group_commutator:
if d is None:
d = self.diagonal_h_matrix
sqrt_step = np.sqrt(step)
operator = (
self.h.exp(-step)
@ self.backend.calculate_matrix_exp(-step, d)
@ self.h.exp(step)
@ self.backend.calculate_matrix_exp(step, d)
self.h.exp(sqrt_step)
@ self.backend.calculate_matrix_exp(-sqrt_step, d)
@ self.h.exp(-sqrt_step)
@ self.backend.calculate_matrix_exp(sqrt_step, d)
)
else:
raise NotImplementedError(f"The mode {mode} is not supported")
Expand Down

0 comments on commit 0fa4818

Please sign in to comment.