2019-04-19
阅读量:
697
考虑一个形状(100,2)表示坐标的随机向量,逐点找到距离
Z = np.random.random((10,2))
X,Y = np.atleast_2d(Z[:,0]), np.atleast_2d(Z[:,1])
D = np.sqrt( (X-X.T)**2 + (Y-Y.T)**2)
import scipy
import scipy.spatial
Z = np.random.random((10,2))
D = scipy.spatial.distance.cdist(Z,Z)
# print D






评论(0)


暂无数据