4
$\begingroup$

I want to implement the quantum Uhlmann fidelity $$F(\rho, \sigma) := \mathrm{tr} \left[\sqrt{\sqrt{\rho} \sigma \sqrt{\rho}} \right]^2.$$ in Mathematica as a measure of "closeness" between two density matrices.

However, I think that my implementation is wrong.

$$fidelity[\rho\_, \sigma\_] := (\mathrm{Tr} \left[\sqrt{(\sqrt{\rho}).\sigma.(\sqrt{\rho})} \right])^2$$

When I test it on test$\rho$ = {{1/9, 2/3, 2/9}, {1/3, 4/9, 4/9}, {2/9, 4/9, 4/9}};

test$\sigma$ = {{1/9, 1/3, 2/9}, {1/3, 4/9, 4/9}, {2/9, 4/9, 4/9}};

I get a fidelity of 1, which is obviously not correct, as these matrices are not the same. I would expect that the fidelity is 1 if and only if $\rho=\sigma$.

$\endgroup$
4
  • 2
    $\begingroup$ You need use MatrixPower to take a matrix square root. What you do in your code takes each matrix element’s square root, which is very different. $\endgroup$ – Roman Sep 5 '20 at 9:08
  • $\begingroup$ Could it be that $\varrho$ needs to have trace equal to one for $F(\varrho,\varrho) = 1$ to hold true? Your $\varrho$ has trace $0.8 \neq 1$. Which is to say, your $\varrho$ is not a density matrix... $\endgroup$ – Henrik Schumacher Sep 5 '20 at 9:18
  • $\begingroup$ @ Thanks, I updated the post with two different density matrices that give the wrong result. $\endgroup$ – MrDerDart Sep 5 '20 at 9:58
  • $\begingroup$ Your new test matrices are not positive semi-definite. $\endgroup$ – Roman Sep 5 '20 at 11:40
9
$\begingroup$

Here is a definition that is insensitive to density matrix normalization:

F[ρ_, σ_] := Tr[MatrixPower[MatrixPower[ρ, 1/2].σ.MatrixPower[ρ, 1/2], 1/2]]^2/(Tr[ρ]*Tr[σ])

Tests with positive semi-definite $3\times3$ matrices:

testρ = {{1/5, 1/5, 0}, {1/5, 3/5, 1/5}, {0, 1/5, 1/5}};
testσ = {{1/3, -1/6, 1/6}, {-1/6, 1/3, -1/6}, {1/6, -1/6, 1/3}};

F[testρ, testρ] // FullSimplify
(*    1    *)

F[testρ, testσ] // FullSimplify
(*    8/15    *)

F[testσ, testρ] // FullSimplify
(*    8/15    *)

F[testσ, testσ] // FullSimplify
(*    1    *)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.