aboutsummaryrefslogtreecommitdiffhomepage
path: root/unsupported
diff options
context:
space:
mode:
authorGravatar Desire NUENTSA <desire.nuentsa_wakam@inria.fr>2013-03-20 11:22:45 +0100
committerGravatar Desire NUENTSA <desire.nuentsa_wakam@inria.fr>2013-03-20 11:22:45 +0100
commit4107b371e365a8f2d2544af9808fa90c05a81731 (patch)
tree3547b476963bb8384c65b9798f54fcbbc09e1450 /unsupported
parent9bfeeba1c51e709740b222a7f62bdb1391de8f1a (diff)
Handle zero right hand side in CG and GMRES
Diffstat (limited to 'unsupported')
-rw-r--r--unsupported/Eigen/src/IterativeSolvers/GMRES.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/unsupported/Eigen/src/IterativeSolvers/GMRES.h b/unsupported/Eigen/src/IterativeSolvers/GMRES.h
index 34e67db82..2efb6ff92 100644
--- a/unsupported/Eigen/src/IterativeSolvers/GMRES.h
+++ b/unsupported/Eigen/src/IterativeSolvers/GMRES.h
@@ -348,7 +348,8 @@ public:
template<typename Rhs,typename Dest>
void _solve(const Rhs& b, Dest& x) const
{
- x.setZero();
+ x = b;
+ if(!x.squaredNorm()) return; // Check Zero right hand side
_solveWithGuess(b,x);
}