Fix the Jacobian in trust_region_minimizer_test.cc The analytical Jacobians for Powell's singular function were incorrect. Thanks to William Gandler for reporting this. Change-Id: I780ffe449daa6935a79b904835e13edcf1cdffa2
diff --git a/internal/ceres/trust_region_minimizer_test.cc b/internal/ceres/trust_region_minimizer_test.cc index 8993273..a1c48b6 100644 --- a/internal/ceres/trust_region_minimizer_test.cc +++ b/internal/ceres/trust_region_minimizer_test.cc
@@ -141,7 +141,7 @@ 1.0, 0.0, 0.0, - sqrt(10.0) * 2.0 * (x1 - x4) * (1.0 - x4); + sqrt(10.0) * 2.0 * (x1 - x4); // clang-format on } if (col2) { @@ -149,7 +149,7 @@ jacobian_matrix.col(column_index++) << 10.0, 0.0, - 2.0*(x2 - 2.0*x3)*(1.0 - 2.0*x3), + 2.0*(x2 - 2.0*x3), 0.0; // clang-format on } @@ -159,7 +159,7 @@ jacobian_matrix.col(column_index++) << 0.0, sqrt(5.0), - 2.0*(x2 - 2.0*x3)*(x2 - 2.0), + 4.0*(2.0*x3 - x2), 0.0; // clang-format on } @@ -170,7 +170,7 @@ 0.0, -sqrt(5.0), 0.0, - sqrt(10.0) * 2.0 * (x1 - x4) * (x1 - 1.0); + sqrt(10.0) * 2.0 * (x4 - x1); // clang-format on } VLOG(1) << "\n" << jacobian_matrix; @@ -188,7 +188,7 @@ if (col3) { gradient[column_index++] = - f2 * sqrt(5.0) + f3 * (2.0 * 2.0 * (2.0 * x3 - x2)); + f2 * sqrt(5.0) + f3 * (4.0 * (2.0 * x3 - x2)); } if (col4) {