mirror of
https://github.com/ceres-solver/ceres-solver.git
synced 2026-08-29 16:40:38 +08:00
Add residuals and jacobian getters to TinySolver.
- Add methods to aceess the cached residuals and jacobian computed in the optimization process in TinySolver. Usage of such methods will retrieve the corresponding values associated with the converged parameter. - Reorder the Update() call to ensure that the jacobian/residuals associated with the converged parameter are computed and cached. Change-Id: If82e19d67d28b057833357f2c9a75b2d0fd139af
This commit is contained in:
@@ -121,6 +121,14 @@ void TestHelper(const Function& f, const Vector& x0) {
|
||||
TinySolver<Function> solver;
|
||||
solver.Solve(f, &x);
|
||||
EXPECT_NEAR(0.0, solver.summary.final_cost, 1e-10);
|
||||
|
||||
// Getter methods for residuals and jacobian should match the corresponding
|
||||
// values evaluated at the converged parameter value.
|
||||
Vec2 expected_residuals;
|
||||
Eigen::Matrix<double, 2, 3> expected_jacobian;
|
||||
f(x.data(), expected_residuals.data(), expected_jacobian.data());
|
||||
EXPECT_TRUE(expected_residuals.isApprox(solver.Residuals()));
|
||||
EXPECT_TRUE(expected_jacobian.isApprox(solver.Jacobian()));
|
||||
}
|
||||
|
||||
// A test case for when the cost function is statically sized.
|
||||
|
||||
Reference in New Issue
Block a user