NumCpp  2.12.1
A Templatized Header Only C++ Implementation of the Python NumPy Library
nc::roots::Brent Class Reference

#include <Brent.hpp>

Inherits nc::roots::Iteration.

Public Member Functions

 Brent (const double epsilon, const uint32 maxNumIterations, std::function< double(double)> f) noexcept
 
 Brent (const double epsilon, std::function< double(double)> f) noexcept
 
 ~Brent () override=default
 
uint32 numIterations () const noexcept
 
double solve (double a, double b)
 

Protected Member Functions

void incrementNumberOfIterations ()
 
void resetNumberOfIterations () noexcept
 

Protected Attributes

const double epsilon_
 
uint32 maxNumIterations_ { 1000 }
 
uint32 numIterations_ { 0 }
 

Detailed Description

Brent root finding method

Constructor & Destructor Documentation

◆ Brent() [1/2]

nc::roots::Brent::Brent ( const double  epsilon,
std::function< double(double)>  f 
)
inlinenoexcept

Constructor

Parameters
epsilonthe epsilon value
fthe function

◆ Brent() [2/2]

nc::roots::Brent::Brent ( const double  epsilon,
const uint32  maxNumIterations,
std::function< double(double)>  f 
)
inlinenoexcept

Constructor

Parameters
epsilonthe epsilon value
maxNumIterationsthe maximum number of iterations to perform
fthe function

◆ ~Brent()

nc::roots::Brent::~Brent ( )
overridedefault

Destructor

Member Function Documentation

◆ incrementNumberOfIterations()

void nc::roots::Iteration::incrementNumberOfIterations ( )
inlineprotectedinherited

Incraments the number of iterations

◆ numIterations()

uint32 nc::roots::Iteration::numIterations ( ) const
inlinenoexceptinherited

Returns the number of iterations

Returns
: number of iterations

◆ resetNumberOfIterations()

void nc::roots::Iteration::resetNumberOfIterations ( )
inlineprotectednoexceptinherited

Resets the number of iterations

◆ solve()

double nc::roots::Brent::solve ( double  a,
double  b 
)
inline

Solves for the root in the range [a, b]

Parameters
athe lower bound
bthe upper bound
Returns
root between the bound

Field Documentation

◆ epsilon_

const double nc::roots::Iteration::epsilon_
protectedinherited

◆ maxNumIterations_

uint32 nc::roots::Iteration::maxNumIterations_ { 1000 }
protectedinherited

◆ numIterations_

uint32 nc::roots::Iteration::numIterations_ { 0 }
protectedinherited

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