SchmidtRank

SchmidtRank is a function that computes the Schmidt Rank of a bipartite vector. If the vector is full, the Schmidt rank is computed using MATLAB's rank function. If the vector is sparse, the Schmidt rank is computed using the QR decomposition.

Syntax

 * RNK = SchmidtRank(VEC)
 * RNK = SchmidtRank(VEC,DIM)
 * RNK = SchmidtRank(VEC,DIM,TOL)

Argument descriptions

 * VEC: A bipartite vector (e.g., a pure quantum state) to have its Schmidt rank 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.
 * TOL</tt> (optional, default sqrt(length(VEC))*eps(norm(VEC))</tt>): The numerical tolerance used when determining if a Schmidt coefficient equals zero or not.

Examples
The following code computes a random state vector in $\mathbb{C}^4 \otimes \mathbb{C}^6$ with Schmidt rank three, and then verifies that its Schmidt rank is indeed 3: