gtsam
Loading...
Searching...
No Matches
Numerical Derivative Helpers

Finite-difference Jacobian and Hessian utilities for manifold-valued functions. More...

First-Order Derivative Helpers

template<class X, int N = traits<X>::dimension, class F, internal::EnableIfScalarInvocable< F, X > = 0>
Eigen::Matrix< double, N, 1 > gtsam::numericalGradient (F &&h, const X &x, double delta=1e-5)
 Numerically compute gradient of scalar function.
template<class X, int N = traits<X>::dimension>
Eigen::Matrix< double, N, 1 > gtsam::numericalGradient (double(&h)(const X &), const X &x, double delta=1e-5)
 Raw-function overload for numericalGradient.
template<class Y = internal::DeducedOutput, class X, int N = traits<X>::dimension, class F, internal::EnableIfInvocable< F, X > = 0>
internal::MatrixMN< traits< internal::OutputType< Y, F, X > >::dimension, N >::type gtsam::numericalDerivative11 (F &&h, const X &x, double delta=1e-5)
 New-style numerical derivatives using manifold_traits.
template<class Y, class X, int N = traits<X>::dimension>
internal::MatrixMN< traits< Y >::dimension, N >::type gtsam::numericalDerivative11 (Y(&h)(const X &), const X &x, double delta=1e-5)
 Raw-function overload for numericalDerivative11.
template<class Y = internal::DeducedOutput, class X1, class X2, int N = traits<X1>::dimension, class F, internal::EnableIfInvocable< F, X1, X2 > = 0>
internal::MatrixMN< traits< internal::OutputType< Y, F, X1, X2 > >::dimension, N >::type gtsam::numericalDerivative21 (F &&h, const X1 &x1, const X2 &x2, double delta=1e-5)
 Compute numerical derivative in argument 1 of binary function.
template<class Y, class X1, class X2, int N = traits<X1>::dimension>
internal::MatrixMN< traits< Y >::dimension, N >::type gtsam::numericalDerivative21 (Y(&h)(const X1 &, const X2 &), const X1 &x1, const X2 &x2, double delta=1e-5)
 Raw-function overload for numericalDerivative21.
template<class Y = internal::DeducedOutput, class X1, class X2, int N = traits<X2>::dimension, class F, internal::EnableIfInvocable< F, X1, X2 > = 0>
internal::MatrixMN< traits< internal::OutputType< Y, F, X1, X2 > >::dimension, N >::type gtsam::numericalDerivative22 (F &&h, const X1 &x1, const X2 &x2, double delta=1e-5)
 Compute numerical derivative in argument 2 of binary function.
template<class Y, class X1, class X2, int N = traits<X2>::dimension>
internal::MatrixMN< traits< Y >::dimension, N >::type gtsam::numericalDerivative22 (Y(&h)(const X1 &, const X2 &), const X1 &x1, const X2 &x2, double delta=1e-5)
 Raw-function overload for numericalDerivative22.
template<class Y = internal::DeducedOutput, class X1, class X2, class X3, int N = traits<X1>::dimension, class F, internal::EnableIfInvocable< F, X1, X2, X3 > = 0>
internal::MatrixMN< traits< internal::OutputType< Y, F, X1, X2, X3 > >::dimension, N >::type gtsam::numericalDerivative31 (F &&h, const X1 &x1, const X2 &x2, const X3 &x3, double delta=1e-5)
 Compute numerical derivative in argument 1 of ternary function.
template<class Y, class X1, class X2, class X3, int N = traits<X1>::dimension>
internal::MatrixMN< traits< Y >::dimension, N >::type gtsam::numericalDerivative31 (Y(&h)(const X1 &, const X2 &, const X3 &), const X1 &x1, const X2 &x2, const X3 &x3, double delta=1e-5)
 Raw-function overload for numericalDerivative31.
template<class Y = internal::DeducedOutput, class X1, class X2, class X3, int N = traits<X2>::dimension, class F, internal::EnableIfInvocable< F, X1, X2, X3 > = 0>
internal::MatrixMN< traits< internal::OutputType< Y, F, X1, X2, X3 > >::dimension, N >::type gtsam::numericalDerivative32 (F &&h, const X1 &x1, const X2 &x2, const X3 &x3, double delta=1e-5)
 Compute numerical derivative in argument 2 of ternary function.
template<class Y, class X1, class X2, class X3, int N = traits<X2>::dimension>
internal::MatrixMN< traits< Y >::dimension, N >::type gtsam::numericalDerivative32 (Y(&h)(const X1 &, const X2 &, const X3 &), const X1 &x1, const X2 &x2, const X3 &x3, double delta=1e-5)
 Raw-function overload for numericalDerivative32.
template<class Y = internal::DeducedOutput, class X1, class X2, class X3, int N = traits<X3>::dimension, class F, internal::EnableIfInvocable< F, X1, X2, X3 > = 0>
internal::MatrixMN< traits< internal::OutputType< Y, F, X1, X2, X3 > >::dimension, N >::type gtsam::numericalDerivative33 (F &&h, const X1 &x1, const X2 &x2, const X3 &x3, double delta=1e-5)
 Compute numerical derivative in argument 3 of ternary function.
template<class Y, class X1, class X2, class X3, int N = traits<X3>::dimension>
internal::MatrixMN< traits< Y >::dimension, N >::type gtsam::numericalDerivative33 (Y(&h)(const X1 &, const X2 &, const X3 &), const X1 &x1, const X2 &x2, const X3 &x3, double delta=1e-5)
 Raw-function overload for numericalDerivative33.
template<class Y = internal::DeducedOutput, class X1, class X2, class X3, class X4, int N = traits<X1>::dimension, class F, internal::EnableIfInvocable< F, X1, X2, X3, X4 > = 0>
internal::MatrixMN< traits< internal::OutputType< Y, F, X1, X2, X3, X4 > >::dimension, N >::type gtsam::numericalDerivative41 (F &&h, const X1 &x1, const X2 &x2, const X3 &x3, const X4 &x4, double delta=1e-5)
 Compute numerical derivative in argument 1 of 4-argument function.
