Pure to mixed

Jump to navigation Jump to search
Converts a state vector or density matrix representation of a state to a density matrix

Other toolboxes required none
Function category Helper functions
This is a helper function that only exists to aid other functions in QETLAB. If you are an end-user of QETLAB, you likely will never have a reason to use this function.

pure_to_mixed is a function that convert's a state's current representation (either as a pure state vector or as a density matrix) into a density matrix. This function just exists to make the code within some other functions a bit cleaner.


  • RHO = pure_to_mixed(PHI)

Argument descriptions

  • PHI: A density matrix or a pure state vector.


The following code shows that if v is a pure state vector then pure_to_mixed(v) == v*v', yet if rho is a density matrix then pure_to_mixed(rho) == rho.

>> v = RandomStateVector(2)

v =

   0.6732 - 0.5736i
   0.3190 + 0.3407i

>> pure_to_mixed(v)

ans =

   0.7822             0.0193 - 0.4123i
   0.0193 + 0.4123i   0.2178          

>> pure_to_mixed(v*v')

ans =

   0.7822             0.0193 - 0.4123i
   0.0193 + 0.4123i   0.2178   

>> v*v'

ans =

   0.7822             0.0193 - 0.4123i
   0.0193 + 0.4123i   0.2178

Source code

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