code: def apply_func_to_eigvalsh(mat, function, check_positive=False):
      """Apply function to eigenvalues and reconstruct the matrix.
  
      Parameters
      ----------
      mat : array_like, shape=[..., n, n]
          Hermitian matrix.
      function : callable, list of callables
          Function to apply to eigenvalues. If a list of functions is passed,
          a list of results will be returned.
      check_positive : bool
          Whether to check positivity of the eigenvalues.
          Optional. Default: False.
  
      Returns
      -------
      mat : array_like, shape=[..., n, n]
          Hermitian matrix.
      """
      eigvals, eigvecs = gs.linalg.eigh(mat)
      if check_positive and gs.any(
          gs.cast(eigvals, gs.get_default_dtype()) < 0.0
      ):
          try:
              name = function.__name__
          except AttributeError:
              name = function[0].__name__
  
          logging.warning("Negative eigenvalue encountered in %s", name)
  
      return_list = True
      if not isinstance(function, list):
          function = [function]
          return_list = False
      reconstruction = []
  
      if gs.is_complex(mat):
          transp_eigvecs = ComplexMatrices.transconjugate(eigvecs)
      else:
          transp_eigvecs = Matrices.transpose(eigvecs)
  
      for fun in function:
          eigvals_f = fun(eigvals)
          eigvals_f = utils.from_vector_to_diagonal_matrix(eigvals_f)
          reconstruction.append(
              Matrices.mul(eigvecs, eigvals_f, transp_eigvecs)
          )
      return reconstruction if return_list else reconstruction[0]
  
file_path: geomstats/geomstats/geometry/hermitian_matrices.py
imports: import logging
  import geomstats.backend
  from geomstats import algebra_utils
  from geomstats.geometry.base import ComplexMatrixVectorSpace
  from geomstats.geometry.complex_matrices import ComplexMatrices, ComplexMatricesMetric
  from geomstats.geometry.matrices import Matrices
label_desc: Use image node_id 3 for calling a global function with example usage: apply_func_to_eigvalsh(mat, function, check_positive) and returns: unknown