Skip to content

Commit 1c95da1

Browse files
chore: updating the expectation_value.py for commutativity
1 parent 2427623 commit 1c95da1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mpqp/core/instruction/measurement/expectation_value.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ def is_diagonal(self) -> bool:
183183
self._is_diagonal = is_diagonal(self._matrix)
184184
# If only the diagonal elements are known, we pass by the matrix for efficiency
185185
elif self._diag_elements is not None:
186-
self._is_diagonal = is_diagonal(self.matrix)
186+
self._is_diagonal = True
187187
# Otherwise, the observable is empty, we return False by convention
188188
else:
189189
return False
@@ -197,7 +197,7 @@ def __mult__(self, other: Expr | Real) -> Observable:
197197
"""3M-TODO"""
198198
...
199199

200-
def is_commuting(self, obs: Observable):
200+
def commutes_with(self, obs: Observable):
201201
# Naive version, just computing AB - BA, and compare to 0 matrix.
202202
# TODO : distinguer si on a l'observable ou le pauli string
203203
# TODO: traitement spécifique si observable diagonal ?

0 commit comments

Comments
 (0)