21#include <gtsam/base/VectorSpace.h>
23#include <gtsam/3rdparty/ceres/autodiff.h>
25#include <boost/static_assert.hpp>
26#include <boost/type_traits/is_base_of.hpp>
37template <
typename FUNCTOR,
int M,
int N1,
int N2>
39 typedef Eigen::Matrix<double, M, N1, Eigen::RowMajor> RowMajor1;
40 typedef Eigen::Matrix<double, M, N2, Eigen::RowMajor> RowMajor2;
42 typedef Eigen::Matrix<double, M, 1> VectorT;
43 typedef Eigen::Matrix<double, N1, 1> Vector1;
44 typedef Eigen::Matrix<double, N2, 1> Vector2;
49 VectorT operator()(
const Vector1& v1,
const Vector2& v2,
52 using ceres::internal::AutoDiff;
59 const double* parameters[] = {v1.data(), v2.data()};
60 double rowMajor1[M * N1] = {}, rowMajor2[M * N2] = {};
61 double* jacobians[] = {rowMajor1, rowMajor2};
62 success = AutoDiff<FUNCTOR, double, N1, N2>::Differentiate(
63 f, parameters, M, result.data(), jacobians);
68 if (H1) *H1 = Eigen::Map<RowMajor1>(rowMajor1);
69 if (H2) *H2 = Eigen::Map<RowMajor2>(rowMajor2);
73 success = f(v1.data(), v2.data(), result.data());
76 throw std::runtime_error(
77 "AdaptAutoDiff: function call resulted in failure");
Special class for optional Jacobian arguments.
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
OptionalJacobian is an Eigen::Ref like class that can take be constructed using either a fixed size o...
Definition: OptionalJacobian.h:39
The AdaptAutoDiff class uses ceres-style autodiff to adapt a ceres-style Function evaluation,...
Definition: AdaptAutoDiff.h:38