Fidelity

From QETLAB
Revision as of 15:48, 20 November 2014 by Nathaniel (talk | contribs) (Created page with "{{Function |name=Fidelity |desc=Computes the fidelity of two density matrices |rel=TraceNorm |cat=List of functions#Norms_and_distance_measures|Norms and distance measur...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Fidelity
Computes the fidelity of two density matrices

Other toolboxes required none
Related functions TraceNorm
Function category Norms and distance measures

Fidelity is a function that computes the fidelity between two quantum states $\rho$ and $\sigma$, defined as follows:

<math>F(\rho,\sigma) := \mathrm{Tr}\Big( \sqrt{ \sqrt{\rho}\sigma\sqrt{\rho}}\Big).</math>

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.