Commit Graph

33 Commits

Author SHA1 Message Date
Björn Piltz c0b883816f Disabled warning C4251 Added the files disable_warnings.h and reenable_warnings.h which need to be included by every file that uses the macro CERES_EXPORT.
Change-Id: I176326a600d094a4524bac873564fcbf8efd2456
2014-05-19 22:53:41 +02:00
Sameer Agarwal 31b5037926 Lint cleanup from William Rucklidge.
Change-Id: If545f114c1a2b07edd660a3c71ecfc16ffa25e43
2014-04-30 15:02:38 -07:00
Sameer Agarwal b1668067f1 Variety of changes to documentation and example code.
1. Update version history.
2. Minor changes to the tutorial to reflect the bounds constrained
   problem.
3. Added static factory methods to the SnavelyReprojectionError.
4. Removed relative gradient tolerance from types.h as it is
   not true anymore.

Change-Id: I8de386e5278a008c84ef2d3290d2c4351417a9f1
2014-04-29 09:09:00 -07:00
Björn Piltz 5d7eed87b4 Suppport for MSVC DLLs.
Change-Id: Ibbcc4ba4e59f5bbf1cb91fe81c7d3b9042d03493
2014-04-28 19:56:24 +00:00
Sameer Agarwal e5d62197b9 Remove all references to int16.
Change-Id: Iab87463dd32f64ee371e6cc7d1f5e30128412a10
2014-02-15 15:02:26 -08:00
Sameer Agarwal dcee120bac Consolidate SolverTerminationType enum.
1. Rename SolverTerminationType to TerminationType.
2. Consolidate the enum as
  a. CONVERGENCE - subsumes FUNCTION_TOLERANCE, PARAMETER_TOLERANCE and GRADIENT_TOLERANCE
  b. NO_CONVERGENCE
  c. FAILURE - captures all kinds of failures including DID_NOT_RUN.
  d. USER_SUCCESS
  e. USER_FAILURE
3. Solver::Summary::error is renamed to be Solver::Summary::message, to both
reduce confusion as well as capture its true meaning.

Change-Id: I27a382e66e67f5a4750d0ee914d941f6b53c326d
2013-12-17 11:21:33 -08:00
Sameer Agarwal 79bde35f29 SuiteSparse errors do not cause a fatal crash.
1. Move LinearSolverTerminationType to ceres::internal.
2. Add FATAL_ERROR as a new enum to LinearSolverTerminationType.
3. Pipe SuiteSparse errors via a LinearSolverTerminationType so
   to distinguish between fatal and non-fatal errors.
4. Update levenberg marquardt and dogleg strategies to deal
   with FATAL_ERROR.
5. Update trust_region_minimizer to terminate when FATAL_ERROR
   is encountered.
6. Remove SuiteSparse::SolveCholesky as it screws up the error
   handling.
7. Fix all clients calling SuiteSparse to handle the result of
   SuiteSparse::Cholesky correctly.
8. Remove fatal failures in SuiteSparse when symbolic factorization
   fails.
9. Fix all clients of SuiteSparse to deal with null symbolic factors.

This is a temporary fix to deal with some production problems. A more
extensive cleanup and testing regime will be put in place in a
subsequent CL.

Change-Id: I1f60d539799dd95db7ecc340911e261fa4824f92
2013-11-21 22:16:24 -08:00
Sameer Agarwal 9ba0b352a2 Lint and other cleanups from William Rucklidge
Change-Id: I7fb23c2db85f0f121204560b79f1966f3d584431
2013-11-05 13:04:56 -08:00
Sameer Agarwal f06b9face5 Add support for multiple visibility clustering algorithms.
The original visibility based preconditioning paper and
implementation only used the canonical views algorithm.

This algorithm for large dense graphs can be particularly
expensive. As its worst case complexity is cubic in size
of the graph.

Further, for many uses the SCHUR_JACOBI preconditioner
was both effective enough while being cheap. It however
suffers from a fatal flaw. If the camera parameter blocks
are split between two or more parameter blocks, e.g,
extrinsics and intrinsics. The preconditioner because
it is block diagonal will not capture the interactions
between them.

Using CLUSTER_JACOBI or CLUSTER_TRIDIAGONAL will fix
this problem but as mentioned above this can be quite
expensive depending on the problem.

