Pure to mixed

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.

Syntax

 * RHO = pure_to_mixed(PHI)

Argument descriptions

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

Examples
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.