:orphan: # MatIsHermitian Test whether a matrix is Hermitian ## Synopsis ``` #include "petscmat.h" PetscErrorCode MatIsHermitian(Mat A, PetscReal tol, PetscBool *flg) ``` Collective ## Input Parameters - ***A -*** the matrix to test - ***tol -*** difference between value and its transpose less than this amount counts as equal (use 0.0 for exact Hermitian) ## Output Parameter - ***flg -*** the result ## Notes For real numbers `MatIsSymmetric()` and `MatIsHermitian()` return identical results If the matrix does not yet know if it is Hermitian or not this can be an expensive operation, also available `MatIsHermitianKnown()` One can declare that a matrix is Hermitian with `MatSetOption`(mat,`MAT_HERMITIAN`,`PETSC_TRUE`) and if it is known to remain Hermitian after changes to the matrices values one can call `MatSetOption`(mat,`MAT_SYMEMTRY_ETERNAL`,`PETSC_TRUE`) ## See Also [](ch_matrices), `Mat`, `MatTranspose()`, `MatIsTranspose()`, `MatIsHermitianKnown()`, `MatIsStructurallySymmetric()`, `MatSetOption()`, `MatIsSymmetricKnown()`, `MatIsSymmetric()`, `MAT_HERMITIAN`, `MAT_SYMMETRY_ETERNAL`, `MatSetOption()` ## Level intermediate ## Location src/mat/interface/matrix.c ## Implementations MatIsHermitian_SeqAIJ in src/mat/impls/aij/seq/aij.c
MatIsHermitian_SeqDense in src/mat/impls/dense/seq/dense.c
MatIsHermitian_IS in src/mat/impls/is/matis.c
MatIsHermitian_SeqSBAIJ in src/mat/impls/sbaij/seq/sbaij.c
--- [Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/mat/interface/matrix.c) [Index of all Mat routines](index.md) [Table of Contents for all manual pages](/manualpages/index.md) [Index of all manual pages](/manualpages/singleindex.md)