QuantLib: a free/open-source library for quantitative finance
Reference manual - version 1.40
Loading...
Searching...
No Matches
LeastSquareFunction Class Reference

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

#include <ql/math/optimization/leastsquare.hpp>

Inheritance diagram for LeastSquareFunction:

Public Member Functions

 LeastSquareFunction (LeastSquareProblem &lsp)
 Default constructor.
 ~LeastSquareFunction () override=default
 Destructor.
Real value (const Array &x) const override
 compute value of the least square function
Array values (const Array &) const override
 method to overload to compute the cost function values in x
void gradient (Array &grad_f, const Array &x) const override
 compute vector of derivatives of the least square function
Real valueAndGradient (Array &grad_f, const Array &x) const override
 compute value and gradient of the least square function
Public Member Functions inherited from CostFunction
virtual void jacobian (Matrix &jac, const Array &x) const
 method to overload to compute J_f, the jacobian of
virtual Array valuesAndJacobian (Matrix &jac, const Array &x) const
 method to overload to compute J_f, the jacobian of
virtual Real finiteDifferenceEpsilon () const
 Default epsilon for finite difference method :

Protected Attributes

LeastSquareProblemlsp_
 least square problem

Detailed Description

Cost function for least-square problems.

Implements a cost function using the interface provided by the LeastSquareProblem class.

Member Function Documentation

◆ value()

Real value ( const Array & x) const
overridevirtual

compute value of the least square function

Reimplemented from CostFunction.

◆ values()

Array values ( const Array & x) const
overridevirtual

method to overload to compute the cost function values in x

Implements CostFunction.

◆ gradient()

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

compute vector of derivatives of the least square function

Reimplemented from CostFunction.

◆ valueAndGradient()

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

compute value and gradient of the least square function

Reimplemented from CostFunction.