Eigen-Contrib  5.0.1-dev+master
 
Loading...
Searching...
No Matches
Eigen::Ridders< Functor_ > Class Template Reference

#include <contrib/Eigen/src/NumericalDiff/Ridders.h>

Detailed Description

template<typename Functor_>
class Eigen::Ridders< Functor_ >

Adaptive numerical Jacobians using Ridders' extrapolation method.

Stores a functor by value and computes its Jacobian from central differences at successively smaller steps. Richardson extrapolation in the squared step size reduces truncation error; the Jacobian column with the smallest estimated error is retained. The stopping test uses the maximum absolute componentwise difference over the entire column.

The functor supplies Scalar, InputType, ValueType, JacobianType, InputsAtCompileTime, ValuesAtCompileTime, values(), and operator(), as for NumericalDiff. The scalar type must be real and non-integer. The functor's inputs() method is required only when calling inputs().

Warning
The functor must be smooth and defined throughout the initial step interval.
derivative.df(x, jacobian); // Returns the number of function evaluations.
derivative.df(x, jacobian, error); // Also returns an absolute error estimate per input coordinate.
Adaptive numerical Jacobians using Ridders' extrapolation method.
Definition Ridders.h:49
Functor & functor()
Definition Ridders.h:100
Template Parameters
Functor_The vector-valued functor to differentiate.

Classes

struct  Parameters
 Parameters controlling the initial interval and the maximum refinement cost. More...
 

Public Member Functions

int df (const InputType &x, JacobianType &jac) const
 Computes the Jacobian using adaptive central differences.
 
int df (const InputType &x, JacobianType &jac, InputType &error) const
 Computes the Jacobian and an absolute error estimate per input coordinate.
 
Functor & functor ()
 
const Functor & functor () const
 
int inputs () const
 
int operator() (const InputType &x, ValueType &values) const
 Evaluates the stored functor.
 
const Parameters & parameters () const
 
 Ridders (const Functor &functor, const Parameters &parameters=Parameters())
 Constructs from a copy of a functor and differentiation parameters.
 
void setParameters (const Parameters &parameters)
 Sets the differentiation parameters.
 
int values () const
 

Constructor & Destructor Documentation

◆ Ridders()

template<typename Functor_>
Eigen::Ridders< Functor_ >::Ridders ( const Functor & functor,
const Parameters & parameters = Parameters() )
inlineexplicit

Constructs from a copy of a functor and differentiation parameters.

Parameters
functorThe functor to differentiate.
parametersThe differentiation parameters.

Member Function Documentation

◆ df() [1/2]

template<typename Functor_>
int Eigen::Ridders< Functor_ >::df ( const InputType & x,
JacobianType & jac ) const
inline

Computes the Jacobian using adaptive central differences.

The caller sizes jac to values() by x.size(). At most 2*maxSteps evaluations are made per coordinate. Difference quotients divide by the separation of the representable evaluation points. Refinement stops when successive tableau diagonals differ by at least twice the best estimated error, when evaluation points coincide or repeat the previous pair, or when a non-finite value is encountered. The best finite estimate is retained; if none exists, the column contains NaNs.

Parameters
[in]xThe evaluation point.
[out]jacThe Jacobian at x.
Returns
the number of functor evaluations.
See also
Parameters

◆ df() [2/2]

template<typename Functor_>
int Eigen::Ridders< Functor_ >::df ( const InputType & x,
JacobianType & jac,
InputType & error ) const
inline

Computes the Jacobian and an absolute error estimate per input coordinate.

The estimate is the maximum componentwise difference from the two parent tableau entries; it is a heuristic, not an error bound. An infinite estimate means no extrapolation was available.

Parameters
[in]xThe evaluation point.
[out]jacThe Jacobian at x, sized by the caller to values() by x.size().
[out]errorThe error estimates, resized to x.size().
Returns
the number of functor evaluations.
See also
Parameters

◆ functor() [1/2]

template<typename Functor_>
Functor & Eigen::Ridders< Functor_ >::functor ( )
inline
Returns
the stored functor.

◆ functor() [2/2]

template<typename Functor_>
const Functor & Eigen::Ridders< Functor_ >::functor ( ) const
inline
Returns
the stored functor.

◆ inputs()

template<typename Functor_>
int Eigen::Ridders< Functor_ >::inputs ( ) const
inline
Returns
the stored functor's number of inputs.

◆ operator()()

template<typename Functor_>
int Eigen::Ridders< Functor_ >::operator() ( const InputType & x,
ValueType & values ) const
inline

Evaluates the stored functor.

Parameters
[in]xThe evaluation point.
[out]valuesThe function values.
Returns
the value returned by the functor.

◆ parameters()

template<typename Functor_>
const Parameters & Eigen::Ridders< Functor_ >::parameters ( ) const
inline
Returns
the differentiation parameters.

◆ setParameters()

template<typename Functor_>
void Eigen::Ridders< Functor_ >::setParameters ( const Parameters & parameters)
inline

Sets the differentiation parameters.

Parameters
parametersThe differentiation parameters.

◆ values()

template<typename Functor_>
int Eigen::Ridders< Functor_ >::values ( ) const
inline
Returns
the stored functor's number of values.

The documentation for this class was generated from the following file: