9 #ifndef EIGEN_AUTODIFF_CHAIN_JACOBIAN_SPARSE_H_
10 #define EIGEN_AUTODIFF_CHAIN_JACOBIAN_SPARSE_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;
58 typedef typename JacobianType::Index
Index;
64 typedef Matrix<ActiveScalar, InputsAtCompileTime, 1>
ActiveInput;
65 typedef Matrix<ActiveScalar, ValuesAtCompileTime, 1>
ActiveValue;
67 #if EIGEN_HAS_VARIADIC_TEMPLATES
76 template <
typename... ParamsType>
82 template <
typename... ParamsType>
85 this->
operator()(x, v, jac,
nullptr, Params...);
88 template <
typename... ParamsType>
90 const ParamsType &... Params)
const
96 template <
typename... ParamsType>
98 const ParamsType &... Params)
const
124 eigen_assert(
x.rows() == jac.cols());
125 for (
Index j = 0; j < jac.rows(); ++j)
126 av[j].derivatives().resize(
x.rows());
128 for (
Index i = 0; i <
x.rows(); ++i)
130 ax[i].derivatives().resize(
x.rows());
131 ax[i].derivatives().insert(i) = 1.0;
139 for (
Index j = 0; j < jac.rows(); ++j)
140 av[j].derivatives().resize(ijac.cols());
142 for (
Index i = 0; i <
x.rows(); ++i)
144 ax[i].derivatives().resize(ijac.cols());
145 ax[i].derivatives() = ijac.row(i);
149 #if EIGEN_HAS_VARIADIC_TEMPLATES
150 Functor::operator()(ax, av, Params...);
152 Functor::operator()(ax, av);
155 for (
int i = 0; i < jac.rows(); ++i)
157 v[i] = av[i].value();
160 jac.insert(i, it.row()) = av[i].derivatives().coeffRef(it.row());
168 #endif // EIGEN_AUTODIFF_CHAIN_JACOBIAN_SPARSE_H_