From 351eff84f19618d2720cffb13f8e6f97901103a6 Mon Sep 17 00:00:00 2001 From: MatteoRobbiati Date: Tue, 9 Jan 2024 09:51:57 +0100 Subject: [PATCH] real expv in expectation --- src/qibo/hamiltonians/hamiltonians.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qibo/hamiltonians/hamiltonians.py b/src/qibo/hamiltonians/hamiltonians.py index 0aa68d08a6..2933163354 100644 --- a/src/qibo/hamiltonians/hamiltonians.py +++ b/src/qibo/hamiltonians/hamiltonians.py @@ -155,7 +155,7 @@ def expectation_from_samples(self, freq, qubit_map=None): for i in qubit_map: index += int(k[qubit_map.index(i)]) * 2 ** (size - 1 - i) expval += obs[index, index] * counts[j] - return expval + return np.real(expval) def eye(self, dim: Optional[int] = None): """Generate Identity matrix with dimension ``dim``"""