Not with *
, but with packages all is possible:
using Random, Tullio, OffsetArrays
X = rand!(zeros(0:3, 1:3));
Y = rand!(zeros(1:3, 2:3));
@tullio Z[i,k] := X[i,j] * Y[j,k] # 4×2 OffsetArray(::Matrix{Float64}, 0:3, 2:3)
all(Z[i,k] ≈ sum(X[i,j] * Y[j,k] for j in 1:3) for i in 0:3, k in 2:3) # true
One approach is #270. This tries to avoid the ambiguities of adding yet more methods to *
, by catching offsets further down the the pipe.