10 #ifndef EIGEN_AUTODIFF_JACOBIAN_H 11 #define EIGEN_AUTODIFF_JACOBIAN_H 23 #if EIGEN_HAS_VARIADIC_TEMPLATES 24 template<
typename...
T>
28 AutoDiffJacobian(
const T0& a0) :
Functor(a0) {}
29 template<
typename T0,
typename T1>
30 AutoDiffJacobian(
const T0& a0,
const T1& a1) :
Functor(a0, a1) {}
31 template<
typename T0,
typename T1,
typename T2>
32 AutoDiffJacobian(
const T0& a0,
const T1& a1,
const T2& a2) :
Functor(a0, a1, a2) {}
35 typedef typename Functor::InputType InputType;
36 typedef typename Functor::ValueType ValueType;
37 typedef typename ValueType::Scalar Scalar;
40 InputsAtCompileTime = InputType::RowsAtCompileTime,
41 ValuesAtCompileTime = ValueType::RowsAtCompileTime
45 typedef typename JacobianType::Index Index;
53 #if EIGEN_HAS_VARIADIC_TEMPLATES 57 void operator() (
const InputType& x, ValueType* v)
const 59 this->operator()(x, v, 0);
61 template<
typename... ParamsType>
62 void operator() (
const InputType& x, ValueType* v, JacobianType* _jac,
63 const ParamsType&... Params)
const 65 void operator() (
const InputType& x, ValueType* v, JacobianType* _jac=0)
const 72 #if EIGEN_HAS_VARIADIC_TEMPLATES 73 Functor::operator()(x, v, Params...);
75 Functor::operator()(x, v);
80 JacobianType& jac = *_jac;
82 ActiveInput ax = x.template cast<ActiveScalar>();
83 ActiveValue av(jac.rows());
85 if(InputsAtCompileTime==
Dynamic)
86 for (Index j=0; j<jac.rows(); j++)
87 av[j].derivatives().
resize(x.rows());
89 for (Index i=0; i<jac.cols(); i++)
90 ax[i].derivatives() = DerivativeType::Unit(x.rows(),i);
92 #if EIGEN_HAS_VARIADIC_TEMPLATES 93 Functor::operator()(ax, &av, Params...);
95 Functor::operator()(ax, &av);
98 for (Index i=0; i<jac.rows(); i++)
100 (*v)[i] = av[i].value();
101 jac.row(i) = av[i].derivatives();
108 #endif // EIGEN_AUTODIFF_JACOBIAN_H Definition: AutoDiffJacobian.h:16
Definition: NonLinearOptimization.cpp:108
A scalar type replacement with automatic differentation capability.
Definition: AutoDiffScalar.h:33
Namespace containing all symbols from the Eigen library.
Definition: bench_norm.cpp:85
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void resize(Index rows, Index cols)
Resizes *this to a rows x cols matrix.
Definition: PlainObjectBase.h:273
const int Dynamic
This value means that a positive quantity (e.g., a size) is not known at compile-time, and that instead the value is stored in some runtime variable.
Definition: Constants.h:21
The matrix class, also used for vectors and row-vectors.
Definition: Matrix.h:178