Skip to content

Commit 534cc5c

Browse files
authored
Avoid warning on complex-to-float conversion (quantumlib#5795)
Make it clear we want to use the real part.
1 parent c2a153b commit 534cc5c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cirq/ops/pauli_string.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,7 @@ def _expectation_from_density_matrix_no_validation(
745745
while any(result.shape):
746746
result = np.trace(result, axis1=0, axis2=len(result.shape) // 2)
747747

748-
return float(result * self.coefficient)
748+
return float(np.real(result * self.coefficient))
749749

750750
def zip_items(
751751
self, other: 'cirq.PauliString[TKey]'

0 commit comments

Comments
 (0)