32 namespace ModelFitting {
35 return std::make_shared<LevmarEngine>(max_iterations);
41 double epsilon2,
double epsilon3,
double delta)
42 : m_itmax{itmax}, m_opts{tau, epsilon1, epsilon2, epsilon3, delta} { }
47 #ifdef LINSOLVERS_RETAIN_MEMORY
58 auto adata =
std::tie(parameter_manager, residual_estimator);
61 auto levmar_res_func = [](
double *p,
double *hx, int, int,
void *extra) {
62 #ifdef LINSOLVERS_RETAIN_MEMORY
63 levmar_mutex.unlock();
65 auto* extra_ptr = (decltype(adata)*)extra;
71 #ifdef LINSOLVERS_RETAIN_MEMORY
86 #ifdef LINSOLVERS_RETAIN_MEMORY
90 auto res = dlevmar_dif(levmar_res_func,
99 covariance_matrix.data(),
102 #ifdef LINSOLVERS_RETAIN_MEMORY
103 levmar_mutex.unlock();
114 summary.success_flag = (res != -1);
115 summary.iteration_no = info[5];
116 summary.underlying_framework_info = info;
virtual ~LevmarEngine()
Destructor.
Class containing the summary information of solving a least square minimization problem.
void populateResiduals(DoubleIter output_iter) const
void getEngineValues(DoubleIter output_iter) const
Returns the engine values of the managed parameters.
void updateEngineValues(DoubleIter new_values_iter)
Updates the managed parameters with the given engine values.
static std::shared_ptr< LeastSquareEngine > createLevmarEngine(unsigned max_iterations)
std::vector< double > m_opts
LevmarEngine(size_t itmax=1000, double tau=1E-3, double epsilon1=1E-8, double epsilon2=1E-8, double epsilon3=1E-8, double delta=1E-4)
Constructs a new instance of the engine.
std::size_t numberOfResiduals() const
static LeastSquareEngineManager::StaticEngine levmar_engine
Class responsible for managing the parameters the least square engine minimizes.
std::vector< double > convertCovarianceMatrixToWorldSpace(std::vector< double > covariance_matrix) const
LeastSquareSummary solveProblem(EngineParameterManager ¶meter_manager, ResidualEstimator &residual_estimator) override
Provides to the LeastSquareEngine the residual values.
std::size_t numberOfParameters()
Returns the number of parameters managed by the manager.