From f6df80e8a0b4518967c44be2ce65fa5d99871ced Mon Sep 17 00:00:00 2001 From: Sameer Agarwal Date: Sun, 22 Oct 2017 22:04:24 -0700 Subject: [PATCH] Fix tiny_solver_test Verify that the final cost is small enough instead of the norm of the residual vector. Change-Id: I9591d97d3e8f1c71067d99270967f1e593889843 --- internal/ceres/tiny_solver_test.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/internal/ceres/tiny_solver_test.cc b/internal/ceres/tiny_solver_test.cc index 747e20d05..f92b186fa 100644 --- a/internal/ceres/tiny_solver_test.cc +++ b/internal/ceres/tiny_solver_test.cc @@ -146,13 +146,11 @@ void TestHelper(const Function& f, const Vector& x0) { Vector x = x0; Vec2 residuals; f(x.data(), residuals.data(), NULL); - EXPECT_GT(residuals.norm(), 1e-10); + EXPECT_GT(residuals.squaredNorm() / 2.0, 1e-10); TinySolver solver; solver.Solve(f, &x); - - f(x.data(), residuals.data(), NULL); - EXPECT_NEAR(0.0, residuals.norm(), 1e-10); + EXPECT_NEAR(0.0, solver.summary.final_cost, 1e-10); } // A test case for when the cost function is statically sized.