Fidelity: Difference between revisions

From QETLAB
Jump to navigation Jump to search
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..."
 
mNo edit summary
Line 2: Line 2:
|name=Fidelity
|name=Fidelity
|desc=Computes the fidelity of two density matrices
|desc=Computes the fidelity of two density matrices
|rel=[[TraceNorm]]
|rel=[[MaximumOutputFidelity]]<br />[[TraceNorm]]
|cat=[[List of functions#Norms_and_distance_measures|Norms and distance measures]]
|cat=[[List of functions#Norms_and_distance_measures|Norms and distance measures]]
|upd=November 20, 2014
|upd=November 20, 2014

Revision as of 15:50, 20 November 2014

Fidelity
Computes the fidelity of two density matrices

Other toolboxes required none
Related functions MaximumOutputFidelity
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.