Skip to main content
`Ctrl`+`K`

# 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

Matrices, `Mat`, `MatTranspose()`, `MatIsTranspose()`, `MatIsHermitianKnown()`, `MatIsStructurallySymmetric()`, `MatSetOption()`, `MatIsSymmetricKnown()`, `MatIsSymmetric()`, `MAT_HERMITIAN`, `MAT_SYMMETRY_ETERNAL`

## Level

intermediate

## Location

src/mat/interface/matrix.c

## Implementations

MatIsHermitian_SeqDense() in src/mat/impls/dense/seq/dense.c
MatIsHermitian_IS() in src/mat/impls/is/matis.c

Index of all Mat routines
Table of Contents for all manual pages
Index of all manual pages