Direct Sum

Author: Changkai Zhang

The direct sum of two tensors can be performed via oplus (originate from the LaTeX command for direct sum \oplus) function. This is a QSpace built-in function available since QSpace 4.0. The oplus function takes in two tensors and an array of indices as arguments, and generate the direct sum of the two input tensors along the indices in the array.

Next, let's take an example of the direct sum of operator \(S_z\) and the identity \(I\). This is a common operation in constructing the Matrix Product Operator for the Hamiltonian of some spin model. Operator \(S_z\) is a rank-3 tensor with the first two indices being physical and the last index auxiliary:

Sz = 
     Q:  3x { 2 x 1 }  abelian U(1)  operator,  { +-- }
  data:  3-D double (224)      2 x 2 x 1  @ norm = 0.7071

     1.  1x1      [  1 ;  1 ;  0 ]          0.5
     2.  1x1      [ -1 ; -1 ;  0 ]         -0.5

The identity tensor \(I\) has similar structure:

Id = 
     Q:  3x { 2 x 1 }  abelian U(1)  { +-- }
  data:  3-D double (224)      2 x 2 x 1  @ norm = √2

     1.  1x1      [ -1 ; -1 ;  0 ]           1.
     2.  1x1      [  1 ;  1 ;  0 ]           1.

Now, we can perform the direct sum along the 3rd index (auxiliary) via

M = oplus(Sz, Id, 3)
M = 
     Q:  3x { 2 x 1 }  abelian U(1)  operator,  { +-- }
  data:  3-D double (240)      2 x 2 x 2  @ norm = 1.581

     1.  1x1x2    [ -1 ; -1 ;  0 ]      16 b 
     2.  1x1x2    [  1 ;  1 ;  0 ]      16 b 

We can check by looking at the data sectors of the output tensor M that the direct sum is performed correctly:

M.data{1}
ans(:,:,1) =

   -0.5000


ans(:,:,2) =

     1
M.data{2}
ans(:,:,1) =

    0.5000


ans(:,:,2) =

     1

Finally, note that the direct sum can only be performed when the indices that are not involved come from exactly the same linear space. Otherwise, the operation may become invalid.