From 6b7d17d91e437125ea68e9ac870f51968885ab28 Mon Sep 17 00:00:00 2001 From: astrojhgu Date: Mon, 9 Apr 2012 09:22:31 +0000 Subject: git-svn-id: file:///home/svn/opt_utilities@234 ed2142bd-67ad-457f-ba7c-d818d4011675 --- methods/conjugate_gradient/conjugate_gradient.hpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/methods/conjugate_gradient/conjugate_gradient.hpp b/methods/conjugate_gradient/conjugate_gradient.hpp index f5befd7..edec92d 100644 --- a/methods/conjugate_gradient/conjugate_gradient.hpp +++ b/methods/conjugate_gradient/conjugate_gradient.hpp @@ -150,6 +150,11 @@ namespace opt_utilities b1+=Delta_Xn[i]*(Delta_Xn[i]-Delta_Xn1[i]); b2+=Delta_Xn1[i]*Delta_Xn1[i]; } + if(b2==0) + { + end_point=xn; + return end_point; + } betan=max(rT(0),b1/b2); //// for(size_t i=0;i