roboptim::IdentityFunction Class Reference

Identity function. More...

#include <roboptim/core/identity-function.hh>

Inheritance diagram for roboptim::IdentityFunction:
Collaboration diagram for roboptim::IdentityFunction:

List of all members.

Public Member Functions

 IdentityFunction (const vector_t &offset) throw ()
 Build an identity function.
 ~IdentityFunction () throw ()
virtual std::ostream & print (std::ostream &) const throw ()
 Display the function on the specified output stream.

Protected Member Functions

void impl_compute (result_t &, const argument_t &) const throw ()
 Function evaluation.
void impl_gradient (gradient_t &, const argument_t &, size_type=0) const throw ()
 Gradient evaluation.
void impl_jacobian (jacobian_t &, const argument_t &) const throw ()
 Jacobian evaluation.

Detailed Description

Identity function.

Implement a linear function using the formula:

\[f(x) = x + offset\]

where $A$ and $b$ are set when the class is instantiated.

Examples:
identity-function.cc.

Constructor & Destructor Documentation

Build an identity function.

Parameters:
offsetidentity function offset

Member Function Documentation

void roboptim::IdentityFunction::impl_compute ( result_t result,
const argument_t argument 
) const throw () [protected, virtual]

Function evaluation.

Evaluate the function, has to be implemented in concrete classes.

Warning:
Do not call this function directly, call operator()(result_t&, const argument_t&) const throw () instead.
Parameters:
resultresult will be stored in this vector
argumentpoint at which the function will be evaluated

Implements roboptim::GenericFunction< T >.

void roboptim::IdentityFunction::impl_gradient ( gradient_t gradient,
const argument_t argument,
size_type  functionId = 0 
) const throw () [protected, virtual]

Gradient evaluation.

Compute the gradient, has to be implemented in concrete classes. The gradient is computed for a specific sub-function which id is passed through the functionId argument.

Warning:
Do not call this function directly, call gradient instead.
Parameters:
gradientgradient will be store in this argument
argumentpoint where the gradient will be computed
functionIdevaluated function id in the split representation

Implements roboptim::GenericDifferentiableFunction< T >.

void roboptim::IdentityFunction::impl_jacobian ( jacobian_t jacobian,
const argument_t arg 
) const throw () [protected, virtual]

Jacobian evaluation.

Computes the jacobian, can be overridden by concrete classes. The default behavior is to compute the jacobian from the gradient.

Warning:
Do not call this function directly, call jacobian instead.
Parameters:
jacobianjacobian will be store in this argument
argpoint where the jacobian will be computed

ROBOPTIM_DO_NOT_CHECK_ALLOCATION

Reimplemented from roboptim::GenericDifferentiableFunction< T >.

References roboptim::GenericDifferentiableFunction< T >::jacobianSize().

std::ostream & roboptim::IdentityFunction::print ( std::ostream &  o) const throw () [virtual]

Display the function on the specified output stream.

Parameters:
ooutput stream used for display
Returns:
output stream

Reimplemented from roboptim::GenericLinearFunction< T >.

References roboptim::decindent(), roboptim::iendl(), and roboptim::incindent().

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines