SourceXtractorPlusPlus
0.15
Please provide a description of the project.
|
Go to the documentation of this file.
37 std::cerr <<
" ||e||_2 at initial p: " << info[0] <<
'\n';
38 std::cerr <<
" ||e||_2: " << info[1] <<
'\n';
39 std::cerr <<
" ||J^T e||_inf: " << info[2] <<
'\n';
40 std::cerr <<
" ||Dp||_2: " << info[3] <<
'\n';
41 std::cerr <<
" mu/max[J^T J]_ii: " << info[4] <<
'\n';
42 std::cerr <<
" # iterations: " << info[5] <<
'\n';
43 switch ((
int) info[6]) {
45 std::cerr <<
" stopped by small gradient J^T e\n";
54 std::cerr <<
" singular matrix. Restart from current p with increased mu\n";
57 std::cerr <<
" no further error reduction is possible. Restart with increased mu\n";
60 std::cerr <<
" stopped by small ||e||_2\n";
63 std::cerr <<
" stopped by invalid (i.e. NaN or Inf) func values; a user error\n";
66 std::cerr <<
" # function evaluations: " << info[7] <<
'\n';
67 std::cerr <<
" # Jacobian evaluations: " << info[8] <<
'\n';
68 std::cerr <<
" # linear systems solved: " << info[9] <<
"\n\n";
78 return std::make_shared<LevmarEngine>(max_iterations);
87 switch (
static_cast<int>(info[6])) {
99 double epsilon2,
double epsilon3,
double delta)
100 : m_itmax{itmax}, m_opts{tau, epsilon1, epsilon2, epsilon3, delta} {
101 #ifdef LINSOLVERS_RETAIN_MEMORY
102 logger.
warn() <<
"Using a non thread safe levmar! Parallelism will be reduced.";
109 #ifdef LINSOLVERS_RETAIN_MEMORY
120 auto adata =
std::tie(parameter_manager, residual_estimator);
123 auto levmar_res_func = [](
double *p,
double *hx, int, int,
void *extra) {
124 #ifdef LINSOLVERS_RETAIN_MEMORY
125 levmar_mutex.unlock();
127 auto* extra_ptr = (decltype(adata)*)extra;
133 #ifdef LINSOLVERS_RETAIN_MEMORY
148 #ifdef LINSOLVERS_RETAIN_MEMORY
152 auto res = dlevmar_dif(levmar_res_func,
161 covariance_matrix.
data(),
164 #ifdef LINSOLVERS_RETAIN_MEMORY
165 levmar_mutex.unlock();
177 summary.engine_stop_reason = info[6];
178 summary.iteration_no = info[5];
179 summary.underlying_framework_info = info;
Provides to the LeastSquareEngine the residual values.
static LeastSquareSummary::StatusFlag getStatusFlag(int ret)
std::vector< double > convertCovarianceMatrixToWorldSpace(std::vector< double > covariance_matrix) const
static Elements::Logging logger
void getEngineValues(DoubleIter output_iter) const
Returns the engine values of the managed parameters.
std::size_t numberOfResiduals() const
Class containing the summary information of solving a least square minimization problem.
void updateEngineValues(DoubleIter new_values_iter)
Updates the managed parameters with the given engine values.
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::vector< double > m_opts
void populateResiduals(DoubleIter output_iter) const
void warn(const std::string &logMessage)
Class responsible for managing the parameters the least square engine minimizes.
static LeastSquareEngineManager::StaticEngine levmar_engine
static std::shared_ptr< LeastSquareEngine > createLevmarEngine(unsigned max_iterations)
LeastSquareSummary solveProblem(EngineParameterManager ¶meter_manager, ResidualEstimator &residual_estimator) override
static Logging getLogger(const std::string &name="")
std::size_t numberOfParameters()
Returns the number of parameters managed by the manager.
virtual ~LevmarEngine()
Destructor.