Alternative to Tullio for Chained Multiplication
The README tells why Tullio is slow for chained multiplication. Is there a tensor package that can be recommended for this use case? Thanks.
Yes, TensorOperations ought to be good at this.
I believe it still decides the order of multiplication based only on the syntax, i.e. before knowing the sizes of the arrays. But it has an option to specify relative costs, https://jutho.github.io/TensorOperations.jl/stable/indexnotation/#Contraction-order-and-@tensoropt-macro
Thanks for the response. Can you give a TL;DR version of when to prefer one package over the other?
Yes, TensorOperations ought to be good at this.
I believe it still decides the order of multiplication based only on the syntax, i.e. before knowing the sizes of the arrays. But it has an option to specify relative costs, https://jutho.github.io/TensorOperations.jl/stable/indexnotation/#Contraction-order-and-@tensoropt-macro
Unfortunately, TensorOperations seems to have problems with StaticArrays. There seem to be some composability problems if you stray from the classic dynamic arrays. This holds true for Tullio as well with HybirdArrays.
@mcabbott Is it possible to explicitly decompose computations using the pipe operator, as suggested in the documentation, to avoid the slowness of chained multiplication? For instance:
Ξ(λ,Γp) = ( @tullio x[l,m,s] := -0.5*Γp[l,k]*Λ(λ)[k,m,s]) |> (x -> @tullio _[m,s] := Λ(λ)[l,m,s]*x[l,m,s] |> exp)
Would this approach also help in avoiding the generation of intermediate variables?