template<class Y, class X1, class X2, class X3, class X4, int N = traits<X1>::dimension>
internal::MatrixMN< traits< Y >::dimension, N >::type gtsam::numericalDerivative41 (Y(&h)(const X1 &, const X2 &, const X3 &, const X4 &), const X1 &x1, const X2 &x2, const X3 &x3, const X4 &x4, double delta=1e-5)
 Raw-function overload for numericalDerivative41.
template<class Y = internal::DeducedOutput, class X1, class X2, class X3, class X4, int N = traits<X2>::dimension, class F, internal::EnableIfInvocable< F, X1, X2, X3, X4 > = 0>
internal::MatrixMN< traits< internal::OutputType< Y, F, X1, X2, X3, X4 > >::dimension, N >::type gtsam::numericalDerivative42 (F &&h, const X1 &x1, const X2 &x2, const X3 &x3, const X4 &x4, double delta=1e-5)
 Compute numerical derivative in argument 2 of 4-argument function.
template<class Y, class X1, class X2, class X3, class X4, int N = traits<X2>::dimension>
internal::MatrixMN< traits< Y >::dimension, N >::type gtsam::numericalDerivative42 (Y(&h)(const X1 &, const X2 &, const X3 &, const X4 &), const X1 &x1, const X2 &x2, const X3 &x3, const X4 &x4, double delta=1e-5)
 Raw-function overload for numericalDerivative42.
template<class Y = internal::DeducedOutput, class X1, class X2, class X3, class X4, int N = traits<X3>::dimension, class F, internal::EnableIfInvocable< F, X1, X2, X3, X4 > = 0>
internal::MatrixMN< traits< internal::OutputType< Y, F, X1, X2, X3, X4 > >::dimension, N >::type gtsam::numericalDerivative43 (F &&h, const X1 &x1, const X2 &x2, const X3 &x3, const X4 &x4, double delta=1e-5)
 Compute numerical derivative in argument 3 of 4-argument function.
template<class Y, class X1, class X2, class X3, class X4, int N = traits<X3>::dimension>
internal::MatrixMN< traits< Y >::dimension, N >::type gtsam::numericalDerivative43 (Y(&h)(const X1 &, const X2 &, const X3 &, const X4 &), const X1 &x1, const X2 &x2, const X3 &x3, const X4 &x4, double delta=1e-5)
 Raw-function overload for numericalDerivative43.
template<class Y = internal::DeducedOutput, class X1, class X2, class X3, class X4, int N = traits<X4>::dimension, class F, internal::EnableIfInvocable< F, X1, X2, X3, X4 > = 0>
internal::MatrixMN< traits< internal::OutputType< Y, F, X1, X2, X3, X4 > >::dimension, N >::type gtsam::numericalDerivative44 (F &&h, const X1 &x1, const X2 &x2, const X3 &x3, const X4 &x4, double delta=1e-5)
 Compute numerical derivative in argument 4 of 4-argument function.
template<class Y, class X1, class X2, class X3, class X4, int N = traits<X4>::dimension>
internal::MatrixMN< traits< Y >::dimension, N >::type gtsam::numericalDerivative44 (Y(&h)(const X1 &, const X2 &, const X3 &, const X4 &), const X1 &x1, const X2 &x2, const X3 &x3, const X4 &x4, double delta=1e-5)
 Raw-function overload for numericalDerivative44.
template<class Y = internal::DeducedOutput, class X1, class X2, class X3, class X4, class X5, int N = traits<X1>::dimension, class F, internal::EnableIfInvocable< F, X1, X2, X3, X4, X5 > = 0>
internal::MatrixMN< traits< internal::OutputType< Y, F, X1, X2, X3, X4, X5 > >::dimension, N >::type gtsam::numericalDerivative51 (F &&h, const X1 &x1, const X2 &x2, const X3 &x3, const X4 &x4, const X5 &x5, double delta=1e-5)
 Compute numerical derivative in argument 1 of 5-argument function.
template<class Y, class X1, class X2, class X3, class X4, class X5, int N = traits<X1>::dimension>
internal::MatrixMN< traits< Y >::dimension, N >::type gtsam::numericalDerivative51 (Y(&h)(const X1 &, const X2 &, const X3 &, const X4 &, const X5 &), const X1 &x1, const X2 &x2, const X3 &x3, const X4 &x4, const X5 &x5, double delta=1e-5)
 Raw-function overload for numericalDerivative51.
template<class Y = internal::DeducedOutput, class X1, class X2, class X3, class X4, class X5, int N = traits<X2>::dimension, class F, internal::EnableIfInvocable< F, X1, X2, X3, X4, X5 > = 0>
internal::MatrixMN< traits< internal::OutputType< Y, F, X1, X2, X3, X4, X5 > >::dimension, N >::type gtsam::numericalDerivative52 (F &&h, const X1 &x1, const X2 &x2, const X3 &x3, const X4 &x4, const X5 &x5, double delta=1e-5)
 Compute numerical derivative in argument 2 of 5-argument function.
template<class Y, class X1, class X2, class X3, class X4, class X5, int N = traits<X2>::dimension>
internal::MatrixMN< traits< Y >::dimension, N >::type gtsam::numericalDerivative52 (Y(&h)(const X1 &, const X2 &, const X3 &, const X4 &, const X5 &), const X1 &x1, const X2 &x2, const X3 &x3, const X4 &x4, const X5 &x5, double delta=1e-5)
 Raw-function overload for numericalDerivative52.
template<class Y = internal::DeducedOutput, class X1, class X2, class X3, class X4, class X5, int N = traits<X3>::dimension, class F, internal::EnableIfInvocable< F, X1, X2, X3, X4, X5 > = 0>
internal::MatrixMN< traits< internal::OutputType< Y, F, X1, X2, X3, X4, X5 > >::dimension, N >::type gtsam::numericalDerivative53 (F &&h, const X1 &x1, const X2 &x2, const X3 &x3, const X4 &x4, const X5 &x5, double delta=1e-5)
 Compute numerical derivative in argument 3 of 5-argument function.
template<class Y, class X1, class X2, class X3, class X4, class X5, int N = traits<X3>::dimension>
internal::MatrixMN< traits< Y >::dimension, N >::type gtsam::numericalDerivative53 (Y(&h)(const X1 &, const X2 &, const X3 &, const X4 &, const X5 &), const X1 &x1, const X2 &x2, const X3 &x3, const X4 &x4, const X5 &x5, double delta=1e-5)
 Raw-function overload for numericalDerivative53.
