Usage of Tullio.jl

I have a really big code, that is separated into bunch of functions, modules, and files. I would like to implement Tullio.jl to optimize loops and array operations. Normally I’m using @tullio macro before the loop or arrray operations. Since the code is really big, I would like to know if there’s any way to apply it to whole code.

1 Like

TensorOperations.jl does allow its macro to act on a code block, and look for all applicable expressions within. I think that’s what you’re asking for:

@tensor begin
    # all expressions like this are transformed:
    D[a, b, c] = ...
    E[a, b, c] := ...
end

But Tullio.jl doesn’t support this. The macro expects one assignment expression, something like @tullio out[i] := ..., and always writes one set of nested loops.

1 Like