Commit Graph

69 Commits

Author SHA1 Message Date
Sameer Agarwal fa1c31eee3 Correct the documentation for crs_matrix.h
Thanks to Joydeep Biswas for reporting this.

Change-Id: Iae5fc2274644aab40f2f922a671f65da15ae71fc
2013-01-30 08:50:41 -08:00
Sameer Agarwal 977be7cac3 Add support for reporting linear solver and inner iteration
orderings.

Change-Id: I0588a4285e0925ce689e47bd48ddcc61ce596a1f
2013-01-26 16:02:33 -08:00
Sameer Agarwal 146b9acb4d Update include/ceres.h to export headers.
Update the ABI version.

Change-Id: I5c1c4f110cddc816bbb5a737634f55b4cbea98e1
2013-01-22 10:40:56 -08:00
Sameer Agarwal 2f0d7249cc NumericDiffFunctor.
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
2013-01-18 14:01:47 -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 9c5acce674 Add CostFunctionToFunctor.
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
2013-01-18 11:43:48 -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 2293cb5bc9 Add missing documentation to solver.h
Change-Id: I86e7c4f1f6cc1e15d5eb2cf23e73c32d94d458c1
2012-11-29 16:00:18 -08:00
Sameer Agarwal aed99615c0 Expose lbfgs rank in solver.h
Change-Id: Ibc184b1a2f94a4057fa6569d539ca3a55d6d6098
2012-11-29 15:54:34 -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 86f6ea68b8 Fix a variadic evaluation bug in AutoDiff.
Thanks to Julien Michot for reporting.

Change-Id: I322cd177e85c18ba3fbee56149696d4140f79c68
2012-11-28 15:13:21 -08:00
Sameer Agarwal 747845fc82 Add the GradientChecker.
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
2012-11-08 10:40:18 -08:00
Fisher 12626e8cba Add support for up to 10 parameters in Problem
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
2012-10-21 14:26:30 -04:00
Keir Mierle f1e67cc90b Add support for up to 10 parameters in autodiff.
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
2012-10-19 11:00:46 -07:00
Sameer Agarwal f3c1077c12 Remove collections_port.h from ordered_group.h
Change-Id: Ib81f475d909f9973c78f83961e477d046e24c30d
2012-10-08 11:17:31 -07:00
Sameer Agarwal 68b32a941c ordering -> linear_solver_ordering.
Change-Id: If4af72da90725db2a2d4f397f4cb671c2e863a98
2012-10-06 23:16:04 -07:00
Sameer Agarwal ba8d967f8c Generalization of the inner iterations algorithm.
Add automatic recursive independent set decomposition.
Clean up the naming and the API for inner iterations.

Change-Id: I3d7d6babb9756842d7367e14b7279d2df98fb724
2012-10-05 08:35:53 -07:00
Sameer Agarwal 2c94eed50f Move from Ordering to ParameterBlockOrdering.
Change-Id: I9320afff13ee62be407c725f42f41a18f537bcc1
2012-10-01 16:47:26 -07:00
Sameer Agarwal b6da9c794e OrderedGroups implementation.
This generalizes the Ordering object and paves the path for a more
general inner iteration API.

Change-Id: I6efce5f999c2bfab5f90a8a18e21140581f207cd
2012-10-01 15:23:28 -07:00
Sameer Agarwal 9123e2f624 An implementation of Ruhe & Wedin's Algorithm II.
A non-linear generalization of Ruhe & Wedin's algorithm
for separable non-linear least squares problem. It is implemented
as coordinate descent on an independent subset of the parameter
blocks at the end of every successful Newton step. The resulting
algorithm has much improved convergence at the cost of some
execution time.

Change-Id: I8fdc5edbd0ba1e702c9658b98041b2c2ae705402
2012-09-25 11:13:39 -07:00
Sameer Agarwal b23fd4e667 Add IterationSummary::step_is_nonmonotonic.
So that IterationCallback objects know the kind of step that they
are dealing with.

Change-Id: I7782b211af882bd7b67307c3c23d8021cb56e8ab
2012-09-25 10:14:08 -07:00
Keir Mierle 97ca0fbbea Compile with warnings on Unix.
The warnings got disabled at some point; this re-enables some of them, and
fixes some of the warnings.

Change-Id: I290a4fdfad18cea85e9177ba57744d97b6856bb2
2012-09-18 17:07:18 -07: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 91c9bfee33 Start of the new ordering API.
Change-Id: I37b0f39011f590d54962ad3e1da1f42712008f82
2012-09-17 11:21:22 -07:00
Keir Mierle 6da1f87a6b Add Ceres version and ABI version defines to ceres.h
This will make it possible to write code which detects Ceres
versions and does different things with different versions.
Ideally this wouldn't be necessary, but in practice it is
sometimes useful.

Change-Id: I8d9f56d664ef75706e87c9bd7954e709dd7c0278
2012-09-11 17:36:47 -07:00
Sameer Agarwal 14ee795aea Add ability to query available linear algebra backend.
Change-Id: Ide349a04a69b1a377ea789b355e00b210ec792ba
2012-09-06 11:09:04 -07:00
Ricardo Martin 0b5b788187 Tiny changes to prevent a signed/unsigned compile warning.
Change-Id: Id80bad85009df7be039324609528c944b3195c60
2012-09-06 11:07:52 -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
Sameer Agarwal 1e2892009e Update Summary::FullReport to report dogleg type.
Change-Id: I0b4be8d7486c1c4b36b299693b3fe8b0d3426537
2012-08-22 08:50:17 -07:00
Sameer Agarwal 295ade1122 Fix Eigen3 Row/Column Major storage issue.
Eigen3 does not allow column vectors to be stored in row-major
format. NumericDiffCostFunction by default stores its Jacobian
matrices in row-major format. This works fine if the residual
contains more than one variable. But if the residual block
depends on one variable and has more than one residuals, the
resulting Jacobian matrix is a column matrix in row-major format
resulting in a compile time error.

