19template <
int Rows,
int Cols,
typename F>
21 constexpr double kEpsilon = 1
e-5;
26 for (
int i = 0; i < Cols; ++i) {
28 dX_plus(i) += kEpsilon;
30 dX_minus(i) -= kEpsilon;
31 result.col(i) = (f(dX_plus) - f(dX_minus)) / (kEpsilon * 2.0);
50template <
int Rows,
int States,
int Inputs,
typename F,
typename... Args>
53 return NumericalJacobian<Rows, States>(
70template <
int Rows,
int States,
int Inputs,
typename F,
typename... Args>
73 return NumericalJacobian<Rows, Inputs>(
The matrix class, also used for vectors and row-vectors.
Definition: Matrix.h:180
result
Definition: format.h:2556
Definition: AprilTagFieldLayout.h:22
auto NumericalJacobian(F &&f, const Vectord< Cols > &x)
Returns numerical Jacobian with respect to x for f(x).
Definition: NumericalJacobian.h:20
Eigen::Vector< double, Size > Vectord
Definition: EigenCore.h:12
auto NumericalJacobianU(F &&f, const Vectord< States > &x, const Vectord< Inputs > &u, Args &&... args)
Returns numerical Jacobian with respect to u for f(x, u, ...).
Definition: NumericalJacobian.h:71
auto NumericalJacobianX(F &&f, const Vectord< States > &x, const Vectord< Inputs > &u, Args &&... args)
Returns numerical Jacobian with respect to x for f(x, u, ...).
Definition: NumericalJacobian.h:51
static constexpr const unit_t< compound_unit< charge::coulomb, inverse< substance::mol > > > F(N_A *e)
Faraday constant.
static constexpr const charge::coulomb_t e(1.6021766208e-19)
elementary charge.