ReFRACtor
|
This is a thin wrapper around the GSL integration function. More...
#include <fp_gsl_integrate.h>
Public Member Functions | |
GslIntegrate (int Max_intervals=1000) | |
This sets up the workspace need by GSL for integration. More... | |
virtual | ~GslIntegrate () |
double | integrate (const boost::function< double(double)> &F, double xmin, double xmax, double eps_abs=0.0, double eps_rel=1e-8, int key=GSL_INTEG_GAUSS15) const |
Version of integrate that only returns the results, without the error estimate. More... | |
double | integrate (const boost::function< double(double)> &F, double xmin, double xmax, const std::vector< double > &breakpoints, double eps_abs=0.0, double eps_rel=1e-8, int key=GSL_INTEG_GAUSS15) const |
Version of integrate where we supply breakpoints that should be used in the integral. More... | |
void | integrate_err_est (const boost::function< double(double)> &F, double xmin, double xmax, double &Res, double &Error_est, double eps_abs=0.0, double eps_rel=1e-8, int key=GSL_INTEG_GAUSS15) const |
Calculate the definite integral of F from xmin to xmax. More... | |
void | integrate_err_est (const boost::function< double(double)> &F, double xmin, double xmax, const std::vector< double > &breakpoints, double &Res, double &Error_est, double eps_abs=0.0, double eps_rel=1e-8, int key=GSL_INTEG_GAUSS15) const |
Version of integrate_err_est where we supply breakpoints that should be used in the integral. More... | |
This is a thin wrapper around the GSL integration function.
Definition at line 13 of file fp_gsl_integrate.h.
GslIntegrate::GslIntegrate | ( | int | Max_intervals = 1000 | ) |
This sets up the workspace need by GSL for integration.
Max_intervals | The maximum number of intervals that we can have in the integration. |
Definition at line 13 of file fp_gsl_integrate.cc.
|
virtual |
Definition at line 19 of file fp_gsl_integrate.cc.
double GslIntegrate::integrate | ( | const boost::function< double(double)> & | F, |
double | xmin, | ||
double | xmax, | ||
double | eps_abs = 0.0 , |
||
double | eps_rel = 1e-8 , |
||
int | key = GSL_INTEG_GAUSS15 |
||
) | const |
Version of integrate that only returns the results, without the error estimate.
This takes the first result with the absolute error < eps_abs or the relative error < eps_rel. Note that this is a "or" the first test passed cause the integration to complete. You can set eps_abs or eps_rel to 0 if you want to skip that test.
Definition at line 36 of file fp_gsl_integrate.cc.
double GslIntegrate::integrate | ( | const boost::function< double(double)> & | F, |
double | xmin, | ||
double | xmax, | ||
const std::vector< double > & | breakpoints, | ||
double | eps_abs = 0.0 , |
||
double | eps_rel = 1e-8 , |
||
int | key = GSL_INTEG_GAUSS15 |
||
) | const |
Version of integrate where we supply breakpoints that should be used in the integral.
If you know this ahead of time, it can speed up the integration.
breakpoint doesn't needed to be sorted, and it can also contain points outside the range xmin to xmax. We just throw away any points outside of the range, and sort the data before using.
Definition at line 55 of file fp_gsl_integrate.cc.
void GslIntegrate::integrate_err_est | ( | const boost::function< double(double)> & | F, |
double | xmin, | ||
double | xmax, | ||
double & | Res, | ||
double & | Error_est, | ||
double | eps_abs = 0.0 , |
||
double | eps_rel = 1e-8 , |
||
int | key = GSL_INTEG_GAUSS15 |
||
) | const |
Calculate the definite integral of F from xmin to xmax.
This uses GSL function gsl_integration_qags, you can consult the GSL documentation for details on this function (see http://www.gnu.org/software/gsl/manual/html_node/QAGS-adaptive-integration-with-singularities.html).
This takes the first result with the absolute error < eps_abs or the relative error < eps_rel. Note that this is a "or" the first test passed cause the integration to complete. You can set eps_abs or eps_rel to 0 if you want to skip that test.
Definition at line 89 of file fp_gsl_integrate.cc.
void GslIntegrate::integrate_err_est | ( | const boost::function< double(double)> & | F, |
double | xmin, | ||
double | xmax, | ||
const std::vector< double > & | breakpoints, | ||
double & | Res, | ||
double & | Error_est, | ||
double | eps_abs = 0.0 , |
||
double | eps_rel = 1e-8 , |
||
int | key = GSL_INTEG_GAUSS15 |
||
) | const |
Version of integrate_err_est where we supply breakpoints that should be used in the integral.
If you know this ahead of time, it can speed up the integration.
breakpoint doesn't needed to be sorted, and it can also contain points outside the range xmin to xmax. We just throw away any points outside of the range, and sort the data before using.
Definition at line 113 of file fp_gsl_integrate.cc.