IsProductVector: Difference between revisions

From QETLAB
Jump to navigation Jump to search
Updated documentation using GeSHi
Line 2: Line 2:
|name=IsProductVector
|name=IsProductVector
|desc=Determines if a [[pure state]] is a [[product vector]]
|desc=Determines if a [[pure state]] is a [[product vector]]
|req=[[opt_args]]<br />[[SchmidtDecomposition]]
|rel=[[IsProductOperator]]<br />[[SchmidtDecomposition]]<br />[[SchmidtRank]]
|rel=[[IsProductOperator]]<br />[[SchmidtRank]]
|upd=November 26, 2012
|upd=November 26, 2012
|v=1.00}}
|v=1.00}}
Line 27: Line 26:
===A random example===
===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 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$:
<pre<noinclude></noinclude>>
<syntaxhighlight>
>> v = [[RandomStateVector|RandomStateVector(30)]];
>> v = RandomStateVector(30);
>> IsProductVector(v,[2,3,5])
>> IsProductVector(v,[2,3,5])


Line 34: Line 33:


     0
     0
</pre<noinclude></noinclude>>
</syntaxhighlight>


===A product state's decomposition===
===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.
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.
<pre<noinclude></noinclude>>
<syntaxhighlight>
>> v = [1 0 0 0 1 0 0 0]/sqrt(2);
>> v = [1 0 0 0 1 0 0 0]/sqrt(2);
>> [ipv,dec] = IsProductVector(v,[2,2,2])
>> [ipv,dec] = IsProductVector(v,[2,2,2])
Line 67: Line 66:
     0
     0


>> [[Tensor|Tensor(dec)]]
>> Tensor(dec)


ans =
ans =
Line 79: Line 78:
         0
         0
         0
         0
</pre<noinclude></noinclude>>
</syntaxhighlight>
 
{{SourceCode|name=IsProductVector}}

Revision as of 20:03, 21 September 2014

IsProductVector
Determines if a pure state is a product vector

Other toolboxes required none
Related functions IsProductOperator
SchmidtDecomposition
SchmidtRank

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)

Argument descriptions

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 is a scalar, it is assumed that VEC lives in the tensor product of two subsystems, the first of which has dimension DIM and the second of which has dimension length(VEC)/DIM.
    • If $VEC \in \mathbb{C}^{n_1} \otimes \cdots \otimes \mathbb{C}^{n_p}$ then DIM should be a vector containing the dimensions of the subsystems (i.e., DIM = [n_1, ..., n_p]).

Output arguments

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

Examples

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$:

>> v = RandomStateVector(30);
>> IsProductVector(v,[2,3,5])

ans =

     0

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.

>> v = [1 0 0 0 1 0 0 0]/sqrt(2);
>> [ipv,dec] = IsProductVector(v,[2,2,2])

ipv =

     1

dec = 

    [2x1 double]    [2x1 double]    [2x1 double]

>> celldisp(dec) % display the contents of dec
 
dec{1} =
 
    0.7071
    0.7071

dec{2} =
 
    1.0000
         0

dec{3} =
 
     1
     0

>> Tensor(dec)

ans =

    0.7071
         0
         0
         0
    0.7071
         0
         0
         0

Source code

Click here to view this function's source code on github.