Fixed NonlinearOptimizer to return a shared pointer to a config

release/4.3a0
Alex Cunningham 2009-09-10 22:08:47 +00:00
parent 5e1c719c17
commit 65df85125d
2 changed files with 10 additions and 3 deletions

View File

@ -87,6 +87,13 @@ namespace gtsam {
return lambda_; return lambda_;
} }
/**
* Return the config
*/
NonlinearOptimizer::shared_config config() const {
return config_;
}
/** /**
* linearize and optimize * linearize and optimize
* Thi returns an FGConfig, i.e., vectors in tangent space of Config * Thi returns an FGConfig, i.e., vectors in tangent space of Config

View File

@ -91,7 +91,7 @@ TEST( NonlinearFactorGraph, iterateLM )
// LM iterate with lambda 0 should be the same // LM iterate with lambda 0 should be the same
Optimizer iterated2 = optimizer.iterateLM(); Optimizer iterated2 = optimizer.iterateLM();
CHECK(assert_equal(iterated1.config(), iterated2.config(), 1e-9)); CHECK(assert_equal(*(iterated1.config()), *(iterated2.config()), 1e-9));
} }
/* ************************************************************************* */ /* ************************************************************************* */
@ -123,12 +123,12 @@ TEST( NonlinearFactorGraph, optimize )
// Gauss-Newton // Gauss-Newton
Optimizer actual1 = optimizer.gaussNewton(relativeThreshold, Optimizer actual1 = optimizer.gaussNewton(relativeThreshold,
absoluteThreshold); absoluteThreshold);
CHECK(assert_equal(actual1.config(),cstar)); CHECK(assert_equal(*(actual1.config()),cstar));
// Levenberg-Marquardt // Levenberg-Marquardt
Optimizer actual2 = optimizer.levenbergMarquardt(relativeThreshold, Optimizer actual2 = optimizer.levenbergMarquardt(relativeThreshold,
absoluteThreshold, Optimizer::SILENT); absoluteThreshold, Optimizer::SILENT);
CHECK(assert_equal(actual2.config(),cstar)); CHECK(assert_equal(*(actual2.config()),cstar));
} }
/* ************************************************************************* */ /* ************************************************************************* */