Go to the documentation of this file.
10 #ifndef EIGEN_FINITEDIFF_CHAIN_JACOBIAN_H_
11 #define EIGEN_FINITEDIFF_CHAIN_JACOBIAN_H_
20 template <
typename Functor, NumericalDiffMode mode = Forward>
26 typedef typename ValueType::Scalar
Scalar;
35 typedef Matrix<Scalar, ValuesAtCompileTime, JacobianInputsAtCompileTime>
JacobianType;
37 typedef typename JacobianType::Index
Index;
48 #if EIGEN_HAS_VARIADIC_TEMPLATES
49 template <
typename... T>
53 template <
typename... T>
58 template <
typename T0>
62 template <
typename T0,
typename T1>
66 template <
typename T0,
typename T1,
typename T2>
71 template <
typename T0>
75 template <
typename T0,
typename T1>
79 template <
typename T0,
typename T1,
typename T2>
85 #if EIGEN_HAS_VARIADIC_TEMPLATES
97 template <
typename... ParamsType>
106 template <
typename... ParamsType>
126 const typename InputJacobianRowType::Index n = _jx.size();
127 const Scalar eps = sqrt(((std::max)(
epsfcn_, NumTraits<Scalar>::epsilon())));
133 val1.resize(v.rows());
134 val2.resize(v.rows());
137 #if EIGEN_HAS_VARIADIC_TEMPLATES
139 Functor::operator()(x, v, Params...);
143 Functor::operator()(x, v);
161 for (
int j = 0; j < n; ++j)
163 h = eps * abs(jx[j]);
172 #if EIGEN_HAS_VARIADIC_TEMPLATES
174 Functor::operator()(x, val2, Params...);
178 Functor::operator()(x, val2);
182 jac.col(j) = (val2 - val1) / h;
186 #if EIGEN_HAS_VARIADIC_TEMPLATES
188 Functor::operator()(x, val2, Params...);
192 Functor::operator()(x, val2);
196 #if EIGEN_HAS_VARIADIC_TEMPLATES
198 Functor::operator()(x, val1, Params...);
202 Functor::operator()(x, val1);
206 jac.col(j) = (val2 - val1) / (2 * h);
217 #endif // EIGEN_FINITEDIFF_CHAIN_JACOBIAN_H_
@ Forward
Definition: finitediff_common.h:37
@ Central
Definition: finitediff_common.h:38
Definition: autodiff_chain_hessian.h:16
std::function< void(const InputJacobianRowType &, InputType &)> UpdateFunctionCallbackType
Definition: finitediff_chain_jacobian.h:39
FiniteDiffChainJacobian(const Functor &f, Scalar epsfcn=0.)
Definition: finitediff_chain_jacobian.h:45
JacobianType::Index Index
Definition: finitediff_chain_jacobian.h:37
FunctorBase< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::Dynamic > Functor
Definition: functor.h:49
ValueType::Scalar Scalar
Definition: finitediff_chain_jacobian.h:26
Matrix< Scalar, ValuesAtCompileTime, JacobianInputsAtCompileTime > JacobianType
Definition: finitediff_chain_jacobian.h:35
Functor::ValueType ValueType
Definition: finitediff_chain_jacobian.h:25
FiniteDiffChainJacobian(const T0 &a0, Scalar epsfcn=0.)
Definition: finitediff_chain_jacobian.h:59
FiniteDiffChainJacobian(UpdateFunctionCallbackType update, Scalar epsfcn=0., const T0 &a0, const T1 &a1, const T2 &a2)
Definition: finitediff_chain_jacobian.h:80
Functor::InputType InputType
Definition: finitediff_chain_jacobian.h:24
int operator()(const InputJacobianRowType &_jx, ValueType &v, JacobianType &jac) const
Definition: finitediff_chain_jacobian.h:118
@ InputsAtCompileTime
Definition: finitediff_chain_jacobian.h:30
Matrix< Scalar, JacobianInputsAtCompileTime, 1 > InputJacobianRowType
Definition: finitediff_chain_jacobian.h:36
Scalar epsfcn_
Definition: finitediff_chain_jacobian.h:42
FiniteDiffChainJacobian(const T0 &a0, const T1 &a1, const T2 &a2, Scalar epsfcn=0.)
Definition: finitediff_chain_jacobian.h:67
FiniteDiffChainJacobian(const Functor &f, UpdateFunctionCallbackType update, Scalar epsfcn=0.)
Definition: finitediff_chain_jacobian.h:46
EIGEN_STRONG_INLINE int operator()(const InputJacobianRowType &_jx, ValueType &v) const
Definition: finitediff_chain_jacobian.h:110
FiniteDiffChainJacobian(UpdateFunctionCallbackType update, Scalar epsfcn=0., const T0 &a0, const T1 &a1)
Definition: finitediff_chain_jacobian.h:76
FiniteDiffChainJacobian(UpdateFunctionCallbackType update, Scalar epsfcn=0., const T0 &a0)
Definition: finitediff_chain_jacobian.h:72
Definition: finitediff_chain_jacobian.h:21
FiniteDiffChainJacobian(const T0 &a0, const T1 &a1, Scalar epsfcn=0.)
Definition: finitediff_chain_jacobian.h:63
UpdateFunctionCallbackType update_
Definition: finitediff_chain_jacobian.h:41
@ ValuesAtCompileTime
Definition: finitediff_chain_jacobian.h:31
@ JacobianInputsAtCompileTime
Definition: finitediff_chain_jacobian.h:32
FiniteDiffChainJacobian(Scalar epsfcn=0.)
Definition: finitediff_chain_jacobian.h:44