BSInverse Class Reference

#include <fbsinverse.h>

Inheritance diagram for BSInverse:
Inheritance graph
[legend]
Collaboration diagram for BSInverse:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 BSInverse (Function1D &f, double a, double b, double Tol)
virtual double operator() (double y, unsigned cmp) const
virtual ~BSInverse ()

Private Attributes

Function1D_f
double _a
double _b
double _Tol

Detailed Description

Definition at line 7 of file fbsinverse.h.


Constructor & Destructor Documentation

BSInverse::BSInverse ( Function1D f,
double  a,
double  b,
double  Tol 
)

Definition at line 3 of file fbsinverse.cpp.

00003                                                                  :_f(f)
00004 {
00005         _a=a;
00006         _b=b;
00007         assert(_a < _b);
00008         _Tol=Tol;
00009 }

BSInverse::~BSInverse (  )  [virtual]

Definition at line 29 of file fbsinverse.cpp.

00029 {}


Member Function Documentation

double BSInverse::operator() ( double  y,
unsigned  cmp = 0 
) const [virtual]

Implements Function1D.

Definition at line 11 of file fbsinverse.cpp.

00012 {
00013         assert(isInDomain(y,cmp));
00014         double y_M, x_M;
00015         double x_L = _a;
00016         double x_R = _b;
00017         double diff = x_R-x_L;
00018         while (diff > _Tol)
00019         {
00020                 x_M = 0.5*(x_L + x_R);
00021                 y_M = _f(x_M);
00022                 if (y <= y_M) x_L = x_M;
00023                 else x_R = x_M;
00024                 diff = x_R-x_L;
00025         }
00026         return x_M;
00027 }


Member Data Documentation

double BSInverse::_a [private]

Definition at line 14 of file fbsinverse.h.

double BSInverse::_b [private]

Definition at line 14 of file fbsinverse.h.

Definition at line 10 of file fbsinverse.h.

double BSInverse::_Tol [private]

Definition at line 15 of file fbsinverse.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Generated on Sun Apr 8 23:12:58 2012 for CO2INJECTION by  doxygen 1.6.3