class_docstr: Compute the argkmin of row vectors of X on the ones of Y.
  
  For each row vector of X, computes the indices of k first the rows
  vectors of Y with the smallest distances.
  
  ArgKmin is typically used to perform
  bruteforce k-nearest neighbors queries.
  
  This class is not meant to be instantiated, one should only use
  its :meth:`compute` classmethod which handles allocation and
  deallocation consistently.
docstr: Compute the argkmin reduction.
  
  Parameters
  ----------
  X : ndarray or CSR matrix of shape (n_samples_X, n_features)
      Input data.
  
  Y : ndarray or CSR matrix of shape (n_samples_Y, n_features)
      Input data.
  
  k : int
      The k for the argkmin reduction.
  
  metric : str, default='euclidean'
      The distance metric to use for argkmin.
      For a list of available metrics, see the documentation of
      :class:`~sklearn.metrics.DistanceMetric`.
  
  chunk_size : int, default=None,
      The number of vectors per chunk. If None (default) looks-up in
      scikit-learn configuration for `pairwise_dist_chunk_size`,
      and use 256 if it is not set.
  
  metric_kwargs : dict, default=None
      Keyword arguments to pass to specified metric function.
  
  strategy : str, {'auto', 'parallel_on_X', 'parallel_on_Y'}, default=None
      The chunking strategy defining which dataset parallelization are made on.
  
      For both strategies the computations happens with two nested loops,
      respectively on chunks of X and chunks of Y.
      Strategies differs on which loop (outer or inner) is made to run
      in parallel with the Cython `prange` construct:
  
        - 'parallel_on_X' dispatches chunks of X uniformly on threads.
          Each thread then iterates on all the chunks of Y. This strategy is
          embarrassingly parallel and comes with no datastructures
          synchronisation.
  
        - 'parallel_on_Y' dispatches chunks of Y uniformly on threads.
          Each thread processes all the chunks of X in turn. This strategy is
          a sequence of embarrassingly parallel subtasks (the inner loop on Y
          chunks) with intermediate datastructures synchronisation at each
          iteration of the sequential outer loop on X chunks.
  
        - 'auto' relies on a simple heuristic to choose between
          'parallel_on_X' and 'parallel_on_Y': when `X.shape[0]` is large enough,
          'parallel_on_X' is usually the most efficient strategy.
          When `X.shape[0]` is small but `Y.shape[0]` is large, 'parallel_on_Y'
          brings more opportunity for parallelism and is therefore more efficient
  
        - None (default) looks-up in scikit-learn configuration for
          `pairwise_dist_parallel_strategy`, and use 'auto' if it is not set.
  
  return_distance : boolean, default=False
      Return distances between each X vector and its
      argkmin if set to True.
  
  Returns
  -------
  If return_distance=False:
    - argkmin_indices : ndarray of shape (n_samples_X, k)
      Indices of the argkmin for each vector in X.
  
  If return_distance=True:
    - argkmin_distances : ndarray of shape (n_samples_X, k)
      Distances to the argkmin for each vector in X.
    - argkmin_indices : ndarray of shape (n_samples_X, k)
      Indices of the argkmin for each vector in X.
  
  Notes
  -----
  This classmethod inspects the arguments values to dispatch to the
  dtype-specialized implementation of :class:`ArgKmin`.
  
  This allows decoupling the API entirely from the implementation details
  whilst maintaining RAII: all temporarily allocated datastructures necessary
  for the concrete implementation are therefore freed when this classmethod
  returns.
