40 typedef Eigen::Matrix<double, M, N1, Eigen::RowMajor> RowMajor1;
41 typedef Eigen::Matrix<double, M, N2, Eigen::RowMajor> RowMajor2;
43 typedef Eigen::Matrix<double, M, 1> VectorT;
44 typedef Eigen::Matrix<double, N1, 1> Vector1;
45 typedef Eigen::Matrix<double, N2, 1> Vector2;
50 VectorT operator()(
const Vector1& v1,
const Vector2& v2,
58 const double* parameters[] = {v1.data(), v2.data()};
59 double rowMajor1[M * N1] = {}, rowMajor2[M * N2] = {};
60 double* jacobians[] = {rowMajor1, rowMajor2};
61 ceres::AutoDiffCostFunction<FUNCTOR, M, N1, N2> autoDiff(
62 &f, ceres::DO_NOT_TAKE_OWNERSHIP);
63 success = autoDiff.Evaluate(parameters, 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");