Like SparseCholesky, the DenseCholesky interface abstracts
away the solution of dense linear systems using Cholesky factorization.
This allows the client code to not worry about the type of dense
linear algebra library being used.
DenseNormalCholeskySolver and DenseSchurComplementSolver code
is considerably simpler as a result.
Change-Id: Ie15f09ee376d5f9a64609e6a55ad83e99c76352a
AutoDiffManifold allows the user to define a templated
functor that implements the Plus and Minus operations
on the Manifold and will compute the Jacobians needed
to define the Manifold object using automatic differentiation.
Change-Id: Ibd073c25847389308ca1ab66e6f5fe78aae77205
Manifolds are now part of the public API and co-exist
with LocalParameterizations.
1. Add Manifolds to the Problem API.
a. AddParameterBlock(double*, int, Manifold*)
b. SetParameterization(double*, Manifold*)
b. GetManifold(const double*)
c. HasManifold(const double*)
2. Internally Ceres now only uses Manifolds. When the user uses
a LocalParameterization, it is wrapped in a ManifoldAdapter.
3. To preserve the API semantics while keeping the internals clean
we need a new map in ProblemImpl which stores the association
between parameter blocks and local parameterizations. This
is temporary, it will go away once this transition is complete.
4. There are NO algorithmic changes, as in we are not using
any of the expanded interface of the Manifold objects yet.
That will come later.
5. All tests that use LocalParameterization have been duplicated
to use Manifolds, and when this transition is complete the
LocalParameterization based tests will be deleted.
6. Public documentation for the API has been updated. Deprecation
notices to the documentation as well as C++ annotations will come
later.
7. Similar changes have been made to GradientProblem.
Change-Id: I8e03c8ced6e141876ef3eca5740c113afa788f0c
1. Break tests for one function into its own TEST instance.
2. Use a gmock matcher which gives better logging, previously
we were using a function which in turn used another function
in test_utils. It made tracking down the failing test very
hard.
3. Disable a hypot3 underflow and overflow test when using
libc++ as the three argument in libc++ is borked.
4. The use of the matcher has made a number of comments redundant
so I have removed them.
This is the first step in cleaning up these tests and then expanding
them.
Change-Id: Ib0c827f44432e2496e50b8cda3e06c26bdf50f08
This will help the transition from LocalParameterization to Manifolds,
since most uses of Problem::GetParameterization is to just check
whether a parameter block has a local parameterization associated
with it or not.
Change-Id: Ib3539f377eaed853d7542c9844ec1487aa0fb4d6
1. Increase number of trials.
2. Make all the matchers per point.
3. Add matchers for delta = 0.
4. Add a macro which invokes all the matchers, reducing boilerplate
Change-Id: Ia1bf110323c5877a1b92aef34c12c39008256f05
This is the first in a series of changes that will eventually
replace the LocalParameterization interface with the richer
Manifold interface.
1. Add the Manifold interface.
2. Add implementations and test for:
a. EuclideanManifold (formerly the IdentityParameterization)
b. SubsetManifold (formerly the SubsetParameterization)
c. ProductManifold (formerly the ProductParameterization)
The testing has been completely re-done, where instead of adhoc
testing, we now define a number of matchers which explicitly
enforce the invariants demanded by the Manifold interface.
Change-Id: I3f296d0964388d52b027c99dc86b7730d24d55fa
Previously, Jet did not allow comparison between its value and a scalar
of another type. Specifically, the comparison was limited to scalars of
the same type effectively disabling standard promotion rules. Instead,
users would be required either to cast values to target Jet arithmetic
type or explicitly construct a Jet instance that can be eventually used
for comparison purposes.
However, such a behavior is not intuitive and causes problems with types
that rely on standard promotion rules (e.g., std::complex in some
implementations).
This changeset extends the comparison operators by enabling logical
comparisons between a Jet and values compatible to the underlying scalar
type (e.g., int). To be as generic as possible, the types allowed to be
passed to comparison operators are constrained using SFINAE. This in
turn allows a recursive expansion of jets and therefore the comparison
of a nested jets with a scalar.
The changes alleviate problems described in #414 and also allow the use
of special functions from Boost.Math, e.g., for computing the reciprocal
using boost::math::pow<-1>(...).
Change-Id: I3625791e6c8c2c0bfbffbbdb09e179a32e57f306
Several std::allocator<> members were deprecated in C++17 and
subsequently removed in C++20. Drop deprecated members altogether since
these are unused anyway.
Change-Id: Ic26471a4b1cb3ccc1fdf3231400c81827b0ff712
C++17 provides a three argument hypot(x, y, z) which can now be used
for jets if the standard is active.
Change-Id: Ide62e101f780fe738bb2d4f826b10daf94c585b3
Eigen::MappedSparseMatrix has been deprecated and removed from
Eigen at HEAD.
Thanks to rmlarsen@ for fixing this.
Change-Id: I34f3b0dda2bb91ee8cc65a20e53a3d7de6929221
Zero sign propagation is not always guaranteed. Replace signbit checks
by checks for -nan and +nan sign.
Change-Id: If2ba367e4116d4e6a008a83cf2bc6a8851b27af7
fmin and fmax do not handle NaNs correctly. Also, the comparison
operator for floating-point numbers may raise FE_INVALID if one of the
arguments is NaN. Both functions, however, are not subject to any of the
error conditions specified by the error handling for related
floating-point operators and functions.
Change-Id: Ic6bb65f18568066dba3c739a2df06f5fc3131a80
Currently, it is not possible to accurately evaluate the derivative of
d/dx log(1 + x) under all circumstances and significant deviations from
the actual derivative d/dx log1p(x) can occur. This changeset introduces
the necessary Jet overload and its inverse, expm1.
Change-Id: Ifcf88f6d684f61ba86bbe49f0d551b703f34ad0d
norm allows to compute the squared magnitude both of complex and real
numbers. While Jet does not support decaying of a std::complex to a
scalar performed by norm, the function is still useful when applied to
scalars alone for computing the square.
Change-Id: I27a3513f53f37fb3960411362e80d170d1ae6f74
libc++ (default on macOS) uses the copysign function for std::complex
multiplication which causes compilation errors such as these if
std::complex is combined with jets:
/Applications/Xcode_12.4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/complex:607:19: error: no matching function for call to 'copysign'
__a = copysign(__libcpp_isinf_or_builtin(__a) ? _Tp(1) : _Tp(0), __a);
^~~~~~~~
foo.hpp:218:39: note: in instantiation of function template specialization 'std::__1::operator*<ceres::Jet<double, 3> >' requested here
std::complex<Scalar> result = lhs * rhs;
copysign is also useful in other situations where the sign is required
allowing it to compute without branching.
Change-Id: I84b2d23374f1bf3bae32833016bb686d97d74054
abs() implementation does not correctly handle the sign of the
infinitesimal part when the value is a NaN. Define the function in terms
of copysign which is the only portable way of manipulating the sign of
a NaN value.
Change-Id: I2f13fb1db62d35ca8b09e6bff1c05a736cb91513
This has been a long requested feature so that users can minimize
functions using numeric differentiation.
As part of this, I have also redone rosenbrock.cc, which now has three
variants.
rosenbrock.cc now uses automatic differentiation.
rosenbrock_numeric_diff.cc uses numeric differentiation.
rosenbrock_analytic_diff.cc uses analytic derivatives.
This is analogus to how the helloworld example code is structured.
The tutorial for GradientProblemSolver has also been updated to reflect
this.
https://github.com/ceres-solver/ceres-solver/issues/691
Change-Id: Ib0fb9e35127fe4c8299d4793bea3558722c70dd7
A matrix reference was being incorrectly sized. It was using
the block_size number of rows, where as there are only block_local_size
number of rows that are present in the underlying matrix.
This did not affect the correctness of the resulting code, because
right after construction we then access a subblock with block_local_size
rows.
Thanks to William Gandler for reporting this.
Change-Id: I35e1f5a30b79e31b0b9fac79f7e361821d6073df
The analytical Jacobians for Powell's singular function were
incorrect. Thanks to William Gandler for reporting this.
Change-Id: I780ffe449daa6935a79b904835e13edcf1cdffa2
Fix an incorrect comparison between in QuaternionParameterizationTestHelper.
Reported by William Gandler.
Change-Id: If4d63a51f6a55013b4e6f0c299462c5af6e80c70
- The operator() wasn't called and tests where not executed.
- Fill test matrices with non-constant data.
Change-Id: Iacc9e8cb47d8539aded05bb821d3ce2f08a740d6
- Add testMatrix{Transpose}MatrixMultiply size
templated functions and test multiple problem
sizes.
- Removes duplicated code for matrix{transpose}-
matrix{naive} test cases
Change-Id: I9a5d4b0362732ea7bef58572edcaada778fb4aa0
Comparison operators are defined for Jet-scalar and scalar-Jet.
Add corresponding overloads for fmax and fmix so users
don't have to convert to Jet only to access these functions,
plus it can potentially save an unnecessary conversion.
Change-Id: I20cc2d5874935e019d4ecb2d6a8c2ae631c8a4d3