|
Interior-point-optimisation
1.0-1
Interior-pointoptimisationlibrary
|
This class provides function objects representing linear combinations of the elements of their vector arguments. More...
#include <LinearCombination.hpp>


Public Member Functions | |
| LinearCombination (size_t const size=0) | |
| The constructor sets up function as a linear combination of size entries. More... | |
| void | resize (size_t const size) |
| Resize the vector of coefficients. More... | |
| void | setCoefficient (size_t const index, double const value) |
| Set the value of a coefficient. More... | |
| double | getCoefficient (size_t const index) const |
| Get the value of a coefficient. More... | |
| gsl::vector const & | getCoefficients () const |
| Get the coefficients as a vector by reference. More... | |
| void | setCoefficients (gsl::vector const &vector) |
| Set coefficients from a vector. More... | |
| virtual double | operator() (gsl::vector const &vector) |
| The function operator: computes the sum of the vector entries. More... | |
| virtual gsl::vector | gradient (gsl::vector const &vector) |
| The function operator: returns the gradient: the coefficients. More... | |
| virtual gsl::matrix | hessian (gsl::vector const &vector) |
| The function operator: returns the Hessian: a matrix of 0s. More... | |
| virtual void | setVector (gsl::vector const &vector) |
| Set a vector and compute function value, gradient and Hessian efficiently. More... | |
Public Member Functions inherited from ipo_function::Function | |
| Function (size_t const size=0) | |
| Constructor. More... | |
| virtual std::tuple < gsl::vector, gsl::matrix > | derivatives (gsl::vector const &vector) |
| Compute or estimate derivative values. More... | |
Public Member Functions inherited from ipo_function::detail::FunctionBase | |
| FunctionBase (size_t const size=0) | |
| Constructor. More... | |
| virtual | ~FunctionBase ()=0 |
| Make the class abstract. More... | |
| size_t | getSize () const |
| Get size of vector for function arguments or zero for arbitrary size. More... | |
Public Member Functions inherited from ipo_function::DerivativesEstimates | |
| DerivativesEstimates (size_t const size=0) | |
| Constructor. More... | |
| virtual gsl::matrix | hessian () const |
Public Member Functions inherited from ipo_function::GradientEstimate | |
| GradientEstimate (size_t const size=0) | |
| Constructor. More... | |
| virtual double | value () const |
| virtual gsl::vector | gradient () const |
Protected Attributes | |
| gsl::vector | coefficients |
| The vector of coefficients;. More... | |
Protected Attributes inherited from ipo_function::Function | |
| double | h = std::sqrt( std::numeric_limits<double>::epsilon() ) |
| Value used for default gradient estimates. More... | |
| double | h2 = std::sqrt( h ) |
| Value used for default Hessian estimates. More... | |
Protected Attributes inherited from ipo_function::detail::FunctionBase | |
| size_t const | size |
| Size of vector arguments to supply to subclass functions. More... | |
Protected Attributes inherited from ipo_function::DerivativesEstimates | |
| gsl::matrix | functionHessian |
| The Hessian value. More... | |
Protected Attributes inherited from ipo_function::GradientEstimate | |
| double | functionValue |
| The function value. More... | |
| gsl::vector | functionGradient |
| The gradient value. More... | |
This class provides function objects representing linear combinations of the elements of their vector arguments.
Each object of this class stores a vector
of coefficients. When the function object is called with a vector argument
it returns
.
Definition at line 37 of file LinearCombination.hpp.
| LinearCombination::LinearCombination | ( | size_t const | size = 0 | ) |
The constructor sets up function as a linear combination of size entries.
Initially the coefficient of each entry is zero so that a call to function returns zero.
| size | The size of vectors in the function and derivatives |
Definition at line 28 of file LinearCombination.cc.
| double LinearCombination::getCoefficient | ( | size_t const | index | ) | const |
Get the value of a coefficient.
| index | The index of the coefficient |
| IPOException | if index out of range |
Definition at line 57 of file LinearCombination.cc.
References coefficients, and IPOE.
| gsl::vector const & LinearCombination::getCoefficients | ( | ) | const |
Get the coefficients as a vector by reference.
Definition at line 67 of file LinearCombination.cc.
References coefficients.
|
virtual |
The function operator: returns the gradient: the coefficients.
The return value may change if the coefficients change.
| vector | A vector argument |
Reimplemented from ipo_function::Function.
Definition at line 101 of file LinearCombination.cc.
References coefficients, ipo_function::GradientEstimate::functionGradient, and IPOE.
|
virtual |
The function operator: returns the Hessian: a matrix of 0s.
The return value may change if the number of coefficients change.
| vector | A vector argument |
Reimplemented from ipo_function::Function.
Definition at line 119 of file LinearCombination.cc.
References coefficients, ipo_function::DerivativesEstimates::functionHessian, and IPOE.
|
virtual |
The function operator: computes the sum of the vector entries.
| vector | A vector argument |
Implements ipo_function::Function.
Definition at line 86 of file LinearCombination.cc.
References coefficients, and IPOE.
| void LinearCombination::resize | ( | size_t const | size | ) |
Resize the vector of coefficients.
Any new entries are set to zero.
| size | The new size |
Definition at line 32 of file LinearCombination.cc.
References coefficients, and ipo_function::detail::FunctionBase::size.
| void LinearCombination::setCoefficient | ( | size_t const | index, |
| double const | value | ||
| ) |
Set the value of a coefficient.
| index | The index of the coefficient |
| value | The new value of the coefficient |
| IPOException | if index out of range |
Definition at line 47 of file LinearCombination.cc.
References coefficients, IPOE, and ipo_function::GradientEstimate::value().
| void LinearCombination::setCoefficients | ( | gsl::vector const & | vector | ) |
Set coefficients from a vector.
This can resize the coefficients.
| vector | The new coefficients vector |
Definition at line 72 of file LinearCombination.cc.
References coefficients, and IPOE.
|
virtual |
Set a vector and compute function value, gradient and Hessian efficiently.
| vector | A vector argument |
Implements ipo_function::GradientEstimate.
Definition at line 136 of file LinearCombination.cc.
References coefficients, ipo_function::GradientEstimate::functionGradient, ipo_function::DerivativesEstimates::functionHessian, ipo_function::GradientEstimate::functionValue, and IPOE.
|
protected |
The vector of coefficients;.
Definition at line 106 of file LinearCombination.hpp.
Referenced by getCoefficient(), getCoefficients(), gradient(), hessian(), operator()(), resize(), setCoefficient(), setCoefficients(), and setVector().