Commit Graph

1440 Commits

Author SHA1 Message Date
Sameer Agarwal 0fcfdb0b41 Fix the build breakage caused by the last commit.
Change-Id: I0145c7008e8272f4b7f3ce9134dd3e7128d9059a
2019-03-03 12:16:23 -08:00
Sameer Agarwal 9b9e9f0dc8 Reduce machoness of macro definition in cost_functor_to_function_test.cc
Nuff said.

Change-Id: Ie38ca63bc0fb3b62f68ab330fc452e94071724aa
2019-03-03 11:50:14 -08:00
huangqinjin 21d40daa00 Remove UTF-8 chars
Change-Id: I1e98dd7441d2de05e0b3b0937e496103177631f8
2019-03-03 18:53:13 +00:00
Alex Stewart 9350e57a45 Enable optional use of sanitizers
- The list of sanitizers to compile with can now be specified via the
  SANITIZERS option.

Change-Id: I9af3976e09582d8b3649cb12dc3e94333944d69f
2019-03-03 18:38:26 +00:00
Alex Stewart 0456edffbc Update Travis CI Linux distro to 16.04 (Xenial)
Change-Id: I74638b2defd2992304fcf64fc2be5b2c07ad247f
2019-03-03 12:46:44 +00:00
Sameer Agarwal bef0dfe355 Fix a typo in cubic_interpolation.h
https://github.com/ceres-solver/ceres-solver/issues/439

Change-Id: Ib8c5b2511dd8b162784f387f1624d8568b3a57df
2019-03-02 23:06:28 -08:00
Sameer Agarwal 056ba9bb1d Add AutoDiffFirstOrderFunction
This is to FirstOrderFunction, what AutoDiffCostFunction is to CostFunction.
This allows users of GradientSolver to be able to define objective functions
without requiring them to define the derivatives.

The implementation uses the same Jet objects for computing the gradient as
is used by AutoDiffCostFunction.

Change-Id: Ide6e60532a3adab9be9899ba9b368dc267fd2dbb
2019-03-03 06:50:56 +00:00
Sameer Agarwal 6e527392da Update googletest/googlemock to db9b85e2.
Also update all callsites to use INSTANTIATE_TEST_SUITE_P instead
of INSTANTIATE_TEST_CASE_P which has been deprecated.

Also some minor clang-format changes.

Change-Id: If9d0a77931536ac0765d8435068d00e4471f59d0
2019-03-02 22:42:20 -08:00
Patrik Huber 1b29407490 Clarify documentation of BiCubicInterpolator::Evaluate for out-of-bounds values
This updates outdated documentation and clarifies that supplying out-of-bound values for r and c is fine.
See https://github.com/ceres-solver/ceres-solver/issues/457.

Change-Id: I4a812786ebd05ec5bfedd388edbc71839434cc71
2019-02-08 22:33:44 +00:00
Johannes Beck e51e9b46f6 Implement AddResidualBlock using variadic templates
This CL changes the implementation of AddResidualBlock() in
ceres::Problem using variadic templates. Also one new overload for
AddResidualBlock() is added using a double** and the number of
parameter blocks.

Change-Id: I007a82a06897335a117213a0d12fedb4a77076a0
2018-11-07 21:02:11 +01:00
Sameer Agarwal e243fd292d remove the use of DCHECK_NOTNULL from numeric_diff.h
Change-Id: I7fc258812b1fe4aa727eaeb9b9b834d04a631abd
2018-11-02 06:33:21 -07:00
Johannes Beck 5ec88f6e44 Fix Jacobian evaluation for constant parameter
This CL fixes a regression bug in numeric differentiation where the
differentiation is called even if the parameter block is hold constant.
This resulted into a write to a nullptr.

A unit test is added for Jacobian evaluation of constant parameters.

Change-Id: Ia0f7c6cc7ef18f0f2cd6d758a839729b8ff606a0
2018-11-02 08:51:24 +01:00
Christopher Wecht 7b0ce1adc4 AutoDiffCostFunction: use static_assert to check if the correct overload of the constructor is used.
Change-Id: Iad06843b858ac45e87c0458522657b2e2c55f4e8
2018-10-29 13:56:25 +00:00
Justin Carpentier 928592c57a Avoid additional memory allocation in gradient checker
Change-Id: I91e25e43b0826ec75c67961fdcdab7ed05e27e37
2018-10-24 09:50:47 +02:00
Johannes Beck 2496500436 Variadic cost function to functor
This CL simplifies the implementation of cost function to functor using
variadic templates. The cost functor can now be called with an
arbitrary number of parameter pointers.

Change-Id: I0d9df2e9055a4842f40c232d4474508f010089a4
2018-10-23 19:46:06 +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
Sameer Agarwal f8e8951611 Lint changes from Jim Roseborough.
Change-Id: Ia92ed4dcd6750f33a178ff39465814805a99bdfa
2018-10-11 06:36:39 -07:00
Sameer Agarwal feeadb476a Swap the order of definition of IsValidParameterDimensionSequence.
This triggered a compiler error on clang + linux.

