QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
LeastSquareFunction Class Reference

Cost function for least-square problems. More...

#include <leastsquare.hpp>

+ Inheritance diagram for LeastSquareFunction:
+ Collaboration diagram for LeastSquareFunction:

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

LeastSquareProblemlsp_
 least square problem More...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ LeastSquareFunction()

Default constructor.

Definition at line 63 of file leastsquare.hpp.

◆ ~LeastSquareFunction()

~LeastSquareFunction ( )
overridedefault

Destructor.

Member Function Documentation

◆ value()

Real value ( const Array x) const
overridevirtual

compute value of the least square function

Reimplemented from CostFunction.

Definition at line 28 of file leastsquare.cpp.

+ Here is the call graph for this function:

◆ values()

Array values ( const Array x) const
overridevirtual

method to overload to compute the cost function values in x

Implements CostFunction.

Definition at line 39 of file leastsquare.cpp.

+ Here is the call graph for this function:

◆ gradient()

void gradient ( Array grad_f,
const Array x 
) const
overridevirtual

compute vector of derivatives of the least square function

Reimplemented from CostFunction.

Definition at line 49 of file leastsquare.cpp.

+ Here is the call graph for this function:

◆ valueAndGradient()

Real valueAndGradient ( Array grad_f,
const Array x 
) const
overridevirtual

compute value and gradient of the least square function

Reimplemented from CostFunction.

Definition at line 63 of file leastsquare.cpp.

+ Here is the call graph for this function:

Member Data Documentation

◆ lsp_

LeastSquareProblem& lsp_
protected

least square problem

Definition at line 77 of file leastsquare.hpp.