Difference between revisions of "TensorSum"
Jump to navigation
Jump to search
m |
m (Minor update) |
||
| (2 intermediate revisions by the same user not shown) | |||
| Line 3: | Line 3: | ||
|desc=Computes a vector or operator from its tensor decomposition | |desc=Computes a vector or operator from its tensor decomposition | ||
|rel=[[FilterNormalForm]]<br />[[OperatorSchmidtDecomposition]]<br />[[SchmidtDecomposition]] | |rel=[[FilterNormalForm]]<br />[[OperatorSchmidtDecomposition]]<br />[[SchmidtDecomposition]] | ||
| − | | | + | |cat=[[List of functions#Basic_operations|Basic operation]] |
| − | | | + | |upd=December 19, 2014}} |
<tt>'''TensorSum'''</tt> is a [[List of functions|function]] that computes a vector or operator from its tensor decomposition. It acts as an inverse of the <tt>[[OperatorSchmidtDecomposition]]</tt> and <tt>[[SchmidtDecomposition]]</tt> functions, but also works for multipartite decompositions. | <tt>'''TensorSum'''</tt> is a [[List of functions|function]] that computes a vector or operator from its tensor decomposition. It acts as an inverse of the <tt>[[OperatorSchmidtDecomposition]]</tt> and <tt>[[SchmidtDecomposition]]</tt> functions, but also works for multipartite decompositions. | ||
| Line 18: | Line 18: | ||
===Inverse of <tt>[[SchmidtDecomposition]]</tt>=== | ===Inverse of <tt>[[SchmidtDecomposition]]</tt>=== | ||
This function acts as an inverse of the <tt>SchmidtDecomposition</tt> function: | This function acts as an inverse of the <tt>SchmidtDecomposition</tt> function: | ||
| − | < | + | <syntaxhighlight> |
>> vec = [1,2,3,4]; | >> vec = [1,2,3,4]; | ||
| − | >> [s,u,v] = | + | >> [s,u,v] = SchmidtDecomposition(vec); |
>> TensorSum(s,u,v) | >> TensorSum(s,u,v) | ||
| Line 29: | Line 29: | ||
3.0000 | 3.0000 | ||
4.0000 | 4.0000 | ||
| − | </ | + | </syntaxhighlight> |
===Inverse of <tt>[[OperatorSchmidtDecomposition]]</tt>=== | ===Inverse of <tt>[[OperatorSchmidtDecomposition]]</tt>=== | ||
This function also acts as an inverse of the <tt>OperatorSchmidtDecomposition</tt> function: | This function also acts as an inverse of the <tt>OperatorSchmidtDecomposition</tt> function: | ||
| − | < | + | <syntaxhighlight> |
>> X = reshape(1:16,4,4)' | >> X = reshape(1:16,4,4)' | ||
| Line 43: | Line 43: | ||
13 14 15 16 | 13 14 15 16 | ||
| − | >> [s,U,V] = | + | >> [s,U,V] = OperatorSchmidtDecomposition(X); |
>> TensorSum(s,U,V) | >> TensorSum(s,U,V) | ||
| Line 52: | Line 52: | ||
9.0000 10.0000 11.0000 12.0000 | 9.0000 10.0000 11.0000 12.0000 | ||
13.0000 14.0000 15.0000 16.0000 | 13.0000 14.0000 15.0000 16.0000 | ||
| − | </ | + | </syntaxhighlight> |
| + | |||
| + | {{SourceCode|name=TensorSum}} | ||
Latest revision as of 18:03, 19 December 2014
| TensorSum | |
| Computes a vector or operator from its tensor decomposition | |
| Other toolboxes required | none |
|---|---|
| Related functions | FilterNormalForm OperatorSchmidtDecomposition SchmidtDecomposition |
| Function category | Basic operation |
TensorSum is a function that computes a vector or operator from its tensor decomposition. It acts as an inverse of the OperatorSchmidtDecomposition and SchmidtDecomposition functions, but also works for multipartite decompositions.
Syntax
- TS = TensorSum(A1,A2,...)
- TS = TensorSum(S,A1,A2,...)
Argument descriptions
- A1,A2,...: Either matrices or cells containing matrices (and they should all be the same: either all matrices or all cells). If they are matrices, then the k-th column of each Ai will be tensored together for all k, and then the sum over k will be taken at the end. If they are cells, then the k-th element of each Ai will be tensored together for all k, and then the sum over k will be taken at the end.
- S (optional, default [1,1,...,1]): A vector of weights (such as Schmidt coefficients) that will be applied when summing the terms at the end of the computation.
Examples
Inverse of SchmidtDecomposition
This function acts as an inverse of the SchmidtDecomposition function:
>> vec = [1,2,3,4];
>> [s,u,v] = SchmidtDecomposition(vec);
>> TensorSum(s,u,v)
ans =
1.0000
2.0000
3.0000
4.0000Inverse of OperatorSchmidtDecomposition
This function also acts as an inverse of the OperatorSchmidtDecomposition function:
>> X = reshape(1:16,4,4)'
X =
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
>> [s,U,V] = OperatorSchmidtDecomposition(X);
>> TensorSum(s,U,V)
ans =
1.0000 2.0000 3.0000 4.0000
5.0000 6.0000 7.0000 8.0000
9.0000 10.0000 11.0000 12.0000
13.0000 14.0000 15.0000 16.0000Source code
Click here to view this function's source code on github.