pyFM.spectral.nearest_neighbor.compute_sqdistmat

pyFM.spectral.nearest_neighbor.compute_sqdistmat(X, Y, normalized=False)

Pairwise squared Euclidean distance matrix between two sets of points X and Y.

Parameters:
  • X (np.ndarray) – (n1, p) The first set of points.

  • Y (np.ndarray) – (n2, p) The second set of points.

  • normalized (bool) – Whether the points already have unit norm. If so the squared distance reduces to 2 - 2 X.Y, which skips the two norm computations.

Returns:

distmat – (n1, n2). Squared Euclidean distance between each pair.

Return type:

np.ndarray