Commit Graph

28 Commits

Author SHA1 Message Date
Sergiu Deitsch c8658c8992 Modernize more
Apply clang-tidy Google and modernize fixes without trailing return type
using:

$ clang-tidy -p <build-dir> \
  -checks='-*,google-*,modernize-*,-modernize-use-trailing-return-type' {} -fix

Change-Id: I7450cc58ea9abf928f73a467e87876083217fa26
2022-02-26 22:16:56 +00:00
Sameer Agarwal 8fe8ebc3a6 Add final specifier to public classes
Change-Id: Ib7291dc68d5d4141ee821689743481fc84768606
2022-02-18 15:51:17 -08:00
Sergiu Deitsch c6158e0ab5 Replace NULL by nullptr
Change-Id: I200a40678091b984a01635d8637a487b7ad5cc13
2022-02-14 19:22:21 +01:00
Alex Stewart ce9669003a Add const accessor for functor wrapped by auto/numeric-diff objects
- The intended use-case for these accessors is in client code tests to
  support verification of the configuration with which cost functions
  were constructed.

Change-Id: Ib77afa6409804ba7f724138f579e0c51b154f5ad
2022-02-06 21:14:16 +00:00
Sameer Agarwal 8e1d8e32ad A number of small changes.
1. Add a move constructor to NumericDiffCostFunction, DynamicAutoDiffCostfunction
   and DynamicNumericDiffCostFunction.
2. Add optional ownership of the underlying functor.
3. Update docs to reflect this as well as the variadic templates that allow an
   arbitrary number of parameter blocks.

Change-Id: I57bbb51fb9e75f36ec2a661b603beda270f30a19
2020-09-03 10:57:50 -07:00
Johannes Beck a384a7e96e Remove not used using declaration
This CL removes a not used using declaration
which will cause a warning when compiled with
-Wunused-local-typedef under gcc.

Change-Id: Ie4cfd5d1fed9bee860e387545e60d92d257da4f4
2019-12-31 13:38:46 +01:00
Sameer Agarwal 4362a21699 Run clang-format on the public headers.
Also update copyright year.

Change-Id: I8508d4fd4564c646ec2281a1b3b2c36136b54b46
2019-12-03 14:50:37 -08:00
Sameer Agarwal e4577dd6d9 Use override instead of virtual for subclasses.
Now that we are using c++11, it is safer to use override in subclasses
instead of virtual.

This CL does it for the interface, a follow up CL will do it for
other parts of the code base.

Change-Id: Ice8d0f4355cb700019d7a9c1566fbff0099e97d6
2019-07-25 23:26:24 +00:00
Johannes Beck 25e1cdbb6f Switch to FixedArray implementation from abseil.
This PR changes the implementation of the current fixed array to the
abseil one, which has proper allocator support.
Some minor changes are made to make the fixed array implementation
self-contained (no dependent to abseil):
- No address sanitizer support (red zones, etc.)
- Remove of noexecpt specified for copy and move constructor.
- Remove of 'at' function as Ceres does not use exceptions.
- Use std::tuple instead of absl::CompressedTuple as it uses the  abseil
  utility header which includes a whole bunch of other headers.

Change-Id: I43445b42c37f944509b5353a587d0efce74cbccf
2019-04-08 19:44:16 +00:00
Johannes Beck 8eef94de4e Sized cost function using variadic templates
This PR changes the interface of sized_cost_fucntion,
autodiff_cost_function and numeric_diff_costfunction from using ten
hardcoded parameter blocks to a variable number of parameter blocks
using variadic templates.

Trailing parameter blocks of size zero are now considered as error.

Change-Id: I37b9a0a420ef0eda6476a46672bbf6bd57e19760
2018-10-23 20:46:16 +02:00
Kuang Fangjun 0d3a84fce5 Fix typos in doc and errors in the demo code.
Change-Id: I237402958ed8747ae438643132fcab90113ac27d
2018-09-22 12:01:20 +08:00
Keir Mierle 7c4e8a454e Replace scoped_ptr with C++11's unique_ptr
Change-Id: Ib5a504c491e3a79af52a95accf009df473470c6b
2018-04-02 14:47:47 -07:00
Sameer Agarwal ba67ed1e01 A variety of small updates
1. Add answers to a number of FAQs.
2. Add a note to the documentation for NumericDiffCostFunction that
   NumericDiffOptions needs to be documented and mentioned.
