code: def project_symmetric_to_psd_cone(M, is_symmetric=True, epsilon=0):
      """Projects the symmetric matrix M to the PSD cone."""
      if is_symmetric:
          try:
              eigvals, eigvecs = np.linalg.eigh(M)
          except np.linalg.LinAlgError:
              print(
                  "LinAlgError encountered with eigh. Defaulting to eig."
              )
              eigvals, eigvecs = np.linalg.eig(M)
              eigvals = np.real(eigvals)
              eigvecs = np.real(eigvecs)
      else:
          eigvals, eigvecs = np.linalg.eig(M)
      clipped_eigvals = np.clip(eigvals, epsilon, np.inf)
      return (eigvecs * clipped_eigvals).dot(eigvecs.T)
  
imports: from __future__ import print_function
  from __future__ import division
  import numpy
  from scipy.sparse import dok_matrix
  from scipy.linalg import solve_triangular
label_desc: Use image node_id 12 for calling a global function with example usage: project_symmetric_to_psd_cone(M, is_symmetric, epsilon) and returns: unknown