Interestingly it seems * doesn’t broadcast properly along tuples in 0.5 (I seem to remember reading that in 0.5 the .* syntax is actually a special function and not actually broadcasting * but I may be wrong), but likely in 0.6 you could do 2.*size(a) to get a tuple (2n, 2m) like you’d expect.
In 0.5 you could do 2.*collect(size(a)) although it’s far from elegant. If this is something you want to do a lot I’d likely make some function like
function scaled_eye(a, N)
return eye(N.*collect(size(a))...)
end
and then you’d be able to do scaled_eye(a, 2) to get the result you want without worrying about the correct operations you need to multiple a tuple and splat it
It’s slightly surprising that eye doesn’t accept tuples, while zeros and ones do, but it might be related to the fact that eye can only accept at most two size parameters, while the others can take an arbitrary number of dimensions.