From da6219b19dd92231cd0afe380ae4880b62bfe88d Mon Sep 17 00:00:00 2001 From: Desire NUENTSA Date: Wed, 20 Mar 2013 16:15:18 +0100 Subject: Bug567 : Fix iterative solvers to immediately return when the initial guess is the true solution and for trivial solution --- Eigen/src/IterativeLinearSolvers/BiCGSTAB.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'Eigen/src/IterativeLinearSolvers/BiCGSTAB.h') diff --git a/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h b/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h index 5a822e0ea..fbefb696f 100644 --- a/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h +++ b/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h @@ -44,6 +44,11 @@ bool bicgstab(const MatrixType& mat, const Rhs& rhs, Dest& x, VectorType r0 = r; RealScalar r0_sqnorm = rhs.squaredNorm(); + if(r0_sqnorm == 0) + { + x.setZero(); + return true; + } Scalar rho = 1; Scalar alpha = 1; Scalar w = 1; -- cgit v1.2.3