gtsam 4.1.1
gtsam
numericalDerivative.h File Reference

Some functions to compute numerical derivatives. More...

Go to the source code of this file.

Classes

struct  gtsam::internal::FixedSizeMatrix< Y, X >
 
class  gtsam::G_x1< X1, X2 >
 Helper class that computes the derivative of f w.r.t. More...
 

Namespaces

namespace  gtsam
 Global functions in a separate testing namespace.
 

Functions

template<class X , int N = traits<X>::dimension>
Eigen::Matrix< double, N, 1 > gtsam::numericalGradient (std::function< double(const X &)> h, const X &x, double delta=1e-5)
 Numerically compute gradient of scalar function. More...
 
template<class Y , class X , int N = traits<X>::dimension>
internal::FixedSizeMatrix< Y, X >::type gtsam::numericalDerivative11 (std::function< Y(const X &)> h, const X &x, double delta=1e-5)
 New-style numerical derivatives using manifold_traits. More...
 
template<class Y , class X >
internal::FixedSizeMatrix< Y, X >::type gtsam::numericalDerivative11 (Y(*h)(const X &), const X &x, double delta=1e-5)
 use a raw C++ function pointer
 
template<class Y , class X1 , class X2 , int N = traits<X1>::dimension>
internal::FixedSizeMatrix< Y, X1 >::type gtsam::numericalDerivative21 (const std::function< Y(const X1 &, const X2 &)> &h, const X1 &x1, const X2 &x2, double delta=1e-5)
 Compute numerical derivative in argument 1 of binary function. More...
 
template<class Y , class X1 , class X2 >
internal::FixedSizeMatrix< Y, X1 >::type gtsam::numericalDerivative21 (Y(*h)(const X1 &, const X2 &), const X1 &x1, const X2 &x2, double delta=1e-5)
 use a raw C++ function pointer
 
template<class Y , class X1 , class X2 , int N = traits<X2>::dimension>
internal::FixedSizeMatrix< Y, X2 >::type gtsam::numericalDerivative22 (std::function< Y(const X1 &, const X2 &)> h, const X1 &x1, const X2 &x2, double delta=1e-5)
 Compute numerical derivative in argument 2 of binary function. More...
 
template<class Y , class X1 , class X2 >
internal::FixedSizeMatrix< Y, X2 >::type gtsam::numericalDerivative22 (Y(*h)(const X1 &, const X2 &), const X1 &x1, const X2 &x2, double delta=1e-5)
 use a raw C++ function pointer
 
template<class Y , class X1 , class X2 , class X3 , int N = traits<X1>::dimension>
internal::FixedSizeMatrix< Y, X1 >::type gtsam::numericalDerivative31 (std::function< Y(const X1 &, const X2 &, const X3 &)> h, const X1 &x1, const X2 &x2, const X3 &x3, double delta=1e-5)
 Compute numerical derivative in argument 1 of ternary function. More...
 
template<class Y , class X1 , class X2 , class X3 >
internal::FixedSizeMatrix< Y, X1 >::type gtsam::numericalDerivative31 (Y(*h)(const X1 &, const X2 &, const X3 &), const X1 &x1, const X2 &x2, const X3 &x3, double delta=1e-5)
 
template<class Y , class X1 , class X2 , class X3 , int N = traits<X2>::dimension>
internal::FixedSizeMatrix< Y, X2 >::type gtsam::numericalDerivative32 (std::function< Y(const X1 &, const X2 &, const X3 &)> h, const X1 &x1, const X2 &x2, const X3 &x3, double delta=1e-5)
 Compute numerical derivative in argument 2 of ternary function. More...
 
template<class Y , class X1 , class X2 , class X3 >
internal::FixedSizeMatrix< Y, X2 >::type gtsam::numericalDerivative32 (Y(*h)(const X1 &, const X2 &, const X3 &), const X1 &x1, const X2 &x2, const X3 &x3, double delta=1e-5)
 
template<class Y , class X1 , class X2 , class X3 , int N = traits<X3>::dimension>
internal::FixedSizeMatrix< Y, X3 >::type gtsam::numericalDerivative33 (std::function< Y(const X1 &, const X2 &, const X3 &)> h, const X1 &x1, const X2 &x2, const X3 &x3, double delta=1e-5)
 Compute numerical derivative in argument 3 of ternary function. More...
 
