From 40cdfa6ec81fa53b4c11e08eb4ae63ec9a2ac32d Mon Sep 17 00:00:00 2001 From: Julien Jerphanion Date: Thu, 29 Sep 2022 11:04:09 +0200 Subject: [PATCH] =?UTF-8?q?GEMMTermComputer.{=5Fcompute=5Fdistances=5Fon?= =?UTF-8?q?=5Fchunks=E2=86=92=5Fcompute=5Fdist=5Fmiddle=5Fterms}?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../metrics/_pairwise_distances_reduction/_argkmin.pyx.tp | 2 +- .../_gemm_term_computer.pxd.tp | 2 +- .../_gemm_term_computer.pyx.tp | 8 ++++---- .../_radius_neighborhood.pyx.tp | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/sklearn/metrics/_pairwise_distances_reduction/_argkmin.pyx.tp b/sklearn/metrics/_pairwise_distances_reduction/_argkmin.pyx.tp index 1c1459e27f210..12746dcfbbeb3 100644 --- a/sklearn/metrics/_pairwise_distances_reduction/_argkmin.pyx.tp +++ b/sklearn/metrics/_pairwise_distances_reduction/_argkmin.pyx.tp @@ -498,7 +498,7 @@ cdef class EuclideanArgKmin{{name_suffix}}(ArgKmin{{name_suffix}}): DTYPE_t squared_dist_i_j ITYPE_t n_X = X_end - X_start ITYPE_t n_Y = Y_end - Y_start - DTYPE_t * dist_middle_terms = self.gemm_term_computer._compute_distances_on_chunks( + DTYPE_t * dist_middle_terms = self.gemm_term_computer._compute_dist_middle_terms( X_start, X_end, Y_start, Y_end, thread_num ) DTYPE_t * heaps_r_distances = self.heaps_r_distances_chunks[thread_num] diff --git a/sklearn/metrics/_pairwise_distances_reduction/_gemm_term_computer.pxd.tp b/sklearn/metrics/_pairwise_distances_reduction/_gemm_term_computer.pxd.tp index 5978cfee9ebee..90a74374244ba 100644 --- a/sklearn/metrics/_pairwise_distances_reduction/_gemm_term_computer.pxd.tp +++ b/sklearn/metrics/_pairwise_distances_reduction/_gemm_term_computer.pxd.tp @@ -76,7 +76,7 @@ cdef class GEMMTermComputer{{name_suffix}}: ITYPE_t thread_num ) nogil - cdef DTYPE_t * _compute_distances_on_chunks( + cdef DTYPE_t * _compute_dist_middle_terms( self, ITYPE_t X_start, ITYPE_t X_end, diff --git a/sklearn/metrics/_pairwise_distances_reduction/_gemm_term_computer.pyx.tp b/sklearn/metrics/_pairwise_distances_reduction/_gemm_term_computer.pyx.tp index 35e57219a96a7..cb44012a1c4b0 100644 --- a/sklearn/metrics/_pairwise_distances_reduction/_gemm_term_computer.pyx.tp +++ b/sklearn/metrics/_pairwise_distances_reduction/_gemm_term_computer.pyx.tp @@ -32,10 +32,10 @@ from ...utils._cython_blas cimport ( {{for name_suffix, upcast_to_float64, INPUT_DTYPE_t, INPUT_DTYPE in implementation_specific_values}} cdef class GEMMTermComputer{{name_suffix}}: - """Component for `FastEuclidean*` variant wrapping the logic for the call to GEMM. + """Component for `EuclideanDistance` specialisation wrapping the logic for the call to GEMM. - `FastEuclidean*` classes internally compute the squared Euclidean distances between - chunks of vectors X_c and Y_c using the following decomposition: + `EuclideanDistance` subclasses internally compute the squared Euclidean distances + between chunks of vectors X_c and Y_c using the following decomposition: ||X_c_i - Y_c_j||² = ||X_c_i||² - 2 X_c_i.Y_c_j^T + ||Y_c_j||² @@ -167,7 +167,7 @@ cdef class GEMMTermComputer{{name_suffix}}: return {{endif}} - cdef DTYPE_t * _compute_distances_on_chunks( + cdef DTYPE_t * _compute_dist_middle_terms( self, ITYPE_t X_start, ITYPE_t X_end, diff --git a/sklearn/metrics/_pairwise_distances_reduction/_radius_neighborhood.pyx.tp b/sklearn/metrics/_pairwise_distances_reduction/_radius_neighborhood.pyx.tp index 8d50a6e04abf9..8c075482f2f6a 100644 --- a/sklearn/metrics/_pairwise_distances_reduction/_radius_neighborhood.pyx.tp +++ b/sklearn/metrics/_pairwise_distances_reduction/_radius_neighborhood.pyx.tp @@ -506,7 +506,7 @@ cdef class EuclideanRadiusNeighbors{{name_suffix}}(RadiusNeighbors{{name_suffix} DTYPE_t squared_dist_i_j ITYPE_t n_X = X_end - X_start ITYPE_t n_Y = Y_end - Y_start - DTYPE_t *dist_middle_terms = self.gemm_term_computer._compute_distances_on_chunks( + DTYPE_t *dist_middle_terms = self.gemm_term_computer._compute_dist_middle_terms( X_start, X_end, Y_start, Y_end, thread_num )