SchmidtDecomposition

SchmidtDecomposition is a function that computes the Schmidt decomposition of a bipartite vector. The user may specify how many terms in the Schmidt decomposition they wish to be returned.

Syntax

 * S = SchmidtDecomposition(VEC)
 * S = SchmidtDecomposition(VEC,DIM)
 * S = SchmidtDecomposition(VEC,DIM,K)
 * [S,U,V] = SchmidtDecomposition(VEC,DIM,K)

Input arguments

 * VEC: A bipartite vector (e.g., a pure quantum state) to have its Schmidt decomposition computed.
 * DIM (optional, by default has both subsystems of equal dimension): A 1-by-2 vector containing the dimensions of the subsystems that VEC lives on.
 * K</tt> (optional, default 0): A flag that determines how many terms in the Schmidt decomposition should be computed. If K</tt> = 0 then all terms with non-zero Schmidt coefficients are computed. If K</tt> = -1 then all terms (including zero Schmidt coefficients) are computed. If K</tt> &gt; 0 then the K</tt> terms with largest Schmidt coefficients are computed.

Output arguments

 * S</tt>: A vector containing the Schmidt coefficients of VEC</tt>.
 * U</tt> (optional): A matrix whose columns are the left Schmidt vectors of VEC</tt>.
 * V</tt> (optional): A matrix whose columns are the right Schmidt vectors of VEC</tt>.

Examples
The following code returns the Schmidt decomposition of the standard maximally-entangled pure state $\frac{1}{\sqrt{d}}\sum_j|j\rangle\otimes|j\rangle \in \mathbb{C}^d \otimes \mathbb{C}^d$ in the $d = 3$ case: