From 3d713fc1a7e81e43fc8a5270350103cba0552232 Mon Sep 17 00:00:00 2001 From: wolf Date: Wed, 22 Aug 2001 11:53:44 +0000 Subject: [PATCH] Check pivot size relative to other matrix entries. git-svn-id: https://svn.dealii.org/trunk@4904 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/lac/include/lac/full_matrix.h | 5 +- .../lac/include/lac/full_matrix.templates.h | 54 +++++++++++++------ 2 files changed, 41 insertions(+), 18 deletions(-) diff --git a/deal.II/lac/include/lac/full_matrix.h b/deal.II/lac/include/lac/full_matrix.h index dc78f223ec..0f7eb948fd 100644 --- a/deal.II/lac/include/lac/full_matrix.h +++ b/deal.II/lac/include/lac/full_matrix.h @@ -613,7 +613,10 @@ class FullMatrix : public vector2d /** * Exception */ - DeclException0 (ExcNotRegular); + DeclException1 (ExcNotRegular, + double, + << "The maximal pivot is " << arg1 + << ", which is below the threshold. The matrix may be singular."); /** * Exception */ diff --git a/deal.II/lac/include/lac/full_matrix.templates.h b/deal.II/lac/include/lac/full_matrix.templates.h index 7a7e4894e8..b2b9b6e6b6 100644 --- a/deal.II/lac/include/lac/full_matrix.templates.h +++ b/deal.II/lac/include/lac/full_matrix.templates.h @@ -1340,17 +1340,33 @@ FullMatrix::gauss_jordan() // Gauss-Jordan-Algorithmus // cf. Stoer I (4th Edition) p. 153 - std::vector p(n()); - - for (unsigned int i=0; i p(N); + for (unsigned int i=0; i max) { @@ -1358,11 +1374,15 @@ FullMatrix::gauss_jordan() r = i; } } - Assert(max>1.e-16, ExcNotRegular()); - // rowinterchange + // check whether the pivot is + // too small + Assert(max > 1.e-16*typical_diagonal_element, + ExcNotRegular(max)); + + // row interchange if (r>j) { - for (unsigned int k=0; k::gauss_jordan() // transformation const number hr = 1./el(j,j); el(j,j) = hr; - for (unsigned int k=0; k hv(n()); - for (unsigned int i=0; i hv(N); + for (unsigned int i=0; i