The fix is to check the template parameters and switch to column-major
storage as needed.

Thanks to Lena Gieseke for reporting this.

Change-Id: Icc51c5b38e1f3609e0e1ecb3c4e4a02aecd72c3b
2012-08-22 08:20:06 -07:00
Sameer Agarwal 0c714a70e6 Fix blanks before private in loss_function.h
Change-Id: I068bed6431bc7c9b7958af391655df61499000b2
2012-08-20 11:18:16 -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 ad1f7b772e Add ArcTanLoss, TolerantLoss and ComposedLossFunction.
Based on work by James Roseborough.

Change-Id: Idc4e0b099028f67702bfc7fe3e43dbd96b6f9256
2012-08-20 11:11:02 -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 383c04f423 Fix QuaternionToAngleAxis to ensure rotations are between -pi and pi.
Thanks to Guoxuan Zhang for reporting this.

Change-Id: I2831ca3a04d5dc6467849c290461adbe23faaea3
2012-08-17 14:32:23 -07:00
Keir Mierle f21bee2472 Fix for fpclassify.h NDK porting work.
Change-Id: I69df1b4caf2941ed96a53e35e43ec54073f84f59
2012-08-16 17:02:43 -07:00
Keir Mierle 6185db22f8 Fix STLPort fpclassify portability.
Change-Id: I9418c05a160aa635574370c5e35424566781dcb0
2012-08-16 14:22:53 -07:00
Keir Mierle 8e68ff395b Zero-initialize Jet derivative components.
Change-Id: I9606aadb1a1f275608f6f332858af9258a120b05
2012-08-14 14:40:42 -07:00
Sameer Agarwal 0beab86dfa Fix glog includes and include sorting order.
Change-Id: I0ec85218e82d1714279d41f7635104d480fb91c3
2012-08-13 15:47:24 -07:00
Keir Mierle d16c34fb4a Explicitly import string into the Ceres namespace.
This is a workaround for anyone building Ceres in an environment
where there is a non-standard string implementation in the global
namespace. Due to the way the standard is written, a "using
namespace X" import is not high enough precedence to resolve a
naked reference to "string". Instead, by explicitly importing
string, the lookup becomes unambiguous.

Change-Id: I8d70463de01c482796c5bc09da05b37d21e7af96
2012-08-10 16:44:52 -07:00
Sameer Agarwal 1b7f3b52fb Add ability to log solver execution to file.
Change-Id: I9996ba2fed5229fe5d621fbb1a027d4c360cd59d
2012-08-10 15:55:31 -07:00
Sameer Agarwal a8f87d7943 Non-monotonic trust region algorithm.
Non-monotonic trust region algorithm based on the work of Phil Toint, as
described in

Non-monotone trust region algorithms for nonlinear
optimization subject to convex constraints.
Philippe L. Toint
Mathematical Programming 77 (1997), 69-94.

Change-Id: I199ecc644e8d1a8cb43666052aef66fb93e15569
2012-08-10 11:09:12 -07:00
Keir Mierle d2a5ab6500 Use C99 macros on Android for fpclassify.h
Change-Id: I7118f05b436afadbff5369ce40d5b9ab95e8a437
2012-07-26 14:31:56 -07:00
Sameer Agarwal 104ad902b6 Fixed Jet to integer comparison.
Thanks to Keith Leung for reporting this.

Change-Id: I97c2eb87a5cf6779779e659aaa716dc507824def
2012-07-17 11:30:31 -07:00
Sameer Agarwal 1d7c49224a Add shared library targets.
Fix a grammo from a previous CL.

Change-Id: Icc683d3a73a542519a6ccefc0f653664f236c24b
2012-07-17 10:23:35 -07:00
Sameer Agarwal 45ccb51701 Drop alignment requirements for Jets.
Change-Id: I7cd1e8f73c6d3e0b9369e567149205075bfbcd82
2012-07-16 21:13:38 -07:00
Sameer Agarwal 4997cbc437 Return jacobians and gradients to the user.
1. Added CRSMatrix object which will store the initial
   and final jacobians if requested by the user.
2. Conversion routine and test for converting a
   CompressedRowSparseMatrix to CRSMatrix.
3. New Evaluator::Evaluate function to do the actual evaluation.
4. Changes to Program::StateVectorToParmeterBlocks and
   Program::SetParameterBlockStatePtrstoUserStatePtrs so that
   they do not try to set the state of constant parameter blocks.
5. Tests for Evaluator::Evaluate.
6. Minor cleanups in SolverImpl.
7. Minor cpplint cleanups triggered by this CL.

Change-Id: I3ac446484692f943c28f2723b719676f8c83ca3d
2012-07-16 12:17:34 -07:00
Keir Mierle efe7ac60a0 Port Ceres to Windows
This is a preliminary, but full, port of Ceres to Windows.
Currently all tests compile and run, with only system_test
failing to work correctly due to a path issue.

Change-Id: I4152c1588bf51ffd7f4d9401ef9759f5d28c299c
2012-06-24 23:22:04 -07:00