template<class Y = internal::DeducedOutput, class X1, class X2, class X3, class X4, class X5, int N = traits<X4>::dimension, class F, internal::EnableIfInvocable< F, X1, X2, X3, X4, X5 > = 0>
internal::MatrixMN< traits< internal::OutputType< Y, F, X1, X2, X3, X4, X5 > >::dimension, N >::type gtsam::numericalDerivative54 (F &&h, const X1 &x1, const X2 &x2, const X3 &x3, const X4 &x4, const X5 &x5, double delta=1e-5)
 Compute numerical derivative in argument 4 of 5-argument function.
template<class Y, class X1, class X2, class X3, class X4, class X5, int N = traits<X4>::dimension>
internal::MatrixMN< traits< Y >::dimension, N >::type gtsam::numericalDerivative54 (Y(&h)(const X1 &, const X2 &, const X3 &, const X4 &, const X5 &), const X1 &x1, const X2 &x2, const X3 &x3, const X4 &x4, const X5 &x5, double delta=1e-5)
 Raw-function overload for numericalDerivative54.
template<class Y = internal::DeducedOutput, class X1, class X2, class X3, class X4, class X5, int N = traits<X5>::dimension, class F, internal::EnableIfInvocable< F, X1, X2, X3, X4, X5 > = 0>
internal::MatrixMN< traits< internal::OutputType< Y, F, X1, X2, X3, X4, X5 > >::dimension, N >::type gtsam::numericalDerivative55 (F &&h, const X1 &x1, const X2 &x2, const X3 &x3, const X4 &x4, const X5 &x5, double delta=1e-5)
 Compute numerical derivative in argument 5 of 5-argument function.
template<class Y, class X1, class X2, class X3, class X4, class X5, int N = traits<X5>::dimension>
internal::MatrixMN< traits< Y >::dimension, N >::type gtsam::numericalDerivative55 (Y(&h)(const X1 &, const X2 &, const X3 &, const X4 &, const X5 &), const X1 &x1, const X2 &x2, const X3 &x3, const X4 &x4, const X5 &x5, double delta=1e-5)
 Raw-function overload for numericalDerivative55.
template<class Y = internal::DeducedOutput, class X1, class X2, class X3, class X4, class X5, class X6, int N = traits<X1>::dimension, class F, internal::EnableIfInvocable< F, X1, X2, X3, X4, X5, X6 > = 0>
internal::MatrixMN< traits< internal::OutputType< Y, F, X1, X2, X3, X4, X5, X6 > >::dimension, N >::type gtsam::numericalDerivative61 (F &&h, const X1 &x1, const X2 &x2, const X3 &x3, const X4 &x4, const X5 &x5, const X6 &x6, double delta=1e-5)
 Compute numerical derivative in argument 1 of 6-argument function.
template<class Y, class X1, class X2, class X3, class X4, class X5, class X6, int N = traits<X1>::dimension>
internal::MatrixMN< traits< Y >::dimension, N >::type gtsam::numericalDerivative61 (Y(&h)(const X1 &, const X2 &, const X3 &, const X4 &, const X5 &, const X6 &), const X1 &x1, const X2 &x2, const X3 &x3, const X4 &x4, const X5 &x5, const X6 &x6, double delta=1e-5)
 Raw-function overload for numericalDerivative61.
template<class Y = internal::DeducedOutput, class X1, class X2, class X3, class X4, class X5, class X6, int N = traits<X2>::dimension, class F, internal::EnableIfInvocable< F, X1, X2, X3, X4, X5, X6 > = 0>
internal::MatrixMN< traits< internal::OutputType< Y, F, X1, X2, X3, X4, X5, X6 > >::dimension, N >::type gtsam::numericalDerivative62 (F &&h, const X1 &x1, const X2 &x2, const X3 &x3, const X4 &x4, const X5 &x5, const X6 &x6, double delta=1e-5)
 Compute numerical derivative in argument 2 of 6-argument function.
template<class Y, class X1, class X2, class X3, class X4, class X5, class X6, int N = traits<X2>::dimension>
internal::MatrixMN< traits< Y >::dimension, N >::type gtsam::numericalDerivative62 (Y(&h)(const X1 &, const X2 &, const X3 &, const X4 &, const X5 &, const X6 &), const X1 &x1, const X2 &x2, const X3 &x3, const X4 &x4, const X5 &x5, const X6 &x6, double delta=1e-5)
 Raw-function overload for numericalDerivative62.
template<class Y = internal::DeducedOutput, class X1, class X2, class X3, class X4, class X5, class X6, int N = traits<X3>::dimension, class F, internal::EnableIfInvocable< F, X1, X2, X3, X4, X5, X6 > = 0>
internal::MatrixMN< traits< internal::OutputType< Y, F, X1, X2, X3, X4, X5, X6 > >::dimension, N >::type gtsam::numericalDerivative63 (F &&h, const X1 &x1, const X2 &x2, const X3 &x3, const X4 &x4, const X5 &x5, const X6 &x6, double delta=1e-5)
 Compute numerical derivative in argument 3 of 6-argument function.
template<class Y, class X1, class X2, class X3, class X4, class X5, class X6, int N = traits<X3>::dimension>
internal::MatrixMN< traits< Y >::dimension, N >::type gtsam::numericalDerivative63 (Y(&h)(const X1 &, const X2 &, const X3 &, const X4 &, const X5 &, const X6 &), const X1 &x1, const X2 &x2, const X3 &x3, const X4 &x4, const X5 &x5, const X6 &x6, double delta=1e-5)
 Raw-function overload for numericalDerivative63.
template<class Y = internal::DeducedOutput, class X1, class X2, class X3, class X4, class X5, class X6, int N = traits<X4>::dimension, class F, internal::EnableIfInvocable< F, X1, X2, X3, X4, X5, X6 > = 0>
internal::MatrixMN< traits< internal::OutputType< Y, F, X1, X2, X3, X4, X5, X6 > >::dimension, N >::type gtsam::numericalDerivative64 (F &&h, const X1 &x1, const X2 &x2, const X3 &x3, const X4 &x4, const X5 &x5, const X6 &x6, double delta=1e-5)
 Compute numerical derivative in argument 4 of 6-argument function.
template<class Y, class X1, class X2, class X3, class X4, class X5, class X6, int N = traits<X4>::dimension>
internal::MatrixMN< traits< Y >::dimension, N >::type gtsam::numericalDerivative64 (Y(&h)(const X1 &, const X2 &, const X3 &, const X4 &, const X5 &, const X6 &), const X1 &x1, const X2 &x2, const X3 &x3, const X4 &x4, const X5 &x5, const X6 &x6, double delta=1e-5)
 Raw-function overload for numericalDerivative64.
template<class Y = internal::DeducedOutput, class X1, class X2, class X3, class X4, class X5, class X6, int N = traits<X5>::dimension, class F, internal::EnableIfInvocable< F, X1, X2, X3, X4, X5, X6 > = 0>
internal::MatrixMN< traits< internal::OutputType< Y, F, X1, X2, X3, X4, X5, X6 > >::dimension, N >::type gtsam::numericalDerivative65 (F &&h, const X1 &x1, const X2 &x2, const X3 &x3, const X4 &x4, const X5 &x5, const X6 &x6, double delta=1e-5)
 Compute numerical derivative in argument 5 of 6-argument function.
template<class Y, class X1, class X2, class X3, class X4, class X5, class X6, int N = traits<X5>::dimension>
internal::MatrixMN< traits< Y >::dimension, N >::type gtsam::numericalDerivative65 (Y(&h)(const X1 &, const X2 &, const X3 &, const X4 &, const X5 &, const X6 &), const X1 &x1, const X2 &x2, const X3 &x3, const X4 &x4, const X5 &x5, const X6 &x6, double delta=1e-5)
 Raw-function overload for numericalDerivative65.
template<class Y = internal::DeducedOutput, class X1, class X2, class X3, class X4, class X5, class X6, int N = traits<X6>::dimension, class F, internal::EnableIfInvocable< F, X1, X2, X3, X4, X5, X6 > = 0>
internal::MatrixMN< traits< internal::OutputType< Y, F, X1, X2, X3, X4, X5, X6 > >::dimension, N >::type gtsam::numericalDerivative66 (F &&h, const X1 &x1, const X2 &x2, const X3 &x3, const X4 &x4, const X5 &x5, const X6 &x6, double delta=1e-5)
 Compute numerical derivative in argument 6 of 6-argument function.
template<class Y, class X1, class X2, class X3, class X4, class X5, class X6, int N = traits<X6>::dimension>
internal::MatrixMN< traits< Y >::dimension, N >::type gtsam::numericalDerivative66 (Y(&h)(const X1 &, const X2 &, const X3 &, const X4 &, const X5 &, const X6 &), const X1 &x1, const X2 &x2, const X3 &x3, const X4 &x4, const X5 &x5, const X6 &x6, double delta=1e-5)
 Raw-function overload for numericalDerivative66.

Hessian Helpers

template<class X, int N = traits<X>::dimension, class F, internal::EnableIfScalarInvocable< F, X > = 0>
internal::MatrixMN< N, N >::type gtsam::numericalHessian (F &&f, const X &x, double delta=1e-5)
 Compute numerical Hessian matrix.
template<class X, int N = traits<X>::dimension>
internal::MatrixMN< N, N >::type gtsam::numericalHessian (double(&f)(const X &), const X &x, double delta=1e-5)
 Raw-function overload for numericalHessian.
template<class X1, class X2, int N1 = traits<X1>::dimension, int N2 = traits<X2>::dimension, class F, internal::EnableIfScalarInvocable< F, X1, X2 > = 0>
internal::MatrixMN< N1, N2 >::type gtsam::numericalHessian212 (F &&f, const X1 &x1, const X2 &x2, double delta=1e-5)
 Mixed Hessian with respect to argument 1 then argument 2.
template<class X1, class X2, int N1 = traits<X1>::dimension, int N2 = traits<X2>::dimension>
internal::MatrixMN< N1, N2 >::type gtsam::numericalHessian212 (double(&f)(const X1 &, const X2 &), const X1 &x1, const X2 &x2, double delta=1e-5)
 Raw-function overload for numericalHessian212.
template<class X1, class X2, int N1 = traits<X1>::dimension, class F, internal::EnableIfScalarInvocable< F, X1, X2 > = 0>
internal::MatrixMN< N1, N1 >::type gtsam::numericalHessian211 (F &&f, const X1 &x1, const X2 &x2, double delta=1e-5)
 Hessian with respect to argument 1 of a binary scalar function.
template<class X1, class X2, int N1 = traits<X1>::dimension>
internal::MatrixMN< N1, N1 >::type gtsam::numericalHessian211 (double(&f)(const X1 &, const X2 &), const X1 &x1, const X2 &x2, double delta=1e-5)
 Raw-function overload for numericalHessian211.
template<class X1, class X2, int N2 = traits<X2>::dimension, class F, internal::EnableIfScalarInvocable< F, X1, X2 > = 0>
internal::MatrixMN< N2, N2 >::type gtsam::numericalHessian222 (F &&f, const X1 &x1, const X2 &x2, double delta=1e-5)
 Hessian with respect to argument 2 of a binary scalar function.
template<class X1, class X2, int N2 = traits<X2>::dimension>
internal::MatrixMN< N2, N2 >::type gtsam::numericalHessian222 (double(&f)(const X1 &, const X2 &), const X1 &x1, const X2 &x2, double delta=1e-5)
 Raw-function overload for numericalHessian222.
template<class X1, class X2, class X3, int N1 = traits<X1>::dimension, class F, internal::EnableIfScalarInvocable< F, X1, X2, X3 > = 0>
internal::MatrixMN< N1, N1 >::type gtsam::numericalHessian311 (F &&f, const X1 &x1, const X2 &x2, const X3 &x3, double delta=1e-5)
 Numerical Hessian for ternary functions.
template<class X1, class X2, class X3, int N1 = traits<X1>::dimension>
internal::MatrixMN< N1, N1 >::type gtsam::numericalHessian311 (double(&f)(const X1 &, const X2 &, const X3 &), const X1 &x1, const X2 &x2, const X3 &x3, double delta=1e-5)
 Raw-function overload for numericalHessian311.