This change extends the visibility based preconditioner
to allow for multiple clustering algorithms. And adds
a simple thresholded single linkage clustering algorithm
which allows you to construct versions of CLUSTER_JACOBI
and CLUSTER_TRIDIAGONAL preconditioners that are cheap
to construct and are more effective than SCHUR_JACOBI.

Currently the constants controlling the threshold above
which edges are considered in the single linkage algorithm
are not exposed. This would be done in a future change.

Change-Id: I7ddc36790943f24b19c7f08b10694ae9a822f5c9
2013-10-31 13:22:57 -07:00
Sameer Agarwal 367b65e17a Multiple dense linear algebra backends.
1. When a LAPACK implementation is present, then
DENSE_QR, DENSE_NORMAL_CHOLESKY and DENSE_SCHUR
can use it for doing dense linear algebra operations.

2. The user can switch dense linear algebra libraries
by setting Solver::Options::dense_linear_algebra_library_type.

3. Solver::Options::sparse_linear_algebra_library is now
Solver::Options::sparse_linear_algebra_library_type to be consistent
with all the other enums in Solver::Options.

4. Updated documentation as well as Solver::Summary::FullReport
to reflect these changes.

Change-Id: I5ab930bc15e90906b648bc399b551e6bd5d6498f
2013-08-13 14:57:03 -07:00
Sameer Agarwal 5a974716e1 Covariance estimation using SuiteSparseQR.
Change-Id: I70d1686e3288fdde5f9723e832e15ffb857d6d85
2013-07-17 22:56:01 -07:00
Alex Stewart 9aa0e3cf72 Adding Wolfe line search algorithm and full BFGS search direction options.
Change-Id: I9d3fb117805bdfa5bc33613368f45ae8f10e0d79
2013-07-17 08:14:20 +00:00
Sameer Agarwal 09244015e3 Expose line search parameters in Solver::Options.
Change-Id: Ifc52980976e7bac73c8164d80518a5a19db1b79d
2013-06-30 22:51:21 -07:00
Sameer Agarwal 79d9353036 Remove Protocol Buffers support.
Change-Id: I451c543c82cdfb566736aab94d836abcfb5c689d
2013-06-24 14:28:40 -07:00
Sameer Agarwal 290b975d1d Preconditioner refactoring.
1. Added a Preconditioner interface.
2. SCHUR_JACOBI is now its own class and is independent of
SuiteSparse.

Change-Id: Id912ab19cf3736e61d1b90ddaf5bfba33e877ec4
2013-02-17 23:20:41 -08:00
Sameer Agarwal 2fc0ed6143 Change NumericDiffCostFunction to accept variadic functors.
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
2013-01-18 13:06:31 -08:00
Sameer Agarwal c89ea4b9de Minor corrections based on Jim Roseborough's comments
Change-Id: I4a8c7a454ddf038a3ed2567c101f9aee582044bf
2013-01-09 16:15:09 -08:00
Sameer Agarwal 1afd498f50 String to and from enum conversion routines.
Update types.h/cc with stringication and unstringication
routines for the newly introduced enums.

Change-Id: I0fe2842b5b1c75ba351f4ab87ec9fa60af2f9ed2
2012-11-29 10:33:37 -08:00
Sameer Agarwal 3e8d192f28 Add a rough implementation of LBFGS.
Change-Id: I2bc816adfe0c02773a23035ea31de3cddc1322a4
2012-11-28 18:26:41 -08:00
Sameer Agarwal f4d0164607 Add a line search based minimizer.
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
2012-11-28 16:18:01 -08:00
Sameer Agarwal 65625f7782 Solver::Options::ordering* are dead.
Remove the old ordering API, and modify solver_impl.cc
to use the new API everywhere.

In the process also clean up the linear solver instantion
logic in solver_impl.cc a bit too.

Change-Id: Ia66898abc7f622070b184b21fce8cc6140c4cebf
2012-09-17 15:41:10 -07:00
Sameer Agarwal 14ee795aea Add ability to query available linear algebra backend.
Change-Id: Ide349a04a69b1a377ea789b355e00b210ec792ba
2012-09-06 11:09:04 -07:00
Sameer Agarwal cbae856193 Various cleanups to nist.cc.
More flexible testing.
Read and parse the certified cost value from the data file.
Remove the ugly hack for computing the certified cost.
Refactored the flags parsing logic

