#include <func.hpp>
Public Member Functions | |
realfunc () | |
realfunc (double(*f)(const point &)) | |
virtual | ~realfunc () |
void | set_function_ptr (double(f_in)(const point &p)) |
double | operator() (const point &p) const |
virtual double | at (const point &p) const |
virtual double | d (const point &x, size_t k) const |
virtual double | d2 (const point &x, size_t k1, size_t k2) const |
Static Protected Attributes | |
static double | eps = 0 |
static double | sqrteps = 0 |
static double | root3eps = 0 |
static bool | initialised = false |
Private Member Functions | |
void | no_init (int line, string file) const |
Private Attributes | |
double(* | myfunc )(const point &p) |
bvp::realfunc::realfunc | ( | ) |
00051 : myfunc(0){ 00052 if(!initialised){ 00053 eps = std::numeric_limits<double>::epsilon(); 00054 sqrteps = sqrt(eps); 00055 root3eps = pow(eps,1/3.0); 00056 initialised = true; 00057 } 00058 }
bvp::realfunc::realfunc | ( | double(*)(const point &) | f | ) |
00060 : myfunc(f) { 00061 if(!initialised){ 00062 eps = std::numeric_limits<double>::epsilon(); 00063 sqrteps = sqrt(eps); 00064 root3eps = pow(eps,1/3.0); 00065 initialised = true; 00066 } 00067 }
void bvp::realfunc::set_function_ptr | ( | double(f_in)(const point &p) | ) |
double bvp::realfunc::operator() | ( | const point & | p | ) | const |
Reimplemented in bvp::interpolator< RBF >.
00073 { 00074 return at(p); 00075 }
double bvp::realfunc::at | ( | const point & | p | ) | const [virtual] |
Reimplemented in bvp::interpolator< RBF >.
00076 { 00077 if(myfunc == 0){ 00078 no_init(__LINE__,__FILE__); 00079 } 00080 00081 return myfunc(p); 00082 }
double bvp::realfunc::d | ( | const point & | x, | |
size_t | k | |||
) | const [virtual] |
Reimplemented in bvp::interpolator< RBF >.
00084 { 00085 gsl_function_wrapper gfw(*this,p,k); 00086 double result, abserror; 00087 double x = p(1); 00088 double typx = (1 > log(x) ? 1 : log(x)); 00089 double h = sqrteps*( fabs(x) > typx ? fabs(x) : typx); 00090 00091 gsl_deriv_central(gfw.get_gsl_function(), x, h, &result, &abserror); 00092 return result; 00093 }
double bvp::realfunc::d2 | ( | const point & | x, | |
size_t | k1, | |||
size_t | k2 | |||
) | const [virtual] |
Reimplemented in bvp::interpolator< RBF >.
00095 { 00096 //FIXME 00097 //Figure this out later. 00098 k1 = k2; 00099 p.size(); 00100 return 0; 00101 }
void bvp::realfunc::no_init | ( | int | line, | |
string | file | |||
) | const [private] |
00103 { 00104 error_handling::badArgument exc; 00105 exc.line = line; 00106 exc.file = file; 00107 exc.reason = "Did not assign a function pointer to a realfunc object."; 00108 throw exc; 00109 }
double bvp::realfunc::eps = 0 [static, protected] |
Reimplemented in rbf::c_infty_rbf.
double bvp::realfunc::sqrteps = 0 [static, protected] |
double bvp::realfunc::root3eps = 0 [static, protected] |
bool bvp::realfunc::initialised = false [static, protected] |
double(* bvp::realfunc::myfunc)(const point &p) [private] |