# MatIsHermitian#

Test whether a matrix is Hermitian

## Synopsis#

#include "petscmat.h"
PetscErrorCode MatIsHermitian(Mat A, PetscReal tol, PetscBool *flg)


Collective on Mat

## 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 Parameters#

• 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)

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

intermediate

## Location#

src/mat/interface/matrix.c

Edit on GitLab