added equals in NonlinearOptimizerParams
parent
b5d06b5878
commit
ff40590fc3
|
@ -113,6 +113,17 @@ public:
|
|||
|
||||
virtual void print(const std::string& str = "") const;
|
||||
|
||||
bool equals(const NonlinearOptimizerParams& other, double tol = 1e-9) const {
|
||||
return maxIterations == other.getMaxIterations()
|
||||
&& std::abs(relativeErrorTol - other.getRelativeErrorTol()) <= tol
|
||||
&& std::abs(absoluteErrorTol - other.getAbsoluteErrorTol()) <= tol
|
||||
&& std::abs(errorTol - other.getErrorTol()) <= tol
|
||||
&& verbosityTranslator(verbosity) == other.getVerbosity();
|
||||
// && orderingType.equals(other.getOrderingType()_;
|
||||
// && linearSolverType == other.getLinearSolverType();
|
||||
// TODO: check ordering, iterativeParams, and iterationsHook
|
||||
}
|
||||
|
||||
inline bool isMultifrontal() const {
|
||||
return (linearSolverType == MULTIFRONTAL_CHOLESKY)
|
||||
|| (linearSolverType == MULTIFRONTAL_QR);
|
||||
|
|
|
@ -48,6 +48,19 @@ const double tol = 1e-5;
|
|||
using symbol_shorthand::X;
|
||||
using symbol_shorthand::L;
|
||||
|
||||
/* ************************************************************************* */
|
||||
TEST( NonlinearOptimizer, paramsEquals )
|
||||
{
|
||||
// default constructors lead to two identical params
|
||||
GaussNewtonParams gnParams1;
|
||||
GaussNewtonParams gnParams2;
|
||||
CHECK(gnParams1.equals(gnParams2));
|
||||
|
||||
// but the params become different if we change something in gnParams2
|
||||
gnParams2.setVerbosity("DELTA");
|
||||
CHECK(!gnParams1.equals(gnParams2));
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
TEST( NonlinearOptimizer, iterateLM )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue