Open ogauthe opened 2 months ago
I agree it makes sense to support the syntax:
contract(((1, 4), (3,)), ft1, (1, 2), ft2, (2, 3, 4))
to specify which dimensions will become the codomain and domain of the output tensor, good suggestion.
However, I think in terms of terminology you might be conflating the concept of labels and permutations, I don't think that supporting blockedperm((1, 4), (3,))
makes sense, but I also don't think it is needed to implement this feature. In syntax like contract(((1, 4), (3,)), ft1, (1, 2), ft2, (2, 3, 4))
, to be consistent with the conventions of the current interface, those should be interpreted as labels, and then those would be compiled down to blocked permutations. So contract
should be thought of as having two layers/interfaces, one based around dimension labels and one based around permutations/bipartitioned permutations (and those shouldn't be mixed in a single function call).
I believe the permutation version of that contraction would be something like:
contract(blockedperm((1, 3), (2,)), ft1, blockedperm((1,), (2,)), ft2, blockedperm((1,), (2, 3)))
I'm not sure if I got that exactly right but hopefully you get the idea. I'm not sure if that syntax is supported right now but if it isn't we should add it as well.
For a
FusionTensor
, a permutation is not enough to specify the structure, a biperm is needed. Currently,TensorAlgebra.contract
does not allow this.Note that it is not possible to construct a
BlockedPermutation
from((1,4), (3,))
:but even a correct
BlockedPermutation
fails: