Efficiently Calculating a Euclidean Distance Matrix Using Numpy
You can take advantage of the complex type : # build a complex array of your cells z = np.array([complex(c.m_x, c.m_y) for c in cells]) First solution # mesh this array so that you will have all combinations m, n = np.meshgrid(z, z) # get the distance via the norm out = abs(m-n) Second solution … Read more