I think this has been asked before, but I'm trying to implement the following: I've got a list of tuples containing the 2D coordinates of the N particles that I have. I have defined a numpy.zeros((N,N)) array to store the distance between them. How could I do this the fastest?
Thanks in advance for any help! :)
Edited to add: I've already written a function to measure the distance between two tuples, and was wondering how to iterate it!
My distance measuring function:
def calc_distance(p1, p2):
distance = numpy.linalg.norm(p1 - p2)
return distance