I want to compute the pairwise squared Euclidean distances between all the rows of an NxD matrix and store these distances in an NxN matrix. In plain C++ code, that would look something like this: for(int i = 0; i smaller than n; i++) { for(int j = i + 1; j...
def compute_pairwise_distances(x, y): """ Computes the squared pairwise Euclidean distances between x and y. :param x: a tensor of shape [num_x_samples, num_features] :param y: a tensor of shape [num_y_samples, num_features] :return: a distance matrix of dimensions [num_x_samples...
DistanceMetric, ) from ._argkmin import ( ArgKmin32, @@ -32,6 +31,7 @@ RadiusNeighborsClassMode64, ) def sqeuclidean_row_norms(X, num_threads): """Compute the squared euclidean norm of the rows of X in parallel. @@ -81,7 +81,9 @@ def valid_metrics(cls) -> List[str]:...