Loading...
Searching...
No Matches
Mathematical functions

Classes

class  roboptim::GenericConstantFunction< T >
 Constant function. More...
class  roboptim::Cos< T >
 Cos function. More...
class  roboptim::GenericIdentityFunction< T >
 Identity function. More...
class  roboptim::Polynomial< T >
 Polynomial function. More...
class  roboptim::Sin< T >
 Sin function. More...
class  roboptim::NTimesDerivableFunction< DerivabilityOrder >
 Define a $\mathbb{R} \rightarrow \mathbb{R}^m$ function, derivable n times ( $n \geq 2$). More...
class  roboptim::GenericNumericLinearFunction< T >
 Build a linear function from a vector and a matrix. More...
class  roboptim::GenericNumericQuadraticFunction< T >
 Build a quadratic function from a matrix and a vector. More...

Functions

 roboptim::ROBOPTIM_GENERATE_TRAITS_REFS_T (derivative, traits_t)
 Explicit specialization for the stop case of NTimesDerivable class.
virtual size_type roboptim::derivabilityOrderMax () const
 Returns the maximum derivability order (relevant for N>2 only).
virtual roboptim::~NTimesDerivableFunction ()
size_type roboptim::derivativeSize () const
 Return the size of the derivative vector.
bool roboptim::isValidDerivative (const_derivative_ref derivative) const
 Check if a derivative is valid (check sizes).
result_t roboptim::operator() (value_type argument) const
 Evaluate the function at a specified point.
void roboptim::operator() (result_ref result, value_type argument) const
 Evaluate the function at a specified point.
derivative_t roboptim::derivative (value_type argument, size_type order=1) const
 Compute the derivative of the function.
void roboptim::derivative (derivative_ref derivative, value_type argument, size_type order=1) const
 Compute the derivative of the function.
virtual std::ostream & roboptim::print (std::ostream &o) const
 Display the function on the specified output stream.
 roboptim::NTimesDerivableFunction (size_type outputSize=1, std::string name=std::string())
 Concrete class constructor should call this constructor.
void roboptim::impl_compute (result_ref result, const_argument_ref argument) const
 Function evaluation.
virtual void roboptim::impl_compute (result_ref result, value_type t) const =0
 Function evaluation.
void roboptim::impl_gradient (gradient_ref gradient, const_argument_ref argument, size_type functionId=0) const
 Gradient evaluation.
virtual void roboptim::impl_derivative (derivative_ref derivative, value_type argument, size_type order=1) const =0
 Derivative evaluation.
void roboptim::impl_hessian (hessian_ref hessian, const_argument_ref argument, size_type functionId=0) const
 Hessian evaluation.
void roboptim::Cos< T >::impl_gradient (gradient_ref gradient, const_argument_ref x, size_type) const
void roboptim::Cos< T >::impl_jacobian (jacobian_ref jacobian, const_argument_ref x) const
 Jacobian evaluation.
void roboptim::Cos< T >::impl_hessian (hessian_ref hessian, const_argument_ref x, size_type) const
void roboptim::GenericIdentityFunction< T >::impl_gradient (gradient_ref gradient, const_argument_ref, size_type idFunction) const
void roboptim::Sin< T >::impl_gradient (gradient_ref gradient, const_argument_ref x, size_type) const
void roboptim::Sin< T >::impl_jacobian (jacobian_ref jacobian, const_argument_ref x) const
 Jacobian evaluation.
void roboptim::Sin< T >::impl_hessian (hessian_ref hessian, const_argument_ref x, size_type) const

Variables

static const size_type roboptim::derivabilityOrder = 2
 Function derivability order.

Detailed Description

Function Documentation

◆ derivabilityOrderMax()

virtual size_type roboptim::derivabilityOrderMax ( ) const
virtual

Returns the maximum derivability order (relevant for N>2 only).

Referenced by derivative().

◆ derivative() [1/2]

void roboptim::derivative ( derivative_ref derivative,
value_type argument,
size_type order = 1 ) const

Compute the derivative of the function.

Derivative is computed for a certain order, at a given point.

Parameters
derivativederivative will be stored in this vector
argumentpoint at which the derivative will be computed
orderderivative order (if 0 then function is evaluated)

References derivabilityOrderMax(), derivative(), impl_derivative(), and isValidDerivative().

◆ derivative() [2/2]

derivative_t roboptim::derivative ( value_type argument,
size_type order = 1 ) const

◆ derivativeSize()

size_type roboptim::derivativeSize ( ) const

Return the size of the derivative vector.

Returns
derivative vector size

Referenced by isValidDerivative().

◆ impl_compute() [1/2]

void roboptim::impl_compute ( result_ref result,
const_argument_ref argument ) const
protected

Function evaluation.

Implement generic function evaluation, as required by Function, using this class evaluation method (using a double instead of a vector).

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
Examples
result.cc, visualization-gnuplot-function.cc, and visualization-matplotlib-function.cc.

Referenced by operator()(), and roboptim::ParametrizedFunction< F >::operator()().

◆ impl_compute() [2/2]

virtual void roboptim::impl_compute ( result_ref result,
value_type t ) const
protectedpure virtual

Function evaluation.

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

Warning
Do not call this function directly, call #operator()(double) const instead.
Parameters
resultresult will be stored in this vector
tpoint at which the function will be evaluated

◆ impl_derivative()

virtual void roboptim::impl_derivative ( derivative_ref derivative,
value_type argument,
size_type order = 1 ) const
protectedpure virtual

