MCPcopy Create free account
hub / github.com/ceres-solver/ceres-solver / TinySolver

Class TinySolver

include/ceres/tiny_solver.h:133–394  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

131 Function::NUM_PARAMETERS, //
132 Function::NUM_PARAMETERS>>>
133class TinySolver {
134 public:
135 // This class needs to have an Eigen aligned operator new as it contains
136 // fixed-size Eigen types.
137 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
138
139 enum {
140 NUM_RESIDUALS = Function::NUM_RESIDUALS,
141 NUM_PARAMETERS = Function::NUM_PARAMETERS
142 };
143 using Scalar = typename Function::Scalar;
144 using Parameters = typename Eigen::Matrix<Scalar, NUM_PARAMETERS, 1>;
145
146 enum Status {
147 // max_norm |J'(x) * f(x)| < gradient_tolerance
148 GRADIENT_TOO_SMALL,
149 // ||dx|| <= parameter_tolerance * (||x|| + parameter_tolerance)
150 RELATIVE_STEP_SIZE_TOO_SMALL,
151 // cost_threshold > ||f(x)||^2 / 2
152 COST_TOO_SMALL,
153 // num_iterations >= max_num_iterations
154 HIT_MAX_ITERATIONS,
155 // (new_cost - old_cost) < function_tolerance * old_cost
156 COST_CHANGE_TOO_SMALL,
157
158 // TODO(sameeragarwal): Deal with numerical failures.
159 };
160
161 struct Options {
162 int max_num_iterations = 50;
163
164 // max_norm |J'(x) * f(x)| < gradient_tolerance
165 Scalar gradient_tolerance = 1e-10;
166
167 // ||dx|| <= parameter_tolerance * (||x|| + parameter_tolerance)
168 Scalar parameter_tolerance = 1e-8;
169
170 // (new_cost - old_cost) < function_tolerance * old_cost
171 Scalar function_tolerance = 1e-6;
172
173 // cost_threshold > ||f(x)||^2 / 2
174 Scalar cost_threshold = std::numeric_limits<Scalar>::epsilon();
175
176 Scalar initial_trust_region_radius = 1e4;
177 };
178
179 struct Summary {
180 // 1/2 ||f(x_0)||^2
181 Scalar initial_cost = -1;
182 // 1/2 ||f(x)||^2
183 Scalar final_cost = -1;
184 // max_norm(J'f(x))
185 Scalar gradient_max_norm = -1;
186 int iterations = -1;
187 Status status = HIT_MAX_ITERATIONS;
188 };
189
190 bool Update(const Function& function, const Parameters& x) {

Callers

nothing calls this directly

Calls 4

functionFunction · 0.85
absFunction · 0.85
SummaryClass · 0.70
UpdateFunction · 0.50

Tested by

no test coverage detected