Change-Id: I8628c1b342980c50792f664d04d37465c17bf618
2018-10-10 20:50:39 -07:00
Sameer Agarwal 0040434507 Add ParameterBlock::IsSetConstantByUser()
Introduce IsSetConstantByUser method which indicates whether
the user set the parameter block constant or not.

Changed the definition of IsConstant() to indicate if the
parameter block is effectively constant or not, which is
now the uniion of two conditions - the user set it to be constant
or the local tangent space is of size zero. Currently
this change has no effect as we do not allow local parameterizations
with zero tangent space size, but thats an inconsistency we are
working on fixing.

A variety of code cleans up to parameter_block.h

1. Remove an old TODO comment which is not really actionable.
2. Remove Init() method.
3. NULL -> nullptr
4. memcpy -> std::copy

Change-Id: I12973ee0f053fa22f09908cf36e9aa57d9d8dd74
2018-10-10 10:56:13 -07:00
Johannes Beck 7edb3a6b92 Add parameter dims for variadic sized cost function
The class parameter dims is a helper class that holds the parameter
dimensions. The parameter dimensions are either dynamic or the
sizes are known at compile time. It is used to pass parameter block
dimensions around (e.g. between functions or classes).

Also the dimensions of the parameter blocks are checked at compile
time and must be greater than zero. This means trailing zero parameter
blocks will result in a compile error.

Change-Id: I4decf2f09e63fdb0fd652022b2be2a1cfd9c4478
2018-10-09 22:35:17 +02:00
Johannes Beck b2a03ef919 Remove trailing zero parameter block sizes
This patch removes the use of trailing zeros in cost functions used in
unit tests as this will be an error once the sized cost function is
implemented using variadic templates.

Change-Id: I3e8a31b310ba7299fc6b1f012f540a3118cc7661
2018-10-08 20:42:23 +02:00
Johannes Beck 336a6be5a4 Adding integer sequence and algorithms
This PR adds integer sequence and two algorithms (sum and exclusive
scan). Those will be needed to implement a sized cost function using
variadic templates.

Change-Id: I8e98d7c11fac94286fe9c364633406e59438f059
2018-10-08 20:42:15 +02:00
Sameer Agarwal 3366a66e8f Improve readability of LocalParameterization code.
A variety of small cleanups to the local parameterization
implementation and tests to improve readability.

Change-Id: I5457206129cb3c301999d2f88912ba8300a2c934
2018-10-05 17:26:54 -07:00
Johannes Beck e004eba85c Simplifying Init in manual contructor
All Init() function overloads are replaced by a perfect forwarding Init
function using variadic templates.

Change-Id: I42d0e236d274174982a4e56c0d73ec2776ed96f8
2018-09-27 20:49:44 +02:00
Alessandro Gentilini 3793693a0c Fix typo in NIST url.
Change-Id: I27937dc4bf6f0216d54be5c90d9f950b8ced87af
2018-09-25 18:30:42 +00:00
Sameer Agarwal d91e313cf9 Add a .clang-format file.
Change-Id: Ib48bc18033311ec83afd8884f1daf352ef15f2c6
2018-09-25 10:10:39 -07:00
Sameer Agarwal c65cdd7074 Make ConditionedCostFunction compatible with repeated CostFunction.
If the user uses the same conditioner twice, it does not lead
to a double free errors.

https://github.com/ceres-solver/ceres-solver/issues/422

Change-Id: I9041ddcbffa8dcb882a63bddb82b384897efc970
2018-09-25 10:08:35 -07:00
Johannes Graeter 956fd1aca7 Solver:Support autodiff for dyn. NUM_RESIDUALS
Enable use of dynamic number of residuals for autodiff.
Implemented with "Substitution failure is not an error" similar
to tiny_solver.h .
Move test from tiny_solver_test.cc to
tiny_solver_autodiff_function_test.cc .
Use cpplint.py from C++ Google Style Guide for formatting.

Change-Id: I2e1a159d17118552943c6ac7a833c5bbd0c927ec
2018-09-25 18:47:50 +02:00
Kuang Fangjun b040970cb8 Remove conversions from a double to a Jet.
There are overloaded operators supporting operations between a double and a Jet, so there
is no need to convert a double to a Jet.

Change-Id: I9cfcefb32c6b1a5ad716496b620d578871f0ff03
2018-09-23 11:56:53 +08:00
Kuang Fangjun 86b27228bf close the file on return.
See https://github.com/ceres-solver/ceres-solver/issues/425

Change-Id: I7d02a07d36608c25db191de31f47f19b33962040
2018-09-23 03:01:49 +00:00
Kuang Fangjun 189f0c2f6e fix typos.
Change-Id: I9255d3c6cc0604b227ddfe065c2cdb770dceaf5c
2018-09-23 10:56:34 +08: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
Sameer Agarwal 860b551e51 Add some missing headers to ceres.h
https://github.com/ceres-solver/ceres-solver/issues/423

