roboptim::CachedFunction< T > Class Template Reference

Store previous function computation. More...

#include <roboptim/core/filter/cached-function.hh>

Inheritance diagram for roboptim::CachedFunction< T >:

Public Types

typedef DifferentiableFunction::value_type value_type
 Import value type. More...
 
typedef DifferentiableFunction::size_type size_type
 Import size type. More...
 
typedef DifferentiableFunction::vector_t vector_t
 Import vector type. More...
 
typedef DifferentiableFunction::result_t result_t
 Import result type. More...
 
typedef DifferentiableFunction::argument_t argument_t
 Import argument type. More...
 
typedef DifferentiableFunction::gradient_t gradient_t
 Import gradient type. More...
 
typedef TwiceDifferentiableFunction::hessian_t hessian_t
 Import hessian type. More...
 
typedef DifferentiableFunction::jacobian_t jacobian_t
 Import jacobian type. More...
 
typedef DifferentiableFunction::interval_t interval_t
 Import interval type. More...
 
typedef std::map< Function::vector_t, Function::vector_t, detail::ltvectorfunctionCache_t
 
typedef std::map< Function::vector_t, hessian_t, detail::ltvectorhessianCache_t
 

Public Member Functions

 CachedFunction (boost::shared_ptr< const T > fct) throw ()
 
 ~CachedFunction () throw ()
 
void reset () throw ()
 

Protected Member Functions

virtual void impl_compute (result_t &result, const argument_t &argument) const throw ()
 
virtual void impl_gradient (gradient_t &gradient, const argument_t &argument, size_type functionId=0) const throw ()
 
virtual void impl_hessian (hessian_t &hessian, const argument_t &argument, size_type functionId=0) const throw ()
 
virtual void impl_derivative (gradient_t &derivative, double argument, size_type order=1) const throw ()
 
template<>
void impl_gradient (gradient_t &, const argument_t &, size_type) const throw()
 
template<>
void impl_hessian (hessian_t &, const argument_t &, size_type) const throw()
 
template<>
void impl_hessian (hessian_t &, const argument_t &, size_type) const throw()
 
template<>
void impl_derivative (gradient_t &, double, size_type) const throw()
 
template<>
void impl_derivative (gradient_t &, double, size_type) const throw()
 
template<>
void impl_derivative (gradient_t &, double, size_type) const throw()
 

Detailed Description

template<typename T>
class roboptim::CachedFunction< T >

Store previous function computation.

When an expensive function is called several times at the same point (exactly!), the cached function prevents useless computation by caching the function result.

This filter is experimental in this release.

Member Typedef Documentation

Import argument type.

Import gradient type.

Import hessian type.

template<typename T >
typedef std::map<Function::vector_t, hessian_t, detail::ltvector> roboptim::CachedFunction< T >::hessianCache_t

Import interval type.

Import jacobian type.

Import result type.

Import size type.

Import value type.

Import vector type.

Constructor & Destructor Documentation

template<typename T >
roboptim::CachedFunction< T >::CachedFunction ( boost::shared_ptr< const T >  fct)
throw (
)
explicit
template<typename T >
roboptim::CachedFunction< T >::~CachedFunction ( )
throw (
)

Member Function Documentation

template<typename T >
void roboptim::CachedFunction< T >::impl_compute ( result_t result,
const argument_t argument 
) const
throw (
)
protectedvirtual
template<typename T >
void roboptim::CachedFunction< T >::impl_derivative ( gradient_t derivative,
double  argument,
size_type  order = 1 
) const
throw (
)
protectedvirtual
template<>
void roboptim::CachedFunction< Function >::impl_derivative ( gradient_t ,
double  ,
size_type   
) const
throw(
)
protected
template<>
void roboptim::CachedFunction< DifferentiableFunction >::impl_derivative ( gradient_t ,
double  ,
size_type   
) const
throw(
)
protected
template<>
void roboptim::CachedFunction< TwiceDifferentiableFunction >::impl_derivative ( gradient_t ,
double  ,
size_type   
) const
throw(
)
protected
template<>
void roboptim::CachedFunction< Function >::impl_gradient ( gradient_t ,
const argument_t ,
size_type   
) const
throw(
)
protected
template<typename T >
void roboptim::CachedFunction< T >::impl_gradient ( gradient_t gradient,
const argument_t argument,
size_type  functionId = 0 
) const
throw (
)
protectedvirtual
template<typename T >
void roboptim::CachedFunction< T >::impl_hessian ( hessian_t hessian,
const argument_t argument,
size_type  functionId = 0 
) const
throw (
)
protectedvirtual
template<>
void roboptim::CachedFunction< Function >::impl_hessian ( hessian_t ,
const argument_t ,
size_type   
) const
throw(
)
protected
template<>
void roboptim::CachedFunction< DifferentiableFunction >::impl_hessian ( hessian_t ,
const argument_t ,
size_type   
) const
throw(
)
protected
template<typename T >
void roboptim::CachedFunction< T >::reset ( )
throw (
)