Tullio Order of Operations

OK. No, then Tullio is not really the thing. It does not, except perhaps accidentally, think about slices of arrays.

To use broadcasting, you want something like inv.(x' .* Ref(I) .- eachslice(H, dims=1)), which makes a matrix of matrices, which you then glue together & sum on the right axis. And index-notation way is this:

julia> using TensorCast, LinearAlgebra

julia> @reduce mat[i,j,k] := sum(l) inv(x[i]*Ref(I) - H[l,:,:])[j,k];  # that you need Ref(I) is probably a bug, sorry

julia> summary(mat)
"10×3×3 Array{Float64, 3}"
3 Likes