From: kronbichler Date: Sun, 8 Nov 2009 20:12:21 +0000 (+0000) Subject: Avoid ambiguity in calculation of square root in Chebyshev preconditioner. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=90bddd2c90dec413db5e93856461d5b09b4ab617;p=dealii-svn.git Avoid ambiguity in calculation of square root in Chebyshev preconditioner. git-svn-id: https://svn.dealii.org/trunk@20073 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/lac/include/lac/precondition.h b/deal.II/lac/include/lac/precondition.h index 7074b29e6e..5672c547a6 100644 --- a/deal.II/lac/include/lac/precondition.h +++ b/deal.II/lac/include/lac/precondition.h @@ -1549,7 +1549,9 @@ PreconditionChebyshev::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::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(matrix.m())); g.reinit(data.matrix_diagonal_inverse, true); unsigned int it=0;