21 #include <gtsam/base/VectorSpace.h> 23 #include <gtsam/3rdparty/ceres/autodiff.h> 34 template <
typename FUNCTOR,
int M,
int N1,
int N2>
36 typedef Eigen::Matrix<double, M, N1, Eigen::RowMajor> RowMajor1;
37 typedef Eigen::Matrix<double, M, N2, Eigen::RowMajor> RowMajor2;
39 typedef Eigen::Matrix<double, M, 1> VectorT;
40 typedef Eigen::Matrix<double, N1, 1> Vector1;
41 typedef Eigen::Matrix<double, N2, 1> Vector2;
46 VectorT operator()(
const Vector1& v1,
const Vector2& v2,
49 using ceres::internal::AutoDiff;
56 const double* parameters[] = {v1.data(), v2.data()};
57 double rowMajor1[M * N1] = {}, rowMajor2[M * N2] = {};
58 double* jacobians[] = {rowMajor1, rowMajor2};
59 success = AutoDiff<FUNCTOR, double, N1, N2>::Differentiate(
60 f, parameters, M, result.data(), jacobians);
65 if (H1) *H1 = Eigen::Map<RowMajor1>(rowMajor1);
66 if (H2) *H2 = Eigen::Map<RowMajor2>(rowMajor2);
70 success = f(v1.data(), v2.data(), result.data());
73 throw std::runtime_error(
74 "AdaptAutoDiff: function call resulted in failure");
Definition: AdaptAutoDiff.h:35
Definition: chartTesting.h:28
Definition: OptionalJacobian.h:38
Special class for optional Jacobian arguments.