MatIsSymmetric#

Test whether a matrix is symmetric

Synopsis#

#include "petscmat.h"
PetscErrorCode MatIsSymmetric(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 transpose)

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 symmetric or not this can be an expensive operation, also available MatIsSymmetricKnown()

One can declare that a matrix is symmetric with MatSetOption(mat,MAT_SYMMETRIC,PETSC_TRUE) and if it is known to remain symmetric after changes to the matrices values one can call MatSetOption(mat,MAT_SYMMETRY_ETERNAL,PETSC_TRUE)

MatTranspose(), MatIsTranspose(), MatIsHermitian(), MatIsStructurallySymmetric(), MatSetOption(), MatIsSymmetricKnown(), MAT_SYMMETRIC, MAT_SYMMETRY_ETERNAL, MatSetOption()

intermediate

Location#

src/mat/interface/matrix.c

Edit on GitLab