Honeycomb  0.1
Component-Model Framework
Public Types | Public Member Functions | List of all members
honey::Bisect< Real > Class Template Reference

Find the root of a function by the bisection method. ie. Finds where function returns 0. More...

#include <Bisect.h>

Public Types

typedef function< Real(Real)> Func
 

Public Member Functions

 Bisect (Real tol=Real_::zeroTol, int iterMax=30)
 
tuple< bool, Real, Realbracket (const Func &func, Real min, Real max)
 Find the lower and upper bounds of the root of a function. ie. Estimate bounds where somewhere within the function returns 0. More...
 
tuple< bool, Realroot (const Func &func, Real min, Real max)
 Find the root of a function within bounds [min,max]. More...
 

Detailed Description

template<class Real>
class honey::Bisect< Real >

Find the root of a function by the bisection method. ie. Finds where function returns 0.

Bisection should only be used if the function to be evaluated is monotonic over the range [min,max], ie. the function is either increasing or decreasing over the range.

Member Typedef Documentation

template<class Real >
typedef function<Real (Real)> honey::Bisect< Real >::Func

Constructor & Destructor Documentation

template<class Real >
honey::Bisect< Real >::Bisect ( Real  tol = Real_::zeroTol,
int  iterMax = 30 
)
inline
Parameters
tolfind root to within tolerance of zero
iterMaxmax bisections

Member Function Documentation

template<class Real >
tuple< bool, Real, Real > honey::Bisect< Real >::bracket ( const Func func,
Real  min,
Real  max 
)

Find the lower and upper bounds of the root of a function. ie. Estimate bounds where somewhere within the function returns 0.

This method finds the bounds by expanding min/max each step

Parameters
func
minroot lower bound estimate
maxroot upper bound estimate
Return values
foundif not found a best guess is returned
min
max
template<class Real >
tuple< bool, Real > honey::Bisect< Real >::root ( const Func func,
Real  min,
Real  max 
)

Find the root of a function within bounds [min,max].

If the bounds are unknown call Bracket to estimate the bounds

Parameters
func
minroot lower bound
maxroot upper bound
Return values
foundif not found a best guess is returned
root

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