]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Avoid ambiguity in calculation of square root in Chebyshev preconditioner.
authorMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Sun, 8 Nov 2009 20:12:21 +0000 (20:12 +0000)
committerMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Sun, 8 Nov 2009 20:12:21 +0000 (20:12 +0000)
git-svn-id: https://svn.dealii.org/trunk@20073 0785d39b-7218-0410-832d-ea1e28bc413d

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

index 7074b29e6e9ce7b5d10a319b4580440f3723ddd8..5672c547a63b0540635ebdb58c1d26f2e2bbdffc 100644 (file)
@@ -1549,7 +1549,9 @@ PreconditionChebyshev<MATRIX,VECTOR>::initialize (const MATRIX &matrix,
 
                                 // calculate largest eigenvalue using a
                                 // hand-tuned CG iteration on the matrix
-                                // weighted by its diagonal.
+                                // weighted by its diagonal. we start 
+                                // with a vector that consists of ones 
+                                // only, weighted by the length.
                                 // 
                                 // TODO: can we obtain this with the
                                 // regular CG implementation? we would need
@@ -1564,7 +1566,7 @@ PreconditionChebyshev<MATRIX,VECTOR>::initialize (const MATRIX &matrix,
 
     VECTOR rhs, g;
     rhs.reinit(data.matrix_diagonal_inverse, true);
-    rhs = 1./sqrt(matrix.m());
+    rhs = 1./std::sqrt(static_cast<double>(matrix.m()));
     g.reinit(data.matrix_diagonal_inverse, true);
 
     unsigned int it=0;

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.