9 #ifndef EIGEN_AUTODIFF_CHAIN_JACOBIAN_H_ 10 #define EIGEN_AUTODIFF_CHAIN_JACOBIAN_H_ 17 template <
typename Functor>
24 #if EIGEN_HAS_VARIADIC_TEMPLATES 25 template <
typename... T>
30 template <
typename T0>
34 template <
typename T0,
typename T1>
38 template <
typename T0,
typename T1,
typename T2>
46 typedef typename ValueType::Scalar
Scalar;
55 typedef Matrix<Scalar, ValuesAtCompileTime, JacobianInputsAtCompileTime>
JacobianType;
58 typedef typename JacobianType::Index
Index;
63 typedef Matrix<ActiveScalar, InputsAtCompileTime, 1>
ActiveInput;
64 typedef Matrix<ActiveScalar, ValuesAtCompileTime, 1>
ActiveValue;
66 #if EIGEN_HAS_VARIADIC_TEMPLATES 70 void operator()(
const InputType &x, ValueType &v)
const 75 template <
typename... ParamsType>
76 void operator()(
const InputType &
x, ValueType &v,
const ParamsType &... Params)
const 81 template <
typename... ParamsType>
82 void operator()(
const InputType &x, ValueType &v, JacobianType &jac,
const ParamsType &... Params)
const 84 this->
operator()(x, v, jac,
nullptr, Params...);
87 template <
typename... ParamsType>
88 void operator()(
const InputType &x, ValueType &v, JacobianType &jac,
const InputJacobianType &ijac,
89 const ParamsType &... Params)
const 95 template <
typename... ParamsType>
96 void operator()(
const InputType &x, ValueType &v, JacobianType &jac,
const InputJacobianType *_ijac = 0,
97 const ParamsType &... Params)
const 105 void operator()(
const InputType &x, ValueType &v, JacobianType &jac)
const 110 void operator()(
const InputType &x, ValueType &v, JacobianType &jac,
const InputJacobianType &ijac)
const 115 void operator()(
const InputType &x, ValueType &v, JacobianType &jac = 0,
const InputJacobianType *_ijac = 0) const
118 ActiveInput ax = x.template cast<ActiveScalar>();
119 ActiveValue av(jac.rows());
126 for (Index j = 0; j < jac.rows(); ++j)
127 av[j].derivatives().resize(x.rows());
129 for (Index i = 0; i < jac.cols(); ++i)
130 ax[i].derivatives() = DerivativeType::Unit(x.rows(), i);
135 const InputJacobianType &ijac = *_ijac;
138 for (Index j = 0; j < jac.rows(); ++j)
139 av[j].derivatives().resize(ijac.cols());
141 for (Index i = 0; i < x.rows(); ++i)
142 ax[i].derivatives() = ijac.row(i);
145 #if EIGEN_HAS_VARIADIC_TEMPLATES 146 Functor::operator()(ax, av, Params...);
148 Functor::operator()(ax, av);
150 for (Index i = 0; i < jac.rows(); ++i)
152 v[i] = av[i].value();
153 jac.row(i) = av[i].derivatives();
160 #endif // EIGEN_AUTODIFF_CHAIN_JACOBIAN_H_ Matrix< Scalar, ValuesAtCompileTime, JacobianInputsAtCompileTime > JacobianType
AutoDiffChainJacobian(const T0 &a0, const T1 &a1, const T2 &a2)
JacobianType::Index Index
AutoDiffChainJacobian(const Functor &f)
EIGEN_STRONG_INLINE void operator()(const InputType &x, ValueType &v) const
void operator()(const InputType &x, ValueType &v, JacobianType &jac) const
FunctorBase< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::Dynamic > Functor
void operator()(const InputType &x, ValueType &v, JacobianType &jac=0, const InputJacobianType *_ijac=0) const
AutoDiffScalar< DerivativeType > ActiveScalar
Functor::InputType InputType
Matrix< Scalar, InputsAtCompileTime, JacobianInputsAtCompileTime > InputJacobianType
void operator()(const InputType &x, ValueType &v, JacobianType &jac, const InputJacobianType &ijac) const
AutoDiffChainJacobian(const T0 &a0, const T1 &a1)
Matrix< ActiveScalar, InputsAtCompileTime, 1 > ActiveInput
Matrix< ActiveScalar, ValuesAtCompileTime, 1 > ActiveValue
Matrix< Scalar, JacobianInputsAtCompileTime, 1 > DerivativeType
AutoDiffChainJacobian(const T0 &a0)
Functor::ValueType ValueType