Open guochu opened 3 years ago
I am certainly open to suggestions, but how would you like this to work or look like, even for the case of a tensor without symmetries (i.e. an object of type TensorMap{ComplexSpace}
)? The current definition corresponds to taking the direct sum of the vector space on the domain / codomain. I think I understand what you want, but I am not sure and there might be different possibilities.
I am certainly open to suggestions, but how would you like this to work or look like, even for the case of a tensor without symmetries (i.e. an object of type
TensorMap{ComplexSpace}
)? The current definition corresponds to taking the direct sum of the vector space on the domain / codomain. I think I understand what you want, but I am not sure and there might be different possibilities.
In case of dense array, it simply goes to the function cat(a, b; dims). For example size(a) = (2,2,3) and size(b) = (2,3,2), then c = cat(a, b; dims=(2,3)) will put the 2 and 3-th dimensions in a block-diagonal way, as a result size(c) = (2,5,5). This function is in need if one wants to implement MPS additions, for example, in which case one would "cat" the two auxiliary. However the current implementation in TensorKit assumes that the only axes been concatenated. If you are too busy I could also try to implemented this function myself some time later, then I have to understand much deeper about the internal logic of TensorMap:), I guess this would take me quite a while:) Anyway this package is so nice and thanks a lot for your effort!
The way I used to implement mps+mps (apparantly I removed this method, I don't know why), was to explicitly construct the embedding maps (new_space <- old_space_1) and (new_space <- old_space_2). These maps will be site dependent, and your code would then look a bit like:
embedders1 = [...];
embedders2 = [...];
for i in 1:len
@tensor new_tensor[i][-1 -2;-3] := embedders1[i][-1,1]
*mps_tensor_1[i][1,-2,2]*conj(embedders1[i+1][-3,2]) + embedders2[i][-1,1]
*mps_tensor_2[i][1,-2,2]*conj(embedders2[i+1][-3,2])
end
The way I used to implement mps+mps (apparantly I removed this method, I don't know why), was to explicitly construct the embedding maps (new_space <- old_space_1) and (new_space <- old_space_2).
This seems to be an equivalent way around. Thanks for you kind reply! (I used to follow the approach as Eqs.(6,7,8) of this work.)
Maybe the construction with the embedding is actually the easiest way also to provide an actual implementation. I often find the most difficult question to be the name and interface for a given functionality (not the actual implementation). Catdomain
and catcodomain
are already not really scoring great on naming and clarity with respect to what they do.
Is it possible to support more general catdomain and catcodomain? Current only one axes and be concatenated, however to support MPS/MPO addition one has to concatenate two axes..