Fidelity calculation for density matrices improvement
See original GitHub issueThe current implementation uses the direct definition of fidelity, which works well for small dimensions. From my experience, I was getting values significantly greater than 1. For the fidelity between rho1 and rho2, I found that squaring the sum of the singular values of the product of square_root(rho1) and square_root(rho2) gives a more accurate calculation. This equation is equal to fidelity. The idea is not mine and came from qutip.
This is my version of the implementation that I use.
import scipy
def get_fidelity(rho1, rho2):
rho1_sqrt=scipy.linalg.sqrtm(rho1)
rho2_sqrt=scipy.linalg.sqrtm(rho2)
return scipy.linalg.svdvals(rho1_sqrt @ rho2_sqrt).sum()**2
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Quantum fidelity simplified formula while both of the density ...
I'm wondering how to prove this formula and is it always safe to use it while one of the density matrices is in...
Read more >Improved Quantum Algorithms for Fidelity Estimation - arXiv
Our algorithms use advanced quantum linear algebra techniques, such as the quantum singular value transformation, as well as density matrix ...
Read more >(a) Average fidelity of the reconstructed density matrices (DM ...
Specifically, the average fidelity improves from 0.751 to 0.982 with a standard deviation of 1.04 × 10 −3 , and 0.88 to 0.996...
Read more >On the learnability of quantum state fidelity
The correlation factor substantially improved to 0.82 and 0.74 for the ... They then use convex optimization to estimate the density matrix.
Read more >`qutip.metrics.fidelity` needs fix for pure states represented by ...
I found an instance where putting two kets in fidelity function gives nonphysical result while inputting corresponding density matrices ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@anonymousr007 Yes, the issue is still open.
The goal is to replace the current implementation of calculating fidelity of two density matrices with the improved implementation that has lower numerical error.
Current implementation: https://github.com/quantumlib/Cirq/blob/782c14e0cc821794d21e82f30df8e6998f4b9992/cirq-core/cirq/qis/measures.py#L239-L242
New implementation:
The PR implementing the change should also add a unit test demonstrating improved numerical stability of the new implementation, s.t. the current implementation fails but the new one passes.
Nice, I noticed pretty bad rounding errors when testing https://github.com/quantumlib/Cirq/pull/5265 and wasn’t sure what to make of it. (I had to reduce the atol in my tests to just 1e-2)