docstr_tok: ["Compute","the","argkmin","reduction",".","Parameters","--","--","--","--","--","X",":","ndarray","or","CSR","matrix","of","shape","(","n_samples_X",",","n_features",")","Input","data",".","Y",":","ndarray","or","CSR","matrix","of","shape","(","n_samples_Y",",","n_features",")","Input","data",".","k",":","int","The","k","for","the","argkmin","reduction",".","metric",":","str",",","default='euclidean'","The","distance","metric","to","use","for","argkmin",".","For","a","list","of","available","metrics",",","see","the","documentation","of",":","class",":","`","~sklearn.metrics.DistanceMetric","`",".","chunk_size",":","int",",","default=None",",","The","number","of","vectors","per","chunk",".","If","None","(","default",")","looks-up","in","scikit-learn","configuration","for","`","pairwise_dist_chunk_size","`",",","and","use","256","if","it","is","not","set",".","metric_kwargs",":","dict",",","default=None","Keyword","arguments","to","pass","to","specified","metric","function",".","strategy",":","str",",","{","'auto","'",",","'parallel_on_X","'",",","'parallel_on_Y","'","}",",","default=None","The","chunking","strategy","defining","which","dataset","parallelization","are","made","on",".","For","both","strategies","the","computations","happens","with","two","nested","loops",",","respectively","on","chunks","of","X","and","chunks","of","Y",".","Strategies","differs","on","which","loop","(","outer","or","inner",")","is","made","to","run","in","parallel","with","the","Cython","`","prange","`","construct",":","-","'parallel_on_X","'","dispatches","chunks","of","X","uniformly","on","threads",".","Each","thread","then","iterates","on","all","the","chunks","of","Y",".","This","strategy","is","embarrassingly","parallel","and","comes","with","no","datastructures","synchronisation",".","-","'parallel_on_Y","'","dispatches","chunks","of","Y","uniformly","on","threads",".","Each","thread","processes","all","the","chunks","of","X","in","turn",".","This","strategy","is","a","sequence","of","embarrassingly","parallel","subtasks","(","the","inner","loop","on","Y","chunks",")","with","intermediate","datastructures","synchronisation","at","each","iteration","of","the","sequential","outer","loop","on","X","chunks",".","-","'auto","'","relies","on","a","simple","heuristic","to","choose","between","'parallel_on_X","'","and","'parallel_on_Y","'",":","when","`","X.shape","[","0","]","`","is","large","enough",",","'parallel_on_X","'","is","usually","the","most","efficient","strategy",".","When","`","X.shape","[","0","]","`","is","small","but","`","Y.shape","[","0","]","`","is","large",",","'parallel_on_Y'","brings","more","opportunity","for","parallelism","and","is","therefore","more","efficient","-","None","(","default",")","looks-up","in","scikit-learn","configuration","for","`","pairwise_dist_parallel_strategy","`",",","and","use","'auto","'","if","it","is","not","set",".","return_distance",":","boolean",",","default=False","Return","distances","between","each","X","vector","and","its","argkmin","if","set","to","True",".","Returns","--","--","--","-","If","return_distance=False",":","-","argkmin_indices",":","ndarray","of","shape","(","n_samples_X",",","k",")","Indices","of","the","argkmin","for","each","vector","in","X",".","If","return_distance=True",":","-","argkmin_distances",":","ndarray","of","shape","(","n_samples_X",",","k",")","Distances","to","the","argkmin","for","each","vector","in","X",".","-","argkmin_indices",":","ndarray","of","shape","(","n_samples_X",",","k",")","Indices","of","the","argkmin","for","each","vector","in","X",".","Notes","--","--","-","This","classmethod","inspects","the","arguments","values","to","dispatch","to","the","dtype-specialized","implementation","of",":","class",":","`","ArgKmin","`",".","This","allows","decoupling","the","API","entirely","from","the","implementation","details","whilst","maintaining","RAII",":","all","temporarily","allocated","datastructures","necessary","for","the","concrete","implementation","are","therefore","freed","when","this","classmethod","returns","."]
code: def compute(
      cls,
      X,
      Y,
      k,
      metric="euclidean",
      chunk_size=None,
      metric_kwargs=None,
      strategy=None,
      return_distance=False,
  ):
      """Compute the argkmin reduction.
  
      Parameters
      ----------
      X : ndarray or CSR matrix of shape (n_samples_X, n_features)
          Input data.
  
      Y : ndarray or CSR matrix of shape (n_samples_Y, n_features)
          Input data.
  
      k : int
          The k for the argkmin reduction.
  
      metric : str, default='euclidean'
          The distance metric to use for argkmin.
          For a list of available metrics, see the documentation of
          :class:`~sklearn.metrics.DistanceMetric`.
  
      chunk_size : int, default=None,
          The number of vectors per chunk. If None (default) looks-up in
          scikit-learn configuration for `pairwise_dist_chunk_size`,
          and use 256 if it is not set.
  
      metric_kwargs : dict, default=None
          Keyword arguments to pass to specified metric function.
  
      strategy : str, {'auto', 'parallel_on_X', 'parallel_on_Y'}, default=None
          The chunking strategy defining which dataset parallelization are made on.
  
          For both strategies the computations happens with two nested loops,
          respectively on chunks of X and chunks of Y.
          Strategies differs on which loop (outer or inner) is made to run
          in parallel with the Cython `prange` construct:
  
            - 'parallel_on_X' dispatches chunks of X uniformly on threads.
              Each thread then iterates on all the chunks of Y. This strategy is
              embarrassingly parallel and comes with no datastructures
              synchronisation.
  
            - 'parallel_on_Y' dispatches chunks of Y uniformly on threads.
              Each thread processes all the chunks of X in turn. This strategy is
              a sequence of embarrassingly parallel subtasks (the inner loop on Y
              chunks) with intermediate datastructures synchronisation at each
              iteration of the sequential outer loop on X chunks.
  
            - 'auto' relies on a simple heuristic to choose between
              'parallel_on_X' and 'parallel_on_Y': when `X.shape[0]` is large enough,
              'parallel_on_X' is usually the most efficient strategy.
              When `X.shape[0]` is small but `Y.shape[0]` is large, 'parallel_on_Y'
              brings more opportunity for parallelism and is therefore more efficient
  
            - None (default) looks-up in scikit-learn configuration for
              `pairwise_dist_parallel_strategy`, and use 'auto' if it is not set.
  
      return_distance : boolean, default=False
          Return distances between each X vector and its
          argkmin if set to True.
  
      Returns
      -------
      If return_distance=False:
        - argkmin_indices : ndarray of shape (n_samples_X, k)
          Indices of the argkmin for each vector in X.
  
      If return_distance=True:
        - argkmin_distances : ndarray of shape (n_samples_X, k)
          Distances to the argkmin for each vector in X.
        - argkmin_indices : ndarray of shape (n_samples_X, k)
          Indices of the argkmin for each vector in X.
  
      Notes
      -----
      This classmethod inspects the arguments values to dispatch to the
      dtype-specialized implementation of :class:`ArgKmin`.
  
      This allows decoupling the API entirely from the implementation details
      whilst maintaining RAII: all temporarily allocated datastructures necessary
      for the concrete implementation are therefore freed when this classmethod
      returns.
      """
      if X.dtype == Y.dtype == np.float64:
          return ArgKmin64.compute(
              X=X,
              Y=Y,
              k=k,
              metric=metric,
              chunk_size=chunk_size,
              metric_kwargs=metric_kwargs,
              strategy=strategy,
              return_distance=return_distance,
          )
  
      if X.dtype == Y.dtype == np.float32:
          return ArgKmin32.compute(
              X=X,
              Y=Y,
              k=k,
              metric=metric,
              chunk_size=chunk_size,
              metric_kwargs=metric_kwargs,
              strategy=strategy,
              return_distance=return_distance,
          )
  
      raise ValueError(
          "Only float64 or float32 datasets pairs are supported at this time, "
          f"got: X.dtype={X.dtype} and Y.dtype={Y.dtype}."
      )
  
imports: from abc import abstractmethod
  from typing import List
  import numpy
  from scipy.sparse import issparse
  from ...None import get_config
  from .._dist_metrics import BOOL_METRICS, METRIC_MAPPING64
  from ._argkmin import ArgKmin32, ArgKmin64
  from ._argkmin_classmode import ArgKminClassMode32, ArgKminClassMode64
  from ._base import _sqeuclidean_row_norms32, _sqeuclidean_row_norms64
  from ._radius_neighbors import RadiusNeighbors32, RadiusNeighbors64
label_desc: Use image node_id 1 for calling the ArgKmin obj's underlying member method code with example usage: obj.compute(cls, X, Y, k, metric, chunk_size, metric_kwargs, strategy, return_distance) and returns: ArgKmin64, ArgKmin32