Commit Graph

1607 Commits

Author SHA1 Message Date
Sameer Agarwal 8c3ecec6db Fix some minor errors in IterationCallback docs
Change-Id: Id3d7f21a523ff8466868cdec542921c566bbbfa9
2020-08-04 14:21:23 -07:00
Alex Stewart 7d3ffcb423 Remove forced CONFIG from find_package(Eigen3)
- Ceres will fail to configure if Eigen3::Eigen target is not found, and
  the minimum required Eigen version specified (3.3) exports Eigen as
  a CMake package and this is reflected in the default Ubuntu 18.04
  packages.
- This permits users to specify their own Eigen3 detection should they
  choose to do so, but they must do so via an imported target.

Change-Id: I5edff117c8001770004f49012ac1ae63b66ec9c1
2020-08-04 21:16:25 +00:00
Alex Stewart a029fc0f93 Use latest FindTBB.cmake from VTK project
- Retrieved from [1], SHA: 0d9bbf9beb97f8f696c43a9edf1e52c082b3639b on
  2020-07-26
- [1]: https://gitlab.kitware.com/vtk/vtk/blob/master/CMake/FindTBB.cmake

Change-Id: I953a8c87802a974d30ccc7c80f5229683826efbd
2020-08-04 21:16:07 +00:00
Alex Stewart aa1abbc578 Replace use of GFLAGS_LIBRARIES with export gflags target
- As our minimum required version of gflags (2.2) exports itself as
  a CMake package and this is the case for the default 18.04 package
  we can use the gflags target directly.
- Replaces forced use of CONFIG in find_package(gflags) with a check
  that the gflags imported target exists to avoid ambiguity with
  libgflags if installed in a default location.  This permits users to
  override the gflags detection should they so choose, provided that
  they do so via an imported target.
- Also removes some previously removed legacy GLAGS_ vars from the
  installation docs.

Change-Id: I015f5a751e5b22f956bbf9df692e63a6825c9f0d
2020-08-04 21:15:51 +00:00
Sameer Agarwal db2af1be87 Add Problem::EvaluateResidualBlockAssumingParametersUnchanged
Simplify the semantics for Problem::EvaluateResidualBlock to
not ignore the presence of EvaluationCallback and add another method
EvaluateResidualBlockAssumingParametersUnchanged to handle the case
where the user has an EvaluationCallback but knows that the parameter
blocks do not change between calls.

Updated the documentation for the methods and EvaluationCallback to
reflect these semantics.

Also added tests for Evaluation related methods calling i
EvaluationCallback when its present.

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

Change-Id: If0a0c95c2f1f92e9183a90df240104a69a71c46d
2020-08-04 13:59:42 -07:00
Sameer Agarwal ab4ed32cda Replace NULL with nullptr in the documentation.
Change-Id: I995f68770e2a4b6027c0a1d3edf5eb5132b081d7
2020-08-03 04:18:05 -07:00
Sameer Agarwal ee280e27a6 Allow SubsetParameterization to accept an empty vector of constant parameters.
Thanks to Frédéric Devernay for reporting this and providing an initial fix.

Change-Id: Id86a2051ab7841ecafdcfb00f4634b353a7ef3b4
2020-07-31 16:48:06 -07:00
Sameer Agarwal 4b8c731d8a Fix a bug in DynamicAutoDiffCostFunction
DynamicAutoDiffCostFunction::Evaluate when provided with a jacobians
array that was non-empty but all its entries are nullptr, would
compute num_active_parameters = 0, and then skip over all the loops
that evaluated the CostFunctor.

The fix is to check if num_active_parameters == 0, and then treat
it as the case where jacobians array is null.

Thanks to Ky Waegel for reporting and providing a reproduction for this.

Change-Id: Ib86930c2c3f722724d249f662bf88238679bbf98
2020-07-31 10:05:52 -07:00
Alex Stewart 5cb5b35a93 Fixed incorrect argument name in RotationMatrixToQuaternion()
- Raised as: https://github.com/ceres-solver/ceres-solver/pull/607 by
  Frank Dellaert

