Both GaussNewton and LM now exit immediately if initial error<absoluteThreshold, and pront out a messsage saying that if verbisty>=ERROR

release/4.3a0
Frank Dellaert 2010-03-07 17:51:46 +00:00
parent d4447cbe48
commit 920d86ce35
1 changed files with 11 additions and 1 deletions

View File

@ -101,6 +101,13 @@ namespace gtsam {
verbosityLevel verbosity, int maxIterations) const {
static W writer(error_);
// check if we're already close enough
if (error_ < absoluteThreshold) {
if (verbosity >= ERROR) cout << "Exiting, as error = " << error_
<< " < absoluteThreshold (" << absoluteThreshold << ")" << endl;
return *this;
}
// linearize, solve, update
NonlinearOptimizer next = iterate(verbosity);
@ -191,8 +198,11 @@ namespace gtsam {
verbosityLevel verbosity, int maxIterations, double lambdaFactor) const {
// check if we're already close enough
if (error_ < absoluteThreshold)
if (error_ < absoluteThreshold) {
if (verbosity >= ERROR) cout << "Exiting, as error = " << error_
<< " < absoluteThreshold (" << absoluteThreshold << ")" << endl;
return *this;
}
// do one iteration of LM
NonlinearOptimizer next = iterateLM(verbosity, lambdaFactor);