Effective implementation of algorithms (Master Thesis)
Effective and error-free implementation of algorithms
math::binsearch::FunctionBinsearch< T > Class Template Reference

#include <function_binsearch.h>

List of all members.

Public Member Functions

root (Function< T > *f, T left, T right, T precision)
convex_min (ConvexFunction< T > *f, T left, T right, T precision)

Private Member Functions

int number_of_iterations (T left, T right, T precision, double division)

template<typename T>
class math::binsearch::FunctionBinsearch< T >


Member Function Documentation

template<typename T >
T math::binsearch::FunctionBinsearch< T >::convex_min ( ConvexFunction< T > *  f,
left,
right,
precision 
) [inline]

Finds a minimum value of convex function on given interval [left, right)

Warning:
Real error can be greated than precision if precision is small compared to magnitude of the result,
See also:
root()
Precondition:
  • function should be convex
Parameters:
leftleft end of the interval
rightright end of the interval
precisionrequired precision
Returns:
argmin
template<typename T >
int math::binsearch::FunctionBinsearch< T >::number_of_iterations ( left,
right,
precision,
double  division 
) [inline, private]

Calculate the number of iterations needed to obtain specified precision if original range is [left, right) and each iteration the range is reduced to 1/division of its size.

Warning:
This is exact-math result, in floating-point numbers it may not be possible to obtain required precision. In that case the iteration count should be hovewer sufficient as after the required number of iterations, the computation will be stalled
template<typename T >
T math::binsearch::FunctionBinsearch< T >::root ( Function< T > *  f,
left,
right,
precision 
) [inline]

Finds any root of function on interval [left, right) with specified precision

Precondition:
  • You must provide such an interval, that function values are of opposite sign at the interval ends.
Warning:
Real error can be greater than precision in case that precision is smaller than distance between two floating-point values at required range
Returns:
any root on the interval.

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines