Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tensor network contraction fails #156

Open
mechapple opened this issue Jan 16, 2022 · 0 comments
Open

Tensor network contraction fails #156

mechapple opened this issue Jan 16, 2022 · 0 comments

Comments

@mechapple
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant