# QuantLib_NonLinearLeastSquare man page

NonLinearLeastSquare — Non-linear least-square method.

## Synopsis

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

### Public Member Functions

NonLinearLeastSquare (Constraint &c, Real accuracy=1e-4, Size maxiter=100)
Default constructor.
NonLinearLeastSquare (Constraint &c, Real accuracy, Size maxiter, boost::shared_ptr< OptimizationMethod > om)
Default constructor.
~NonLinearLeastSquare ()
Destructor.
Array & perform (LeastSquareProblem &lsProblem)
Solve least square problem using numerix solver.
void setInitialValue (const Array &initialValue)
Array & results ()
return the results
Real residualNorm ()
return the least square residual norm
Real lastValue ()
return last function value
Integer exitFlag ()
return exit flag
Integer iterationsNumber ()
return the performed number of iterations

## Detailed Description

Non-linear least-square method.

Using a given optimization algorithm (default is conjugate gradient),

[ min r(x) : x in R^n ].PP 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) ]

## Author

Generated automatically by Doxygen for QuantLib from the source code.

## Referenced By

The man pages exitFlag(3), iterationsNumber(3), lastValue(3), NonLinearLeastSquare(3), _NonLinearLeastSquare(3), perform(3), residualNorm(3) and setInitialValue(3) are aliases of QuantLib_NonLinearLeastSquare(3).

Mon Apr 30 2018 Version 1.12.1 QuantLib