Change-Id: Id3e9f190e814cf18206e2f8c3b1b67b995c21dd5
2020-07-26 20:42:12 +01:00
Carl Dehlin e39d9ed1d6 Add a missing term and remove a superfluous word
Change-Id: I25f40f0bf241302b975e6fc14690aa863c0728b0
2020-06-16 09:02:05 +02:00
Carl Dehlin 27cab77b69 Reformulate some sentences
Change-Id: I4841aa8e8522008dd816261d9ad98e5fb8ad1758
2020-06-15 20:01:18 +02:00
Carl Dehlin 8ac6655ce8 Fix documentation formatting issues
Change-Id: Iea3a6e75dc3a7376eda866ab24e535a6df84f8ea
2020-06-15 19:10:12 +02:00
Alex Stewart 7ef83e0759 Update minimum required C++ version for Ceres to C++14
- Removes all workarounds for pre-C++14 versions
- Removes '11' qualifier from C++ threading option and associated
  defines.
- Fix missing inclusion of 'Multithreading' in reported Ceres components
  when C++ threading model is enabled.
- Update Sphinx documentation to specify C++14 as minimum requirement.

Change-Id: I706c8b367b3221e3c4d1a0aaf669a8f9c911e438
2020-05-30 19:15:03 +01:00
Sameer Agarwal 1d75e75681 Improve documentation for LocalParameterization
Change-Id: I63fa81206e67bfac56cc42bf2bb4915a3a11332b
2020-05-27 22:34:48 -07:00
Sameer Agarwal 763398ca4e Update the section on Preconditioners
Re-organize the section, add some more references and details for
existing preconditioners and add documentation for the SUBSET
precondition.

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

Change-Id: I93d0af819c160f5e4ce48b18202f629ddb92ca7b
2020-05-28 05:25:41 +00:00
Sameer Agarwal a614f788a3 Call EvaluationCallback before evaluating the fixed cost.
Fixe a subtle bug in Program::RemoveFixedBlocks, where we call
ResidualBlock::Evaluate on residual blocks with all constant parameter
blocks without paying attention to the presence of an
EvaluationCallback.

In the process also run clang-format on some of the files touched by
this change.

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

Change-Id: I342b66f6f975fdee2eef139a31f24d4a3e568e84
2020-05-27 22:19:16 -07:00
Sameer Agarwal 70308f7bb9 Simplify documentation generation.
1. The MathJax font configuration is moved into conf.py and removed
from make_docs.py along with better font sizing.
2. Remove the bread crumb replacement as it is not working anymore.
3. Fix a parsing error in nnls_modeling.rst which the new version of
sphinx barfed on.

Change-Id: Ia3c2e732323a8b5cabafe851ac5ca0f0c82da071
2020-05-27 19:24:46 +00:00
Sameer Agarwal e886d7e653 Reduce the number of minimizer iterations in evaluation_callback_test.cc
This should reduce the probability of the test heuristic failing due
to floating point issues.

https://github.com/ceres-solver/ceres-solver/issues/562
https://github.com/ceres-solver/ceres-solver/issues/392

Change-Id: I8ccf4164a8d595f5930d378f464313d4a2cae419
2020-05-27 19:18:45 +00:00
Sameer Agarwal 9483e6f2f5 Simplify DynamicCompressedRowJacobianWriter::Write
Change-Id: I67aa2959bd479909b5cada79359c5cfdb8a37ef7
2020-05-25 13:07:04 -07:00
Sameer Agarwal 323cc55bb9 Update the version in package.xml to 2.0.0.
Change-Id: Ibac053916520e8c597c875a8c7f5668bb35b6ba1
2020-05-25 10:38:58 -07:00
Bayes Nie 303b078b50 Fix few typos and alter a NULL to nullptr.
Fix typos in docs/source/features.rst and examples/helloworld.cc. Alter a NULL to nullptr in include/ceres/autodiff_cost_function.h

Change-Id: Ibcf00b6ef665ad6be9af14b3add2dd4f3852e7e6
2020-05-25 17:22:40 +00:00
Alex Stewart cca93fed63 Bypass Ceres' FindGlog.cmake in CeresConfig.cmake if possible
- If the version of glog detected and used to build Ceres was built with
  CMake (i.e. Config mode) then we now use Config mode directly in
  CeresConfig.cmake and do not install Ceres' FindGlog.cmake module.
- This has the benefit of removing any hard-coded paths from
  CeresConfig.cmake provided that all dependencies were also built with
  CMake.

