roboptim::GenericConstantFunction< T > Class Template Reference

Constant function. More...

#include <roboptim/core/function/constant.hh>

Inheritance diagram for roboptim::GenericConstantFunction< T >:
roboptim::GenericLinearFunction< T > roboptim::GenericQuadraticFunction< T > roboptim::GenericTwiceDifferentiableFunction< T > roboptim::GenericDifferentiableFunction< T > roboptim::GenericFunction< T >

List of all members.

Public Member Functions

 ROBOPTIM_TWICE_DIFFERENTIABLE_FUNCTION_FWD_TYPEDEFS_ (GenericLinearFunction< T >)
 ROBOPTIM_ADD_FLAG (ROBOPTIM_IS_CONSTANT)
 GenericConstantFunction (const_vector_ref offset)
 Build a constant function.
 GenericConstantFunction (size_type input_size, const_vector_ref offset)
 Build a constant function.
 ~GenericConstantFunction ()
virtual std::ostream & print (std::ostream &o) const
 Display the function on the specified output stream.

Protected Member Functions

void impl_compute (result_ref result, const_argument_ref) const
 Function evaluation.
void impl_gradient (gradient_ref gradient, const_argument_ref, size_type=0) const
 Gradient evaluation.
void impl_jacobian (jacobian_ref jacobian, const_argument_ref) const
 Jacobian evaluation.

Detailed Description

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

Constant function.

Implement a constant function using the formula:

\[f(x) = offset\]

where \(offset\) is set when the class is instantiated.

Examples:
problem-cc.cc.

Constructor & Destructor Documentation

template<typename T >
roboptim::GenericConstantFunction< T >::GenericConstantFunction ( const_vector_ref  offset) [inline]

Build a constant function.

Parameters:
offsetconstant function offset
template<typename T >
roboptim::GenericConstantFunction< T >::GenericConstantFunction ( size_type  input_size,
const_vector_ref  offset 
) [inline]

Build a constant function.

Parameters:
input_sizeinput size of the function
offsetconstant function offset
template<typename T >
roboptim::GenericConstantFunction< T >::~GenericConstantFunction ( ) [inline]

Member Function Documentation

template<typename T >
void roboptim::GenericConstantFunction< T >::impl_compute ( result_ref  result,
const_argument_ref  argument 
) const [inline, protected, virtual]

Function evaluation.

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

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

Implements roboptim::GenericFunction< T >.

template<typename T >
void roboptim::GenericConstantFunction< T >::impl_gradient ( gradient_ref  gradient,
const_argument_ref  argument,
size_type  functionId = 0 
) const [inline, 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 >.

template<typename T >
void roboptim::GenericConstantFunction< T >::impl_jacobian ( jacobian_ref  jacobian,
const_argument_ref  arg 
) const [inline, 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

Reimplemented from roboptim::GenericDifferentiableFunction< T >.

template<typename T >
virtual std::ostream& roboptim::GenericConstantFunction< T >::print ( std::ostream &  o) const [inline, 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 Defines