code: def _pairwise_distance_riemann(X, Y=None, squared=False):
      """Pairwise Riemannian distance matrix.
  
      Compute the matrix of Riemannian distances between pairs of elements of X
      and Y.
  
      Parameters
      ----------
      X : ndarray, shape (n_matrices_X, n, n)
          First set of matrices.
      Y : None | ndarray, shape (n_matrices_Y, n, n), default=None
          Second set of matrices. If None, Y is set to X.
      squared : bool, default False
          Return squared distances.
  
      Returns
      -------
      dist : ndarray, shape (n_matrices_X, n_matrices_X) or (n_matrices_X, \
              n_matrices_Y)
          Riemannian distances between pairs of elements of X if Y is None, or
          between elements of X and Y.
  
      See Also
      --------
      pairwise_distance
      distance_riemann
      """
      XisY = False
      if Y is None:
          XisY = True
          Y = X
  
      n_matrices_X, n_matrices_Y = len(X), len(Y)
      Xinv12 = invsqrtm(X)
      dist = np.zeros((n_matrices_X, n_matrices_Y))
  
      # row by row so it fits in memory
      for i, x_ in enumerate(Xinv12):
          evals_ = np.linalg.eigvalsh(x_ @ Y[i * XisY :] @ x_)
          d2 = np.sum(np.log(evals_) ** 2, -1)
          dist[i, i * XisY :] = d2
  
      if XisY:
          dist += dist.T
  
      return dist if squared else np.sqrt(dist)
  
imports: import numpy
  from scipy.linalg import eigvalsh, solve
  from sklearn.metrics import euclidean_distances
  from .base import logm, sqrtm, invsqrtm
label_desc: Use image node_id 17 for calling a global function with example usage: _pairwise_distance_riemann(X, Y, squared) and returns: unknown