Skip to content
Snippets Groups Projects
Commit 6f413434 authored by Michael Chappell's avatar Michael Chappell
Browse files

Bug fixes to Variable Metric Convergence detection

parent fd64d0cb
No related branches found
No related tags found
No related merge requests found
......@@ -622,6 +622,7 @@ NonlinOut varmet(const NonlinParam& p, const NonlinCF& cfo)
else if (status == LM_LAMBDA_NILL) { // This means we might be heading uphill and should restart
if (p.NextRestart()) { // If we have spare restarts
p.SetCF(p.CF()); // Another copy of old value
p.SetPar(p.Par()); // Another copy of old values
iH.reset(); // Back to being unity matrix
pdir = -grad;
continue;
......@@ -634,7 +635,10 @@ NonlinOut varmet(const NonlinParam& p, const NonlinCF& cfo)
ColumnVector dpar = newpar - p.Par();
p.SetPar(newpar);
p.SetCF(newcf);
if (zero_par_step_conv(dpar,p.Par(),p.FractionalParameterTolerance())) {p.SetStatus(NL_PARCONV); return(p.Status());}
// cout << "p.FractionalParameterTolerance() = " << p.FractionalParameterTolerance() << endl;
// cout << "P.Par() = " << p.Par() << endl;
// cout << "dpar = " << dpar << endl;
if (zero_par_step_conv(p.Par(),dpar,p.FractionalParameterTolerance())) {p.SetStatus(NL_PARCONV); return(p.Status());}
// Get gradient at new point
ColumnVector newgrad = sf*cfo.grad(p.Par());
// Test for convergence based on "zero" gradient
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment