Tullio.jl icon indicating copy to clipboard operation
Tullio.jl copied to clipboard

Unable to understand an array of arrays of arrays

Open mcabbott opened this issue 4 years ago • 0 comments

Something is insufficiently recursive -- it writes eachindex(first(vvv)) and then eachindex(first(vvv[c])):

julia> vvv = [[rand(4) for b in 1:5] for c in 1:6]; summary(vvv)
"6-element Vector{Vector{Vector{Float64}}}"

julia> using Tullio

julia> @tullio m[b,a] := vvv[c][b][a]
ERROR: UndefVarError: c not defined
Stacktrace:
 [1] top-level scope
   @ ~/.julia/dev/Tullio/src/macro.jl:981

julia> using TensorCast

julia> @reduce m[b,a] := sum(c) vvv[c][b][a]; summary(m)
"5×4 Matrix{Float64}"

julia> c = 1;

julia> m ≈ @tullio m1[b,a] := vvv[c][b][a]
true

mcabbott avatar Apr 05 '21 13:04 mcabbott