IsProductVector

IsProductVector is a function that determines if a bipartite or multipartite vector (e.g., a pure quantum state) is a product vector or not. If it is a product vector, its tensor decomposition can be provided.

Syntax

 * IPV = IsProductVector(VEC)
 * IPV = IsProductVector(VEC,DIM)
 * [IPV,DEC] = IsProductVector(VEC,DIM)

Input arguments

 * VEC: A vector that lives in a bipartite or multipartite Hilbert space.
 * DIM (optional, by default has two subsystems of equal dimension): A specification of the dimensions of the subsystems that VEC lives in. DIM can be provided in one of two ways:
 * If DIM</tt> is a scalar, it is assumed that VEC</tt> lives in the tensor product of two subsystems, the first of which has dimension DIM</tt> and the second of which has dimension length(VEC)/DIM</tt>.
 * If $VEC \in \mathbb{C}^{n_1} \otimes \cdots \otimes \mathbb{C}^{n_p}$ then DIM</tt> should be a vector containing the dimensions of the subsystems (i.e., DIM = [n_1, ..., n_p]</tt>).

Output arguments

 * IPV</tt>: Either 1 or 0, indicating that VEC</tt> is or is not a product vector.
 * DEC</tt> (optional): If IPV = 1</tt> (i.e., VEC</tt> is a product vector), then DEC</tt> is a cell containing two or more vectors, the tensor product of which is VEC</tt>. If IPV = 0</tt> then DEC</tt> is meaningless.

A random example
A randomly-generated pure state will almost surely not be a product vector. The following code demonstrates this for a random pure state chosen from $\mathbb{C}^2 \otimes \mathbb{C}^3 \otimes \mathbb{C}^5$:

A product state's decomposition
The following code determines that a certain pure state living in $\mathbb{C}^2 \otimes \mathbb{C}^2 \otimes \mathbb{C}^2$ is a product state, and provides a decomposition of that product state. It is then verified that the tensor product of the vectors in that decomposition do indeed give the original state.