Python Method for Calculating Euclidean Distance from One Point to All Points
- 2021-07-10 20:01:29
- OfStack
As shown below:
distances = np.sqrt(np.sum(np.asarray(airportPosition - x_vals)**2, axis=1))
airportPosition is some 1 point in the matrix
x_vals is all the points in the matrix
distances is the distance matrix from one point to all points