3. Update the docs for Solver::Options::numeric_derivative_relative_step_size
   to indicate that this setting only applies to the gradient checker.
4. Remove deprecated constructors from NumericDiffCostFunction and
   DynamicNumericDiffCostFunction.

Change-Id: If8fc011b2a5996dbc2c51268aa477550ed014a1c
2015-11-08 10:59:42 -08:00
Tal Ben-Nun 4f049db7c2 Adaptive numeric differentiation using Ridders' method.
This method numerically computes function derivatives in different
scales, extrapolating between intermediate results to conserve function
evaluations. Adaptive differentiation is essential to produce accurate
results for functions with noisy derivatives.

Full changelist:
-Created a new type of NumericDiffMethod (RIDDERS).
-Implemented EvaluateRiddersJacobianColumn in NumericDiff.
-Created unit tests with f(x) = x^2 + [random noise] and
 f(x) = exp(x).

Change-Id: I2d6e924d7ff686650272f29a8c981351e6f72091
2015-08-30 14:06:13 +03:00
Tal Ben-Nun b2dcef36e7 Refactored DynamicNumericDiffCostFunction to use NumericDiff
Change-Id: I2fc4b203e984beaa7af96fb3cbe8ce14e5bca614
2015-05-07 01:48:27 +03:00
Keir Mierle 3fafa3cd72 Add CERES_ prefix to macros in public headers
Change-Id: Ie4f4311d5a669c03746e8f00426f4d7cbef20ad0
2015-03-21 04:55:20 -07:00
Keir Mierle 7492b0d8de Update copyright headers with new year and URL
Since Ceres is moving to using GitHub for issues, and the Google
Code URL in the current copyright header will soon become invalid,
update all the headers.

Change-Id: I1fce70375d1bcf098591f07b4d8f01a5c1e0789c
2015-03-18 05:43:23 +00:00
Sameer Agarwal 10ac7d8048 Lint cleanup and a bug fix.
Thanks to William Rucklidge.

Change-Id: I963656be661020abacbff792cfc3025623503db8
2013-10-03 14:37:07 -07:00
Sameer Agarwal 3a2158d728 NumericDiffCostFunction supports dynamic number of residuals.
1. Update AutoDiffCostFunction template parameters to be consistent
with NumericDiffCostFunction.

2. Update the documentation for NumericDiffCostFunction and
AutoDiffCostFunction.

Change-Id: I113038abb5bedebb0f6f326f2a4ac31480d785fc
2013-10-03 20:09:59 +00:00
Sameer Agarwal ebbb984db8 Various corrections and enhancements to the documentation.
Change-Id: I03519bfccf4367b36d36006f1450d5fbcbbf8621
2013-05-28 10:37:01 -07:00
Sameer Agarwal a1eaa262ea Update glog path
Change-Id: I47a69cb267c71a9f8f3350c4f645e8cf83e44cc9
2013-05-09 10:09:38 -07:00
Sameer Agarwal 01fb8a3133 Add documentation about CostFunction::Evaluate.
Change-Id: I1df42c14f20c7c03f2a8ae21e75dda98cc592214
2013-04-30 21:04:24 -07:00
Sameer Agarwal 937777a5ac Miscellanous fixes in preparation for 1.6.0
1. Bug fix in NumericDiffCostFunction (Thanks to Nicolas Brodu).
2. Minor documentation update in solver.h
3. Version history update.
4. Bump the version and ABI version.

Change-Id: I951574ddd0b2c4c03b9c79ff33eb9bea549071e7
2013-04-29 15:58:54 -07:00
Sameer Agarwal 509f68cfe3 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
2013-02-24 19:04:21 +00: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 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 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