From: guido Date: Mon, 28 Aug 2000 20:32:59 +0000 (+0000) Subject: Check for symmetry X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=00455c7fb514a7bc7ee99a41b51301f6d05bbe3e;p=dealii-svn.git Check for symmetry git-svn-id: https://svn.dealii.org/trunk@3282 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/lac/include/lac/full_matrix.h b/deal.II/lac/include/lac/full_matrix.h index dd9813f903..9fef2dc80f 100644 --- a/deal.II/lac/include/lac/full_matrix.h +++ b/deal.II/lac/include/lac/full_matrix.h @@ -355,7 +355,7 @@ class FullMatrix : public Subscriptor * Compute the quadratic matrix norm. * Return value is the root of the square * sum of all matrix entries. Also called - * Frobenius Norm. + * Frobenius norm. * * This norm is compatible with the $l_2$ * vector norm. But it is not a natural @@ -363,6 +363,21 @@ class FullMatrix : public Subscriptor * therefore it is not called $l_2$-norm. */ number norm2 () const; + + /** + * Compute the relative norm of + * the skew-symmetric part. The + * return value is the Frobenius + * norm of the skew-symmetric + * part of the matrix divided by + * that of the matrix. + * + * Main purpose of this function + * is to check, if a matrix is + * symmetric within a certain + * accuracy, or not. + */ + number relative_symmetry_norm2 () const; /** * A=Inverse(A). Inversion of diff --git a/deal.II/lac/include/lac/full_matrix.templates.h b/deal.II/lac/include/lac/full_matrix.templates.h index d423afa1c3..1843378d29 100644 --- a/deal.II/lac/include/lac/full_matrix.templates.h +++ b/deal.II/lac/include/lac/full_matrix.templates.h @@ -1111,7 +1111,27 @@ FullMatrix::norm2 () const number s = 0.; for (unsigned int i=0;i +number +FullMatrix::relative_symmetry_norm2 () const +{ + Assert (val != 0, ExcEmptyMatrix()); + + number s = 0.; + number a = 0.; + for (unsigned int i=0;i