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


Public Member Functions | |
| QuadraticCombination (size_t const size=0) | |
| The constructor sets up function as a quadratic combination of size entries. More... | |
| void | resize (size_t const size) |
| Resize the matrix of coefficients. More... | |
| void | setCoefficient (size_t const index, double const value) |
| Set the value of a coefficient on the diagonal. More... | |
| void | setCoefficient (size_t const row, size_t const col, double const value) |
| Set the value of a coefficient. More... | |
| double | getCoefficient (size_t const index) const |
| Get the value of a coefficient on the diagonal. More... | |
| double | getCoefficient (size_t const row, size_t const col) const |
| Get the value of a coefficient. More... | |
| gsl::matrix const & | getCoefficients () const |
| Get the coefficients as a matrix by reference. More... | |
| void | setCoefficients (gsl::matrix const &matrix) |
| Set coefficients from a matrix. 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::matrix | coefficients |
| The matrix 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 quadratic combinations of the elements of their matrix of arguments.
Each object of this class stores a symmetric
matrix
of coefficients. When the function object is called with a vector argument
it returns
. Note that the coefficient of
is twice the
th element of
when
.
Definition at line 38 of file QuadraticCombination.hpp.
| QuadraticCombination::QuadraticCombination | ( | size_t const | size = 0 | ) |
The constructor sets up function as a quadratic 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 QuadraticCombination.cc.
| double QuadraticCombination::getCoefficient | ( | size_t const | index | ) | const |
Get the value of a coefficient on the diagonal.
| index | The index of the coefficient |
| IPOException | if index out of range |
Definition at line 82 of file QuadraticCombination.cc.
References coefficients, and IPOE.
Referenced by getCoefficient().
| double QuadraticCombination::getCoefficient | ( | size_t const | row, |
| size_t const | col | ||
| ) | const |
Get the value of a coefficient.
It doesn’t matter here if row and col values are interchanged because the coefficient matrix is symmetric.
| row | The row index of the coefficient |
| col | The column index of the coefficient |
| IPOException | if row or col out of range |
Definition at line 92 of file QuadraticCombination.cc.
References coefficients, getCoefficient(), and IPOE.
| gsl::matrix const & QuadraticCombination::getCoefficients | ( | ) | const |
Get the coefficients as a matrix by reference.
Definition at line 108 of file QuadraticCombination.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 164 of file QuadraticCombination.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 187 of file QuadraticCombination.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 147 of file QuadraticCombination.cc.
References coefficients, and IPOE.
| void QuadraticCombination::resize | ( | size_t const | size | ) |
Resize the matrix of coefficients.
Any new entries are set to zero.
| size | The new size |
Definition at line 32 of file QuadraticCombination.cc.
References coefficients, and ipo_function::detail::FunctionBase::size.
| void QuadraticCombination::setCoefficient | ( | size_t const | index, |
| double const | value | ||
| ) |
Set the value of a coefficient on the diagonal.
| index | The index of the coefficient |
| value | The new value of the coefficient |
| IPOException | if index out of range |
Definition at line 52 of file QuadraticCombination.cc.
References coefficients, and IPOE.
Referenced by setCoefficient().
| void QuadraticCombination::setCoefficient | ( | size_t const | row, |
| size_t const | col, | ||
| double const | value | ||
| ) |
Set the value of a coefficient.
The values of row and col can be interchanged without affecting the result.
| row | The row index of the coefficient |
| col | The column index of the coefficient |
| value | The new value of the coefficient |
| IPOException | if row or col out of range |
Definition at line 62 of file QuadraticCombination.cc.
References coefficients, IPOE, and setCoefficient().
| void QuadraticCombination::setCoefficients | ( | gsl::matrix const & | matrix | ) |
Set coefficients from a matrix.
This can resize the coefficients.
| matrix | The new coefficients matrix |
| IPOException | if matrix is not symmetric or has wrong size |
Definition at line 113 of file QuadraticCombination.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 205 of file QuadraticCombination.cc.
References coefficients, ipo_function::GradientEstimate::functionGradient, ipo_function::DerivativesEstimates::functionHessian, ipo_function::GradientEstimate::functionValue, and IPOE.
|
protected |
The matrix of coefficients;.
Definition at line 127 of file QuadraticCombination.hpp.
Referenced by getCoefficient(), getCoefficients(), gradient(), hessian(), operator()(), resize(), setCoefficient(), setCoefficients(), and setVector().