![]() |
CosmoBolognaLib
Free Software C++/Python libraries for cosmological calculations
|
#include "Headers/FuncGrid_Bspline.h"
Public Member Functions | |
Constructors/destructors | |
| FuncGrid ()=default | |
| default constructor | |
| FuncGrid (const std::vector< double > x, const std::vector< double > y, const std::string interpType, const BinType bin_type=BinType::_linear_) | |
| constructor More... | |
| ~FuncGrid ()=default | |
| default destructor | |
Functions to get the private members of the class | |
| std::vector< double > | x () const |
| get the private member FuncGrid::m_x More... | |
| double | x (const int i) const |
| get the i-th element of the private member FuncGrid::m_x More... | |
| std::vector< double > | y () const |
| get the private member FuncGrid::m_y More... | |
| double | y (const int i) const |
| get the i-th element of the private member FuncGrid::m_y More... | |
| double | size () const |
| get the private member FuncGrid::m_size More... | |
| double | xmin () const |
| get the private member FuncGrid::m_xmin More... | |
| double | xmax () const |
| get the private member FuncGrid::m_xmax More... | |
Functions of generic usage | |
| void | free () |
| free the GSL objects | |
| double | operator() (const double xx) const |
| overloading of the () operator More... | |
| std::vector< double > | eval_func (const std::vector< double > xx) const |
| evaluate the function at the xx points More... | |
| double | D1v (const double xx) const |
| compute the first derivative at xx More... | |
| double | D2v (const double xx) const |
| compute the second derivative at xx More... | |
| double | integrate_qag (const double a, const double b, const double rel_err=1.e-2, const double abs_err=1.e-6, const int limit_size=1000, const int rule=6) |
| compute the definite integral with GSL qag method More... | |
| double | integrate_cquad (const double a, const double b, const double rel_err=1.e-2, const double abs_err=1.e-6, const int nevals=100) |
| compute the definite integral with GSL cquad method More... | |
| double | integrate_qaws (const double a, const double b, const double alpha=0, const double beta=0, const int mu=0, const int nu=0, const double rel_err=1.e-2, const double abs_err=1.e-6, const int limit_size=1000) |
| compute the definite integral with GSL qaws method More... | |
| double | root (const double x_low, const double x_up, const double fx0=0, const double rel_err=1.e-2, const double abs_err=1.e-6) |
| find roots with GSL brent method More... | |
| double | root_D1v (const double x_low, const double x_up, const double fx0=0, const double rel_err=1.e-2, const double abs_err=1.e-6) |
| find roots with GSL brent method for the first derivative More... | |
| double | root_D2v (const double x_low, const double x_up, const double fx0=0, const double rel_err=1.e-2, const double abs_err=1.e-6) |
| find roots with GSL brent method for the second derivative More... | |
Private Attributes | |
| std::vector< double > | m_x |
| x values | |
| std::vector< double > | m_y |
| y values | |
| size_t | m_size |
| size of the x,y vectors, i.e. the grid size | |
| std::string | m_interpType |
| method used to interpolate | |
| std::shared_ptr< gsl_spline > | m_spline |
| GSL object used to interpolate. | |
| const gsl_interp_type * | m_type |
| GSL object used to set the interpolation type. | |
| std::shared_ptr< gsl_interp_accel > | m_acc |
| GSL accelerator object. | |
| double | m_xmin |
| minimum x value | |
| double | m_xmax |
| maximum x value | |
| BinType | m_binType |
| bin type | |
The class FuncGrid.
The class FuncGrid_Bspline.
This class is used to handle functions stored on a grid. Specifically, it contains member functions to interpolate, find minima, compute derivatives and integrals.
This class is used to handle functions interpolated using a basis spline (http://mathworld.wolfram.com/B-Spline.html) In particular this class wraps the GSL Bspline implementation. For further details, please refer to https://www.gnu.org/software/gsl/doc/html/bspline.html
Definition at line 54 of file FuncGrid.h.
| cbl::glob::FuncGrid::FuncGrid | ( | const std::vector< double > | x, |
| const std::vector< double > | y, | ||
| const std::string | interpType, | ||
| const BinType | bin_type = BinType::_linear_ |
||
| ) |
constructor
| x | vector containing the x values |
| y | vector containing the y values |
| interpType | interpolation method |
| bin_type | the binning type |
Definition at line 45 of file FuncGrid.cpp.
| double cbl::glob::FuncGrid::D1v | ( | const double | xx | ) | const |
compute the first derivative at xx
| xx | the value at which the derivative is computed |
Definition at line 167 of file FuncGrid.cpp.
| double cbl::glob::FuncGrid::D2v | ( | const double | xx | ) | const |
compute the second derivative at xx
| xx | the value at which the derivative is computed |
Definition at line 178 of file FuncGrid.cpp.
| std::vector< double > cbl::glob::FuncGrid::eval_func | ( | const std::vector< double > | xx | ) | const |
evaluate the function at the xx points
| xx | the values at which the function will be evaluated |
Definition at line 153 of file FuncGrid.cpp.
| double cbl::glob::FuncGrid::integrate_cquad | ( | const double | a, |
| const double | b, | ||
| const double | rel_err = 1.e-2, |
||
| const double | abs_err = 1.e-6, |
||
| const int | nevals = 100 |
||
| ) |
compute the definite integral with GSL cquad method
| a | the lower limit of the integral |
| b | the upper limit of the integral |
| rel_err | the relative error |
| abs_err | the absolute error |
| nevals | the number of intervals |
Definition at line 198 of file FuncGrid.cpp.
| double cbl::glob::FuncGrid::integrate_qag | ( | const double | a, |
| const double | b, | ||
| const double | rel_err = 1.e-2, |
||
| const double | abs_err = 1.e-6, |
||
| const int | limit_size = 1000, |
||
| const int | rule = 6 |
||
| ) |
compute the definite integral with GSL qag method
| a | the lower limit of the integral |
| b | the upper limit of the integral |
| rel_err | the relative error |
| abs_err | the absolute error |
| limit_size | the maximum size of workspace |
| rule | the rule of integration |
Definition at line 187 of file FuncGrid.cpp.
| double cbl::glob::FuncGrid::integrate_qaws | ( | const double | a, |
| const double | b, | ||
| const double | alpha = 0, |
||
| const double | beta = 0, |
||
| const int | mu = 0, |
||
| const int | nu = 0, |
||
| const double | rel_err = 1.e-2, |
||
| const double | abs_err = 1.e-6, |
||
| const int | limit_size = 1000 |
||
| ) |
compute the definite integral with GSL qaws method
| a | the lower limit of the integral |
| b | the upper limit of the integral |
| alpha | α |
| beta | β |
| mu | μ |
| nu | ν |
| rel_err | the relative error |
| abs_err | the absolute error |
| limit_size | the maximum size of workspace |
Definition at line 209 of file FuncGrid.cpp.
| double cbl::glob::FuncGrid::operator() | ( | const double | xx | ) | const |
overloading of the () operator
| xx | the value at which the function will be evaluated |
Definition at line 120 of file FuncGrid.cpp.
| double cbl::glob::FuncGrid::root | ( | const double | x_low, |
| const double | x_up, | ||
| const double | fx0 = 0, |
||
| const double | rel_err = 1.e-2, |
||
| const double | abs_err = 1.e-6 |
||
| ) |
find roots with GSL brent method
| x_low | the lower limit |
| x_up | the upper limit |
| fx0 | fx0 |
| rel_err | the relative error |
| abs_err | the absolute error |
Definition at line 220 of file FuncGrid.cpp.
| double cbl::glob::FuncGrid::root_D1v | ( | const double | x_low, |
| const double | x_up, | ||
| const double | fx0 = 0, |
||
| const double | rel_err = 1.e-2, |
||
| const double | abs_err = 1.e-6 |
||
| ) |
find roots with GSL brent method for the first derivative
| x_low | the lower limit |
| x_up | the upper limit |
| fx0 | fx0 |
| rel_err | the relative error |
| abs_err | the absolute error |
Definition at line 231 of file FuncGrid.cpp.
| double cbl::glob::FuncGrid::root_D2v | ( | const double | x_low, |
| const double | x_up, | ||
| const double | fx0 = 0, |
||
| const double | rel_err = 1.e-2, |
||
| const double | abs_err = 1.e-6 |
||
| ) |
find roots with GSL brent method for the second derivative
| x_low | the lower limit |
| x_up | the upper limit |
| fx0 | fx0 |
| rel_err | the relative error |
| abs_err | the absolute error |
Definition at line 242 of file FuncGrid.cpp.
|
inline |
get the private member FuncGrid::m_size
Definition at line 159 of file FuncGrid.h.
|
inline |
get the private member FuncGrid::m_x
Definition at line 131 of file FuncGrid.h.
|
inline |
get the i-th element of the private member FuncGrid::m_x
| i | the i-th index |
Definition at line 139 of file FuncGrid.h.
|
inline |
get the private member FuncGrid::m_xmax
Definition at line 171 of file FuncGrid.h.
|
inline |
get the private member FuncGrid::m_xmin
Definition at line 165 of file FuncGrid.h.
|
inline |
get the private member FuncGrid::m_y
Definition at line 145 of file FuncGrid.h.
|
inline |
get the i-th element of the private member FuncGrid::m_y
| i | the i-th index |
Definition at line 153 of file FuncGrid.h.