On Windows, including the "windows.h" header defines an enormous number of
symbols; some of which are macros with common names. In particular, "ERROR" and
"min" and "max" get defined. This causes clashes when user code references
these names in a context other than the intended use in windows.h.
To deal with this, the Microsoft engineers added the ability to control the
definition of these symbols by adding extra defines. In particular, including
windows.h in the following way
#define NOGDI
#define NOMINMAX
will reduce the number of macros defined. This way they will not conflict with
other uses in Ceres. For example, numeric_limits<double>::max() is impossible
to call without defining NOMINMAX.
Change-Id: I166f5d3bb6dc0e2e4b2ebf800fb19e49206f7874
This patch introduces a matrix wrapper (MatrixAdapter) that allows to
transparently pass pointers to row-major or column-major matrices
to the conversion functions.
Change-Id: I7f1683a8722088cffcc542f593ce7eb46fca109b
This adds support for removing parameter and residual blocks.
There are two modes of operation: in the first, removals of
paremeter blocks are expensive, since each remove requires
scanning all residual blocks to find ones that depend on the
removed parameter. In the other, extra memory is sacrificed to
maintain a list of the residuals a parameter block depends on,
removing the need to scan. In both cases, removing residual blocks
is fast.
As a caveat, any removals destroys the ordering of the parameters,
so the residuals or jacobian returned from Solver::Solve() is
meaningless. There is some debate on the best way to handle this;
the details remain for a future change.
This also adds some overhead, even in the case that fast removals
are not requested:
- 1 int32 to each residual, to track its position in the program.
- 1 pointer to each parameter, to store the dependent residuals.
Change-Id: I71dcac8656679329a15ee7fc12c0df07030c12af
1. Added a Preconditioner interface.
2. SCHUR_JACOBI is now its own class and is independent of
SuiteSparse.
Change-Id: Id912ab19cf3736e61d1b90ddaf5bfba33e877ec4
Commit f102a68e41 seems to have introduced
a bug in both solver_impl.cc and solver_impl_test.cc
solver_impl_test showed 3 errors, where two were due to ceres NOT
failing when the test expected that, and one was due to the initial cost
being wrong (-1 instead of 0.5)
Ceres now does not attempt to evaluate the initial cost if
options.return_initial_xxx is not set. It therefore did not fail in
the tests.
It also seems that the CERES_EVALUATE macro erroneously always sets
final_cost, even when called with 'initial' as argument.
Change-Id: Ia3c3eeb476e7023a3f80b201124010d6c67e9824
1. Add an ExecutionSummary object to record execution
information about Ceres objects.
2. Add an EventLogger object to log events in a function call.
3. Add a ScopedExecutionTimer object to log times in ExecutionSummary.
4. Instrument ProgramEvaluator and all the linear solvers
to report their timing statistics.
5. Connect the timing statistics to Summary::FullReport.
6. Add high precision timer on unix systems using
gettimeofday() call.
7. Various minor clean ups all around.
Change-Id: I5e09804b730b09535484124be7dbc1c58eccd1d4
report execution statistics of all kinds.
Currently a single map which maps arbitrary strings to doubles is supported,
which allows for precise timing information to be communicated.
Change-Id: Ibd930aca5c9e6cae89bcfeffe9b13e2887644881
A wrapper class that takes a variadic functor evaluating a
function, numerically differentiates it and makes it available as a
templated functor so that it can be easily used as part of Ceres'
automatic differentiation framework.
The tests for NumericDiffCostFunction and NumericDiffFunctor have
a lot of stuff that is common, so refactor them to reduce code.
Change-Id: I83b01e58b05e575fb2530d15cbd611928298646a
The interface for NumericDiffCostFunction and AutoDiffCostFunction
are not comparable. They both accept variadic functors.
The change is backward compatible, as it still supports numeric
differentiation of CostFunction objects.
Some refactoring of documentation and code in auto_diff_cost_function
and its relatives was also done to make things consistent.
Change-Id: Ib5f230a1d4a85738eb187803b9c1cd7166bb3b92
CostFunctionToFunctor wraps a CostFunction, and makes it available
as a templated functor that can be called from other templated
functors. This is useful for when one wants to mix automatic,
numeric and analytic differentiated functions.
Also a bug fix in autodiff.h
Change-Id: If8ba281a89fda976ef2ce10a5844a74c4ac7b84a
Add a specialization for the common case where the residual block
outputs exactly one residual.
The matrix routines used by Corrector can be then specialized to
a scalar and be made considerably faster.
For denoising upto 400% speedup is observed.
Change-Id: I8e3f24b8ba41caa8e62ad97c5f5e96ab6ea47150
1. New LineSearchDirection interface, factory and instances.
2. Cleanup of LineSearchMinimizer to use the State and Direction objects.
3. LBFGS -> LowRankInverseHessian.
4. Refactoring of the RunCallbacks function and share it across
LineSearchMinimizer and TrustRegionMinimizer.
Change-Id: I19354afc6f5d6567b28918710c2012dc30ef8f32
1. Add a line search based minimization loop.
2. Currently this loop supports steepest descent and three
kinds of non-linear conjugate gradient algorithms.
3. Update SolverImpl to talk to LineSearchMinimizer.
4. Update IterationCallback to carry information about
line search.
5. Update LineSearch to take the initial point as input,
saving on one function evaluation.
6. Updates to the external API.
Change-Id: I901a0e89fc948451ab34c743e70f3dec57c9405e
One of the tests CreateLinearSolverNoSuiteSparse, fails
when no sparse backend is present. This was a failure
in running tests with all possible sparse backend settings.
Thanks to Sebastian Fabbro for reporting this.
Change-Id: I0ab98632ae7dd33f18d67cb9f490e74c034ce03d
An interface for line search and an initial implementation of
Armijo line search with and without interpolation.
Change-Id: I234da141be36172819a6df87ce5625aa8b58ed47
The buffers used to store the per thread value of the gradient
were not set to zero at the beginning of each call to evaluate.
Change-Id: I9c8afea54a4e2e0b805164025da3023166a309af
1. polynomial_solver* -> polynomial*.
2. Added support for differentiating polynomials.
2. Added support for interpolating polynomials from function
values and gradients.
3. Added support for minimizing polynomials by solving
for the roots of their derivatives in an interval.
4. Added support for finding the minimum of a polynomial
that interpolates function values and gradients in
an interval.
Change-Id: Id7e6764ad4db09c3edd60f1378c7f50f20dd08dc
The GradientChecker is a utility class written by
William Rucklidge that can be used to check that the
derivatives returned by a cost function match those
returned by numerically differentiating the residuals
returned by the same cost function.
This is useful when developing CostFunction objects
and testing them before plugging them into an optimization
problem.
Change-Id: Ic60f859b48b6246406448555d25556784e097b81
Following the last commit, which extends the number of parameters blocks autodiff can accept, the interface of Problem::AddResidualBlock is extended to accept up to 10 parameter blocks.
Change-Id: I162c3d1b1868fdda32c1522d57e9a211a9c02f90
Supporting only 6 parameters in autodiff was enough for most
cases, but 6 was not always sufficient. This extends the
current implementation to work with up to 10 parameters.
This also increases the number of parameters supported in
SizedCostFunction to 10.
Change-Id: Ic783602f93e6ddf4af24fa34eff37c0a4b775dc1
The NDK build of Ceres was broken; this fixes it and also
disables a useless warning that shows up in NDK 8b.
Change-Id: I54cfb3de7ccea4a0864385f7ffdb55d8f3431f34
Improve the logic with which various corner cases like
constant program, failures to evaluate initial and final
cost etc are handled.
Change-Id: Id43d45ebe46b65918909d47201d6fb7b89ebbd57