template<class Y , class X1 , class X2 , class X3 >
internal::FixedSizeMatrix< Y, X3 >::type gtsam::numericalDerivative33 (Y(*h)(const X1 &, const X2 &, const X3 &), const X1 &x1, const X2 &x2, const X3 &x3, double delta=1e-5)
 
template<class Y , class X1 , class X2 , class X3 , class X4 , int N = traits<X1>::dimension>
internal::FixedSizeMatrix< Y, X1 >::type gtsam::numericalDerivative41 (std::function< Y(const X1 &, const X2 &, const X3 &, const X4 &)> 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. More...
 
template<class Y , class X1 , class X2 , class X3 , class X4 >
internal::FixedSizeMatrix< Y, X1 >::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)
 
template<class Y , class X1 , class X2 , class X3 , class X4 , int N = traits<X2>::dimension>
internal::FixedSizeMatrix< Y, X2 >::type gtsam::numericalDerivative42 (std::function< Y(const X1 &, const X2 &, const X3 &, const X4 &)> 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. More...
 
template<class Y , class X1 , class X2 , class X3 , class X4 >
internal::FixedSizeMatrix< Y, X2 >::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)
 
template<class Y , class X1 , class X2 , class X3 , class X4 , int N = traits<X3>::dimension>
internal::FixedSizeMatrix< Y, X3 >::type gtsam::numericalDerivative43 (std::function< Y(const X1 &, const X2 &, const X3 &, const X4 &)> 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. More...
 
template<class Y , class X1 , class X2 , class X3 , class X4 >
internal::FixedSizeMatrix< Y, X3 >::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)
 
template<class Y , class X1 , class X2 , class X3 , class X4 , int N = traits<X4>::dimension>
internal::FixedSizeMatrix< Y, X4 >::type gtsam::numericalDerivative44 (std::function< Y(const X1 &, const X2 &, const X3 &, const X4 &)> 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. More...
 
template<class Y , class X1 , class X2 , class X3 , class X4 >
internal::FixedSizeMatrix< Y, X4 >::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)
 
template<class Y , class X1 , class X2 , class X3 , class X4 , class X5 , int N = traits<X1>::dimension>
internal::FixedSizeMatrix< Y, X1 >::type gtsam::numericalDerivative51 (std::function< Y(const X1 &, const X2 &, const X3 &, const X4 &, const X5 &)> 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. More...
 
template<class Y , class X1 , class X2 , class X3 , class X4 , class X5 >
internal::FixedSizeMatrix< Y, X1 >::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)
 
template<class Y , class X1 , class X2 , class X3 , class X4 , class X5 , int N = traits<X2>::dimension>
internal::FixedSizeMatrix< Y, X2 >::type gtsam::numericalDerivative52 (std::function< Y(const X1 &, const X2 &, const X3 &, const X4 &, const X5 &)> 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. More...
 
template<class Y , class X1 , class X2 , class X3 , class X4 , class X5 >
internal::FixedSizeMatrix< Y, X2 >::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)
 
template<class Y , class X1 , class X2 , class X3 , class X4 , class X5 , int N = traits<X3>::dimension>
internal::FixedSizeMatrix< Y, X3 >::type gtsam::numericalDerivative53 (std::function< Y(const X1 &, const X2 &, const X3 &, const X4 &, const X5 &)> 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. More...
 
template<class Y , class X1 , class X2 , class X3 , class X4 , class X5 >
internal::FixedSizeMatrix< Y, X3 >::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)
 
template<class Y , class X1 , class X2 , class X3 , class X4 , class X5 , int N = traits<X4>::dimension>
internal::FixedSizeMatrix< Y, X4 >::type gtsam::numericalDerivative54 (std::function< Y(const X1 &, const X2 &, const X3 &, const X4 &, const X5 &)> 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. More...
 
template<class Y , class X1 , class X2 , class X3 , class X4 , class X5 >
internal::FixedSizeMatrix< Y, X4 >::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)
 
template<class Y , class X1 , class X2 , class X3 , class X4 , class X5 , int N = traits<X5>::dimension>
internal::FixedSizeMatrix< Y, X5 >::type gtsam::numericalDerivative55 (std::function< Y(const X1 &, const X2 &, const X3 &, const X4 &, const X5 &)> 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. More...
 
template<class Y , class X1 , class X2 , class X3 , class X4 , class X5 >
internal::FixedSizeMatrix< Y, X5 >::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)
 
