Finding squared distances beteen n points to m points in numpy
问题 I have 2 numpy arrays(say X and Y) which each row represents a point vector. I want to find the squared euclidean distances(will call this 'dist') between each point in X to each point in Y. I want to the output to be a matrix D where D(i,j) is dist(X(i) , Y(j)). I have the following python code based on : http://nonconditional.com/2014/04/on-the-trick-for-computing-the-squared-euclidian-distances-between-two-sets-of-vectors/ def get_sq_distances(X, Y): a = np.sum(np.square(X),axis=1,keepdims