Difference between revisions of "Tensor"

From QETLAB
Jump to navigation Jump to search
m
Line 2: Line 2:
 
|name=Tensor
 
|name=Tensor
 
|desc=[[Kronecker product|Kronecker tensor product]] of two or more matrices
 
|desc=[[Kronecker product|Kronecker tensor product]] of two or more matrices
 +
|rel=[[TensorSum]]
 
|upd=November 27, 2012
 
|upd=November 27, 2012
 
|v=1.00}}
 
|v=1.00}}

Revision as of 19:33, 28 November 2012

Tensor
Kronecker tensor product of two or more matrices

Other toolboxes required none
Related functions TensorSum

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

Several different input formats

The Tensor function accepts input in many different formats, so that you may use whichever is most convenient at a particular time. For example, the following three code snippets all result in the same operator: Tensor(A,3), Tensor(A,A,A), and Tensor({A,A,A}).

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.