Compiling Ceres with Schur specializations and Link Time Optimization
(LTO) results in warnings such as
/usr/include/eigen3/Eigen/src/Core/ProductEvaluators.h:31:8: warning: type ‘struct evaluator’ violates the C++ One Definition Rule [-Wodr]
31 | struct evaluator<Product<Lhs, Rhs, Options>> : public product_evaluator<Product<Lhs, Rhs, Options>> {
| ^
due to the redefinition of EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD which
alters internal Eigen class definitions and consequently results in ODR
violations.
Avoid the ODR violation by renaming the Eigen namespace in translation
units that redefine EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD.
While the issue is diagnosed in LTO builds of Ceres only, the problem
exists in non-LTO builds as well and per standard the compiler is not
even required to diagnose ODR issues. ODR violations constitute
undefined behavior.
Change-Id: Idf7c7a30cc8d3a86b0d62cbd33bef58783a62ee4
Resolve the following warnings issue by the latest version of the
benchmark library:
/Users/runner/work/ceres-solver/ceres-solver/internal/ceres/small_blas_gemv_benchmark.cc:71:54: warning: 'Benchmark' is deprecated: Use ::benchmark::Benchmark instead [-Wdeprecated-declarations]
71 | static void MatrixSizeArguments(benchmark::internal::Benchmark* benchmark) {
|
/Users/runner/work/ceres-solver/ceres-solver/internal/ceres/dense_linear_solver_benchmark.cc:67:46: warning: 'Benchmark' is deprecated: Use ::benchmark::Benchmark instead [-Wdeprecated-declarations]
67 | static void MatrixSizes(benchmark::internal::Benchmark* b) {
|
/Users/runner/work/ceres-solver/ceres-solver/internal/ceres/invert_psd_matrix_benchmark.cc:80:37: warning: 'Benchmark' is deprecated: Use ::benchmark::Benchmark instead [-Wdeprecated-declarations]
80 | ->Apply([](benchmark::internal::Benchmark* benchmark) {
|
Change-Id: Ice6fe57dc5635698809e368fda23a018f4d7df5a
Add documentation on the output of DumpLinearLeastSquaresProblem.
This is to clarify confusion brought up on #608
Change-Id: I935cacee1e4345a1d0250aaac322ca2f8e794e66
Normally we expect it to be the case that inner iteration cost
will be less than the trust region cost, but due to round off
error it can be that it is larger, so make the test for inner
iteration being successful to be stricter.
Change-Id: Icbafe9fc6a311940d5368cca78eeac7ccd5fa943
Using a define to determine whether to disable warnings introduces a
dependency on the header inclusion order and thus can prevent the
warnings from being enabled.
Fixes#1173
Change-Id: I21f5bca78a83bfe4642e9b01abd220b9fbba31a4
This CL reorders the fields to group the hot fields together to increase data density. This CL doesn’t change functionality but expects to reduce cache misses and save CPU.
Change-Id: I313493a187ac6ebc607b311c39415c79a94f00c8
This change fixes a bug in ceres::CovarianceImpl where a new thread was always being created even when num_threads=1. After this fix, when num_threads=1, CovarianceImpl should run single-threaded and will not create any additional threads.
Change-Id: I784e359f8afe3e7e6d72930500a10e909bfe9308
Allow to specify the memory layout of quaternion coefficients using a
template parameter which defaults to Ceres coefficients order.
The changes are, for the most part, backwards compatible unless the
floating-point type is explicitly specified, e.g., as
&ceres::QuaternionToAngleAxis<double> to obtain a pointer to the
corresponding function. In such rare use cases, the coefficients order
must be given explicitly first as
ceres::QuaternionToAngleAxis<ceres::CeresQuaternionOrder>. In normal
situations, however, this should not be needed.
Change-Id: I05dd80f0593672dec656cc785cf06fe5268aee74
Define the relation between the axis-angle representation of a rotation
and the corresponding unit quaternion as
q(𝐞) = cos(𝜃/2) + sin(𝜃/2)/𝜃·𝐞
where 𝐞 = 𝜃𝛚 is the rotation vector given by the rotation angle 𝜃 and
the unit axis of rotation 𝛚 instead of
q(𝐞) = cos(𝜃) + sin(𝜃)/𝜃·𝐞 .
This brings the former relation closer to the available functionality
provided by ceres/rotation.h.
Fixes#941
Change-Id: Id40c065f78593887ecc52e67a068737d7eb5bda6
Previously, compiling using GCC failed with
In file included from /usr/include/c++/15.1.1/cassert:46,
from <ceres-prefix>/third_party/abseil-cpp/absl/container/internal/container_memory.h:18,
from <ceres-prefix>/third_party/abseil-cpp/absl/container/flat_hash_map.h:40,
from <ceres-prefix>/third_party/abseil-cpp/absl/flags/reflection.h:29,
from <ceres-prefix>/third_party/abseil-cpp/absl/flags/reflection.cc:16:
<ceres-prefix>/third_party/abseil-cpp/absl/container/internal/container_memory.h: In function ‘void* absl::lts_20240116::container_internal::Allocate(Alloc*, size_t)’:
<ceres-prefix>/third_party/abseil-cpp/absl/container/internal/container_memory.h:66:27: error: ‘uintptr_t’ does not name a type [-Wtemplate-body]
66 | assert(reinterpret_cast<uintptr_t>(p) % Alignment == 0 &&
| ^~~~~~~~~
<ceres-prefix>/third_party/abseil-cpp/absl/container/internal/container_memory.h:31:1: note: ‘uintptr_t’ is defined in header ‘<cstdint>’; this is probably fixable by adding ‘#include <cstdint>’
30 | #include "absl/utility/utility.h"
+++ |+#include <cstdint>
31 |
Additionally, the previous version of Abseil errouneously depends on
googletest when Ceres is consumed which results in issues with
downstream projects. We therefore update both dependencies to avoid
these issues.
Thanks to @adam-ce for figuring out the working versions of Abseil and
googletest.
Fixes#1140
Change-Id: Ie991da04491d42979d51b891a4565cabbb1c604b
Unfortunately, libc++'s 3-argument std::hypot implementation is
numerically unstable until LLVM 19.x. Therefore, checking the arguments
for zeros is insufficient since an underflow can still occur resulting
in a zero norm which requires another check. As such, division by zero
cannot be reliably avoided.
Change-Id: I189c8dc722aaec1ebc3ec8b1a177e1d8ac3b36db
Some of the benchmark functions use the same name as other functions
in the ceres namespace. For example Axpby defines both benchmark but
also an utility function in eigen_vector_ops.h. It seems to confuse
some compilers and leads to a compilation error rooting deeper into
the benchmark header itself: it seems that the compiler can not
deduct which of the instances of such functions to use.
Wrapping the file into an anonymous namespace solves the problem.
Alternative could be to use benchmark namespace to make thins more
explicit, for example ceres::internal::benchmark.
Tested on the following configuration:
- macOS 15.4
- Xcode 16.3
- Apple M3 CPU
- google-benchmark 1.9.2 installed via homebrew
Change-Id: Id127015dd22de99c6c3da88e71f255736e0bed82
Ceres CMake package configuration relies on several own find modules
(e.g., for SuiteSparse and METIS). To allow CMake to discover additional
find modules, the CMAKE_MODULE_PATH variable must be updated to include
the directories containing the corresponding find modules.
Previously, before updating CMAKE_MODULE_PATH, Ceres stored the
variable's initial value and then completely replaced it by the
directory containing Ceres's modules. However, a find_dependency failure
would cause an early return preventing CMAKE_MODULE_PATH to be restored.
Thus, any initial user changes to CMAKE_MODULE_PATH would be lost.
Now, instead of completely replacing the CMAKE_MODULE_PATH value we only
prepend additional directories. An early return no longer has a
destructive effect on CMAKE_MODULE_PATH. In a failure case,
CMAKE_MODULE_PATH still contains caller's initial set of directories and
an additional path prepended by Ceres.
Fixes#1024
Change-Id: I80d92a5dff9f3cff651f950c4f8d04ece008b44b
Recent TBB CMake package configurations do not define the
TBB_INTERFACE_VERSION variable. This causes the reported version to be
incomplete, i.e., the version looks as "(2022.0 / )". Use the CMake
specified package variable to report the identified version instead.
Change-Id: Ic7851c821217e20fd6673de5442808ea3d302f4a
CMake will print the following warning:
CMake Warning (dev) at CMakeLists.txt:n (target_link_libraries):
The library that is being linked to, ceres, is marked as being deprecated
by the owner. The message provided by the developer is:
The unscoped import target `ceres' is deprecated and will be removed in a
future Ceres Solver release. Please use the Ceres::ceres import target
instead.
This warning is for project developers. Use -Wno-dev to suppress it.
Change-Id: I5abc875b1f61e1f47523375d1579a188047c45d4
Stop linker emitting warnings such as
lto-wrapper: warning: using serial compilation of n LTRANS jobs
Change-Id: Ic933ef7b45955eabfa5b06e88cd195077ff9fc86
Using mold instead of GNU ld reduces the total build time by roughly
5-15 min. (depending on the load).
Change-Id: I66feab4e54c248cf92cc379d0085a93bdfdfef69
Use `pip install -r docs/requirements.txt` (e.g., in a virtual environment) to install Python dependencies required for building the documentation.
Change-Id: Ied9bd505bd6fc92f8c04f526ebd3ccacec306371