aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorastrojhgu <astrojhgu@ed2142bd-67ad-457f-ba7c-d818d4011675>2012-04-09 09:22:31 +0000
committerastrojhgu <astrojhgu@ed2142bd-67ad-457f-ba7c-d818d4011675>2012-04-09 09:22:31 +0000
commit6b7d17d91e437125ea68e9ac870f51968885ab28 (patch)
treed8d8a7db4b0108091ecb2a7e8cf99690078cab2f
parent190f2b4e15cdeb8d5593f8a15e02d459a3c7483d (diff)
downloadopt-utilities-6b7d17d91e437125ea68e9ac870f51968885ab28.tar.bz2
git-svn-id: file:///home/svn/opt_utilities@234 ed2142bd-67ad-457f-ba7c-d818d4011675
-rw-r--r--methods/conjugate_gradient/conjugate_gradient.hpp5
1 files changed, 5 insertions, 0 deletions
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<get_size(start_point);++i)