Difference between revisions of "Tensor"
Jump to navigation
Jump to search
(Uploaded v1.01) |
(Fixing red links) |
||
| (4 intermediate revisions by the same user not shown) | |||
| Line 3: | Line 3: | ||
|desc=[[Kronecker product|Kronecker tensor product]] of two or more matrices | |desc=[[Kronecker product|Kronecker tensor product]] of two or more matrices | ||
|rel=[[TensorSum]] | |rel=[[TensorSum]] | ||
| + | |cat=[[List of functions#Basic_operations|Basic operation]] | ||
|upd=November 28, 2012 | |upd=November 28, 2012 | ||
| − | |v= | + | |v=0.50}} |
| − | <tt>'''Tensor'''</tt> is a [[List of functions|function]] that produces the [ | + | <tt>'''Tensor'''</tt> is a [[List of functions|function]] that produces the [https://en.wikipedia.org/wiki/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== | ||
| Line 13: | Line 14: | ||
==Argument descriptions== | ==Argument descriptions== | ||
| − | * <tt>A</tt>: If <tt>A</tt> is a cell, | + | * <tt>A</tt>: If <tt>A</tt> is a cell, then <tt>KRN</tt> is the Kronecker product of all matrices within <tt>A</tt>. |
* <tt>M</tt> (optional): A scalar indicating how many times <tt>A</tt> should be tensored with itself (if <tt>M</tt> is provided, <tt>A</tt> must be a matrix). | * <tt>M</tt> (optional): A scalar indicating how many times <tt>A</tt> should be tensored with itself (if <tt>M</tt> is provided, <tt>A</tt> must be a matrix). | ||
* <tt>B,C,...</tt> (optional): Matrices. If these are provided, then <tt>A</tt> must be a matrix, and the output is $A \otimes B \otimes C \otimes \cdots$. | * <tt>B,C,...</tt> (optional): Matrices. If these are provided, then <tt>A</tt> must be a matrix, and the output is $A \otimes B \otimes C \otimes \cdots$. | ||
| Line 22: | Line 23: | ||
===Multiple copies of Werner states=== | ===Multiple copies of Werner states=== | ||
| − | When investigating the [ | + | When investigating the [https://oqp.iqoqi.univie.ac.at/undistillability-implies-ppt/ NPPT bound entanglement] conjecture, you may want to tensor [https://en.wikipedia.org/wiki/Werner_state Werner states] with themselves multiple times. The following code tensors a particular Werner state with itself 6 times: |
| − | < | + | <syntaxhighlight> |
| − | >> rho = | + | >> rho = WernerState(3,1/2); |
>> rho6 = Tensor(rho,6); | >> rho6 = Tensor(rho,6); | ||
| − | </ | + | </syntaxhighlight> |
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. | ||
| + | |||
| + | {{SourceCode|name=Tensor}} | ||
Latest revision as of 12:26, 28 April 2020
| Tensor | |
| Kronecker tensor product of two or more matrices | |
| Other toolboxes required | none |
|---|---|
| Related functions | TensorSum |
| Function category | Basic operation |
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, then 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);
>> rho6 = Tensor(rho,6);Note that rho6 is a 531441-by-531441 matrix, so we don't display it here.
Source code
Click here to view this function's source code on github.