Skip to content
This repository has been archived by the owner on Dec 7, 2021. It is now read-only.

Commit

Permalink
Change conversion from array of strings to array of booleans for nump…
Browse files Browse the repository at this point in the history
…y 1.18.3 (#907)

* Change conversion from array of strings to array of booleans for numpy 1.18.3
  • Loading branch information
manoelmarques authored Apr 20, 2020
1 parent 9de21f6 commit 31cfdc9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions qiskit/aqua/operators/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def measure_pauli_z(data, pauli):
num_shots = sum(data.values())
p_z_or_x = np.logical_or(pauli.z, pauli.x)
for key, value in data.items():
bitstr = np.asarray(list(key))[::-1].astype(np.bool)
bitstr = np.asarray(list(key))[::-1].astype(np.int).astype(np.bool)
# pylint: disable=no-member
sign = -1.0 if np.logical_xor.reduce(np.logical_and(bitstr, p_z_or_x)) else 1.0
observable += sign * value
Expand Down Expand Up @@ -107,7 +107,7 @@ def covariance(data, pauli_1, pauli_2, avg_1, avg_2):
p1_z_or_x = np.logical_or(pauli_1.z, pauli_1.x)
p2_z_or_x = np.logical_or(pauli_2.z, pauli_2.x)
for key, value in data.items():
bitstr = np.asarray(list(key))[::-1].astype(np.bool)
bitstr = np.asarray(list(key))[::-1].astype(np.int).astype(np.bool)
# pylint: disable=no-member
sign_1 = -1.0 if np.logical_xor.reduce(np.logical_and(bitstr, p1_z_or_x)) else 1.0
sign_2 = -1.0 if np.logical_xor.reduce(np.logical_and(bitstr, p2_z_or_x)) else 1.0
Expand Down

0 comments on commit 31cfdc9

Please sign in to comment.