Change-Id: I8f2e6be183b758b2453302fcdc6696bfa0db5eb8
2012-09-04 15:39:18 -07:00
Markus Moll 51cf7cbe3b Add the two-dimensional subspace search to DoglegStrategy
Change-Id: I5163744c100cdf07dd93343d0734ffe0e80364f3
2012-08-20 11:16:41 -07:00
Sameer Agarwal b9f15a5936 Add a dense Cholesky factorization based linear solver.
For problems with a small number of variables, but a large
number of residuals, it is sometimes beneficial to use the
Cholesky factorization on the normal equations, instead of
the dense QR factorization of the Jacobian, even though it
is numerically the better thing to do.

Change-Id: I3506b006195754018deec964e6e190b7e8c9ac8f
2012-08-19 14:47:38 -07:00
Sameer Agarwal fa01519c47 Dogleg strategy and timing cleanups.
1. A new dogleg trust region strategy.
2. Consistent naming of all variables taking and reporting
   time. Also all are doubles now.
3. Enum to stringification routines.
4. bundle_adjuster.cc accepts max solver time and trust_region_strategy.
5. Time accounting is pushed into solver_impl.cc and there is now
   postprocessing time accounted for explicitly.
6. IterationCallback now has cumulative time.
7. LoggingCallback logs per iteration and cumulative time.
8. TrustRegionStrategy now allows for Invalid steps to be indicated
   explicitly.
9. Trust region minimizer actually terminates on max_solver_time.

Change-Id: I7e3b82c8beebc17b6b355ea46ddd280754a2d8b2
2012-06-11 22:16:02 -07:00
Sameer Agarwal aa9a83c657 New Trust region loop.
1. New TrustRegionMinimizer and basic tests for it.
2. New TrustRegionStrategy interface.
3. New LevenbergMarquardtStrategy and tests for it.
4. Updates to SolverImpl to reflect this.
5. Changes to Solver::Options and IterationSummary related to this.
6. Deleted levenberg_marquardt.cc/h/_test.cc

Change-Id: I6c1d1a7c774f014856f9f26263a830aa886e1400
2012-05-30 21:44:46 -07:00
Sameer Agarwal b051873a55 Multiple sparse linear algebra backends.
1. Added support for CXSparse - SparseNormalCholesky and
   SchurComplementSolver support SuiteSparse and CXSparse now.
   I am not sure I will add suport for visibility based
   preconditioning using CXSparse. Its not a high priority.

2. New enum SparseLinearAlgebraLibraryType which allows the user
   to indicate which sparse linear algebra library should be used.

3. Updated tests for SolverImpl and system_test.

4. Build system changes to automatically detect CXSparse and
   link to it by default -- just like SuiteSparse.

5. Minor bug fixes dealing in the cmake files and VBP.

6. Changed the order of the system test.

7. Deduped the unsymmetric linear solver test.

Change-Id: I33252a103c87b722ecb7ed7b5f0ae7fd91249244
2012-05-29 19:44:43 -07:00
Keir Mierle fdeb5772cc 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.
2012-05-09 12:53:00 -07:00
Sameer Agarwal 82f4b88c34 Extend support writing linear least squares problems to disk.
1. Make the mechanism for writing problems to disk, generic and
controllable using an enum DumpType visible in the API.

2. Instead of single file containing protocol buffers, now matrices can
be written in a matlab/octave friendly format. This is now the default.

3. The support for writing problems to disk is moved into
linear_least_squares_problem.cc/h

4. SparseMatrix now has a ToTextFile virtual method which is
implemented by each of its subclasses to write a (i,j,s) triplets.

5. Minor changes to simple_bundle_adjuster to enable logging at startup.
2012-05-08 17:40:16 -07:00
Keir Mierle e2a6cdc081 Address some of the comments on CGNR patch
- Rename BlockDiagonalPreconditioner to BlockJacobiPreconditioner
- Include the diagonal in the block jacobi preconditioner.
- Better flag help for eta.
- Enable test for CGNR
- Rename CONJUGATE_GRADIENTS to CGNR.
- etc.
2012-05-07 06:39:56 -07:00
Sameer Agarwal 6447219826 1. Changes the tutorial to refer to BriefReport.
2. Some of the enums have commas at the end.
3. Fix a bug in the default value of circle_fit.cc in the examples.
2012-05-03 21:53:07 -07:00
Keir Mierle 8ebb073038 Initial commit of Ceres Solver. 2012-04-30 23:09:08 -07:00