template<class X1, class X2, class X3, int N2 = traits<X2>::dimension, class F, internal::EnableIfScalarInvocable< F, X1, X2, X3 > = 0>
internal::MatrixMN< N2, N2 >::type gtsam::numericalHessian322 (F &&f, const X1 &x1, const X2 &x2, const X3 &x3, double delta=1e-5)
 Hessian with respect to argument 2 of a ternary scalar function.
template<class X1, class X2, class X3, int N2 = traits<X2>::dimension>
internal::MatrixMN< N2, N2 >::type gtsam::numericalHessian322 (double(&f)(const X1 &, const X2 &, const X3 &), const X1 &x1, const X2 &x2, const X3 &x3, double delta=1e-5)
 Raw-function overload for numericalHessian322.
template<class X1, class X2, class X3, int N3 = traits<X3>::dimension, class F, internal::EnableIfScalarInvocable< F, X1, X2, X3 > = 0>
internal::MatrixMN< N3, N3 >::type gtsam::numericalHessian333 (F &&f, const X1 &x1, const X2 &x2, const X3 &x3, double delta=1e-5)
 Hessian with respect to argument 3 of a ternary scalar function.
template<class X1, class X2, class X3, int N3 = traits<X3>::dimension>
internal::MatrixMN< N3, N3 >::type gtsam::numericalHessian333 (double(&f)(const X1 &, const X2 &, const X3 &), const X1 &x1, const X2 &x2, const X3 &x3, double delta=1e-5)
 Raw-function overload for numericalHessian333.
template<class X1, class X2, class X3, int N1 = traits<X1>::dimension, int N2 = traits<X2>::dimension, class F, internal::EnableIfScalarInvocable< F, X1, X2, X3 > = 0>
internal::MatrixMN< N1, N2 >::type gtsam::numericalHessian312 (F &&f, const X1 &x1, const X2 &x2, const X3 &x3, double delta=1e-5)
 Mixed Hessian with respect to arguments 1 and 2 of a ternary scalar function.
template<class X1, class X2, class X3, int N1 = traits<X1>::dimension, int N3 = traits<X3>::dimension, class F, internal::EnableIfScalarInvocable< F, X1, X2, X3 > = 0>
internal::MatrixMN< N1, N3 >::type gtsam::numericalHessian313 (F &&f, const X1 &x1, const X2 &x2, const X3 &x3, double delta=1e-5)
 Mixed Hessian with respect to arguments 1 and 3 of a ternary scalar function.
template<class X1, class X2, class X3, int N2 = traits<X2>::dimension, int N3 = traits<X3>::dimension, class F, internal::EnableIfScalarInvocable< F, X1, X2, X3 > = 0>
internal::MatrixMN< N2, N3 >::type gtsam::numericalHessian323 (F &&f, const X1 &x1, const X2 &x2, const X3 &x3, double delta=1e-5)
 Mixed Hessian with respect to arguments 2 and 3 of a ternary scalar function.
template<class X1, class X2, class X3, int N1 = traits<X1>::dimension, int N2 = traits<X2>::dimension>
internal::MatrixMN< N1, N2 >::type gtsam::numericalHessian312 (double(&f)(const X1 &, const X2 &, const X3 &), const X1 &x1, const X2 &x2, const X3 &x3, double delta=1e-5)
 Raw-function overload for numericalHessian312.
template<class X1, class X2, class X3, int N1 = traits<X1>::dimension, int N3 = traits<X3>::dimension>
internal::MatrixMN< N1, N3 >::type gtsam::numericalHessian313 (double(&f)(const X1 &, const X2 &, const X3 &), const X1 &x1, const X2 &x2, const X3 &x3, double delta=1e-5)
 Raw-function overload for numericalHessian313.
template<class X1, class X2, class X3, int N2 = traits<X2>::dimension, int N3 = traits<X3>::dimension>
internal::MatrixMN< N2, N3 >::type gtsam::numericalHessian323 (double(&f)(const X1 &, const X2 &, const X3 &), const X1 &x1, const X2 &x2, const X3 &x3, double delta=1e-5)
 Raw-function overload for numericalHessian323.

Detailed Description

Finite-difference Jacobian and Hessian utilities for manifold-valued functions.

Function Documentation

◆ numericalDerivative11()

template<class Y = internal::DeducedOutput, class X, int N = traits<X>::dimension, class F, internal::EnableIfInvocable< F, X > = 0>
internal::MatrixMN< traits< internal::OutputType< Y, F, X > >::dimension, N >::type gtsam::numericalDerivative11 ( F && h,
const X & x,
double delta = 1e-5 )

New-style numerical derivatives using manifold_traits.

Computes numerical derivative in argument 1 of unary function

Parameters
hunary function yielding m-vector
xn-dimensional value at which to evaluate h
deltaincrement for numerical derivative
Template Parameters
Youtput manifold type; defaults to the deduced callable output
Xdifferentiated manifold input type
Ntangent dimension of X; provide explicitly for variable-size manifold types
Returns
m*n Jacobian computed via central differencing

◆ numericalDerivative21()

template<class Y = internal::DeducedOutput, class X1, class X2, int N = traits<X1>::dimension, class F, internal::EnableIfInvocable< F, X1, X2 > = 0>
internal::MatrixMN< traits< internal::OutputType< Y, F, X1, X2 > >::dimension, N >::type gtsam::numericalDerivative21 ( F && h,
const X1 & x1,
const X2 & x2,
double delta = 1e-5 )

Compute numerical derivative in argument 1 of binary function.

Parameters
hbinary function yielding m-vector
x1,x2argument values; differentiate with respect to x1
deltaincrement for numerical derivative
Returns
m*n Jacobian computed via central differencing
Template Parameters
intN is the dimension of the X1 input value if variable dimension type but known at test time

◆ numericalDerivative22()

template<class Y = internal::DeducedOutput, class X1, class X2, int N = traits<X2>::dimension, class F, internal::EnableIfInvocable< F, X1, X2 > = 0>
internal::MatrixMN< traits< internal::OutputType< Y, F, X1, X2 > >::dimension, N >::type gtsam::numericalDerivative22 ( F && h,
const X1 & x1,
const X2 & x2,
double delta = 1e-5 )

Compute numerical derivative in argument 2 of binary function.

Parameters
hbinary function yielding m-vector
x1,x2argument values; differentiate with respect to x2
deltaincrement for numerical derivative
Returns
m*n Jacobian computed via central differencing
Template Parameters
intN is the dimension of the X2 input value if variable dimension type but known at test time

◆ numericalDerivative31()

template<class Y = internal::DeducedOutput, class X1, class X2, class X3, int N = traits<X1>::dimension, class F, internal::EnableIfInvocable< F, X1, X2, X3 > = 0>
internal::MatrixMN< traits< internal::OutputType< Y, F, X1, X2, X3 > >::dimension, N >::type gtsam::numericalDerivative31 ( F && h,
const X1 & x1,
const X2 & x2,
const X3 & x3,
double delta = 1e-5 )

Compute numerical derivative in argument 1 of ternary function.

Parameters
hternary function yielding m-vector
x1,x2,x3argument values; differentiate with respect to x1
deltaincrement for numerical derivative
Returns
m*n Jacobian computed via central differencing
Template Parameters
intN is the dimension of the X1 input value if variable dimension type but known at test time

◆ numericalDerivative32()

template<class Y = internal::DeducedOutput, class X1, class X2, class X3, int N = traits<X2>::dimension, class F, internal::EnableIfInvocable< F, X1, X2, X3 > = 0>
internal::MatrixMN< traits< internal::OutputType< Y, F, X1, X2, X3 > >::dimension, N >::type gtsam::numericalDerivative32 ( F && h,
const X1 & x1,
const X2 & x2,
const X3 & x3,
double delta = 1e-5 )

Compute numerical derivative in argument 2 of ternary function.

Parameters
hternary function yielding m-vector
x1,x2,x3argument values; differentiate with respect to x2
deltaincrement for numerical derivative
Returns
m*n Jacobian computed via central differencing
Template Parameters
intN is the dimension of the X2 input value if variable dimension type but known at test time

◆ numericalDerivative33()

template<class Y = internal::DeducedOutput, class X1, class X2, class X3, int N = traits<X3>::dimension, class F, internal::EnableIfInvocable< F, X1, X2, X3 > = 0>
internal::MatrixMN< traits< internal::OutputType< Y, F, X1, X2, X3 > >::dimension, N >::type gtsam::numericalDerivative33 ( F && h,
const X1 & x1,
const X2 & x2,
const X3 & x3,
double delta = 1e-5 )

Compute numerical derivative in argument 3 of ternary function.

Parameters
hternary function yielding m-vector
x1,x2,x3argument values; differentiate with respect to x3
deltaincrement for numerical derivative
Returns
m*n Jacobian computed via central differencing
Template Parameters
intN is the dimension of the X3 input value if variable dimension type but known at test time

◆ numericalDerivative41()

template<class Y = internal::DeducedOutput, class X1, class X2, class X3, class X4, int N = traits<X1>::dimension, class F, internal::EnableIfInvocable< F, X1, X2, X3, X4 > = 0>
internal::MatrixMN< traits< internal::OutputType< Y, F, X1, X2, X3, X4 > >::dimension, N >::type gtsam::numericalDerivative41 ( F && h,
const X1 & x1,
const X2 & x2,
const X3 & x3,
const X4 & x4,
double delta = 1e-5 )

Compute numerical derivative in argument 1 of 4-argument function.

Parameters
hquartic function yielding m-vector
x1,x2,x3,x4argument values; differentiate with respect to x1
deltaincrement for numerical derivative
Returns
m*n Jacobian computed via central differencing
Template Parameters
intN is the dimension of the X1 input value if variable dimension type but known at test time

◆ numericalDerivative42()

template<class Y = internal::DeducedOutput, class X1, class X2, class X3, class X4, int N = traits<X2>::dimension, class F, internal::EnableIfInvocable< F, X1, X2, X3, X4 > = 0>
internal::MatrixMN< traits< internal::OutputType< Y, F, X1, X2, X3, X4 > >::dimension, N >::type gtsam::numericalDerivative42 ( F && h,
const X1 & x1,
const X2 & x2,
const X3 & x3,
const X4 & x4,
double delta = 1e-5 )

Compute numerical derivative in argument 2 of 4-argument function.

Parameters
hquartic function yielding m-vector
x1,x2,x3,x4argument values; differentiate with respect to x2
deltaincrement for numerical derivative
Returns
m*n Jacobian computed via central differencing
Template Parameters
intN is the dimension of the X2 input value if variable dimension type but known at test time

◆ numericalDerivative43()

template<class Y = internal::DeducedOutput, class X1, class X2, class X3, class X4, int N = traits<X3>::dimension, class F, internal::EnableIfInvocable< F, X1, X2, X3, X4 > = 0>
internal::MatrixMN< traits< internal::OutputType< Y, F, X1, X2, X3, X4 > >::dimension, N >::type gtsam::numericalDerivative43 ( F && h,
const X1 & x1,
const X2 & x2,
const X3 & x3,
const X4 & x4,
double delta = 1e-5 )

Compute numerical derivative in argument 3 of 4-argument function.

Parameters
hquartic function yielding m-vector
x1,x2,x3,x4argument values; differentiate with respect to x3
deltaincrement for numerical derivative
Returns
m*n Jacobian computed via central differencing
Template Parameters
intN is the dimension of the X3 input value if variable dimension type but known at test time

◆ numericalDerivative44()

template<class Y = internal::DeducedOutput, class X1, class X2, class X3, class X4, int N = traits<X4>::dimension, class F, internal::EnableIfInvocable< F, X1, X2, X3, X4 > = 0>
internal::MatrixMN< traits< internal::OutputType< Y, F, X1, X2, X3, X4 > >::dimension, N >::type gtsam::numericalDerivative44 ( F && h,
const X1 & x1,
const X2 & x2,
const X3 & x3,
const X4 & x4,
double delta = 1e-5 )

Compute numerical derivative in argument 4 of 4-argument function.

Parameters
hquartic function yielding m-vector
x1,x2,x3,x4argument values; differentiate with respect to x4
deltaincrement for numerical derivative
Returns
m*n Jacobian computed via central differencing
Template Parameters
intN is the dimension of the X4 input value if variable dimension type but known at test time

