Difference between revisions of "Purity"

From QETLAB
Jump to navigation Jump to search
(Created page with "{{Function |name=Purity |desc=Computes the purity of a quantum state |upd=July 18, 2013 |v=1.00}} <tt>'''Purity'''</tt> is a function that computes the [...")
 
m
 
(3 intermediate revisions by the same user not shown)
Line 2: Line 2:
 
|name=Purity
 
|name=Purity
 
|desc=Computes the purity of a quantum state
 
|desc=Computes the purity of a quantum state
|upd=July 18, 2013
+
|cat=[[List of functions#Miscellaneous|Miscellaneous]]
|v=1.00}}
+
|upd=October 15, 2014
<tt>'''Purity'''</tt> is a [[List of functions|function]] that computes the [[purity_(concept)|purity]] of a quantum state $\rho$ (i.e., it computes the quantity ${\rm Tr}(\rho^2)$.
+
|v=0.50}}
 +
<tt>'''Purity'''</tt> is a [[List of functions|function]] that computes the purity of a quantum state $\rho$ (i.e., it computes the quantity ${\rm Tr}(\rho^2)$).
  
 
==Syntax==
 
==Syntax==
Line 15: Line 16:
 
===Purity of pure states===
 
===Purity of pure states===
 
Pure states have purity equal to 1, as illustrated by the following code:
 
Pure states have purity equal to 1, as illustrated by the following code:
<pre<noinclude></noinclude>>
+
<syntaxhighlight>
>> phi = [[RandomStateVector|RandomStateVector(3)]];
+
>> phi = RandomStateVector(3);
 
>> Purity(phi*phi')
 
>> Purity(phi*phi')
  
Line 23: Line 24:
 
     1.0000
 
     1.0000
  
>> Purity([[RandomDensityMatrix|RandomDensityMatrix(3,0,1)]])
+
>> Purity(RandomDensityMatrix(3,0,1))
  
 
ans =
 
ans =
  
 
     1.0000
 
     1.0000
</pre<noinclude></noinclude>>
+
</syntaxhighlight>
  
 
===Purity of mixed states===
 
===Purity of mixed states===
 
If $\rho \in M_d$ is mixed then its purity is strictly less than 1. Its purity attains its minimum value of $1/d$ if and only if $\rho$ is the maximally-mixed state (i.e., the scaled identity operator).
 
If $\rho \in M_d$ is mixed then its purity is strictly less than 1. Its purity attains its minimum value of $1/d$ if and only if $\rho$ is the maximally-mixed state (i.e., the scaled identity operator).
<pre<noinclude></noinclude>>
+
<syntaxhighlight>
>> Purity([[WernerState|WernerState(2,1/4)]]) % the state WernerState(2,1/4) acts on 4-dimensional space
+
>> Purity(WernerState(2,1/4)) % the state WernerState(2,1/4) acts on 4-dimensional space
  
 
ans =
 
ans =
Line 44: Line 45:
  
 
     0.2500
 
     0.2500
</pre<noinclude></noinclude>>
+
</syntaxhighlight>
 +
 
 +
{{SourceCode|name=Purity}}

Latest revision as of 01:40, 13 May 2018

Purity
Computes the purity of a quantum state

Other toolboxes required none
Function category Miscellaneous

Purity is a function that computes the purity of a quantum state $\rho$ (i.e., it computes the quantity ${\rm Tr}(\rho^2)$).

Syntax

  • GAMMA = Purity(RHO)

Argument descriptions

  • RHO: A density matrix to have its purity computed.

Examples

Purity of pure states

Pure states have purity equal to 1, as illustrated by the following code:

>> phi = RandomStateVector(3);
>> Purity(phi*phi')

ans =

    1.0000

>> Purity(RandomDensityMatrix(3,0,1))

ans =

    1.0000

Purity of mixed states

If $\rho \in M_d$ is mixed then its purity is strictly less than 1. Its purity attains its minimum value of $1/d$ if and only if $\rho$ is the maximally-mixed state (i.e., the scaled identity operator).

>> Purity(WernerState(2,1/4)) % the state WernerState(2,1/4) acts on 4-dimensional space

ans =

    0.2653

>> Purity(eye(4)/4)

ans =

    0.2500

Source code

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