Loop vs vectorization

For finite differences, I would tend to prefer loops (properly written, as noted by @lmiq and others above). Loops just give you more flexibility for this kind of thing (as well as excellent performance).

For example, see this post for example code of writing a scalar-wave equation finite-difference routine using loops that, combined with Julia’s CartesianIndex facilities, support arbitrary dimensionality with a single loop: Seemingly unnecessary allocation within for loop - #8 by stevengj