code: def distance_logeuclid(A, B, squared=False):
      r"""Log-Euclidean distance between SPD/HPD matrices.
  
      The Log-Euclidean distance between two SPD/HPD matrices :math:`\mathbf{A}`
      and :math:`\mathbf{B}` is [1]_:
  
      .. math::
          d(\mathbf{A},\mathbf{B}) =
          \Vert \log(\mathbf{A}) - \log(\mathbf{B}) \Vert_F
  
      Parameters
      ----------
      A : ndarray, shape (..., n, n)
          First SPD/HPD matrices, at least 2D ndarray.
      B : ndarray, shape (..., n, n)
          Second SPD/HPD matrices, same dimensions as A.
      squared : bool, default False
          Return squared distance.
  
          .. versionadded:: 0.5
  
      Returns
      -------
      d : float or ndarray, shape (...,)
          Log-Euclidean distance between A and B.
  
      See Also
      --------
      distance
  
      References
      ----------
      .. [1] `Geometric means in a novel vector space structure on symmetric
          positive-definite matrices
          <https://epubs.siam.org/doi/abs/10.1137/050637996>`_
          V. Arsigny, P. Fillard, X. Pennec, N. Ayache.
          SIAM J Matrix Anal Appl, 2007, 29 (1), pp. 328-347
      """
      return distance_euclid(logm(A), logm(B), squared=squared)
  
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 9 for calling a global function with example usage: distance_logeuclid(A, B, squared) and returns: distance_euclid