]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Fix computation of eigenvalues when only a few iterations are done.
authorkronbichler <kronbichler@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 23 Aug 2011 09:41:55 +0000 (09:41 +0000)
committerkronbichler <kronbichler@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 23 Aug 2011 09:41:55 +0000 (09:41 +0000)
git-svn-id: https://svn.dealii.org/trunk@24170 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/include/deal.II/lac/precondition.h

index 0d96f8f45b43869f5679619188e83275b9fd0430..224044fe5e6131a8b62bb4bc752b0d2eec8680eb 100644 (file)
@@ -1592,6 +1592,8 @@ PreconditionChebyshev<MATRIX,VECTOR>::initialize (const MATRIX &matrix,
                                                  const AdditionalData &additional_data)
 {
   Assert (matrix.m() == matrix.n(), ExcMessage("Matrix not quadratic."));
+  Assert (additional_data.eig_cg_n_iterations > 2,
+         ExcMessage ("Need to set at least two iterations to find eigenvalues."));
   matrix_ptr = &matrix;
   data = additional_data;
   if (data.matrix_diagonal_inverse.size() != matrix.m())
@@ -1644,7 +1646,10 @@ PreconditionChebyshev<MATRIX,VECTOR>::initialize (const MATRIX &matrix,
        g.add (alpha, update1);
        res = g.l2_norm();
 
-       if (it > data.eig_cg_n_iterations || res < data.eig_cg_residual)
+                               // need at least two iterations to have
+                               // maximum and minimum eigenvalue
+       if (it > data.eig_cg_n_iterations || (it > 2 &&
+                                             res < data.eig_cg_residual))
          break;
 
        beta = gh;

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.