In the program below, I had expected a, a2 to produce the same result, but they don’t. It appears that Tullio (which I like!) does not deal with vectors of matrices in the way that I had expected.
The output is:
[ Info: loop 1
true
[ Info: loop 2
false
Two questions:
- What is the best way of running a loop like the one indicated?
- What other gotchas should I be aware of?
using Tullio, LoopVectorization
function test()
J = [2; 3]; I = 4; R= 5; Jmax = maximum(J)
x = Vector{ Matrix{Float64} }(undef, 2);
a = fill(typemax(Float64), I, Jmax); a2 = fill(typemax(Float64),I, Jmax);
for m = 1:2
x[m] = randn(I,J[m])
end
for m = 1:2
@info "loop $m"
@tullio a[i,j] = x[$m][i,j+0] (j in 1:J[m])
xm = x[m]
@tullio a2[i,j] = xm[i,j+0] (j in 1:J[m])
println( a[:,1:J[m]] ≈ a2[:,1:J[m]] )
#~ println(a); println(a2)
end
end
test()