pwtools.num.distsq

pwtools.num.distsq(arrx, arry)[source]

Squared distances between all points in arrx and arry:

rij2=k(arrx[i,k]arry[j,k])2i=1..Mxj=1..Myk=1..N
This is like

scipy.spatial.distance.cdist(arrx, arry)**2.0

This is a wrapper for pwtools._flib.distsq().

Parameters:
  • arrx (ndarray (Mx,N), (My,N)) – Mx (My) points in N-dim space

  • arry (ndarray (Mx,N), (My,N)) – Mx (My) points in N-dim space

Return type:

2d array (Mx,My)