/**
* Test whether a matrix is Hermitian,
* i.e. it is the complex conjugate
- * of its transpose.
+ * of its transpose. Default tolerance
+ * is zero.
*/
- PetscTruth is_hermitian ();
+ PetscTruth is_hermitian (const double tol = 0.0);
/*
* Abstract PETSc object that helps view
}
void
- MatrixBase::transpose ()
+ MatrixBase::transpose ()
{
int ierr;
+
+#if (PETSC_VERSION_MAJOR <= 2)
ierr = MatTranspose(matrix, PETSC_NULL);
+#else
+ ierr = MatTranspose(matrix, MAT_REUSE_MATRIX, &matrix);
+#endif
+
AssertThrow (ierr == 0, ExcPETScError(ierr));
}
}
PetscTruth
- MatrixBase::is_hermitian ()
+ MatrixBase::is_hermitian (const double tolerance)
{
PetscTruth truth;
// First flush PETSc caches
compress ();
+
+#if (PETSC_VERSION_MAJOR <= 2)
MatIsHermitian (matrix, &truth);
+#else
+ MatIsHermitian (matrix, tolerance, &truth);
+#endif
return truth;
}
// First flush PETSc caches
compress ();
- // Write to screen
+ // Set options
+#if (PETSC_VERSION_MAJOR <= 2)
PetscViewerSetFormat (PETSC_VIEWER_STDOUT_WORLD,
PETSC_VIEWER_ASCII_DEFAULT);
-
+#else
+ PetscViewerSetFormat (PETSC_VIEWER_STDOUT_WORLD,
+ PETSC_VIEWER_DEFAULT);
+#endif
+ // Write to screen
MatView (matrix,PETSC_VIEWER_STDOUT_WORLD);
}