Skip to content

Commit

Permalink
use sum, not norm
Browse files Browse the repository at this point in the history
  • Loading branch information
Cryoris committed Mar 9, 2023
1 parent 086e9d7 commit b22df7c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion qiskit/quantum_info/states/densitymatrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ def probabilities(self, qargs=None, decimals=None):
probs = probs.round(decimals=decimals)

# to account for roundoff errors, we renormalize and clip
probs = np.clip(probs / np.linalg.norm(probs), a_min=0, a_max=1)
probs = np.clip(probs / np.sum(probs), a_min=0, a_max=1)
return probs

def reset(self, qargs=None):
Expand Down
2 changes: 1 addition & 1 deletion qiskit/quantum_info/states/statevector.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ def probabilities(self, qargs=None, decimals=None):
probs = probs.round(decimals=decimals)

# to account for roundoff errors, we renormalize and clip
probs = np.clip(probs / np.linalg.norm(probs), a_min=0, a_max=1)
probs = np.clip(probs / np.sum(probs), a_min=0, a_max=1)
return probs

def reset(self, qargs=None):
Expand Down

0 comments on commit b22df7c

Please sign in to comment.