code: def mean_logeuclid(X=None, sample_weight=None, covmats=None):
      r"""Mean of SPD/HPD matrices according to the log-Euclidean metric.
  
      Log-Euclidean mean is [1]_:
  
      .. math::
          \mathbf{M} = \exp{ \left( \sum_i w_i \ \log{\mathbf{X}_i} \right) }
  
      Parameters
      ----------
      X : ndarray, shape (n_matrices, n, n)
          Set of SPD/HPD matrices.
      sample_weight : None | ndarray, shape (n_matrices,), default=None
          Weights for each matrix. If None, it uses equal weights.
  
      Returns
      -------
      M : ndarray, shape (n, n)
          Log-Euclidean mean.
  
      See Also
      --------
      mean_covariance
  
      References
      ----------
      .. [1] `Geometric means in a novel vector space structure on symmetric
          positive-definite matrices
          <https://epubs.siam.org/doi/abs/10.1137/050637996?journalCode=sjmael>`_
          V. Arsigny, P. Fillard, X. Pennec, and N. Ayache. SIAM Journal on
          Matrix Analysis and Applications. Volume 29, Issue 1 (2007).
      """
      X = _deprecate_covmats(covmats, X)
      M = expm(mean_euclid(logm(X), sample_weight=sample_weight))
      return M
  
imports: from copy import deepcopy
  import numpy
  import warnings
  from .ajd import ajd_pham
  from .base import sqrtm, invsqrtm, logm, expm, powm
  from .distance import distance_riemann
  from .geodesic import geodesic_riemann
  from .utils import check_weights
label_desc: Use image node_id 9 for calling a global function with example usage: mean_logeuclid(X, sample_weight, covmats) and returns: M