Change-Id: I568aeda83b91a4d5a12a3f271078535610c4ad44
2018-09-21 13:41:18 +00:00
Kuang Fangjun 72d8e1cdb1 Fix typos.
Change-Id: I61296f42354eab797c55c1435ca46b3475b767e9
2018-09-20 22:52:39 +08:00
Kuang Fangjun 12a9978788 Fix an error in the demo code for ceres::Jet.
The example code for ceres::Jet is incorrect since it misses at which point
the derivate is computed.

Change-Id: Ic3f2ee061a2b69f0a402ca1a01297ddda1f153cd
2018-09-20 14:28:44 +00:00
Kuang Fangjun e80501cd32 Recheck the residual after a new call.
When Jacobian is needed, a different function is called internally. Thus we have to recheck the residual.

Change-Id: I83044b3668479fc21b6612662271e872addf6f48
2018-09-20 16:52:21 +08:00
Kuang Fangjun ea8c6fb161 avoid recomputation.
f_a/g_a has already been computed and we can use it directly.

Change-Id: I39b07205c7d2486e88076089fa960f116919f27f
2018-09-18 14:39:35 +08:00
Kuang Fangjun b979df56b6 Fix a dead link in doc.
The original link is not available any more.

Change-Id: I0d47f5e05d80973bc29deb377ccec814f555e3ef
2018-09-18 03:18:04 +00:00
Kuang Fangjun 57067a2545 fix typos.
Change-Id: I6d3a5eb93e29596823afc5eb11f9a79806078bc0
2018-09-18 09:29:05 +08:00
Alex Stewart 2bbee09ed8 Document rationale for not reordering program when using Accelerate.
Change-Id: Id11b3920cfdc706133ee497773a537287adc0a27
2018-09-16 16:52:11 +01:00
Alex Stewart df6e27e13b Fix calculation of Solver::Summary::num_threads_used.
- Previously we were only bounding num_threads_used based on whether
  CERES_NO_THREADS was defined, meaning that we could erroneously report
  a value larger than the number of threads actually used.

Change-Id: I7373c0c968f9be268c8b7ab0b9561ae31700fda6
2018-09-12 18:30:51 +01:00
Sameer Agarwal ac2c4c5666 Add an errant CHECK_NOTNULL
Change-Id: I07851bd103cff8c79dafd4801295d02806b7bd0b
2018-09-09 14:14:13 -07:00
Sameer Agarwal 94712db5c7 Convert calls to CHECK_NOTNULL to CHECK.
CHECK_NOTNULL is being deprecated and removed from the
glog library.

Change-Id: I4a6d1eec6e82a768c7861c8f776bf1f9c0b50c74
2018-08-28 08:14:19 -07:00
Alex Stewart 402a2e4b6d Import Threads::Threads CMake target in CeresConfig.cmake
- Required now that Threads is a public dependency for Ceres and so
  Threads::Threads will appear in the dependency list for the Ceres
  target and so must be defined when Ceres itself is imported.

Change-Id: Ia5f8ea16e8f24cf0158f40e1fc8d3962106459a6
2018-08-23 09:22:22 +01:00
Alex Stewart 1b17405e38 Make CMake threads a public Ceres dependency.
- Required to propagate the threading flags to example targets that
  depend upon Ceres and do not directly specify threads as a dependency
  to support some *nix builds.

Change-Id: I1c229bd0241da55a203c2b1f8fc28ea43c312e69
2018-08-22 15:39:13 +01:00
Sameer Agarwal 4fc5d25f9c Add a missing <cstdint> to block_structure.h
Change-Id: Ic192eb61b87726e5e939a28b00842da4e0f2b30a
2018-08-09 21:47:25 -07:00
Sameer Agarwal e82e128344 Deprecate integral_types.h
This header defined integral types in the pre-C++11 days, and can
be replaced with <cstdint> and the types defined therein.

Also remove a shallow (and incorrect) typedef in include/ceres/types.h

https://github.com/ceres-solver/ceres-solver/issues/409

Change-Id: I398c652f74d24bbeea459672508bf28f591b100f
2018-08-09 12:17:05 -07:00
Sameer Agarwal 515639e14b Add missing ceres/internal/port.h to two header files.
Without these these files cannot be included on their own.

https://github.com/ceres-solver/ceres-solver/issues/410

Change-Id: I87ca91d15f5ab2053e43480ecbde74779125c709
2018-08-08 06:58:06 -07:00
Alex Stewart e6f7a75fdc Fix brew installation failing if formula is already installed.
Change-Id: I8b297a7b8ae1cd2e3a34e38f52121f420d5b7651
2018-08-07 12:06:52 +01:00
Dmitriy Korchemkin 2ac62a6d78 Fix docs for Problem::EvaluateOptions and contributing
Fix Problem::EvaluateOptions::residual_blocks description
Fix gerrit interface description in contributing instructions

Change-Id: I3347f35a85700a9f8ae1da3b79a6292a9d4dffe0
2018-08-03 15:16:42 +03:00