[modernize] Modernize AutoDiff and NumericDiff CostFunctions to C++17

Modernize the construction and initialization logic of AutoDiffCostFunction,
NumericDiffCostFunction, AutoDiffFirstOrderFunction,
NumericDiffFirstOrderFunction, DynamicAutoDiffCostFunction,
DynamicNumericDiffCostFunction, and CostFunctionToFunctor by utilizing
C++17 features:

- Simplify constructor delegation using if constexpr, removing the need for
  internal InitTag structures.
- Use std::is_constructible_v for cleaner SFINAE in variadic constructors.
- Add static_assert to catch improper usage of DYNAMIC residuals/parameters
  at compile-time.
- Add Ownership support to AutoDiffFirstOrderFunction,
  DynamicAutoDiffCostFunction, and DynamicNumericDiffCostFunction.
- Simplify CostFunctionToFunctor::operator() using variadic parameter packs.
- Use this->num_residuals() for consistent and clear access to base class
  state.
- Minor code quality improvements and removal of redundant template
  parameters.

Change-Id: Id760a26ba2ceca4fb2939ef7632f2f1d9cc430c9
6 files changed
tree: 2ce747d702cf45c399a8dcbe422837c7c017dda0
  1. .github/
  2. bazel/
  3. cmake/
  4. config/
  5. data/
  6. docs/
  7. examples/
  8. include/
  9. internal/
  10. scripts/
  11. third_party/
  12. .clang-format
  13. .gitignore
  14. .gitmodules
  15. .readthedocs.yaml
  16. BUILD
  17. CITATION.cff
  18. CMakeLists.txt
  19. CONTRIBUTING.md
  20. LICENSE
  21. MODULE.bazel
  22. package.xml
  23. README.md
  24. WORKSPACE
README.md

Android Linux macOS Windows

Ceres Solver

Ceres Solver is an open source C++ library for modeling and solving large, complicated optimization problems. It is a feature rich, mature and performant library which has been used in production at Google since 2010. Ceres Solver can solve two kinds of problems.

  1. Non-linear Least Squares problems with bounds constraints.
  2. General unconstrained optimization problems.

Please see ceres-solver.org for more information.