Problem::Evaluate implementation.

1. Add Problem::Evaluate and tests.
2. Remove Solver::Summary::initial/final_*
3. Remove Solver::Options::return_* members.
4. Various cpplint cleanups.

Change-Id: I4266de53489896f72d9c6798c5efde6748d68a47
This commit is contained in:
Sameer Agarwal
2013-02-20 01:39:03 -08:00
committed by Gerrit Code Review
parent d4a0bf86d6
commit 509f68cfe3
79 changed files with 1383 additions and 578 deletions
+58
View File
@@ -1110,6 +1110,64 @@ Instances
The size of the residual vector obtained by summing over the sizes
of all of the residual blocks.
.. function:: bool Problem::Evaluate(const Problem::EvaluateOptions& options, double* cost, vector<double>* residuals, vector<double>* gradient, CRSMatrix* jacobian)
Evaluate a :class:`Problem`. Any of the output pointers can be
`NULL`. Which residual blocks and parameter blocks are used is
controlled by the :class:`Problem::EvaluateOptions` struct below.
.. code-block:: c++
Problem problem;
double x = 1;
problem.Add(new MyCostFunction, NULL, &x);
double cost = 0.0;
problem.Evaluate(Problem::EvaluateOptions(), &cost, NULL, NULL, NULL);
The cost is evaluated at `x = 1`. If you wish to evaluate the
problem at `x = 2`, then
.. code-block:: c++
x = 2;
problem.Evaluate(Problem::EvaluateOptions(), &cost, NULL, NULL, NULL);
is the way to do so.
**NOTE** If no local parameterizations are used, then the size of
the gradient vector is the sum of the sizes of all the parameter
blocks. If a parameter block has a local parameterization, then
it contributes "LocalSize" entries to the gradient vector.
.. class:: Problem::EvaluateOptions
Options struct that is used to control :func:`Problem::Evaluate`.
.. member:: vector<double*> Problem::EvaluateOptions::parameter_blocks
The set of parameter blocks for which evaluation should be
performed. This vector determines the order in which parameter
blocks occur in the gradient vector and in the columns of the
jacobian matrix. If parameter_blocks is empty, then it is assumed
to be equal to a vector containing ALL the parameter
blocks. Generally speaking the ordering of the parameter blocks in
this case depends on the order in which they were added to the
problem and whether or not the user removed any parameter blocks.
**NOTE** This vector should contain the same pointers as the ones
used to add parameter blocks to the Problem. These parameter block
should NOT point to new memory locations. Bad things will happen if
you do.
.. member:: vector<ResidualBlockId> Problem::EvaluateOptions::residual_blocks
The set of residual blocks for which evaluation should be
performed. This vector determines the order in which the residuals
occur, and how the rows of the jacobian are ordered. If
residual_blocks is empty, then it is assumed to be equal to the
vector containing all the parameter blocks.
``rotation.h``
--------------