12 Commits

Author SHA1 Message Date
Pez Firoozfam 806af056fe Add support for maximum matrix sizes to TinySolver.
This change restructures the `TinySolver` template and its associated
adapters (`AutoDiff` and `CostFunction`) to make maximum sizing
attributes first-class parameters. This enables the entire `TinySolver`
stack to be used in restricted environments (e.g., small MCUs) without
dynamic memory allocation, even when the number of residuals or
parameters is only known at runtime (`Eigen::Dynamic`).

Specifically:
- Adds `kMaxResiduals` and `kMaxParameters` template parameters to
  `TinySolver`.
- Updated `TinySolverAutoDiffFunction` and
  `TinySolverCostFunctionAdapter` to support optional maximum size
  template parameters for their internal buffers.
- The new API maintains backward compatibility for existing users by
  defaulting to the sizes defined in the `Function`'s enums.
- This structure also supports reducing code bloat by allowing
  `TinySolver` to be instantiated with an abstract base class, using
  dynamic dispatch for cost function evaluation.

New test cases for `TinySolver` and its adapters verify the
zero-allocation behavior and the unified API flexibility.

Change-Id: Ic6f43984d384dbe71472b31c5ebd2b538d61f19d
2026-04-07 23:16:48 -07:00
Sameer Agarwal 0a53aa9054 Take abseil as a dependency
1. Add abseil-cpp as a submodule. We are tracking the latest LTS
release, which is lts_2024_01_16.
2. Replace glog/gflags with absl::log and absl::flags.
3. Remove miniglog
4. Also take a whack at making the bazel build work with
   abseil-cpp and gtest.

There are a number of TODOs in this CL that still need to be resolved.

Change-Id: I39355ed7d61375be4ebcbc8596d9cc70acc1c678
2024-07-18 00:24:49 -07:00
Sameer Agarwal 5a30cae583 Preparing for 2.2.0rc1
1. Add a version history
2. Update copyright years across the code base
3. Run format_all.sh
4. Update version strings from 2.1.0 to 2.2.0 in the docs and
   elsewhere.

Change-Id: I46d8d479d54bd6002d532785e67342106e73c9ac
2023-09-21 11:23:38 -07:00
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
Sergiu Deitsch c6158e0ab5 Replace NULL by nullptr
Change-Id: I200a40678091b984a01635d8637a487b7ad5cc13
2022-02-14 19:22:21 +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
Johannes Beck 939253c208 Fix Eigen alignment issues.
For proper alignment on the heap Eigen needs to have a custom
allocator. There are two forms, new and in-place new. To make sure
that memory is aligned using new, one needs to overload new by
adding EIGEN_MAKE_ALIGNED_OPERATOR_NEW to any struct which contains a
fixed size Eigen type either through inheritance or as a direct or
indirect member. For the in-place new one need to use the
Eigen::aligned_allocator (e.g. for std::vector, std::list,
FixedArray, etc.). For more details see:
https://eigen.tuxfamily.org/dox/group__DenseMatrixManipulation__Alignement.html

This CL adds EIGEN_MAKE_ALIGNED_OPERATOR_NEW to all structs, which
contain fixed-size Eigen types and uses the Eigen::aligned_allocator
for containers which stores structs of fixed-size Eigen types.

Change-Id: I06c6c4fc74a6835918d5d1c571b7814a14c029d8
2019-04-15 22:09:24 +02:00
Sameer Agarwal e49507cbea More C++ification.
"> >" -> ">>"
"> > >" -> ">>>"

Change-Id: Id1ddd9dbf030fe21d57207741b4ca8403068e55b
2018-04-03 10:58:15 -07:00
Rodrigo Queiro 237eb17bdd Consistently use quotes to include Eigen
This makes these files match the convention in the rest of the codebase.

Change-Id: I3a0634274e0e604c575dd3c78fa87f485770e7ff
2018-01-12 18:25:16 +00:00
Alex Stewart e9009829b5 Fix use of unnamed type as template argument warnings on Clang.
- When compiling Ceres without C++11 but with glog, then the unnamed
  enum results in a compiler warning when
  google::GetReferenceableValue(.) is invoked with the unnamed enum as a
  template parameter (unnamed-type-template-args) which was not legal
  prior to C++11.

Change-Id: Iddbed05e2199865ab915f2c5817ce917bb0609b5
2017-12-01 10:12:54 +00:00
Keir Mierle b485002bb7 Replace template use of >>
Older compilers do not support >> to terminate
templates, only > >. Ceres supports old compilers.

Change-Id: I7e43dc9fdac06507b32dd0c9bf1a3bc2a544916b
2017-10-14 16:08:17 -07:00
Sameer Agarwal 8beedf5cf6 Add TinySolverCostFunctionAdapter
Change-Id: I1905044d09abe5c927cd7e2cda804cba516fd961
2017-10-14 15:12:01 -07:00