Fix a bug in system_test.cc Fix an error in the cost functor for Powell's function. Reported by William Gandler. Change-Id: I4ffbbca3b3731aa13c3608067baaebd06c1a044a
diff --git a/internal/ceres/system_test.cc b/internal/ceres/system_test.cc index 429973f..11b0504 100644 --- a/internal/ceres/system_test.cc +++ b/internal/ceres/system_test.cc
@@ -97,7 +97,7 @@ template <typename T> bool operator()(const T* const x1, const T* const x2, T* residual) const { // f1 = x1 + 10 * x2; - *residual = *x1 + 10.0 * *x2; + *residual = x1[0] + 10.0 * x2[0]; return true; } }; @@ -107,7 +107,7 @@ template <typename T> bool operator()(const T* const x3, const T* const x4, T* residual) const { // f2 = sqrt(5) (x3 - x4) - *residual = sqrt(5.0) * (*x3 - *x4); + *residual = sqrt(5.0) * (x3[0] - x4[0]); return true; } }; @@ -115,9 +115,9 @@ class F3 { public: template <typename T> - bool operator()(const T* const x2, const T* const x4, T* residual) const { + bool operator()(const T* const x2, const T* const x3, T* residual) const { // f3 = (x2 - 2 x3)^2 - residual[0] = (x2[0] - 2.0 * x4[0]) * (x2[0] - 2.0 * x4[0]); + residual[0] = (x2[0] - 2.0 * x3[0]) * (x2[0] - 2.0 * x3[0]); return true; } };