template<class Y , class X1 , class X2 , class X3 , class X4 , class X5 , class X6 , int N = traits<X1>::dimension>
internal::FixedSizeMatrix< Y, X1 >::type gtsam::numericalDerivative61 (std::function< Y(const X1 &, const X2 &, const X3 &, const X4 &, const X5 &, const X6 &)> 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. More...
 
template<class Y , class X1 , class X2 , class X3 , class X4 , class X5 , class X6 >
internal::FixedSizeMatrix< Y, X1 >::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)
 
template<class Y , class X1 , class X2 , class X3 , class X4 , class X5 , class X6 , int N = traits<X2>::dimension>
internal::FixedSizeMatrix< Y, X2 >::type gtsam::numericalDerivative62 (std::function< Y(const X1 &, const X2 &, const X3 &, const X4 &, const X5 &, const X6 &)> 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. More...
 
template<class Y , class X1 , class X2 , class X3 , class X4 , class X5 , class X6 >
internal::FixedSizeMatrix< Y, X2 >::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)
 
template<class Y , class X1 , class X2 , class X3 , class X4 , class X5 , class X6 , int N = traits<X3>::dimension>
internal::FixedSizeMatrix< Y, X3 >::type gtsam::numericalDerivative63 (std::function< Y(const X1 &, const X2 &, const X3 &, const X4 &, const X5 &, const X6 &)> 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. More...
 
template<class Y , class X1 , class X2 , class X3 , class X4 , class X5 , class X6 >
internal::FixedSizeMatrix< Y, X3 >::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)
 
template<class Y , class X1 , class X2 , class X3 , class X4 , class X5 , class X6 , int N = traits<X4>::dimension>
internal::FixedSizeMatrix< Y, X4 >::type gtsam::numericalDerivative64 (std::function< Y(const X1 &, const X2 &, const X3 &, const X4 &, const X5 &, const X6 &)> 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. More...
 
template<class Y , class X1 , class X2 , class X3 , class X4 , class X5 , class X6 >
internal::FixedSizeMatrix< Y, X4 >::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)
 
template<class Y , class X1 , class X2 , class X3 , class X4 , class X5 , class X6 , int N = traits<X5>::dimension>
internal::FixedSizeMatrix< Y, X5 >::type gtsam::numericalDerivative65 (std::function< Y(const X1 &, const X2 &, const X3 &, const X4 &, const X5 &, const X6 &)> 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. More...
 
template<class Y , class X1 , class X2 , class X3 , class X4 , class X5 , class X6 >
internal::FixedSizeMatrix< Y, X5 >::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)
 
template<class Y , class X1 , class X2 , class X3 , class X4 , class X5 , class X6 , int N = traits<X6>::dimension>
internal::FixedSizeMatrix< Y, X6 >::type gtsam::numericalDerivative66 (std::function< Y(const X1 &, const X2 &, const X3 &, const X4 &, const X5 &, const X6 &)> 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. More...
 
template<class Y , class X1 , class X2 , class X3 , class X4 , class X5 , class X6 >
internal::FixedSizeMatrix< Y, X6 >::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)
 
template<class X >
internal::FixedSizeMatrix< X, X >::type gtsam::numericalHessian (std::function< double(const X &)> f, const X &x, double delta=1e-5)
 Compute numerical Hessian matrix. More...
 
template<class X >
internal::FixedSizeMatrix< X, X >::type gtsam::numericalHessian (double(*f)(const X &), const X &x, double delta=1e-5)
 
template<class X1 , class X2 >
internal::FixedSizeMatrix< X1, X2 >::type gtsam::numericalHessian212 (std::function< double(const X1 &, const X2 &)> f, const X1 &x1, const X2 &x2, double delta=1e-5)
 
template<class X1 , class X2 >
internal::FixedSizeMatrix< X1, X2 >::type gtsam::numericalHessian212 (double(*f)(const X1 &, const X2 &), const X1 &x1, const X2 &x2, double delta=1e-5)
 
template<class X1 , class X2 >
internal::FixedSizeMatrix< X1, X1 >::type gtsam::numericalHessian211 (std::function< double(const X1 &, const X2 &)> f, const X1 &x1, const X2 &x2, double delta=1e-5)
 
