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

#include <Bisection.hpp>

Inherits nc::roots::Iteration.

Public Member Functions

 Bisection (const double epsilon, const uint32 maxNumIterations, std::function< double(double)> f) noexcept
 
 Bisection (const double epsilon, std::function< double(double)> f) noexcept
 
 ~Bisection () 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

Bisection root finding method

Constructor & Destructor Documentation

◆ Bisection() [1/2]

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

Constructor

Parameters
epsilonthe epsilon value
fthe function

◆ Bisection() [2/2]

nc::roots::Bisection::Bisection ( 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

◆ ~Bisection()

nc::roots::Bisection::~Bisection ( )
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::Bisection::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: