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