All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Function decorators

Namespaces

namespace  roboptim::finiteDifferenceGradientPolicies
 Contains finite difference gradients policies.
 

Classes

class  roboptim::CachedFunction< T >
 Store previous function computation. More...
 
class  roboptim::BadGradient< T >
 Exception thrown when a gradient check fails. More...
 
class  roboptim::BadJacobian< T >
 Exception thrown when a Jacobian check fails. More...
 
class  roboptim::GenericFiniteDifferenceGradient< T, FdgPolicy >
 Compute automatically a gradient with finite differences. More...
 

Functions

template<typename T >
std::ostream & roboptim::operator<< (std::ostream &o, const BadGradient< T > &f)
 Override operator<< to handle exception display. More...
 
template<typename T >
std::ostream & roboptim::operator<< (std::ostream &o, const BadJacobian< T > &f)
 Override operator<< to handle exception display. More...
 
template<typename T >
bool roboptim::checkGradient (const GenericDifferentiableFunction< T > &function, typename GenericDifferentiableFunction< T >::size_type functionId, typename GenericDifferentiableFunction< T >::const_argument_ref x, typename GenericDifferentiableFunction< T >::value_type threshold=finiteDifferenceThreshold, typename GenericDifferentiableFunction< T >::value_type fd_eps=finiteDifferenceEpsilon)
 Check if a gradient is valid. More...
 
template<typename T >
void roboptim::checkGradientAndThrow (const GenericDifferentiableFunction< T > &function, typename GenericDifferentiableFunction< T >::size_type functionId, typename GenericDifferentiableFunction< T >::const_argument_ref x, typename GenericDifferentiableFunction< T >::value_type threshold=finiteDifferenceThreshold, typename GenericDifferentiableFunction< T >::value_type fd_eps=finiteDifferenceEpsilon) throw (BadGradient<T>)
 
template<typename T >
bool roboptim::checkJacobian (const GenericDifferentiableFunction< T > &function, typename GenericDifferentiableFunction< T >::const_argument_ref x, typename GenericDifferentiableFunction< T >::value_type threshold=finiteDifferenceThreshold, typename GenericDifferentiableFunction< T >::value_type fd_eps=finiteDifferenceEpsilon)
 Check if a Jacobian is valid. More...
 
template<typename T >
void roboptim::checkJacobianAndThrow (const GenericDifferentiableFunction< T > &function, typename GenericDifferentiableFunction< T >::const_argument_ref x, typename GenericDifferentiableFunction< T >::value_type threshold=finiteDifferenceThreshold, typename GenericDifferentiableFunction< T >::value_type fd_eps=finiteDifferenceEpsilon) throw (BadJacobian<T>)
 

Variables

static const double roboptim::finiteDifferenceThreshold = 1e-4
 Default threshold for checkGradient. More...
 
static const double roboptim::finiteDifferenceEpsilon = 1e-8
 Default epsilon for finite difference class. More...
 

Detailed Description

Function Documentation

template<typename T >
bool roboptim::checkGradient ( const GenericDifferentiableFunction< T > &  function,
typename GenericDifferentiableFunction< T >::size_type  functionId,
typename GenericDifferentiableFunction< T >::const_argument_ref  x,
typename GenericDifferentiableFunction< T >::value_type  threshold = finiteDifferenceThreshold,
typename GenericDifferentiableFunction< T >::value_type  fd_eps = finiteDifferenceEpsilon 
)

Check if a gradient is valid.

Check if a gradient is valid by comparing the distance between its gradient and an automatically computed finite differences gradient.

Parameters
functionfunction that will be checked
functionIdfunction id in split representation
xpoint where the gradient will be evaluated
thresholdmaximum tolerated error
Returns
true if valid, false if not
Examples:
numeric-quadratic-function.cc.

References roboptim::allclose(), roboptim::GenericDifferentiableFunction< T >::gradient(), ROBOPTIM_ALLOW_DEPRECATED_OFF, and ROBOPTIM_ALLOW_DEPRECATED_ON.

template<typename T >
void roboptim::checkGradientAndThrow ( const GenericDifferentiableFunction< T > &  function,
typename GenericDifferentiableFunction< T >::size_type  functionId,
typename GenericDifferentiableFunction< T >::const_argument_ref  x,
typename GenericDifferentiableFunction< T >::value_type  threshold = finiteDifferenceThreshold,
typename GenericDifferentiableFunction< T >::value_type  fd_eps = finiteDifferenceEpsilon 
) throw (BadGradient<T>)
template<typename T >
bool roboptim::checkJacobian ( const GenericDifferentiableFunction< T > &  function,
typename GenericDifferentiableFunction< T >::const_argument_ref  x,
typename GenericDifferentiableFunction< T >::value_type  threshold = finiteDifferenceThreshold,
typename GenericDifferentiableFunction< T >::value_type  fd_eps = finiteDifferenceEpsilon 
)

Check if a Jacobian is valid.

Check if a Jacobian is valid by comparing the distance between the matrix and an automatically computed finite differences Jacobian.

Parameters
functionfunction that will be checked
xpoint where the Jacobian will be evaluated
thresholdmaximum tolerated error
Returns
true if valid, false if not
Examples:
numeric-quadratic-function.cc.

References roboptim::allclose(), roboptim::GenericDifferentiableFunction< T >::jacobian(), ROBOPTIM_ALLOW_DEPRECATED_OFF, and ROBOPTIM_ALLOW_DEPRECATED_ON.

template<typename T >
void roboptim::checkJacobianAndThrow ( const GenericDifferentiableFunction< T > &  function,
typename GenericDifferentiableFunction< T >::const_argument_ref  x,
typename GenericDifferentiableFunction< T >::value_type  threshold = finiteDifferenceThreshold,
typename GenericDifferentiableFunction< T >::value_type  fd_eps = finiteDifferenceEpsilon 
) throw (BadJacobian<T>)
template<typename T >
std::ostream & roboptim::operator<< ( std::ostream &  o,
const BadGradient< T > &  f 
)

Override operator<< to handle exception display.

Parameters
ooutput stream used for display
ffunction to be displayed
Returns
output stream
template<typename T >
std::ostream & roboptim::operator<< ( std::ostream &  o,
const BadJacobian< T > &  f 
)

Override operator<< to handle exception display.

Parameters
ooutput stream used for display
ffunction to be displayed
Returns
output stream

Variable Documentation

const double roboptim::finiteDifferenceEpsilon = 1e-8
static

Default epsilon for finite difference class.

const double roboptim::finiteDifferenceThreshold = 1e-4
static

Default threshold for checkGradient.