golib
0.5
|
Newton optimisation. More...
#include <gonewton.h>
Public Types | |
typedef goMath::Vector< type_ > | vector_type |
typedef goMath::Matrix< type_ > | matrix_type |
typedef goMath::OptFunction< matrix_type, vector_type > | function_type |
Public Member Functions | |
NewtonOpt (goAutoPtr< function_type > f) | |
Constructor. More... | |
void | setF (goAutoPtr< function_type > f) |
Sets the function to be minimised. More... | |
virtual void | cleanup () |
Frees temporary memory. | |
virtual void | solveDirect (vector_type &x) |
Solves without line search. More... | |
virtual void | solveLineSearch (vector_type &x) |
virtual type_ | newtonDecrement (vector_type &x) |
virtual void | step (vector_type &x, vector_type &ret) |
Calculate the newton step. More... | |
Protected Attributes | |
goAutoPtr< function_type > | myF |
matrix_type | myHessian |
LineSearch< function_type, vector_type > | myLineSearch |
Newton optimisation.
This implements the standard Newton step descent algorithm, solving
to find a step and then updating
until convergence. A line search is not conducted, this needs to be added.
callable_ | A type that supports the interface defined by the class goMath::OptFunction, with goMath::Matrix and goMath::Vector types as template parameters. You can simply derive from OptFunction and implement the operator() accordingly, or use a OptFunctor. The function to be minimised will be of type callable_ . |
type_ | A floating point type (float or double). |
|
inline |
Constructor.
eps
is used squared in hessian(), therefore it should not be much smaller than 0.01 for floats in order not to run into machine precision problems.f | Function object that is to be minimised. |
|
inline |
Sets the function to be minimised.
f | Function object that is to be minimised. |
|
inlinevirtual |
Solves without line search.
x | Initial point. |
Reimplemented in goMath::NewtonOptEq< type_ >.
|
inlinevirtual |
Calculate the newton step.
x | Point at which to calculate |
ret | Contains the Newton step on return |
Reimplemented in goMath::NewtonOptEq< type_ >.