Difference between revisions of "Tensor"

From QETLAB
Jump to navigation Jump to search
m (Nathaniel moved page MultiKron to Tensor: Changed name of function)
(Function name changed)
Line 1: Line 1:
 
{{Function
 
{{Function
|name=MultiKron
+
|name=Tensor
 
|desc=[[Kronecker product|Kronecker tensor product]] of two or more matrices
 
|desc=[[Kronecker product|Kronecker tensor product]] of two or more matrices
 
|upd=November 27, 2012
 
|upd=November 27, 2012
 
|v=1.00}}
 
|v=1.00}}
<tt>'''MultiKron'''</tt> is a [[List of functions|function]] that produces the [[Kronecker product]] of two or more matrices, and thus extends MATLAB's built-in [http://www.mathworks.com/help/matlab/ref/kron.html kron] function.
+
<tt>'''Tensor'''</tt> is a [[List of functions|function]] that produces the [[Kronecker product|Kronecker (tensor) product]] of two or more matrices, and thus extends MATLAB's built-in [http://www.mathworks.com/help/matlab/ref/kron.html kron] function.
  
 
==Syntax==
 
==Syntax==
* <tt>KRN = MultiKron(A)</tt>
+
* <tt>KRN = Tensor(A)</tt>
* <tt>KRN = MultiKron(A,M)</tt>
+
* <tt>KRN = Tensor(A,M)</tt>
* <tt>KRN = MultiKron(A,B,C,...)</tt>
+
* <tt>KRN = Tensor(A,B,C,...)</tt>
  
 
==Argument descriptions==
 
==Argument descriptions==
Line 21: Line 21:
 
<pre<noinclude></noinclude>>
 
<pre<noinclude></noinclude>>
 
>> rho = [[WernerState|WernerState(3,1/2,1)]];
 
>> rho = [[WernerState|WernerState(3,1/2,1)]];
>> rho6 = MultiKron(rho,6);
+
>> rho6 = Tensor(rho,6);
 
</pre<noinclude></noinclude>>
 
</pre<noinclude></noinclude>>
  
 
Note that <tt>rho6</tt> is a 531441-by-531441 matrix, so we don't display it here.
 
Note that <tt>rho6</tt> is a 531441-by-531441 matrix, so we don't display it here.

Revision as of 15:25, 28 November 2012

Tensor
Kronecker tensor product of two or more matrices

Other toolboxes required none

Tensor is a function that produces the Kronecker (tensor) product of two or more matrices, and thus extends MATLAB's built-in kron function.

Syntax

  • KRN = Tensor(A)
  • KRN = Tensor(A,M)
  • KRN = Tensor(A,B,C,...)

Argument descriptions

  • A: If A is a cell, the KRN is the Kronecker product of all matrices within A.
  • M (optional): A scalar indicating how many times A should be tensored with itself (if M is provided, A must be a matrix).
  • B,C,... (optional): Matrices. If these are provided, then A must be a matrix, and the output is $A \otimes B \otimes C \otimes \cdots$.

Examples

Multiple copies of Werner states

When investigating the NPPT bound entanglement conjecture, you may want to tensor Werner states with themselves multiple times. The following code tensors a particular Werner state with itself 6 times:

>> rho = WernerState(3,1/2,1);
>> rho6 = Tensor(rho,6);

Note that rho6 is a 531441-by-531441 matrix, so we don't display it here.