TensorSum

From QETLAB
Revision as of 18:03, 19 December 2014 by Nathaniel (talk | contribs) (Minor update)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
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.0000

Inverse 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.0000

Source code

Click on "expand" to the right to view the MATLAB source code for this function.