Skip to content

Commit

Permalink
revert the probs change due to raised convern #6727
Browse files Browse the repository at this point in the history
  • Loading branch information
JerryChen97 committed Dec 18, 2024
1 parent 717b5fb commit 3d41822
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions pennylane/measurements/probs.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,6 @@ def process_density_matrix(self, density_matrix: TensorLike, wire_order: Wires):
)

# Since we only care about the probabilities, we can simplify the task here by creating a 'pseudo-state' to carry the diagonal elements and reuse the process_state method
# Introduce a small epsilon to avoid sqrt(0) to ensure absolute positivity.
prob = qml.math.real(prob)
prob = qml.math.where(prob < 0, -prob, prob)
prob = qml.math.where(prob == 0, prob + np.finfo(np.float64).eps, prob)
p_state = qml.math.sqrt(prob)
return self.process_state(p_state, wire_order)

Expand Down

0 comments on commit 3d41822

Please sign in to comment.