Streamline ArraySelector, VariadicEvaluate, and perturbation seeding

- In ArraySelector, collapse the two absl::FixedArray specializations
  into a single specialization, replace release-mode CHECK_EQ with
  DCHECK, use absl::FixedArray<T, 0> instead of std::vector<T> for the
  heap fallback, and add a fill-value constructor so residual Jet arrays
  are initialized to kImpossibleValue in a single pass.
- Simplify VariadicEvaluateImpl to expand functor(input[Is]..., output)
  directly via std::index_sequence, removing the intermediate
  std::array copy and std::apply/std::invoke wrappers, and mark hot
  helpers EIGEN_STRONG_INLINE.
- In Make1stOrderPerturbation, rely on dst[i].v being zero-initialized
  on entry by Jet's default constructor (checked with DCHECK) and assign
  dst[i].a and dst[i].v[i + Offset] in-place instead of constructing a
  temporary JetT and re-zeroing v.

Benchmark (Apple M1 Pro, kAutoDiff, kResidualsAndJacobians):
----------------------------------------------------------------------
Benchmark                                     Before    After   Change
----------------------------------------------------------------------
SnavelyReprojectionError                      136 ns  78.4 ns   -42.4%
PhotometricError<8>                           901 ns   748 ns   -17.0%
RelativePoseError                             248 ns   130 ns   -47.6%
Brdf                                          827 ns   255 ns   -69.2%
ColmapOpenCVReprojectionError                 185 ns  61.7 ns   -66.6%
ColmapFullOpenCVReprojectionError             263 ns  86.2 ns   -67.2%
ColmapRigReprojectionError                    391 ns   134 ns   -65.7%
ColmapSampsonError                            100 ns  86.2 ns   -13.8%
ColmapFisheyeReprojectionError                209 ns  84.6 ns   -59.5%
ColmapSphericalReprojectionError             86.1 ns  46.5 ns   -46.0%
LibmvBrownReprojectionError                   225 ns  98.7 ns   -56.1%
LibmvNukeInvertReprojectionError              228 ns  82.8 ns   -63.7%
PoseGraph3dError                              249 ns   139 ns   -44.2%
RosenbrockFirstOrderFunctor<4>               10.8 ns  7.96 ns   -26.3%
RosenbrockFirstOrderFunctor<16>               188 ns   163 ns   -13.3%
RosenbrockFirstOrderFunctor<24>               399 ns   367 ns    -8.0%
----------------------------------------------------------------------

Change-Id: I0d3af3eb31b476a8fc5703bbbd529d3fb292ac98
6 files changed
tree: 378b0b388844aff4a00025a11524891d3190c766
  1. .github/
  2. bazel/
  3. cmake/
  4. config/
  5. data/
  6. docs/
  7. examples/
  8. include/
  9. internal/
  10. LICENSES/
  11. scripts/
  12. third_party/
  13. .bazelignore
  14. .clang-format
  15. .gitignore
  16. .gitmodules
  17. .readthedocs.yaml
  18. BUILD
  19. CITATION.cff
  20. CMakeLists.txt
  21. CONTRIBUTING.md
  22. LICENSE
  23. MODULE.bazel
  24. package.xml
  25. README.md
  26. REUSE.toml
  27. 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.