#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 | ( | ) |
00052 : myfunc(0){ 00053 if(!initialised){ 00054 eps = std::numeric_limits<double>::epsilon(); 00055 sqrteps = sqrt(eps); 00056 root3eps = pow(eps,1/3.0); 00057 initialised = true; 00058 } 00059 }
bvp::realfunc::realfunc | ( | double(*)(const point &) | f | ) |
00061 : myfunc(f) { 00062 if(!initialised){ 00063 eps = std::numeric_limits<double>::epsilon(); 00064 sqrteps = sqrt(eps); 00065 root3eps = pow(eps,1/3.0); 00066 initialised = true; 00067 } 00068 }
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 >.
00074 { 00075 return at(p); 00076 }
double bvp::realfunc::at | ( | const point & | p | ) | const [virtual] |
Reimplemented in bvp::interpolator< RBF >.
00077 { 00078 if(myfunc == 0){ 00079 no_init(__LINE__,__FILE__); 00080 } 00081 00082 return myfunc(p); 00083 }
double bvp::realfunc::d | ( | const point & | x, | |
size_t | k | |||
) | const [virtual] |
Reimplemented in bvp::interpolator< RBF >.
00085 { 00086 gsl_function_wrapper gfw(*this,p,k); 00087 double result, abserror; 00088 double x = p(1); 00089 double typx = (1 > log(x) ? 1 : log(x)); 00090 double h = sqrteps*( fabs(x) > typx ? fabs(x) : typx); 00091 00092 gsl_deriv_central(gfw.get_gsl_function(), x, h, &result, &abserror); 00093 return result; 00094 }
double bvp::realfunc::d2 | ( | const point & | x, | |
size_t | k1, | |||
size_t | k2 | |||
) | const [virtual] |
Reimplemented in bvp::interpolator< RBF >.
00096 { 00097 //FIXME 00098 //Figure this out later. 00099 k1 = k2; 00100 p.size(); 00101 return 0; 00102 }
void bvp::realfunc::no_init | ( | int | line, | |
string | file | |||
) | const [private] |
00104 { 00105 error_handling::badArgument exc; 00106 exc.line = line; 00107 exc.file = file; 00108 exc.reason = "Did not assign a function pointer to a realfunc object."; 00109 throw exc; 00110 }
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] |