Is this implementation of calculating L2 distance matrix efficient?

See here Efficient Distance Matrix Computation. Approach B is the most efficient if its numerical accuracy is enough for you.