message: more robust convergence checking
diff: @@ -137,6 +137,7 @@ fl accurate_line_search(F& f, sz n, const Conf& x, const Change& g, const fl f0,
  test = compute_lambdamin(p, x, n);
  alamin = epsilon_fl / test;
  + std::cout << "alamin " << alamin << " epsilon_fl " << epsilon_fl << " test " << test << "\n";
  alpha = FIRST; //single newton step
  for (;;) //always try full newton step first
  {
  @@ -145,8 +146,8 @@ fl accurate_line_search(F& f, sz n, const Conf& x, const Change& g, const fl f0,
  f1 = f(x_new, g_new);
  - //std::cout << "alpha " << alpha << " f " << f1 << "\tslope " << slope << " f0ALF " << f0 + ALF * alpha * slope << "\n";
  - if (alpha < alamin) //convergence
  + std::cout << "alpha " << alpha << " f " << f1 << "\tslope " << slope << " f0ALF " << f0 + ALF * alpha * slope << "\n";
  + if (alpha < alamin || !std::isfinite(alpha)) //convergence
  {
  x_new = x;
  g_new.clear(); //dkoes - set gradient to zero
  @@ -190,7 +191,7 @@ fl accurate_line_search(F& f, sz n, const Conf& x, const Change& g, const fl f0,
  }
  alpha2 = alpha;
  f2 = f1;
  - //std::cout << "TMPLAM " << tmplam << "\n";
  + std::cout << "TMPLAM " << tmplam << "\n";
  //considered slowing things down with f1 > 0, but it was slow without actually improving scores
  alpha = std::max(tmplam, (fl)0.1 * alpha); //never smaller than a tenth
  }
  @@ -234,11 +235,7 @@ fl bfgs(F& f, Conf& x, Change& g, const fl average_required_improvement,
  minus_mat_vec_product(h, g, p);
  fl f1 = 0;
  fl alpha;
  -/*
  - f.m->set(x);
  - f.m->write_sdf(fout);
  - fout << "$$$$\n";
  -*/
  +
  if (params.type == minimization_params::BFGSAccurateLineSearch)
  alpha = accurate_line_search(f, n, x, g, f0, p, x_new, g_new, f1);
  else
  @@ -255,6 +252,13 @@ fl bfgs(F& f, Conf& x, Change& g, const fl average_required_improvement,
  fl prevf0 = f0;
  f0 = f1;
  +
  + /*
  + f.m->set(x);
  + f.m->write_sdf(fout);
  + fout << "$$$$\n";
  + */
  +
  x = x_new;
  if (params.early_term)
  