Commit b802e463 by Francois Gygi

truncate beta if too large

git-svn-id: http://qboxcode.org/svn/qb/trunk@1011 cba15fb0-1239-40c8-b417-11db7ca47a34
parent d847fb22
......@@ -119,11 +119,11 @@ void CGOptimizer::compute_xp(const valarray<double>& x, const double f,
ddot_(&n_,&gm_[0],&one,&g[0],&one)) / g0norm2_;
#endif
if ( beta_max_ > 0.0 && beta > beta_max_ )
if ( beta_max_ > 0.0 && fabs(beta) > beta_max_ )
{
if ( debug_print )
cout << " CGOptimizer: beta exceeds beta_max " << endl;
if ( beta > beta_max_ ) beta = 0.0;
cout << " CGOptimizer: |beta| exceeds beta_max " << endl;
beta = (beta > 0.0) ? beta_max_ : -beta_max_;
}
if ( debug_print )
cout << " CGOptimizer: beta = " << beta << endl;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment