|
QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.38
|
Non-linear least-square method. More...
#include <leastsquare.hpp>
Collaboration diagram for NonLinearLeastSquare:Public Member Functions | |
| NonLinearLeastSquare (Constraint &c, Real accuracy=1e-4, Size maxiter=100) | |
| Default constructor. More... | |
| NonLinearLeastSquare (Constraint &c, Real accuracy, Size maxiter, ext::shared_ptr< OptimizationMethod > om) | |
| Default constructor. More... | |
| ~NonLinearLeastSquare ()=default | |
| Destructor. More... | |
| Array & | perform (LeastSquareProblem &lsProblem) |
| Solve least square problem using numerix solver. More... | |
| void | setInitialValue (const Array &initialValue) |
| Array & | results () |
| return the results More... | |
| Real | residualNorm () const |
| return the least square residual norm More... | |
| Real | lastValue () const |
| return last function value More... | |
| Integer | exitFlag () const |
| return exit flag More... | |
| Integer | iterationsNumber () const |
| return the performed number of iterations More... | |
Private Attributes | |
| Array | results_ |
| solution vector More... | |
| Array | initialValue_ |
| Real | resnorm_ |
| least square residual norm More... | |
| Integer | exitFlag_ |
| Exit flag of the optimization process. More... | |
| Real | accuracy_ |
| required accuracy of the solver More... | |
| Real | bestAccuracy_ |
| Size | maxIterations_ |
| maximum and real number of iterations More... | |
| Size | nbIterations_ |
| ext::shared_ptr< OptimizationMethod > | om_ |
| Optimization method. More... | |
| Constraint & | c_ |
Non-linear least-square method.
Using a given optimization algorithm (default is conjugate gradient),
\[ min \{ r(x) : x in R^n \} \]
where \( r(x) = |f(x)|^2 \) is the Euclidean norm of \( f(x) \) for some vector-valued function \( f \) from \( R^n \) to \( R^m \),
\[ f = (f_1, ..., f_m) \]
with \( f_i(x) = b_i - \phi(x,t_i) \) where \( b \) is the vector of target data and \( phi \) is a scalar function.
Assuming the differentiability of \( f \), the gradient of \( r \) is defined by
\[ grad r(x) = f'(x)^t.f(x) \]
Definition at line 97 of file leastsquare.hpp.
| NonLinearLeastSquare | ( | Constraint & | c, |
| Real | accuracy = 1e-4, |
||
| Size | maxiter = 100 |
||
| ) |
Default constructor.
Definition at line 79 of file leastsquare.cpp.
| NonLinearLeastSquare | ( | Constraint & | c, |
| Real | accuracy, | ||
| Size | maxiter, | ||
| ext::shared_ptr< OptimizationMethod > | om | ||
| ) |
Default constructor.
Definition at line 87 of file leastsquare.cpp.
|
default |
Destructor.
| Array & perform | ( | LeastSquareProblem & | lsProblem | ) |
Solve least square problem using numerix solver.
Definition at line 93 of file leastsquare.cpp.
Here is the call graph for this function:| void setInitialValue | ( | const Array & | initialValue | ) |
Definition at line 114 of file leastsquare.hpp.
return the results
Definition at line 119 of file leastsquare.hpp.
| Real residualNorm | ( | ) | const |
return the least square residual norm
Definition at line 122 of file leastsquare.hpp.
| Real lastValue | ( | ) | const |
return last function value
Definition at line 125 of file leastsquare.hpp.
| Integer exitFlag | ( | ) | const |
return exit flag
Definition at line 128 of file leastsquare.hpp.
| Integer iterationsNumber | ( | ) | const |
return the performed number of iterations
Definition at line 131 of file leastsquare.hpp.
|
private |
solution vector
Definition at line 135 of file leastsquare.hpp.
|
private |
Definition at line 135 of file leastsquare.hpp.
|
private |
least square residual norm
Definition at line 137 of file leastsquare.hpp.
|
private |
Exit flag of the optimization process.
Definition at line 139 of file leastsquare.hpp.
|
private |
required accuracy of the solver
Definition at line 141 of file leastsquare.hpp.
|
private |
Definition at line 141 of file leastsquare.hpp.
|
private |
maximum and real number of iterations
Definition at line 143 of file leastsquare.hpp.
|
private |
Definition at line 143 of file leastsquare.hpp.
|
private |
Optimization method.
Definition at line 145 of file leastsquare.hpp.
|
private |
Definition at line 147 of file leastsquare.hpp.