Pure to mixed: Difference between revisions
Jump to navigation
Jump to search
Created page with "{{Function |name=pure_to_mixed |desc=Converts a state vector or density matrix representation of a state to a density matrix |cat=List of functions#Helper_functions|Helper f..." |
No edit summary |
||
| Line 5: | Line 5: | ||
|upd=January 12, 2016 | |upd=January 12, 2016 | ||
|helper=1}} | |helper=1}} | ||
<tt>'''pure_to_mixed'''</tt> is a [[List of functions|function]] that convert's a state's current representation (either as a pure state vector or as a density matrix) into a density matrix. | <tt>'''pure_to_mixed'''</tt> is a [[List of functions|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== | ==Syntax== | ||
Latest revision as of 16:29, 20 January 2016
| pure_to_mixed | |
| 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.
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.
>> 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.2178Source code
Click here to view this function's source code on github.