NumericDiffCostFunction supports dynamic number of residuals.
1. Update AutoDiffCostFunction template parameters to be consistent
with NumericDiffCostFunction.
2. Update the documentation for NumericDiffCostFunction and
AutoDiffCostFunction.
Change-Id: I113038abb5bedebb0f6f326f2a4ac31480d785fc
diff --git a/internal/ceres/numeric_diff_cost_function_test.cc b/internal/ceres/numeric_diff_cost_function_test.cc
index 3953ded..422c712 100644
--- a/internal/ceres/numeric_diff_cost_function_test.cc
+++ b/internal/ceres/numeric_diff_cost_function_test.cc
@@ -184,5 +184,18 @@
new SizeTestingCostFunction<2,2>, ceres::TAKE_OWNERSHIP));
}
+TEST(NumericDiffCostFunction, EasyCaseFunctorCentralDifferencesAndDynamicNumResiduals) {
+ internal::scoped_ptr<CostFunction> cost_function;
+ cost_function.reset(
+ new NumericDiffCostFunction<EasyFunctor,
+ CENTRAL,
+ ceres::DYNAMIC,
+ 5, /* size of x1 */
+ 5 /* size of x2 */>(
+ new EasyFunctor, TAKE_OWNERSHIP, 3));
+ EasyFunctor functor;
+ functor.ExpectCostFunctionEvaluationIsNearlyCorrect(*cost_function, CENTRAL);
+}
+
} // namespace internal
} // namespace ceres