From 7e0dd173120434e7c7cbb45b018e98d477baaa33 Mon Sep 17 00:00:00 2001 From: Desire NUENTSA Date: Wed, 19 Sep 2012 18:32:02 +0200 Subject: [PATCH] Improve BiCGSTAB : With exact preconditioner, the solution should be found in one iteration --- Eigen/src/IterativeLinearSolvers/BiCGSTAB.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h b/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h index 126341be8..5a822e0ea 100644 --- a/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h +++ b/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h @@ -39,10 +39,11 @@ bool bicgstab(const MatrixType& mat, const Rhs& rhs, Dest& x, int maxIters = iters; int n = mat.cols(); + x = precond.solve(x); VectorType r = rhs - mat * x; VectorType r0 = r; - RealScalar r0_sqnorm = r0.squaredNorm(); + RealScalar r0_sqnorm = rhs.squaredNorm(); Scalar rho = 1; Scalar alpha = 1; Scalar w = 1; @@ -223,7 +224,8 @@ public: template void _solve(const Rhs& b, Dest& x) const { - x.setZero(); +// x.setZero(); + x = b; _solveWithGuess(b,x); }