ReFRACtor
FullPhysics::GslIntegrate Class Reference

This is a thin wrapper around the GSL integration function. More...

#include <fp_gsl_integrate.h>

+ Inheritance diagram for FullPhysics::GslIntegrate:
+ Collaboration diagram for FullPhysics::GslIntegrate:

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...
 

Detailed Description

This is a thin wrapper around the GSL integration function.

Definition at line 13 of file fp_gsl_integrate.h.

Constructor & Destructor Documentation

◆ GslIntegrate()

GslIntegrate::GslIntegrate ( int  Max_intervals = 1000)

This sets up the workspace need by GSL for integration.

Parameters
Max_intervalsThe maximum number of intervals that we can have in the integration.

Definition at line 13 of file fp_gsl_integrate.cc.

◆ ~GslIntegrate()

GslIntegrate::~GslIntegrate ( )
virtual

Definition at line 19 of file fp_gsl_integrate.cc.

Member Function Documentation

◆ integrate() [1/2]

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.

◆ integrate() [2/2]

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.

◆ integrate_err_est() [1/2]

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.

◆ integrate_err_est() [2/2]

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.


The documentation for this class was generated from the following files:

Copyright © 2017, California Institute of Technology.
ALL RIGHTS RESERVED.
U.S. Government Sponsorship acknowledged.
Generated Fri Aug 24 2018 15:44:12