-
Notifications
You must be signed in to change notification settings - Fork 77
Open
Description
Hello,
I am trying to perform the following tensor contraction between tensors d,P,B,X.
enum {I,J,K,L,M,N};
Tensor<double,4,4> d; Tensor<double,4,3> P; Tensor<double,4,4> B; Tensor<double,4> X;
d.random(); P.random(); B.random(); X.random();
The tensor contraction to be implemented is:
(1) The following fails in compilation.
auto dPBBXX2 = einsum<Index<K,M>,Index<L,N>,Index<K,I>,Index<L,J>,Index<I>,Index<J>>(d,P,B,B,X,X);
(2) However, the following code succeeds.
auto dPB = einsum<Index<K,M>,Index<L,N>,Index<K,I>>(d,P,B);
auto dPBB = einsum<Index<M,L,N,I>,Index<L,J>>(dPB,B);
auto dPBBXX = einsum<Index<M,N,I,J>,Index<I>,Index<J>>(dPBB,X,X);
print("my 2D array", dPBBXX);
Conceptually, they should be equivalent, and (1) should be the preferred way as per the wiki.
Metadata
Metadata
Assignees
Labels
No labels