votca 2024.2-dev
Loading...
Searching...
No Matches
votca::xtp::NewtonRapson< Func > Class Template Reference

Newton Rapson rootfinder for 1d functions. More...

#include <newton_rapson.h>

Public Types

enum  Errors { success , smalldenom , notconverged }
 

Public Member Functions

 NewtonRapson (Index max_iterations, double tolerance)
 
 NewtonRapson (Index max_iterations, double tolerance, double alpha)
 
double FindRoot (const Func &f, double x0)
 
Errors getInfo () const
 
Index getIterations () const
 

Private Attributes

Errors info_ = Errors::notconverged
 
Index max_iterations_
 
Index iter_
 
double tolerance_
 
double alpha_ = 1.0
 

Detailed Description

template<class Func>
class votca::xtp::NewtonRapson< Func >

Newton Rapson rootfinder for 1d functions.

https://en.wikipedia.org/wiki/Newton%27s_method#Modified_Newton_methods

Definition at line 40 of file newton_rapson.h.

Member Enumeration Documentation

◆ Errors

template<class Func >
enum votca::xtp::NewtonRapson::Errors
Enumerator
success 
smalldenom 
notconverged 

Definition at line 42 of file newton_rapson.h.

Constructor & Destructor Documentation

◆ NewtonRapson() [1/2]

template<class Func >
votca::xtp::NewtonRapson< Func >::NewtonRapson ( Index max_iterations,
double tolerance )
inline

Definition at line 43 of file newton_rapson.h.

◆ NewtonRapson() [2/2]

template<class Func >
votca::xtp::NewtonRapson< Func >::NewtonRapson ( Index max_iterations,
double tolerance,
double alpha )
inline

Definition at line 46 of file newton_rapson.h.

Member Function Documentation

◆ FindRoot()

template<class Func >
double votca::xtp::NewtonRapson< Func >::FindRoot ( const Func & f,
double x0 )
inline

Definition at line 49 of file newton_rapson.h.

◆ getInfo()

template<class Func >
Errors votca::xtp::NewtonRapson< Func >::getInfo ( ) const
inline

Definition at line 72 of file newton_rapson.h.

◆ getIterations()

template<class Func >
Index votca::xtp::NewtonRapson< Func >::getIterations ( ) const
inline

Definition at line 73 of file newton_rapson.h.

Member Data Documentation

◆ alpha_

template<class Func >
double votca::xtp::NewtonRapson< Func >::alpha_ = 1.0
private

Definition at line 80 of file newton_rapson.h.

◆ info_

template<class Func >
Errors votca::xtp::NewtonRapson< Func >::info_ = Errors::notconverged
private

Definition at line 76 of file newton_rapson.h.

◆ iter_

template<class Func >
Index votca::xtp::NewtonRapson< Func >::iter_
private

Definition at line 78 of file newton_rapson.h.

◆ max_iterations_

template<class Func >
Index votca::xtp::NewtonRapson< Func >::max_iterations_
private

Definition at line 77 of file newton_rapson.h.

◆ tolerance_

template<class Func >
double votca::xtp::NewtonRapson< Func >::tolerance_
private

Definition at line 79 of file newton_rapson.h.


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