Derivative evaluation.

Compute the derivative, has to be implemented in concrete classes.

Warning
Do not call this function directly, call derivative instead.
Parameters
derivativederivative will be store in this argument
argumentpoint where the gradient will be computed
orderderivative order (if 0 evaluates the function)

References derivative().

Referenced by derivative().

◆ impl_gradient() [1/4]

template<typename T>
void roboptim::Cos< T >::impl_gradient ( gradient_ref gradient,
const_argument_ref x,
size_type  ) const
protected

◆ impl_gradient() [2/4]

template<typename T>
void roboptim::GenericIdentityFunction< T >::impl_gradient ( gradient_ref gradient,
const_argument_ref ,
size_type idFunction ) const
protected

◆ impl_gradient() [3/4]

void roboptim::impl_gradient ( gradient_ref gradient,
const_argument_ref argument,
size_type functionId = 0 ) const
protected

Gradient evaluation.

Implement the gradient computation, as required by DerivableFunction. 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 or derivative instead.
Parameters
gradientgradient will be store in this argument
argumentpoint where the gradient will be computed
functionIdevaluated function id in the split representation

ROBOPTIM_DO_NOT_CHECK_ALLOCATION

ROBOPTIM_DO_NOT_CHECK_ALLOCATION

References derivative(), is_malloc_allowed(), and set_is_malloc_allowed().

◆ impl_gradient() [4/4]

template<typename T>
void roboptim::Sin< T >::impl_gradient ( gradient_ref gradient,
const_argument_ref x,
size_type  ) const
protected

◆ impl_hessian() [1/3]

template<typename T>
void roboptim::Cos< T >::impl_hessian ( hessian_ref hessian,
const_argument_ref x,
size_type  ) const
protected

◆ impl_hessian() [2/3]

void roboptim::impl_hessian ( hessian_ref hessian,
const_argument_ref argument,
size_type functionId = 0 ) const
protected

Hessian evaluation.

Implement the hessian computation, as required by the TwiceDerivableFunction class using the derivative method. The hessian is computed for a specific sub-function which id is passed through the functionId argument.

Warning
Do not call this function directly, call #hessian instead.
Parameters
hessianhessian will be stored here
argumentpoint where the hessian will be computed
functionIdevaluated function id in the split representation

ROBOPTIM_DO_NOT_CHECK_ALLOCATION

ROBOPTIM_DO_NOT_CHECK_ALLOCATION

References derivative(), is_malloc_allowed(), and set_is_malloc_allowed().

◆ impl_hessian() [3/3]

template<typename T>
void roboptim::Sin< T >::impl_hessian ( hessian_ref hessian,
const_argument_ref x,
size_type  ) const
protected

◆ impl_jacobian() [1/2]

template<typename T>
void roboptim::Cos< T >::impl_jacobian ( jacobian_ref jacobian,
const_argument_ref arg ) const
protectedvirtual

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 >.

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

◆ impl_jacobian() [2/2]

template<typename T>
void roboptim::Sin< T >::impl_jacobian ( jacobian_ref jacobian,
const_argument_ref arg ) const
protectedvirtual

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 >.

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

◆ isValidDerivative()

bool roboptim::isValidDerivative ( const_derivative_ref derivative) const

Check if a derivative is valid (check sizes).

Parameters
derivativederivative vector to be checked
Returns
true if valid, false if not

References derivative(), and derivativeSize().

Referenced by derivative().

◆ NTimesDerivableFunction()

roboptim::NTimesDerivableFunction ( size_type outputSize = 1,
std::string name = std::string () )
protected

Concrete class constructor should call this constructor.

Parameters
outputSizeoutput size (result size)
namefunction's name

◆ operator()() [1/2]

void roboptim::operator() ( result_ref result,
value_type argument ) const

Evaluate the function at a specified point.

The program will abort if the argument does not have the expected size.

Parameters
resultresult will be stored in this vector
argumentpoint at which the function will be evaluated
Returns
computed result

References impl_compute().

◆ operator()() [2/2]

result_t roboptim::operator() ( value_type argument) const

Evaluate the function at a specified point.

The program will abort if the argument does not have the expected size.

Parameters
argumentpoint at which the function will be evaluated
Returns
computed result

◆ print()

virtual std::ostream & roboptim::print ( std::ostream & o) const
virtual

Display the function on the specified output stream.

Parameters
ooutput stream used for display
Returns
output stream

References roboptim::NTimesDerivableFunction< DerivabilityOrder >::derivabilityOrderMax().

◆ ROBOPTIM_GENERATE_TRAITS_REFS_T()

roboptim::ROBOPTIM_GENERATE_TRAITS_REFS_T ( derivative ,
traits_t  )

Explicit specialization for the stop case of NTimesDerivable class.

This specialization defines the interface of a ``n times derivable function'' and implements generic methods required by upper classes using this class specific interface. */ template <> class NTimesDerivableFunction<2> : public TwiceDifferentiableFunction { public:

/ Parent type. typedef TwiceDifferentiableFunction parent_t;

/ Traits type. typedef parent_t::traits_t traits_t;

/** Derivative type.

Derivatives are column vectors.

References derivative().

◆ ~NTimesDerivableFunction()

virtual roboptim::~NTimesDerivableFunction ( )
virtual

Variable Documentation

◆ derivabilityOrder

const size_type roboptim::derivabilityOrder = 2
static

Function derivability order.

One static const variable per class in inheritance structure.