Skip to content

Commit

Permalink
Fix #242 trace_distance to use nuclear norm
Browse files Browse the repository at this point in the history
Fix #242 by replacing call to `numpy.linalg.norm(x,1)` with `numpy.linalg.norm(x,'nuc')`
  • Loading branch information
marcusps authored Oct 31, 2024
1 parent aa288ff commit 5a161fd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion forest/benchmarking/distance_measures.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def trace_distance(rho: np.ndarray, sigma: np.ndarray) -> float:
:param sigma: Is a dim by dim positive matrix with unit trace.
:return: Trace distance which is a scalar.
"""
return (0.5) * np.linalg.norm(rho - sigma, 1)
return (0.5) * np.linalg.norm(rho - sigma, 'nuc')


def bures_distance(rho: np.ndarray, sigma: np.ndarray) -> float:
Expand Down

0 comments on commit 5a161fd

Please sign in to comment.