Build a quadratic function from a matrix and a vector. More...
#include <roboptim/core/numeric-quadratic-function.hh>
Public Types | |
| typedef matrix_t | symmetric_t |
| Symmetric matrix type. | |
| typedef const_matrix_ref | const_symmetric_ref |
Public Member Functions | |
| ROBOPTIM_TWICE_DIFFERENTIABLE_FUNCTION_FWD_TYPEDEFS_ (GenericQuadraticFunction< T >) | |
| ROBOPTIM_ADD_FLAG (ROBOPTIM_IS_NUMERIC_QUADRATIC) | |
| GenericNumericQuadraticFunction (const_symmetric_ref A, const_vector_ref b, std::string name=std::string()) | |
| Build a quadratic function from a matrix and a vector. | |
| GenericNumericQuadraticFunction (const_symmetric_ref A, const_vector_ref b, const_vector_ref c, std::string name=std::string()) | |
| Build a quadratic function from a matrix and a vector. | |
| ~GenericNumericQuadraticFunction () | |
| virtual std::ostream & | print (std::ostream &) const |
| Display the function on the specified output stream. | |
| const symmetric_t & | A () const |
| const vector_t & | b () const |
| const vector_t & | c () const |
| symmetric_t & | A () |
| vector_t & | b () |
| vector_t & | c () |
Protected Member Functions | |
| void | impl_compute (result_ref, const_argument_ref) const |
| Function evaluation. | |
| void | impl_gradient (gradient_ref, const_argument_ref, size_type=0) const |
| Gradient evaluation. | |
| void | impl_jacobian (jacobian_ref, const_argument_ref) const |
| Jacobian evaluation. | |
| void | impl_hessian (hessian_ref hessian, const_argument_ref argument, size_type functionId=0) const |
| Hessian evaluation. | |
| template<> | |
| void | impl_jacobian (jacobian_ref jacobian, const_argument_ref x) const |
| Jacobian evaluation. | |
| template<> | |
| void | impl_gradient (gradient_ref gradient, const_argument_ref x, size_type) const |
| Gradient evaluation. | |
Build a quadratic function from a matrix and a vector.
Implement a quadratic function using the general formula:
\[f(x) = x^t A x + b^t x + c\]
where \(A\) and \(B\) are set when the class is instantiated.
| typedef const_matrix_ref roboptim::GenericNumericQuadraticFunction< T >::const_symmetric_ref |
| typedef matrix_t roboptim::GenericNumericQuadraticFunction< T >::symmetric_t |
Symmetric matrix type.
| roboptim::GenericNumericQuadraticFunction< T >::GenericNumericQuadraticFunction | ( | const_symmetric_ref | A, |
| const_vector_ref | b, | ||
| std::string | name = std::string () |
||
| ) |
Build a quadratic function from a matrix and a vector.
c here is omitted and set to zero.
See class documentation for A and b definition.
| A | A symmetric matrix |
| b | b vector |
| name | function's name |
References roboptim::GenericTwiceDifferentiableFunction< T >::setZero().
| roboptim::GenericNumericQuadraticFunction< T >::GenericNumericQuadraticFunction | ( | const_symmetric_ref | A, |
| const_vector_ref | b, | ||
| const_vector_ref | c, | ||
| std::string | name = std::string () |
||
| ) |
Build a quadratic function from a matrix and a vector.
See class documentation for A, b, c definition.
| A | A symmetric matrix (inputSize * inputSize) |
| b | b vector (size inputSize) |
| c | c vector (size one) |
| name | function's name |
| roboptim::GenericNumericQuadraticFunction< T >::~GenericNumericQuadraticFunction | ( | ) |
| const symmetric_t& roboptim::GenericNumericQuadraticFunction< T >::A | ( | ) | const [inline] |
| symmetric_t& roboptim::GenericNumericQuadraticFunction< T >::A | ( | ) | [inline] |
| const vector_t& roboptim::GenericNumericQuadraticFunction< T >::b | ( | ) | const [inline] |
| vector_t& roboptim::GenericNumericQuadraticFunction< T >::b | ( | ) | [inline] |
| const vector_t& roboptim::GenericNumericQuadraticFunction< T >::c | ( | ) | const [inline] |
| vector_t& roboptim::GenericNumericQuadraticFunction< T >::c | ( | ) | [inline] |
| void roboptim::GenericNumericQuadraticFunction< T >::impl_compute | ( | result_ref | result, |
| const_argument_ref | argument | ||
| ) | const [protected, virtual] |
Function evaluation.
Evaluate the function, has to be implemented in concrete classes.
| result | result will be stored in this vector |
| argument | point at which the function will be evaluated |
Implements roboptim::GenericFunction< T >.
| void roboptim::GenericNumericQuadraticFunction< EigenMatrixSparse >::impl_gradient | ( | gradient_ref | gradient, |
| const_argument_ref | argument, | ||
| size_type | functionId | ||
| ) | 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.
| gradient | gradient will be store in this argument |
| argument | point where the gradient will be computed |
| functionId | evaluated function id in the split representation |
Implements roboptim::GenericDifferentiableFunction< T >.
| void roboptim::GenericNumericQuadraticFunction< T >::impl_gradient | ( | gradient_ref | gradient, |
| const_argument_ref | argument, | ||
| size_type | functionId = 0 |
||
| ) | const [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.
| gradient | gradient will be store in this argument |
| argument | point where the gradient will be computed |
| functionId | evaluated function id in the split representation |
Implements roboptim::GenericDifferentiableFunction< T >.
| void roboptim::GenericNumericQuadraticFunction< T >::impl_hessian | ( | hessian_ref | hessian, |
| const_argument_ref | argument, | ||
| size_type | functionId = 0 |
||
| ) | const [protected, virtual] |
Hessian evaluation.
Compute the hessian, has to be implemented in concrete classes. The hessian is computed for a specific sub-function which id is passed through the functionId argument.
| hessian | hessian will be stored here |
| argument | point where the hessian will be computed |
| functionId | evaluated function id in the split representation |
Implements roboptim::GenericTwiceDifferentiableFunction< T >.
| void roboptim::GenericNumericQuadraticFunction< EigenMatrixSparse >::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.
| jacobian | jacobian will be store in this argument |
| arg | point where the jacobian will be computed |
ROBOPTIM_DO_NOT_CHECK_ALLOCATION
ROBOPTIM_DO_NOT_CHECK_ALLOCATION
Reimplemented from roboptim::GenericDifferentiableFunction< T >.
References roboptim::is_malloc_allowed(), and roboptim::set_is_malloc_allowed().
| void roboptim::GenericNumericQuadraticFunction< T >::impl_jacobian | ( | jacobian_ref | jacobian, |
| const_argument_ref | arg | ||
| ) | const [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 |
Reimplemented from roboptim::GenericDifferentiableFunction< T >.
| std::ostream & roboptim::GenericNumericQuadraticFunction< T >::print | ( | std::ostream & | o | ) | const [virtual] |
Display the function on the specified output stream.
| o | output stream used for display |
Reimplemented from roboptim::GenericQuadraticFunction< T >.
References roboptim::decindent(), roboptim::iendl(), roboptim::incindent(), and roboptim::toDense().
| roboptim::GenericNumericQuadraticFunction< T >::ROBOPTIM_ADD_FLAG | ( | ROBOPTIM_IS_NUMERIC_QUADRATIC | ) |
| roboptim::GenericNumericQuadraticFunction< T >::ROBOPTIM_TWICE_DIFFERENTIABLE_FUNCTION_FWD_TYPEDEFS_ | ( | GenericQuadraticFunction< T > | ) |