◆ numericalDerivative51()

template<class Y = internal::DeducedOutput, class X1, class X2, class X3, class X4, class X5, int N = traits<X1>::dimension, class F, internal::EnableIfInvocable< F, X1, X2, X3, X4, X5 > = 0>
internal::MatrixMN< traits< internal::OutputType< Y, F, X1, X2, X3, X4, X5 > >::dimension, N >::type gtsam::numericalDerivative51 ( F && h,
const X1 & x1,
const X2 & x2,
const X3 & x3,
const X4 & x4,
const X5 & x5,
double delta = 1e-5 )

Compute numerical derivative in argument 1 of 5-argument function.

Parameters
hquintic function yielding m-vector
x1,...,x5argument values; differentiate with respect to x1
deltaincrement for numerical derivative
Returns
m*n Jacobian computed via central differencing
Template Parameters
intN is the dimension of the X1 input value if variable dimension type but known at test time

◆ numericalDerivative52()

template<class Y = internal::DeducedOutput, class X1, class X2, class X3, class X4, class X5, int N = traits<X2>::dimension, class F, internal::EnableIfInvocable< F, X1, X2, X3, X4, X5 > = 0>
internal::MatrixMN< traits< internal::OutputType< Y, F, X1, X2, X3, X4, X5 > >::dimension, N >::type gtsam::numericalDerivative52 ( F && h,
const X1 & x1,
const X2 & x2,
const X3 & x3,
const X4 & x4,
const X5 & x5,
double delta = 1e-5 )

Compute numerical derivative in argument 2 of 5-argument function.

Parameters
hquintic function yielding m-vector
x1,...,x5argument values; differentiate with respect to x2
deltaincrement for numerical derivative
Returns
m*n Jacobian computed via central differencing
Template Parameters
intN is the dimension of the X2 input value if variable dimension type but known at test time

◆ numericalDerivative53()

template<class Y = internal::DeducedOutput, class X1, class X2, class X3, class X4, class X5, int N = traits<X3>::dimension, class F, internal::EnableIfInvocable< F, X1, X2, X3, X4, X5 > = 0>
internal::MatrixMN< traits< internal::OutputType< Y, F, X1, X2, X3, X4, X5 > >::dimension, N >::type gtsam::numericalDerivative53 ( F && h,
const X1 & x1,
const X2 & x2,
const X3 & x3,
const X4 & x4,
const X5 & x5,
double delta = 1e-5 )

Compute numerical derivative in argument 3 of 5-argument function.

Parameters
hquintic function yielding m-vector
x1,...,x5argument values; differentiate with respect to x3
deltaincrement for numerical derivative
Returns
m*n Jacobian computed via central differencing
Template Parameters
intN is the dimension of the X3 input value if variable dimension type but known at test time

◆ numericalDerivative54()

template<class Y = internal::DeducedOutput, class X1, class X2, class X3, class X4, class X5, int N = traits<X4>::dimension, class F, internal::EnableIfInvocable< F, X1, X2, X3, X4, X5 > = 0>
internal::MatrixMN< traits< internal::OutputType< Y, F, X1, X2, X3, X4, X5 > >::dimension, N >::type gtsam::numericalDerivative54 ( F && h,
const X1 & x1,
const X2 & x2,
const X3 & x3,
const X4 & x4,
const X5 & x5,
double delta = 1e-5 )

Compute numerical derivative in argument 4 of 5-argument function.

Parameters
hquintic function yielding m-vector
x1,...,x5argument values; differentiate with respect to x4
deltaincrement for numerical derivative
Returns
m*n Jacobian computed via central differencing
Template Parameters
intN is the dimension of the X4 input value if variable dimension type but known at test time

◆ numericalDerivative55()

template<class Y = internal::DeducedOutput, class X1, class X2, class X3, class X4, class X5, int N = traits<X5>::dimension, class F, internal::EnableIfInvocable< F, X1, X2, X3, X4, X5 > = 0>
internal::MatrixMN< traits< internal::OutputType< Y, F, X1, X2, X3, X4, X5 > >::dimension, N >::type gtsam::numericalDerivative55 ( F && h,
const X1 & x1,
const X2 & x2,
const X3 & x3,
const X4 & x4,
const X5 & x5,
double delta = 1e-5 )

Compute numerical derivative in argument 5 of 5-argument function.

Parameters
hquintic function yielding m-vector
x1,...,x5argument values; differentiate with respect to x5
deltaincrement for numerical derivative
Returns
m*n Jacobian computed via central differencing
Template Parameters
intN is the dimension of the X5 input value if variable dimension type but known at test time

◆ numericalDerivative61()

template<class Y = internal::DeducedOutput, class X1, class X2, class X3, class X4, class X5, class X6, int N = traits<X1>::dimension, class F, internal::EnableIfInvocable< F, X1, X2, X3, X4, X5, X6 > = 0>
internal::MatrixMN< traits< internal::OutputType< Y, F, X1, X2, X3, X4, X5, X6 > >::dimension, N >::type gtsam::numericalDerivative61 ( F && h,
const X1 & x1,
const X2 & x2,
const X3 & x3,
const X4 & x4,
const X5 & x5,
const X6 & x6,
double delta = 1e-5 )

Compute numerical derivative in argument 1 of 6-argument function.

Parameters
hquintic function yielding m-vector
x1,...,x6argument values; differentiate with respect to x1
deltaincrement for numerical derivative
Returns
m*n Jacobian computed via central differencing
Template Parameters
intN is the dimension of the X1 input value if variable dimension type but known at test time

◆ numericalDerivative62()

template<class Y = internal::DeducedOutput, class X1, class X2, class X3, class X4, class X5, class X6, int N = traits<X2>::dimension, class F, internal::EnableIfInvocable< F, X1, X2, X3, X4, X5, X6 > = 0>
internal::MatrixMN< traits< internal::OutputType< Y, F, X1, X2, X3, X4, X5, X6 > >::dimension, N >::type gtsam::numericalDerivative62 ( F && h,
const X1 & x1,
const X2 & x2,
const X3 & x3,
const X4 & x4,
const X5 & x5,
const X6 & x6,
double delta = 1e-5 )

Compute numerical derivative in argument 2 of 6-argument function.

