You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I believe the issue is because the n and m indices have three copies. I thought this was fine since they are the free indices. The error I get is "non-matching indices between left and right hand side"
Using the numpy einsum macro things work fine. Is this a limitation of TensorOperations or do I need to somehow re-frame my contraction? Thanks!
importnumpyasnpN, L, A, B=5, 4, 3, 3P=np.random.rand(L, L, A, B)
e=np.random.rand(N, A)
E=np.random.rand(N, L)
K=np.einsum('ijab,na,mb,ni,mj->nm', P, e, e, E, E)
The text was updated successfully, but these errors were encountered:
Yes, TensorOperations.jl is strict in only admitting open indices that appear once on the right hand side, or thus, in general, every index should only appear twice (either once left and once right, or two times right for a contraction): that is really the original Einstein summation convention. All other combinations with indices appearing more than two times, while sometimes useful, do not map directly onto matrix multiplication (e.g. more like batched matrix multiplication) and are, from a more abstract perspective, operations that are very much specific to a chosen basis.
Note that there is also OMEinsum.jl or Tullio.jl, which do support these more general flavors of einsum expressions.
I have the following contraction that I am trying to implement in TensorOperations, but without luck.
@tensor K[n,m] := P[i,j,α,β] * e[n,α] * e[m,β] * E[n,i] * E[m,j]
I believe the issue is because the
n
andm
indices have three copies. I thought this was fine since they are the free indices. The error I get is"non-matching indices between left and right hand side"
Using the numpy einsum macro things work fine. Is this a limitation of TensorOperations or do I need to somehow re-frame my contraction? Thanks!
The text was updated successfully, but these errors were encountered: