Skip to content

Commit

Permalink
change clip to where
Browse files Browse the repository at this point in the history
  • Loading branch information
rochisha0 committed Aug 8, 2024
1 parent 234f26b commit 8995615
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion qutip/entropy.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ def entropy_vn(rho, base=np.e, sparse=False):
if rho.type == 'ket' or rho.type == 'bra':
rho = ket2dm(rho)
vals = rho.eigenenergies(sparse=sparse)
nzvals = np.clip(vals, 1e-17, None)
threshold = 1e-17
nzvals = np.where(vals < threshold, threshold, vals)
if base == 2:
logvals = np.log2(nzvals)
elif base == np.e:
Expand Down

0 comments on commit 8995615

Please sign in to comment.