mul! on 1.3.1 does not update x[:,:,1]
in
x = zeros(2,2,2)
mul!(x[:,:,1],[1,1],[1 2],1.0,1.0)
In contrast, it does update x[1]
in
x = [zeros(2,2) for i=1:2]
mul!(x[1],[1,1],[1 2],1.0,1.0)
Is this difference obvious?
mul! on 1.3.1 does not update x[:,:,1]
in
x = zeros(2,2,2)
mul!(x[:,:,1],[1,1],[1 2],1.0,1.0)
In contrast, it does update x[1]
in
x = [zeros(2,2) for i=1:2]
mul!(x[1],[1,1],[1 2],1.0,1.0)
Is this difference obvious?
Julia slices make copies by default, not views. So the 5-argument mul in your first example is updating the copy.
Try
x = zeros(2,2,2)
@views mul!(x[:,:,1],[1,1],[1 2],1.0,1.0)
x # updated
Or
x = zeros(2,2,2)
xsubsetcopy = x[:,:,1]
mul!(xsubsetcopy,[1,1],[1 2],1.0,1.0)
x # all zeros
xsubsetcopy # updated
Thanks. The slices/copy thing caught me (again). I guess your first example could also be
mul!(view(x,:,:,1),[1,1],[1 2],1.0,1.0)