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
This commit is contained in:
Sameer Agarwal
2013-10-03 07:12:14 -07:00
committed by Keir Mierle
parent 835ae9a639
commit 3a2158d728
6 changed files with 132 additions and 53 deletions
@@ -184,5 +184,18 @@ TEST(NumericDiffCostFunction, EigenRowMajorColMajorTest) {
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