Parametrized function with parameter derivative available. More...
#include <roboptim/core/derivable-parametrized-function.hh>
Public Types | |
typedef F::value_type | value_type |
Import value type. | |
typedef F::size_type | size_type |
Import size type. | |
typedef F::vector_t | vector_t |
Import vector type. | |
typedef F::matrix_t | matrix_t |
Import matrix type. | |
typedef F | result_t |
Import result type. | |
typedef F::argument_t | argument_t |
Import argument types. | |
typedef F::const_argument_ref | const_argument_ref |
typedef F::gradient_t | gradient_t |
Import gradient type. | |
typedef F::gradient_ref | gradient_ref |
typedef F::gradient_ref | const_gradient_ref |
typedef F::jacobian_t | jacobian_t |
Import jacobian type. | |
typedef F::jacobian_ref | jacobian_ref |
typedef F::const_jacobian_ref | const_jacobian_ref |
typedef F::jacobianSize_t | jacobianSize_t |
Import jacobian size type (pair of values). | |
Public Member Functions | |
size_type | gradientSize () const |
Return the gradient size. | |
jacobianSize_t | jacobianSize () const |
Return the jacobian size as a pair. | |
bool | isValidGradient (const_gradient_ref gradient) const |
Check if the gradient is valid (check size). | |
bool | isValidJacobian (const_jacobian_ref jacobian) const throw () |
Check if the jacobian is valid (check sizes). | |
jacobian_t | jacobian (const_argument_ref argument, size_type order=0) const |
Computes the jacobian. | |
void | jacobian (jacobian_ref jacobian, const_argument_ref argument, size_type order=0) const |
Computes the jacobian. | |
gradient_t | gradient (const_argument_ref argument, size_type functionId=0, size_type order=0) const |
Computes the gradient. | |
void | gradient (gradient_ref gradient, const_argument_ref argument, size_type functionId=0, size_type order=0) const |
Computes the gradient. | |
virtual std::ostream & | print (std::ostream &o) const |
Display the function on the specified output stream. | |
Protected Member Functions | |
DerivableParametrizedFunction (size_type inputSize, size_type functionInputSize, size_type functionOutputSize) | |
Concrete class constructor should call this constructor. | |
virtual void | impl_jacobian (jacobian_ref jacobian, const_argument_ref arg, size_type order=0) const |
Jacobian evaluation. | |
virtual void | impl_gradient (gradient_ref gradient, const_argument_ref argument, size_type functionId=0, size_type order=0) const =0 |
Gradient evaluation. |
Parametrized function with parameter derivative available.
Depending on inner function type, this class allows computation of parameter derivative or combined parameter/function derivative.
F | inner function type. |
typedef F::argument_t roboptim::DerivableParametrizedFunction< F >::argument_t |
Import argument types.
Reimplemented from roboptim::ParametrizedFunction< F >.
typedef F::const_argument_ref roboptim::DerivableParametrizedFunction< F >::const_argument_ref |
Reimplemented from roboptim::ParametrizedFunction< F >.
typedef F::gradient_ref roboptim::DerivableParametrizedFunction< F >::const_gradient_ref |
typedef F::const_jacobian_ref roboptim::DerivableParametrizedFunction< F >::const_jacobian_ref |
typedef F::gradient_ref roboptim::DerivableParametrizedFunction< F >::gradient_ref |
typedef F::gradient_t roboptim::DerivableParametrizedFunction< F >::gradient_t |
Import gradient type.
typedef F::jacobian_ref roboptim::DerivableParametrizedFunction< F >::jacobian_ref |
typedef F::jacobian_t roboptim::DerivableParametrizedFunction< F >::jacobian_t |
Import jacobian type.
typedef F::jacobianSize_t roboptim::DerivableParametrizedFunction< F >::jacobianSize_t |
Import jacobian size type (pair of values).
typedef F::matrix_t roboptim::DerivableParametrizedFunction< F >::matrix_t |
Import matrix type.
Reimplemented from roboptim::ParametrizedFunction< F >.
typedef F roboptim::DerivableParametrizedFunction< F >::result_t |
Import result type.
Reimplemented from roboptim::ParametrizedFunction< F >.
typedef F::size_type roboptim::DerivableParametrizedFunction< F >::size_type |
Import size type.
Reimplemented from roboptim::ParametrizedFunction< F >.
typedef F::value_type roboptim::DerivableParametrizedFunction< F >::value_type |
Import value type.
Reimplemented from roboptim::ParametrizedFunction< F >.
typedef F::vector_t roboptim::DerivableParametrizedFunction< F >::vector_t |
Import vector type.
Reimplemented from roboptim::ParametrizedFunction< F >.
roboptim::DerivableParametrizedFunction< F >::DerivableParametrizedFunction | ( | size_type | inputSize, |
size_type | functionInputSize, | ||
size_type | functionOutputSize | ||
) | [inline, protected] |
Concrete class constructor should call this constructor.
inputSize | parameter size |
functionInputSize | inner function argument size |
functionOutputSize | inner function result size |
gradient_t roboptim::DerivableParametrizedFunction< F >::gradient | ( | const_argument_ref | argument, |
size_type | functionId = 0 , |
||
size_type | order = 0 |
||
) | const [inline] |
Computes the gradient.
argument | inner function argument value |
functionId | function id in split representation |
order | derivation order |
References roboptim::DerivableParametrizedFunction< F >::gradientSize().
Referenced by roboptim::DerivableParametrizedFunction< F >::impl_jacobian().
void roboptim::DerivableParametrizedFunction< F >::gradient | ( | gradient_ref | gradient, |
const_argument_ref | argument, | ||
size_type | functionId = 0 , |
||
size_type | order = 0 |
||
) | const [inline] |
Computes the gradient.
Program will abort if the gradient size is wrong before or after the gradient computation.
gradient | gradient will be stored in this argument |
argument | inner function point argument value |
functionId | function id in split representation |
order | derivation order |
References roboptim::DerivableParametrizedFunction< F >::impl_gradient(), roboptim::ParametrizedFunction< F >::inputSize(), and roboptim::DerivableParametrizedFunction< F >::isValidGradient().
size_type roboptim::DerivableParametrizedFunction< F >::gradientSize | ( | ) | const [inline] |
Return the gradient size.
Gradient size is equals to the input size.
References roboptim::ParametrizedFunction< F >::inputSize().
Referenced by roboptim::DerivableParametrizedFunction< F >::gradient(), and roboptim::DerivableParametrizedFunction< F >::isValidGradient().
virtual void roboptim::DerivableParametrizedFunction< F >::impl_gradient | ( | gradient_ref | gradient, |
const_argument_ref | argument, | ||
size_type | functionId = 0 , |
||
size_type | order = 0 |
||
) | const [protected, pure 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.
gradient | gradient will be store in this argument |
argument | inner function point argument value |
functionId | evaluated function id in the split representation |
order | derivation order |
Referenced by roboptim::DerivableParametrizedFunction< F >::gradient().
virtual void roboptim::DerivableParametrizedFunction< F >::impl_jacobian | ( | jacobian_ref | jacobian, |
const_argument_ref | arg, | ||
size_type | order = 0 |
||
) | 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.
jacobian | jacobian will be store in this argument |
arg | point where the jacobian will be computed |
order | derivation order |
References roboptim::ParametrizedFunction< F >::functionOutputSize(), roboptim::DerivableParametrizedFunction< F >::gradient(), and roboptim::ParametrizedFunction< F >::inputSize().
Referenced by roboptim::DerivableParametrizedFunction< F >::jacobian().
bool roboptim::DerivableParametrizedFunction< F >::isValidGradient | ( | const_gradient_ref | gradient | ) | const [inline] |
Check if the gradient is valid (check size).
gradient | checked gradient |
References roboptim::DerivableParametrizedFunction< F >::gradientSize().
Referenced by roboptim::DerivableParametrizedFunction< F >::gradient().
bool roboptim::DerivableParametrizedFunction< F >::isValidJacobian | ( | const_jacobian_ref | jacobian | ) | const throw () [inline] |
Check if the jacobian is valid (check sizes).
jacobian | checked jacobian |
References roboptim::DerivableParametrizedFunction< F >::jacobian(), and roboptim::DerivableParametrizedFunction< F >::jacobianSize().
Referenced by roboptim::DerivableParametrizedFunction< F >::jacobian().
jacobian_t roboptim::DerivableParametrizedFunction< F >::jacobian | ( | const_argument_ref | argument, |
size_type | order = 0 |
||
) | const [inline] |
Computes the jacobian.
argument | point at which the jacobian will be computed |
order | derivation order |
References roboptim::DerivableParametrizedFunction< F >::jacobianSize().
Referenced by roboptim::DerivableParametrizedFunction< F >::isValidJacobian().
void roboptim::DerivableParametrizedFunction< F >::jacobian | ( | jacobian_ref | jacobian, |
const_argument_ref | argument, | ||
size_type | order = 0 |
||
) | const [inline] |
Computes the jacobian.
Program will abort if the jacobian size is wrong before or after the jacobian computation.
jacobian | jacobian will be stored in this argument |
order | derivation order |
argument | inner function point argument value |
References roboptim::DerivableParametrizedFunction< F >::impl_jacobian(), roboptim::ParametrizedFunction< F >::inputSize(), and roboptim::DerivableParametrizedFunction< F >::isValidJacobian().
jacobianSize_t roboptim::DerivableParametrizedFunction< F >::jacobianSize | ( | ) | const [inline] |
Return the jacobian size as a pair.
Gradient size is equals to (output size, input size).
References roboptim::ParametrizedFunction< F >::functionOutputSize(), and roboptim::ParametrizedFunction< F >::inputSize().
Referenced by roboptim::DerivableParametrizedFunction< F >::isValidJacobian(), and roboptim::DerivableParametrizedFunction< F >::jacobian().
virtual std::ostream& roboptim::DerivableParametrizedFunction< F >::print | ( | std::ostream & | o | ) | const [inline, virtual] |
Display the function on the specified output stream.
o | output stream used for display |
Reimplemented from roboptim::ParametrizedFunction< F >.