Mold matrix of the same size

If your array A has one or two dimensions, then you can do:

eye(sz...)

which, if sz is of length 2, is equivalent to:

eye(sz[1], sz[2])

This is called “splatting”: http://docs.julialang.org/en/release-0.5/manual/faq/#splits-one-argument-into-many-different-arguments-in-function-calls

edit: @DNF has an even better suggestion below.