template<class X1 , class X2 >
internal::FixedSizeMatrix< X1, X1 >::type gtsam::numericalHessian211 (double(*f)(const X1 &, const X2 &), const X1 &x1, const X2 &x2, double delta=1e-5)
 
template<class X1 , class X2 >
internal::FixedSizeMatrix< X2, X2 >::type gtsam::numericalHessian222 (std::function< double(const X1 &, const X2 &)> f, const X1 &x1, const X2 &x2, double delta=1e-5)
 
template<class X1 , class X2 >
internal::FixedSizeMatrix< X2, X2 >::type gtsam::numericalHessian222 (double(*f)(const X1 &, const X2 &), const X1 &x1, const X2 &x2, double delta=1e-5)
 
template<class X1 , class X2 , class X3 >
internal::FixedSizeMatrix< X1, X1 >::type gtsam::numericalHessian311 (std::function< double(const X1 &, const X2 &, const X3 &)> f, const X1 &x1, const X2 &x2, const X3 &x3, double delta=1e-5)
 Numerical Hessian for tenary functions.
 
template<class X1 , class X2 , class X3 >
internal::FixedSizeMatrix< X1, X1 >::type gtsam::numericalHessian311 (double(*f)(const X1 &, const X2 &, const X3 &), const X1 &x1, const X2 &x2, const X3 &x3, double delta=1e-5)
 
template<class X1 , class X2 , class X3 >
internal::FixedSizeMatrix< X2, X2 >::type gtsam::numericalHessian322 (std::function< double(const X1 &, const X2 &, const X3 &)> f, const X1 &x1, const X2 &x2, const X3 &x3, double delta=1e-5)
 
template<class X1 , class X2 , class X3 >
internal::FixedSizeMatrix< X2, X2 >::type gtsam::numericalHessian322 (double(*f)(const X1 &, const X2 &, const X3 &), const X1 &x1, const X2 &x2, const X3 &x3, double delta=1e-5)
 
template<class X1 , class X2 , class X3 >
internal::FixedSizeMatrix< X3, X3 >::type gtsam::numericalHessian333 (std::function< double(const X1 &, const X2 &, const X3 &)> f, const X1 &x1, const X2 &x2, const X3 &x3, double delta=1e-5)
 
template<class X1 , class X2 , class X3 >
internal::FixedSizeMatrix< X3, X3 >::type gtsam::numericalHessian333 (double(*f)(const X1 &, const X2 &, const X3 &), const X1 &x1, const X2 &x2, const X3 &x3, double delta=1e-5)
 
template<class X1 , class X2 , class X3 >
internal::FixedSizeMatrix< X1, X2 >::type gtsam::numericalHessian312 (std::function< double(const X1 &, const X2 &, const X3 &)> f, const X1 &x1, const X2 &x2, const X3 &x3, double delta=1e-5)
 
template<class X1 , class X2 , class X3 >
internal::FixedSizeMatrix< X1, X3 >::type gtsam::numericalHessian313 (std::function< double(const X1 &, const X2 &, const X3 &)> f, const X1 &x1, const X2 &x2, const X3 &x3, double delta=1e-5)
 
template<class X1 , class X2 , class X3 >
internal::FixedSizeMatrix< X2, X3 >::type gtsam::numericalHessian323 (std::function< double(const X1 &, const X2 &, const X3 &)> f, const X1 &x1, const X2 &x2, const X3 &x3, double delta=1e-5)
 
template<class X1 , class X2 , class X3 >
internal::FixedSizeMatrix< X1, X2 >::type gtsam::numericalHessian312 (double(*f)(const X1 &, const X2 &, const X3 &), const X1 &x1, const X2 &x2, const X3 &x3, double delta=1e-5)
 
template<class X1 , class X2 , class X3 >
internal::FixedSizeMatrix< X1, X3 >::type gtsam::numericalHessian313 (double(*f)(const X1 &, const X2 &, const X3 &), const X1 &x1, const X2 &x2, const X3 &x3, double delta=1e-5)
 
template<class X1 , class X2 , class X3 >
internal::FixedSizeMatrix< X2, X3 >::type gtsam::numericalHessian323 (double(*f)(const X1 &, const X2 &, const X3 &), const X1 &x1, const X2 &x2, const X3 &x3, double delta=1e-5)
 

Detailed Description

Some functions to compute numerical derivatives.

Author
Frank Dellaert