#include <SolverNleRecipes.h>

Inheritance diagram for SolverNleRecipes:

Public Member Functions

 SolverNleRecipes (int, ObjectiveNleInterface &)
 
void resize (int n) override
 sets the number of unknowns More...
 
double norm (const double *x) override
 return energy-norm More...
 
int solve (void) override
 
std::string message (int code) override
 
void setTolerances (double alf, double tolx, double tolf, double tolmin) override
 
- Public Member Functions inherited from SolverNleInterface
 SolverNleInterface (ObjectiveNleInterface &of)
 
int size (void) const
 
virtual void resize (int n)
 sets the number of unknowns More...
 
void print_table (double *xmin, double *xmax, int nsteps)
 print dependence on all unknowns More...
 
void printResults (void)
 print vector of results More...
 
void printMetrics (void)
 print metric counters More...
 
virtual void setTolerances (double, double, double, double)=0
 virtual function, has different meaning for the different solvers derived from SolverNleInterface More...
 
void setMaximumIterations (int m)
 sets the maximum number of iterations More...
 
void setMaximumStepSize (double stpmx)
 
void bmpout (char *file_out_name) const
 
double residual (int i)
 returns current value of the ith component of the residual vector More...
 
virtual double norm (const double *x)=0
 return root mean square (RMS) norm More...
 
virtual double calculateF (void)=0
 calculates F; returns the norm of the residuals More...
 
virtual double calculateFJ (void)=0
 calculates F and J; returns the norm of the residuals More...
 
virtual int solve (void)=0
 
virtual std::string message (int code)=0
 convert return code returned by solve method to human-readable message More...
 
virtual void verifySolution (void)=0
 evaluate equation set at the current set up estimates for the unknowns; useful to test for convergence after sequential solution More...
 
bool nonConverged (void)
 
- Public Member Functions inherited from Diagnostic
 Diagnostic (void)
 
void setVerbosity (int verbosity)
 sets the verbosity level for this instance More...
 
int verbosity (void) const
 

Protected Member Functions

 ~SolverNleRecipes (void)
 
int lnsrch_ (double fold, double &f, double stpmax)
 
- Protected Member Functions inherited from SolverNleInterface
 ~SolverNleInterface (void)
 
void clearCounters (void)
 
- Protected Member Functions inherited from Diagnostic
virtual ~Diagnostic ()=default
 

Protected Attributes

int * indx_
 
double * g_
 
double * p_
 
double * xold_
 
std::vector< double > d_
 buffer to normalize Jacobian columns More...
 
- Protected Attributes inherited from SolverNleInterface
ObjectiveNleInterfaceofp_
 
int MAXITS
 maximum number of Newton iterations More...
 
int verbosityLocal
 
int nSyst_
 Number of system evaluations. More...
 
int nNewt_
 Number of Newton method applications. More...
 
int nQuas_
 Number of Quasi Newton method applications. More...
 
int nAuto_
 Number of analytical Jacobian evaluations. More...
 
int nNume_
 Number of numerical Jacobian evaluations. More...
 
double STPMX
 scaled maximum step length allowed in line searches More...
 
- Protected Attributes inherited from Diagnostic
int verbosityInstance
 

Additional Inherited Members

- Public Attributes inherited from SolverNleInterface
int NITER
 
double * F_
 current values of residuals More...
 
double * x_
 current values of unknowns More...
 
Jacobian J
 

Detailed Description

Resolution of systems of non-linear equations

#include <libpf/core/SolverNleRecipes.h>

Remarks
Warning
Thread safe:
Extendable:
Platform dependencies:

Constructor & Destructor Documentation

◆ ~SolverNleRecipes()

SolverNleRecipes::~SolverNleRecipes ( void  )
protected

◆ SolverNleRecipes()

SolverNleRecipes::SolverNleRecipes ( int  ,
ObjectiveNleInterface  
)

Member Function Documentation

◆ lnsrch_()

int SolverNleRecipes::lnsrch_ ( double  fold,
double &  f,
double  stpmax 
)
protected

Input:

Parameters
stpmaxlimit to the length of the steps so that you do not try to evaluate the function in regions where it is undefined or subject to overflow.
foldThe previous value of the function
fThe new function value is returned in f.

Output: finds a new point x along the Direction p from xold where the function func has decreased sufficiently

Returns 0 on a normal exit. Returns 4 if on a plateau Returns 5 x is too close to xold (convergence on deltax) Returns 8 if NaN Returns 9 if unknown direction

In a minimization algorithm, this usually signals convergence and can be ignored. However, in a zero-finding algorithm the calling program should check whether the convergence is spurious.

◆ message()

std::string SolverNleRecipes::message ( int  code)
overridevirtual

OK: 0 converged fine

warning level: -1 converged to a local minimum; try a different initial guess -4 objective function insensitive (plateau) -5 convergence on deltax; dubious convergence

error level: 2 exceeded maximum iterations limit 3 error when evaluating the residuals 6 singular matrix, type 1 7 singular matrix, type 2 8 NaN encountered

Implements SolverNleInterface.

◆ norm()

double SolverNleRecipes::norm ( const double *  x)
overridevirtual

return energy-norm

Implements SolverNleInterface.

◆ resize()

void SolverNleRecipes::resize ( int  n)
overridevirtual

sets the number of unknowns

Reimplemented from SolverNleInterface.

Reimplemented in SolverNleRecipesNumeric.

◆ setTolerances()

void SolverNleRecipes::setTolerances ( double  alf,
double  tolx,
double  tolf,
double  tolmin 
)
overridevirtual
Parameters
alfEnsures sufficient decrease in function value
tolxConvergence criterion on dx
tolfconvergence criterion on function values
tolminsets the criterion for deciding whether spurious convergence to a minimum of fmin has occurred

Implements SolverNleInterface.

◆ solve()

int SolverNleRecipes::solve ( void  )
overridevirtual

Globally convergent Newton's method algorithm zero return code: solved ok negative return code: solved with warnings positive return code: unrecoverable error

Implements SolverNleInterface.

Member Data Documentation

◆ d_

std::vector<double> SolverNleRecipes::d_
protected

buffer to normalize Jacobian columns

◆ g_

double* SolverNleRecipes::g_
protected

◆ indx_

int* SolverNleRecipes::indx_
protected

◆ p_

double * SolverNleRecipes::p_
protected

◆ xold_

double * SolverNleRecipes::xold_
protected

The documentation for this class was generated from the following file: