code: def kernel(X, Y=None, *, Cref=None, metric="riemann", reg=1e-10):
      """Kernel matrix between matrices according to a specified metric.
  
      Calculates the kernel matrix K of inner products of two sets X and Y of
      matrices on the tangent space at Cref according to a specified metric.
  
      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.
      Cref : None | ndarray, shape (n, n), default=None
          Reference point for the tangent space and inner product
          calculation. Only used if metric='riemann'.
      metric : {'euclid', 'logeuclid', 'riemann'}, default='riemann'
          The type of metric used for tangent space and mean estimation.
      reg : float, default=1e-10
          Regularization parameter to mitigate numerical errors in kernel
          matrix estimation, to provide a positive-definite kernel matrix.
  
      Returns
      -------
      K : ndarray, shape (n_matrices_X, n_matrices_Y)
          The kernel matrix between X and Y.
  
      Notes
      -----
      .. versionadded:: 0.3
  
      See Also
      --------
      kernel_euclid
      kernel_logeuclid
      kernel_riemann
      """
      try:
          return globals()[f"kernel_{metric}"](X, Y, Cref=Cref, reg=reg)
      except KeyError:
          raise ValueError(
              "Kernel metric must be 'euclid', 'logeuclid', or "
              "'riemann'."
          )
  
file_path: pyRiemann/pyriemann/utils/kernel.py
imports: import numpy
  from .base import invsqrtm, logm
  from .mean import mean_riemann
label_desc: Use image node_id 6 for calling a global function with example usage: kernel(X, Y) and returns: globals