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
This would indeed be a possibility which I have also considered, but I have not implemented it yet. Maybe at some point. One issue that holds me back is how to do/specify the reverse reshaping, i.e. where a single dimension of the tensor gets split into two or more, with easy syntax.
I made a package which does this, and some other things. The notation you suggest works, as does the more compact \ for combining indices:
using TensorOperations; using TensorSlice
B =rand(2,3); C =rand(3,4,5); D =rand(5,6,7,8);
@tensor A[a,e,c,g,f] := B[a,b] * C[b,c,d] * D[d,e,f,g];
@shape Z[a\e\c, g\f] := A[a,e,c,g,f];
Unlike @tensor it doesn’t do any of the work, it just writes the same reshape() command you did. Which I believe should not allocate much memory.
I often use
@tensor
macro andreshape
together, e.g.:I think this code is inelegant and wasting memory. I want to use more elegant format like
instead.
Or, some good way just I don't know already exists?
The text was updated successfully, but these errors were encountered: