rigetti / forest-benchmarking

A library for quantum characterization, verification, validation (QCVV), and benchmarking using pyQuil.
Apache License 2.0
53 stars 22 forks source link

distace_measures.trace_distance uses the wrong matrix norm #242

Open marcusps opened 3 weeks ago

marcusps commented 3 weeks ago

The trace distance is given by $T(\rho, \sigma) = (1/2)|\rho-\sigma|_1$ where $|\cdot|_1$ is the Schatten 1-norm (as correctly indicated in the docs).

In the implementation, however, a call is made to numpy.linalg.norm(rho - sigma, 1), which uses the matrix norm induced by the vector 1-norm (i.e., the maximum absolute column sum).

Instead the implementation should call numpy.linalg.norm(rho - sigma, 'nuc') to compute the nuclear norm (synonymous with the Schatten 1-norm).