QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
|
Cost function for least-square problems. More...
#include <leastsquare.hpp>
Public Member Functions | |
LeastSquareFunction (LeastSquareProblem &lsp) | |
Default constructor. More... | |
~LeastSquareFunction () override=default | |
Destructor. More... | |
Real | value (const Array &x) const override |
compute value of the least square function More... | |
Array | values (const Array &) const override |
method to overload to compute the cost function values in x More... | |
void | gradient (Array &grad_f, const Array &x) const override |
compute vector of derivatives of the least square function More... | |
Real | valueAndGradient (Array &grad_f, const Array &x) const override |
compute value and gradient of the least square function More... | |
Public Member Functions inherited from CostFunction | |
virtual | ~CostFunction ()=default |
virtual Real | value (const Array &x) const |
method to overload to compute the cost function value in x More... | |
virtual Array | values (const Array &x) const =0 |
method to overload to compute the cost function values in x More... | |
virtual void | gradient (Array &grad, const Array &x) const |
method to overload to compute grad_f, the first derivative of More... | |
virtual Real | valueAndGradient (Array &grad, const Array &x) const |
method to overload to compute grad_f, the first derivative of More... | |
virtual void | jacobian (Matrix &jac, const Array &x) const |
method to overload to compute J_f, the jacobian of More... | |
virtual Array | valuesAndJacobian (Matrix &jac, const Array &x) const |
method to overload to compute J_f, the jacobian of More... | |
virtual Real | finiteDifferenceEpsilon () const |
Default epsilon for finite difference method : More... | |
Protected Attributes | |
LeastSquareProblem & | lsp_ |
least square problem More... | |
Cost function for least-square problems.
Implements a cost function using the interface provided by the LeastSquareProblem class.
Definition at line 60 of file leastsquare.hpp.
LeastSquareFunction | ( | LeastSquareProblem & | lsp | ) |
Default constructor.
Definition at line 63 of file leastsquare.hpp.
|
overridedefault |
Destructor.
compute value of the least square function
Reimplemented from CostFunction.
Definition at line 28 of file leastsquare.cpp.
method to overload to compute the cost function values in x
Implements CostFunction.
Definition at line 39 of file leastsquare.cpp.
compute vector of derivatives of the least square function
Reimplemented from CostFunction.
Definition at line 49 of file leastsquare.cpp.
compute value and gradient of the least square function
Reimplemented from CostFunction.
Definition at line 63 of file leastsquare.cpp.
|
protected |
least square problem
Definition at line 77 of file leastsquare.hpp.