Calculating a distance matrix using this function, this is taking a lot of time. How to optimize it? Should I use Job lib/parallel computation?
This is r