code: def eigh(ctx, A, eigvals_only=False, overwrite_a=False):
      """
      "eigh" is a unified interface for "eigsy" and "eighe". Depending on
      whether A is real or complex the appropriate function is called.
  
      This routine solves the (ordinary) eigenvalue problem for a real symmetric
      or complex hermitian square matrix A. Given A, an orthogonal (A real) or
      unitary (A complex) matrix Q is calculated which diagonalizes A:
  
          Q' A Q = diag(E)               and                Q Q' = Q' Q = 1
  
      Here diag(E) a is diagonal matrix whose diagonal is E.
      ' denotes the hermitian transpose (i.e. ordinary transposition and
      complex conjugation).
  
      The columns of Q are the eigenvectors of A and E contains the eigenvalues:
  
          A Q[:,i] = E[i] Q[:,i]
  
      input:
  
        A: a real or complex square matrix of format (n,n) which is symmetric
           (i.e. A[i,j]=A[j,i]) or hermitian (i.e. A[i,j]=conj(A[j,i])).
  
        eigvals_only: if true, calculates only the eigenvalues E.
                      if false, calculates both eigenvectors and eigenvalues.
  
        overwrite_a: if true, allows modification of A which may improve
                     performance. if false, A is not modified.
  
      output:
  
        E: vector of format (n). contains the eigenvalues of A in ascending order.
  
        Q: an orthogonal or unitary matrix of format (n,n). contains the
           eigenvectors of A as columns.
  
      return value:
  
            E         if eigvals_only is true
           (E, Q)     if eigvals_only is false
  
      example:
        >>> from mpmath import mp
        >>> A = mp.matrix([[3, 2], [2, 0]])
        >>> E = mp.eigh(A, eigvals_only = True)
        >>> print(E)
        [-1.0]
        [ 4.0]
  
        >>> A = mp.matrix([[1, 2], [2, 3]])
        >>> E, Q = mp.eigh(A)
        >>> print(mp.chop(A * Q[:,0] - E[0] * Q[:,0]))
        [0.0]
        [0.0]
  
        >>> A = mp.matrix([[1, 2 + 5j], [2 - 5j, 3]])
        >>> E, Q = mp.eigh(A)
        >>> print(mp.chop(A * Q[:,0] - E[0] * Q[:,0]))
        [0.0]
        [0.0]
  
      see also: eigsy, eighe, eig
      """
  
      iscomplex = any(type(x) is ctx.mpc for x in A)
  
      if iscomplex:
          return ctx.eighe(
              A, eigvals_only=eigvals_only, overwrite_a=overwrite_a
          )
      else:
          return ctx.eigsy(
              A, eigvals_only=eigvals_only, overwrite_a=overwrite_a
          )
  
file_path: catboost/contrib/python/mpmath/py3/mpmath/matrices/eigen_symmetric.py
imports: from ..libmp.backend import xrange
  from .eigen import defun
label_desc: Use image node_id 8 for calling a global function with example usage: eigh(ctx, A, eigvals_only, overwrite_a) and returns: ctx, ctx