PARTONS/NumA++  
Numerical Analysis C++ routines
Public Member Functions | Private Attributes | List of all members
NumA::NewtonMD Class Reference

Newton method generalized to any dimension N: Solves the system G(X) = 0, where G is a regular but non-linear application \( R^N \rightarrow R^N \) . More...

Public Member Functions

 NewtonMD (int N=1, LinAlgUtils::Method linMethod=LinAlgUtils::ColQR)
 
virtual ~NewtonMD ()
 
int getN () const
 
void setN (int n)
 
LinAlgUtils::Method getLinMethod () const
 
void setLinMethod (LinAlgUtils::Method linMethod)
 
template<class OBJ , typename FUNC , typename JACOB >
VectorD solve (OBJ *object, FUNC G, const std::vector< double > &funcParameters, VectorD X0, JACOB J_G=0, const double absTolerance=1.e-4, const double relTolerance=1.e-4, const size_t maxIteration=50)
 
VectorD iterate (const VectorD &X0, const VectorD &G_X0, const MatrixD &J_G_X0)
 Produces a new iteration by solving the linear system J^G(X0) * (X0 - X1) = G(X0) and returns X1. More...
 

Private Attributes

int m_N
 Dimension of the problem. More...
 
LinAlgUtils::Method m_linMethod
 Method used for solving linear systems. More...
 

Detailed Description

Newton method generalized to any dimension N: Solves the system G(X) = 0, where G is a regular but non-linear application \( R^N \rightarrow R^N \) .

The class can be used either through templates with the solve method providing G and the Jacobian matrix functions pointers, or manually through instantiating an object NewtonMD and iterating the method iterate by giving G(X) and the Jacobian matrix at each step, to avoid using functions.

For linear G (matrices), use the LinearSystem class.

Constructor & Destructor Documentation

◆ NewtonMD()

NumA::NewtonMD::NewtonMD ( int  N = 1,
LinAlgUtils::Method  linMethod = LinAlgUtils::ColQR 
)

◆ ~NewtonMD()

NumA::NewtonMD::~NewtonMD ( )
virtual

Member Function Documentation

◆ getLinMethod()

LinAlgUtils::Method NumA::NewtonMD::getLinMethod ( ) const

◆ getN()

int NumA::NewtonMD::getN ( ) const

◆ iterate()

VectorD NumA::NewtonMD::iterate ( const VectorD X0,
const VectorD G_X0,
const MatrixD J_G_X0 
)

Produces a new iteration by solving the linear system J^G(X0) * (X0 - X1) = G(X0) and returns X1.

Parameters
X0: VectorD of size N
G_X0: VectorD of size N
J_G_X0: MatrixD of size NxN
Returns
X1 : New solution after the new iteration.

◆ setLinMethod()

void NumA::NewtonMD::setLinMethod ( LinAlgUtils::Method  linMethod)

◆ setN()

void NumA::NewtonMD::setN ( int  n)

◆ solve()

template<class OBJ , typename FUNC , typename JACOB >
VectorD NumA::NewtonMD::solve ( OBJ *  object,
FUNC  G,
const std::vector< double > &  funcParameters,
VectorD  X0,
JACOB  J_G = 0,
const double  absTolerance = 1.e-4,
const double  relTolerance = 1.e-4,
const size_t  maxIteration = 50 
)
inline

Member Data Documentation

◆ m_linMethod

LinAlgUtils::Method NumA::NewtonMD::m_linMethod
private

Method used for solving linear systems.

◆ m_N

int NumA::NewtonMD::m_N
private

Dimension of the problem.


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