class_docstr: Class for K-medoids clustering on manifolds.
  
  K-medoids algorithm using Riemannian manifolds.
  
  Parameters
  ----------
  space : Manifold
      Equipped manifold.
  n_clusters : int
      Number of clusters (k value of k-medoids).
      Optional, default: 8.
  max_iter : int
      Maximum number of iterations.
      Optional, default: 100.
  init : str
      How to initialize cluster centers at the beginning of the algorithm. The
      choice 'random' will select training points as initial cluster centers
      uniformly at random.
      Optional, default: 'random'.
  n_jobs : int
      Number of jobs to run in parallel. `-1` means using all processors.
      Optional, default: 1.
  
  Notes
  -----
  * Required metric methods: `dist`, `dist_pairwise`.
  
  Example
  -------
  Available example on the Poincaré Ball and Hypersphere manifolds
  :mod:`examples.plot_kmedoids_manifolds`
class_docstr_tok: ["Class","for","K-medoids","clustering","on","manifolds",".","K-medoids","algorithm","using","Riemannian","manifolds",".","Parameters","--","--","--","--","--","space",":","Manifold","Equipped","manifold",".","n_clusters",":","int","Number","of","clusters","(","k","value","of","k-medoids",")",".","Optional",",","default",":","8.","max_iter",":","int","Maximum","number","of","iterations",".","Optional",",","default",":","100.","init",":","str","How","to","initialize","cluster","centers","at","the","beginning","of","the","algorithm",".","The","choice","'random","'","will","select","training","points","as","initial","cluster","centers","uniformly","at","random",".","Optional",",","default",":","'random","'",".","n_jobs",":","int","Number","of","jobs","to","run","in","parallel",".","`","-1","`","means","using","all","processors",".","Optional",",","default",":","1",".","Notes","--","--","-","*","Required","metric","methods",":","`","dist","`",",","`","dist_pairwise","`",".","Example","--","--","--","-","Available","example","on","the","Poincar\u00e9","Ball","and","Hypersphere","manifolds",":","mod",":","`","examples.plot_kmedoids_manifolds","`"]
code: def _update_medoid_indexes(self, distances, labels, medoid_indices):
      for cluster in range(self.n_clusters):
          cluster_index = gs.where(labels == cluster)[0]
          if len(cluster_index) == 0:
              logging.warning("One cluster is empty.")
              continue
  
          in_cluster_distances = distances[
              cluster_index, gs.expand_dims(cluster_index, axis=-1)
          ]
          in_cluster_all_costs = gs.sum(in_cluster_distances, axis=1)
          min_cost_index = gs.argmin(in_cluster_all_costs)
          min_cost = in_cluster_all_costs[min_cost_index]
          current_cost = in_cluster_all_costs[
              gs.argmax(cluster_index == medoid_indices[cluster])
          ]
  
          if min_cost < current_cost:
              medoid_indices[cluster] = cluster_index[min_cost_index]
  
file_path: geomstats/geomstats/learning/kmedoids.py
imports: import logging
  from sklearn.base import BaseEstimator, ClusterMixin
  import geomstats.backend
  from geomstats.learning._template import TransformerMixin
label_desc: Use image node_id 4 for calling the RiemannianKMedoids obj's underlying member method code with example usage: obj._update_medoid_indexes(distances, labels, medoid_indices) without return types