Parameters
hquintic function yielding m-vector
x1,...,x6argument values; differentiate with respect to x2
deltaincrement for numerical derivative
Returns
m*n Jacobian computed via central differencing
Template Parameters
intN is the dimension of the X2 input value if variable dimension type but known at test time

◆ numericalDerivative63()

template<class Y = internal::DeducedOutput, class X1, class X2, class X3, class X4, class X5, class X6, int N = traits<X3>::dimension, class F, internal::EnableIfInvocable< F, X1, X2, X3, X4, X5, X6 > = 0>
internal::MatrixMN< traits< internal::OutputType< Y, F, X1, X2, X3, X4, X5, X6 > >::dimension, N >::type gtsam::numericalDerivative63 ( F && h,
const X1 & x1,
const X2 & x2,
const X3 & x3,
const X4 & x4,
const X5 & x5,
const X6 & x6,
double delta = 1e-5 )

Compute numerical derivative in argument 3 of 6-argument function.

Parameters
hquintic function yielding m-vector
x1,...,x6argument values; differentiate with respect to x3
deltaincrement for numerical derivative
Returns
m*n Jacobian computed via central differencing
Template Parameters
intN is the dimension of the X3 input value if variable dimension type but known at test time

◆ numericalDerivative64()

template<class Y = internal::DeducedOutput, class X1, class X2, class X3, class X4, class X5, class X6, int N = traits<X4>::dimension, class F, internal::EnableIfInvocable< F, X1, X2, X3, X4, X5, X6 > = 0>
internal::MatrixMN< traits< internal::OutputType< Y, F, X1, X2, X3, X4, X5, X6 > >::dimension, N >::type gtsam::numericalDerivative64 ( F && h,
const X1 & x1,
const X2 & x2,
const X3 & x3,
const X4 & x4,
const X5 & x5,
const X6 & x6,
double delta = 1e-5 )

Compute numerical derivative in argument 4 of 6-argument function.

Parameters
hquintic function yielding m-vector
x1,...,x6argument values; differentiate with respect to x4
deltaincrement for numerical derivative
Returns
m*n Jacobian computed via central differencing
Template Parameters
intN is the dimension of the X4 input value if variable dimension type but known at test time

◆ numericalDerivative65()

template<class Y = internal::DeducedOutput, class X1, class X2, class X3, class X4, class X5, class X6, int N = traits<X5>::dimension, class F, internal::EnableIfInvocable< F, X1, X2, X3, X4, X5, X6 > = 0>
internal::MatrixMN< traits< internal::OutputType< Y, F, X1, X2, X3, X4, X5, X6 > >::dimension, N >::type gtsam::numericalDerivative65 ( F && h,
const X1 & x1,
const X2 & x2,
const X3 & x3,
const X4 & x4,
const X5 & x5,
const X6 & x6,
double delta = 1e-5 )

Compute numerical derivative in argument 5 of 6-argument function.

Parameters
hquintic function yielding m-vector
x1,...,x6argument values; differentiate with respect to x5
deltaincrement for numerical derivative
Returns
m*n Jacobian computed via central differencing
Template Parameters
intN is the dimension of the X5 input value if variable dimension type but known at test time

◆ numericalDerivative66()

template<class Y = internal::DeducedOutput, class X1, class X2, class X3, class X4, class X5, class X6, int N = traits<X6>::dimension, class F, internal::EnableIfInvocable< F, X1, X2, X3, X4, X5, X6 > = 0>
internal::MatrixMN< traits< internal::OutputType< Y, F, X1, X2, X3, X4, X5, X6 > >::dimension, N >::type gtsam::numericalDerivative66 ( F && h,
const X1 & x1,
const X2 & x2,
const X3 & x3,
const X4 & x4,
const X5 & x5,
const X6 & x6,
double delta = 1e-5 )

Compute numerical derivative in argument 6 of 6-argument function.

Parameters
hquintic function yielding m-vector
x1,...,x6argument values; differentiate with respect to x6
deltaincrement for numerical derivative
Returns
m*n Jacobian computed via central differencing
Template Parameters
intN is the dimension of the X6 input value if variable dimension type but known at test time

◆ numericalGradient()

template<class X, int N = traits<X>::dimension, class F, internal::EnableIfScalarInvocable< F, X > = 0>
Eigen::Matrix< double, N, 1 > gtsam::numericalGradient ( F && h,
const X & x,
double delta = 1e-5 )

Numerically compute gradient of scalar function.

Template requirements
  • Callable argument: h must be invocable with const references to the corresponding argument types (const X&, const X1&, ...).
  • Output type: Y (or the deduced output type when Y is omitted) must be a manifold type (traits<Y>::structure_category derives from manifold_tag) and support traits<Y>::Local and traits<Y>::GetDimension.
  • Differentiated input type: only the argument being differentiated (X, X1, X2, ...) must be a manifold type and support traits<X>::Retract.
  • Other input types: non-differentiated arguments only need to satisfy callable invocation of h.
  • Dimension parameter: N must be positive; for variable-size manifold types, N must be provided explicitly.
Returns
n-dimensional gradient computed via central differencing
Template Parameters
Xmanifold input type
Ntangent dimension of X; provide explicitly for variable-size manifold types

◆ numericalHessian()

template<class X, int N = traits<X>::dimension, class F, internal::EnableIfScalarInvocable< F, X > = 0>
internal::MatrixMN< N, N >::type gtsam::numericalHessian ( F && f,
const X & x,
double delta = 1e-5 )
inline

Compute numerical Hessian matrix.

Requires a single-argument Lie->scalar function. This is implemented simply as the derivative of the gradient.

Parameters
fA function taking a Lie object as input and returning a scalar
xThe center point for computing the Hessian
deltaThe numerical derivative step size
Returns
n*n Hessian matrix computed via central differencing

◆ numericalHessian311()

template<class X1, class X2, class X3, int N1 = traits<X1>::dimension, class F, internal::EnableIfScalarInvocable< F, X1, X2, X3 > = 0>
internal::MatrixMN< N1, N1 >::type gtsam::numericalHessian311 ( F && f,
const X1 & x1,
const X2 & x2,
const X3 & x3,
double delta = 1e-5 )
inline

Numerical Hessian for ternary functions.

Hessian with respect to argument 1 of a ternary scalar function.