move NonlinearOptimizerParams::equals definition to .cpp file and improve slightly
parent
19542053cc
commit
5cf1e0d220
|
|
@ -123,6 +123,28 @@ void NonlinearOptimizerParams::print(const std::string& str) const {
|
|||
std::cout.flush();
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
bool NonlinearOptimizerParams::equals(const NonlinearOptimizerParams& other,
|
||||
double tol) const {
|
||||
// Check for equality of shared ptrs
|
||||
bool iterative_params_equal = iterativeParams == other.iterativeParams;
|
||||
// Check equality of components
|
||||
if (iterativeParams && other.iterativeParams) {
|
||||
iterative_params_equal = iterativeParams->equals(*other.iterativeParams);
|
||||
} else {
|
||||
// If one or both shared pointers are null, we can't assume they are equal
|
||||
iterative_params_equal = false;
|
||||
}
|
||||
|
||||
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 == other.orderingType && ordering == other.ordering &&
|
||||
linearSolverType == other.linearSolverType && iterative_params_equal;
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
std::string NonlinearOptimizerParams::linearSolverTranslator(
|
||||
LinearSolverType linearSolverType) const {
|
||||
|
|
|
|||
|
|
@ -114,24 +114,7 @@ public:
|
|||
|
||||
virtual void print(const std::string& str = "") const;
|
||||
|
||||
bool equals(const NonlinearOptimizerParams& other, double tol = 1e-9) const {
|
||||
// Check for equality of shared ptrs
|
||||
bool iterative_params_equal = false;
|
||||
if (iterativeParams == other.iterativeParams) {
|
||||
iterative_params_equal = true;
|
||||
}
|
||||
if (iterativeParams && other.iterativeParams) {
|
||||
iterative_params_equal = iterativeParams->equals(*other.iterativeParams);
|
||||
}
|
||||
|
||||
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 == other.orderingType && ordering == other.ordering &&
|
||||
linearSolverType == other.linearSolverType && iterative_params_equal;
|
||||
}
|
||||
bool equals(const NonlinearOptimizerParams& other, double tol = 1e-9);
|
||||
|
||||
inline bool isMultifrontal() const {
|
||||
return (linearSolverType == MULTIFRONTAL_CHOLESKY)
|
||||
|
|
|
|||
Loading…
Reference in New Issue