code: def log_map_riemann(X, Cref, C12=False):
      r"""Project matrices in tangent space by Riemannian logarithmic map.
  
      The projection of a matrix :math:`\mathbf{X}` from SPD/HPD manifold
      to tangent space by Riemannian logarithmic map
      according to a SPD/HPD reference matrix :math:`\mathbf{C}_\text{ref}` is:
  
      .. math::
          \mathbf{X}_\text{new} = \log ( \mathbf{C}_\text{ref}^{-1/2}
          \mathbf{X} \mathbf{C}_\text{ref}^{-1/2})
  
      When C12=True, it returns the full Riemannian logarithmic map:
  
      .. math::
          \mathbf{X}_\text{new} = \mathbf{C}_\text{ref}^{1/2}
          \log( \mathbf{C}_\text{ref}^{-1/2} \mathbf{X}
          \mathbf{C}_\text{ref}^{-1/2}) \mathbf{C}_\text{ref}^{1/2}
  
      Parameters
      ----------
      X : ndarray, shape (..., n, n)
          Matrices in SPD/HPD manidold.
      Cref : ndarray, shape (n, n)
          The reference SPD/HPD matrix.
      C12 : bool, default=False
          If True, it returns the full Riemannian logarithmic map.
  
      Returns
      -------
      X_new : ndarray, shape (..., n, n)
          Matrices projected in tangent space.
  
      Notes
      -----
      .. versionadded:: 0.4
      """
      _check_dimensions(X, Cref)
      Cm12 = invsqrtm(Cref)
      X_new = logm(Cm12 @ X @ Cm12)
      if C12:
          C12 = sqrtm(Cref)
          X_new = C12 @ X_new @ C12
      return X_new
  
file_path: pyRiemann/pyriemann/utils/tangentspace.py
imports: import numpy
  from .base import sqrtm, invsqrtm, logm, expm
  from .mean import mean_covariance
label_desc: Use image node_id 7 for calling a global function with example usage: log_map_riemann(X, Cref, C12) and returns: X_new