dlr::optimization::GradientFunction< Functor > Class Template Reference

The GradientFunction class template is derived from std::unary_function, and adds one additional member function for computing the gradient of the function output with respect to the argument. More...

#include <gradientFunction.h>

Collaboration diagram for dlr::optimization::GradientFunction< Functor >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 GradientFunction (const Functor &functor, double epsilon=1.0e-6)
 This is the default constructor.
virtual ~GradientFunction ()
 Destructor.
Functor::argument_type gradient (const typename Functor::argument_type &theta)
 This method numerically approximates the gradient of this->operator() by divided differences.
Functor::result_type operator() (const typename Functor::argument_type &theta)
 This method evaluates the function value a the specified point.

Detailed Description

template<class Functor>
class dlr::optimization::GradientFunction< Functor >

The GradientFunction class template is derived from std::unary_function, and adds one additional member function for computing the gradient of the function output with respect to the argument.

Template argument Functor is assumed to be a subclass of std::unary_function. Functor::result_type is assumed to be a continuous scalar type. Functor::argument_type is assumed to be a vector or 1D array type which supports the following interface:

argument_type(size_t N): construct an N-element vector. size_t size(): return the number of elements in the vector. element_type& operator[](size_t i): return a reference to the (i)th element of the array. const element_type& operator[](size_t i) const: return a const reference to the (i)th element of the array.

It is further assumed that element type of argument_type is a continuous scalar, and can be implicitly cast to and from double.

Definition at line 49 of file gradientFunction.h.


Constructor & Destructor Documentation

template<class Functor>
dlr::optimization::GradientFunction< Functor >::GradientFunction ( const Functor &  functor,
double  epsilon = 1.0e-6 
) [inline]

This is the default constructor.

Parameters:
functor This argument is the function object to be adapted.
epsilon If the gradient() method is not overridden in a subclass, the gradient will be computed by using symmetric divided differences with a total step size of 2 * epsilon.

Definition at line 64 of file gradientFunction.h.

References DLR_THROW3.

template<class Functor>
virtual dlr::optimization::GradientFunction< Functor >::~GradientFunction (  )  [inline, virtual]

Destructor.

Definition at line 75 of file gradientFunction.h.


Member Function Documentation

template<class Functor>
Functor::argument_type dlr::optimization::GradientFunction< Functor >::gradient ( const typename Functor::argument_type &  theta  )  [inline]

This method numerically approximates the gradient of this->operator() by divided differences.

This method should often be overridden by a subclass.

Parameters:
theta The point around which to compute the gradient.
Returns:
The computed gradient.

Definition at line 133 of file gradientFunction.h.

template<class Functor>
Functor::result_type dlr::optimization::GradientFunction< Functor >::operator() ( const typename Functor::argument_type &  theta  )  [inline]

This method evaluates the function value a the specified point.

Parameters:
theta The point at which to evaluate the function.
Returns:
The function value at theta.

Definition at line 95 of file gradientFunction.h.


The documentation for this class was generated from the following file:
Generated on Mon Jul 9 20:34:21 2007 for dlrLibs Utility Libraries by  doxygen 1.5.2