Change-Id: I85af8a953fd6d300e8bc0cdeb0b3636fec182f68
2020-05-25 17:20:12 +00:00
Alex Stewart 77fc1d0fc4 Use build_depend for private dependencies in Catkin package.xml
Change-Id: If0c0569e7ebbf37c0d8e8daaf7765e20a6282531
2020-05-25 17:18:25 +00:00
Alex Stewart a09682f00d Fix MSVC version check to support use of clang-cl front-end
- Raised as issue: #521

Change-Id: Iaea6b43484b90ec8789bda0447c8a90759974ec1
2020-05-25 17:17:42 +00:00
Alex Stewart b70687fcc8 Add namespace qualified Ceres::ceres CMake target
- This reflects modern CMake style, and also provides a measure of
  protection against missing find_package() imports in downstream
  clients resulting in linker errors when 'ceres' matches the compiled
  library and not the imported target.
- The original 'ceres' target remains, as a local imported interface
  target created by CeresConfig for backwards compatibility.

Change-Id: Ie9ed8de9b7059bc0cae1ae5002bb94d8fe617188
2020-05-25 17:16:27 +00:00
Alex Stewart 99efa54bdb Replace type aliases deprecated/removed in C++17/C++20 from FixedArray
- Raised as issue #551
- Also adds C++20 to the set of ALLOWED_CXX_STANDARDS, although this
  will require a version of CMake >= 3.12.

Change-Id: I0f13c72e93a35391fd2d18590b4243a329a2322c
2020-05-24 19:18:38 +01:00
Sameer Agarwal adb973e4a3 NULL -> nullptr
Change-Id: Iaeea2ef7912d328653a76b65976adc8025a5be35
2020-05-21 14:48:46 -07:00
Alastair Harrison 27b717951b Respect FIND_QUIETLY flag in cmake config file
Ensure that Ceres does not print any log messages when somebody has
used 'find_package(Ceres QUIET)' in their CMake project.

Change-Id: Id6b68859cc8a5857f3fa78f29736cb82fd5a0943
2020-05-15 10:10:12 +01:00
huangqinjin 646959ef11 Do not export class template LineParameterization
For MSVC, instantiating a dllimport class template will cause error C2491:
definition of dllimport function not allowed.

Change-Id: Icc7f7ea84598df0a5436f48ffc2bab5cfab93921
2020-05-07 11:22:20 +00:00
huangqinjin 1f128d070a Change the type of parameter index/offset to match their getter/setter
Change-Id: If28b795e792f39db9775ada105e9038570195329
2020-05-07 11:21:47 +00:00
huangqinjin 072c8f070e Initialize integer variables with integer instead of double
Change-Id: I652aca4ceb3129706a5d5e38afe9f16b61200a5b
2020-05-07 11:19:55 +00:00
Alex Stewart 8c36bcc81f Use inline & -inlinehint-threshold in auto-diff benchmarks
- This results in the same performance as the original solution of
  increasing -inline-threshold, but this approach is more viable to
  incorporate in a large code base as its effects are more targeted.

Change-Id: Id798dbca7d3050de0ea847a5ecc69484ac78a2cf
2020-04-27 18:47:22 +01:00
Sameer Agarwal 57cf20aa5d static const -> static constexpr where we can.
Change-Id: I8a6d26a89c4377dd440fa6dcf23513b7556533fc
2020-04-21 10:13:27 -07:00
Sameer Agarwal 40b27482a2 Add std::numeric_limit specialization for Jets
This allows users to use std::numeric_limits on templated functors.

Change-Id: I403cec5c9826033ce7dfd6047deb64f66c35f806
2020-04-21 09:35:30 -07:00
Darius Rueckert e751d6e4f0 Remove AutodiffCodegen
- Remove Codegen files
- Revert Jet and Rotation

Change-Id: I005c5f98f2b6dfa5c7fd88d998b6aa83e47dab60
2020-04-08 10:43:53 +02:00
Darius Rueckert e9eb76f8ef Remove AutodiffCodegen CMake integration
Change-Id: I403597540df8429378336626b8f748b7821fe6f5
2020-04-06 11:11:43 +02:00
Sameer Agarwal 9435e08a7a More clang-tidy and wjr@ comment fixes
Change-Id: I5736ae482f736fc56c00d21c659b1f8d41da68e9
2020-04-03 11:50:09 -07:00
Darius Rueckert d93fac4b7a Remove AutodiffCodegen Tests
Change-Id: Icd194db7b22add518844f1b507d0fdd3e0fe17fe
2020-04-03 13:51:47 +00:00
Sameer Agarwal 2281c6ed24 Fixes for comments from William Rucklidge
Change-Id: I64fcc25532cc66dc4cb7e2ea7ccfb220b0cb7e1f
2020-04-02 16:43:42 -07:00
Sameer Agarwal d797a87a40 Use Ridders' method in GradientChecker.
Using Ridders' method gives orders of magnitude more accuracy compared
to central differences. This will make things slower, but this is
primarily a testing/debugging feature and the speed hit is not a
concern. This should also reduce the false positive rates when users
enable check_gradients. This is reflected the increased sensitivity of
the tests for GradientChecker.

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

Change-Id: I6b871c72df55be1c31175ba062cf3c1e94e4b662
2020-04-02 14:12:20 -07:00
Sameer Agarwal 41675682dc Fix a MSVC type deduction bug in ComputeHouseholderVector
A recent change made this function templated and MSVC 16 has trouble
doing automatic argument deduction, so the type of the template is
simplified and all callsites are explicitly annotated with the type
of the arguments.

Change-Id: I83cd0269e6e82c4a8f4e391f5fc03b92c942f74d
2020-04-02 08:13:55 -07:00
Darius Rueckert 947ec0c1fa Remove AutodiffCodegen autodiff benchmarks
Change-Id: If1eaad31710cc91d40323ea6cae7cabe6fa64b1f
2020-04-02 13:53:20 +00:00
Sameer Agarwal 27183d661e Allow LocalParameterizations to have zero local size.
Local parameterizations with zero tangent/local size will cause the
corresponding parameter block to be treated as constant.

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

Change-Id: I554a2acc420f5dd9d0cc7f97b691877eb057b2c0
2020-04-02 06:49:42 -07:00
Darius Rueckert 7ac7d79dca Remove HelloWorldCodegen example
Change-Id: I2584f41d591a5d648b4832385c2a779bb25fc04d
2020-04-01 14:51:12 +02:00
Nikolaus Demmel 8c8738bf83 Add photometric and relative-pose residuals to autodiff benchmarks
Change-Id: Id100ff2656ab63bb4fd19a51b95e78281cfd8b4a
2020-03-31 19:44:55 +02:00
Darius Rueckert 9f7fb66d62 Add a constant cost function to the autodiff benchmarks
The constant cost function is run with a variable number of
parameters to test at which point, different compilers fail
to optimize the autodiff code.

Clang achieves expected performance which fails at >50 parameters.
G++ fails already at 20 parameters

Change-Id: I75d8c683ef0011d813ec6d966d7ad58f86530f44
2020-03-26 18:23:48 +01:00
Sameer Agarwal ab0d373e46 Fix a comment in autodiff.h
Change-Id: I613e537c834e3f29cd92808c65ddb74f112974cc
2020-03-24 12:30:46 -07:00
Johannes Beck 27bb997144 Change SVD algorithm in covariance computation.
Switch from JacobiSVD to BDCSVD in
ComputeCovarianceValuesUsingDenseSVD. This should increase
the performance for larger covariance matrices. See
https://eigen.tuxfamily.org/dox/classEigen_1_1BDCSVD.html

Change-Id: Icde4dec89f506b638b0f9f1aee3b7cfc9e4d72fc
2020-03-24 18:43:32 +00:00
Johannes Beck 84fdac38e0 Add const to GetCovarianceMatrix*
This CL adds const to the functions GetCovarianceMatrix and
GetCovarianceMatrixInTangentSpace.

Change-Id: Ibe2cafebede47977a9aabcac8d245f30af184fd1
2020-03-24 16:19:55 +00:00
Johannes Beck 6bde61d6be Add line local parameterization.
This CL adds a local parameterization for a n-dimensional
line, which is represented as an origin point and a direction.
The line direction is updated in the same way as a
homogeneous vector and the origin point is updated
perpendicular to the line direction.

Change-Id: I733f395e5cc4250abf9778c26fe0a5ae1de6b624
2020-03-23 22:36:39 -07:00