code: def stashed_previous_impl_for_regression_test():
      @numba.njit(parallel=True, nogil=True)
      def stashed_chunked_parallel_special_metric(
          X,
          Y=None,
          metric=dist.named_distances["hellinger"],
          chunk_size=16,
      ):
          if Y is None:
              row_size = col_size = X.shape[0]
          else:
              row_size = X.shape[0]
              col_size = Y.shape[0]
          result = np.zeros((row_size, col_size), dtype=np.float32)
          if Y is None:
              size = X.shape[0]
              n_row_chunks = (size // chunk_size) + 1
              for chunk_idx in numba.prange(n_row_chunks):
                  n = chunk_idx * chunk_size
                  chunk_end_n = min(n + chunk_size, size)
                  for m in range(n, size, chunk_size):
                      chunk_end_m = min(m + chunk_size, size)
                      if n == m:
                          for i in range(n, chunk_end_n):
                              for j in range(m, chunk_end_m):
                                  if j > i:
                                      d = metric(X[i], X[j])
                                      result[i, j] = d
                                      result[j, i] = d
                      else:
                          for i in range(n, chunk_end_n):
                              for j in range(m, chunk_end_m):
                                  d = metric(X[i], X[j])
                                  result[i, j] = d
                                  result[j, i] = d
          else:
              n_row_chunks = (row_size // chunk_size) + 1
              for chunk_idx in numba.prange(n_row_chunks):
                  n = chunk_idx * chunk_size
                  chunk_end_n = min(n + chunk_size, row_size)
                  for m in range(0, col_size, chunk_size):
                      chunk_end_m = min(m + chunk_size, col_size)
                      for i in range(n, chunk_end_n):
                          for j in range(m, chunk_end_m):
                              d = metric(X[i], Y[j])
                              result[i, j] = d
  
          return result
  
      return stashed_chunked_parallel_special_metric
  
file_path: umap/umap/tests/test_chunked_parallel_spatial_metric.py
imports: import pytest
  import numba
  import os
  import numpy
  from numpy.testing import assert_array_equal
  from umap import distances
label_desc: Use image node_id 1 for calling a global function with example usage: stashed_previous_impl_for_regression_test() and returns: stashed_chunked_parallel_special_metric, result