parameters: (constant)
return_statement: return is_symm, is_herm
docstring: Check if a matrix is Hermitian and/or symmetric.
docstring_summary: Check if a matrix is Hermitian and/or symmetric.
docstring_tokens: Check if a matrix is Hermitian and / or symmetric .
function: def is_hermitian(constant) -> bool:
      """Check if a matrix is Hermitian and/or symmetric.
      """
      complex_type = np.iscomplexobj(constant)
      if complex_type:
          # TODO catch complex symmetric but not Hermitian?
          is_symm = False
          if sp.issparse(constant):
              is_herm = is_sparse_symmetric(constant, complex=True)
          else:
              is_herm = np.allclose(constant, np.conj(constant.T))
      else:
          if sp.issparse(constant):
              is_symm = is_sparse_symmetric(constant, complex=False)
          else:
              is_symm = np.allclose(constant, constant.T)
          is_herm = is_symm
      return is_symm, is_herm
function_tokens: def is_hermitian ( constant ) -> bool : complex_type = np . iscomplexobj ( constant ) if complex_type : # TODO catch complex symmetric but not Hermitian? is_symm = False if sp . issparse ( constant ) : is_herm = is_sparse_symmetric ( constant , complex = True ) else : is_herm = np . allclose ( constant , np . conj ( constant . T ) ) else : if sp . issparse ( constant ) : is_symm = is_sparse_symmetric ( constant , complex = False ) else : is_symm = np . allclose ( constant , constant . T ) is_herm = is_symm return is_symm , is_herm