Skip to content

Commit

Permalink
real expv in expectation
Browse files Browse the repository at this point in the history
  • Loading branch information
MatteoRobbiati committed Jan 9, 2024
1 parent 0eeb6ae commit 351eff8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/qibo/hamiltonians/hamiltonians.py
Original file line number Diff line number Diff line change
Expand Up @@ -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``"""
Expand Down

0 comments on commit 351eff8

Please sign in to comment.