4 #ifndef SOPHUS_NUM_DIFF_HPP 
    5 #define SOPHUS_NUM_DIFF_HPP 
   16 template <
class Scalar>
 
   20   static auto num_diff(Fn curve, Scalar t, Scalar h) -> decltype(curve(t)) {
 
   21     using ReturnType = decltype(curve(t));
 
   22     static_assert(std::is_floating_point<Scalar>::value,
 
   23                   "Scalar must be a floating point type.");
 
   25                   "ReturnType must be either a floating point scalar, " 
   28     return (curve(t + h) - curve(t - h)) / (Scalar(2) * h);
 
   32 template <
class Scalar, 
int N, 
int M>
 
   39     static_assert(std::is_floating_point<Scalar>::value,
 
   40                   "Scalar must be a floating point type.");
 
   41     Eigen::Matrix<Scalar, N, M> J;
 
   44     for (
int i = 0; i < M; ++i) {
 
   47           (vector_field(a + h) - vector_field(a - h)) / (Scalar(2) * eps);
 
   55 template <
class Scalar, 
int N>
 
   60       Scalar 
const& a, Scalar eps) {
 
   71 template <
class Scalar, 
class Fn>
 
   83 template <
class Scalar, 
int N, 
int M, 
class ScalarOrVector, 
class Fn>
 
   85     Fn vector_field, ScalarOrVector 
const& a,
 
   93 #endif  // SOPHUS_NUM_DIFF_HPP