Efficiently Calculating a Euclidean Dist Matrix in Numpy?
问题 I have a large array (~20k entries) of two dimension data, and I want to calculate the pairwise Euclidean distance between all entries. I need the output to have standard square form. Multiple solutions for this problem have been proposed, but none of them seem to work efficiently for large arrays. The method using complex transposing fails for large arrays. Scipy pdist seems to be the most efficient method using numpy. However, using squareform on the result to obtain a square matrix makes