code: def logm(x):
      ndim = x.ndim
      new_x = _to_ndarray(x, to_ndim=3)
  
      if _is_symmetric(new_x) and new_x.dtype not in [
          _np.complex64,
          _np.complex128,
      ]:
          eigvals, eigvecs = _np.linalg.eigh(new_x)
          if (eigvals > 0).all():
              eigvals = _np.log(eigvals)
              eigvals = _diag_vec(eigvals)
              transp_eigvecs = _np.transpose(eigvecs, axes=(0, 2, 1))
              result = _np.matmul(eigvecs, eigvals)
              result = _np.matmul(result, transp_eigvecs)
          else:
              result = _logm_vec(new_x)
      else:
          result = _logm_vec(new_x)
  
      if ndim == 2:
          return result[0]
      return result
  
file_path: geomstats/geomstats/_backend/_shared_numpy/linalg.py
imports: from ._dispatch import _common
  from ._dispatch import numpy
  from ._dispatch import scipy
label_desc: Use image node_id 3 for calling a global function with example usage: logm(x) and returns: result, result