diff options
Diffstat (limited to 'methods/conjugate_gradient/conjugate_gradient.hpp')
-rw-r--r-- | methods/conjugate_gradient/conjugate_gradient.hpp | 5 |
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) |