From 56d4ef7ad6856f95730aa4a143e1c1db757a6ce0 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Fri, 5 Jun 2015 14:37:57 +0200 Subject: BiCGSTAB: set default guess to 0, and improve restart mechanism by recomputing the accurate residual. --- Eigen/src/IterativeLinearSolvers/BiCGSTAB.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'Eigen/src/IterativeLinearSolvers') diff --git a/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h b/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h index e67f09184..be98993f0 100644 --- a/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h +++ b/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h @@ -59,20 +59,21 @@ bool bicgstab(const MatrixType& mat, const Rhs& rhs, Dest& x, VectorType s(n), t(n); - RealScalar tol2 = tol*tol; + RealScalar tol2 = tol*tol*rhs_sqnorm; RealScalar eps2 = NumTraits::epsilon()*NumTraits::epsilon(); Index i = 0; Index restarts = 0; - while ( r.squaredNorm()/rhs_sqnorm > tol2 && i tol2 && i void _solve_impl(const MatrixBase& b, Dest& x) const { - // x.setZero(); - x = b; + x.resize(this->rows(),b.cols()); + x.setZero(); _solve_with_guess_impl(b,x); } -- cgit v1.2.3