Support varying numbers of residuals in autodiff.

This commit modifies the only function in autodiff that takes a
templated number of outputs (i.e. residuals) and makes that
template parameter a normal parameter. With that change, it
is a trivial matter to support a dynamic number of residuals.

The API for dynamic residuals is to pass a fake number of
residuals as the second template argument to
AutoDiffCostFunction, and to pass the real number of
parameters as a second constructor argument.
This commit is contained in:
Keir Mierle
2012-05-09 07:38:07 -07:00
parent da3e0563cc
commit fdeb5772cc
6 changed files with 142 additions and 52 deletions
+7
View File
@@ -237,6 +237,13 @@ enum DumpFormatType {
TEXTFILE
};
// For SizedCostFunction and AutoDiffCostFunction, DYNAMIC can be specified for
// the number of residuals. If specified, then the number of residuas for that
// cost function can vary at runtime.
enum DimensionType {
DYNAMIC = -1
};
const char* LinearSolverTypeToString(LinearSolverType type);
const char* PreconditionerTypeToString(PreconditionerType type);
const char* LinearSolverTerminationTypeToString(