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

Alternative to Tullio for Chained Multiplication #157

Open
prittjam opened this issue Sep 21, 2022 · 4 comments
Open

Alternative to Tullio for Chained Multiplication #157

prittjam opened this issue Sep 21, 2022 · 4 comments

Comments

@prittjam
Copy link

The README tells why Tullio is slow for chained multiplication. Is there a tensor package that can be recommended for this use case? Thanks.

@mcabbott
Copy link
Owner

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

@prittjam
Copy link
Author

Thanks for the response. Can you give a TL;DR version of when to prefer one package over the other?

@prittjam
Copy link
Author

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.

@swanchristmas
Copy link

swanchristmas commented Mar 30, 2024

@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?

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

3 participants