Class xlifepp::NonLinearSolverT#

template<typename T>
class NonLinearSolverT#

Base class for non linear solver: f(X)=0.

NonLinearSolverT

is a base class for non linear solvers f(X)=0. It provides a common interface for all non linear solvers. It stores the function f(x,..) that defines the function, the initial guess X0 and optional parameters. It also provides methods to access the computed states (computation status, nuumber of iterations, solution, intermediate vectors.

Input data

Main function : explicit constructor and virtual solving function: T& solve(number_t itmax=0, real_t eps=0)
Template Parameters:

T – type of the state (real_t, complex_t, Vector<real_t>, Vector<complex_t>, …) required function on type T : iterator (for vector), operator u+v, u-v, s*u, u/s, norm, dot

Param f:

function of the non linear system to be solved f(X)=0 with prototype T& f(const T& x, T& fx, DiffOpType d)

Param x0:

initial guess

Param max_iter:

: maximum number of iterations

Param tol:

tolerance factor to stop iterative process

Param storeXk:

if true, xk are stored in xs vector

Param out:

: ostream pointer to display or store on file intermediate states Computed data

Param name:

: method name

Param dimIn:

: dimension of input

Param dimOut:

dimension of output

Param scalar:

bool flag to indicate scalar function

Param k:

iteration number

Param x:

iterate and solution

Param xs:

list of iterates

Param status:

status of computing info (_success, _noConvergence, _numericalIssue, _invalidInput)

Note

This class is not meant to be used directly, but as a base class for specific non linear solvers like Newton, LevenbergMarquardt, Gradient and QuasiNewton

Subclassed by xlifepp::GradientSolverT< T >, xlifepp::LevenbergMarquardtSolverT< T >, xlifepp::NewtonSolverT< T >, xlifepp::QuasiNewtonSolverT< T >

Public Functions

void computeJtf(const T &J, T &f, T &jtf)#

compute jacobian matrix: J(x) matrix of size dimOut x dimIn (row storage)

inline void start()#

do the resolution

reset iteration data at the beginning of solve: x=x0, k=0, status, list of iterates