Fidelity

From QETLAB
Jump to navigation Jump to search
Fidelity
Computes the (Uhlmann) fidelity of two density matrices

Other toolboxes required none
Related functions MatsumotoFidelity
MaximumOutputFidelity
TraceNorm
Function category Norms and distance measures
Usable within CVX? yes (concave)

Fidelity is a function that computes the Uhlmann fidelity between two quantum states $\rho$ and $\sigma$, defined as follows: \[F(\rho,\sigma) := [\mathrm{Tr}\Big( \sqrt{ \sqrt{\rho}\sigma\sqrt{\rho}}\Big)]^2.\]

Note that, in some sources, "fidelity" refers to the square of this quantity.

Syntax

  • FID = Fidelity(RHO,SIGMA)

Argument descriptions

  • RHO: A density matrix.
  • SIGMA: A density matrix.

Examples

Pure states

If $\rho = |v\rangle\langle v|$ and $\sigma = |w\rangle\langle w|$ are both pure states then their fidelity simply equals $\big|\langle v|w \rangle\big|$:

>> v = RandomStateVector(4);
>> w = RandomStateVector(4);
>> Fidelity(v*v',w*w')

ans =

   0.6486

>> abs(v'*w)

ans =

    0.6486

Can be used with CVX

The fidelity function is a jointly concave function, and it can be used in the objective function or constraints of a CVX optimization problem. For example, the following code computes the maximum output fidelity of two quantum channels:

>> Phi = RandomSuperoperator(3); % generate a random channel
>> Psi = RandomSuperoperator(3); % generate another one
>> cvx_begin sdp quiet
   variable rho(3,3) hermitian;
   variable sigma(3,3) hermitian;

   maximize Fidelity(ApplyMap(rho,Phi),ApplyMap(sigma,Psi))

   subject to % the constraints here just force rho and sigma to be density matrices
       trace(rho) == 1;
       trace(sigma) == 1;
       rho >= 0;
       sigma >= 0;
   cvx_end
>> cvx_optval

cvx_optval =

    0.9829

Of course, in this case it is more convenient to just use the MaximumOutputFidelity function directly:

>> MaximumOutputFidelity(Phi,Psi)

ans =

    0.9829

Source code

Click here to view this function's source code on github.