![]() |
CosmoBolognaLib
Free Software C++/Python libraries for cosmological calculations
|
The class FuncGrid2D. More...
#include "Headers/FuncGrid.h"
Public Member Functions | |
Constructors/destructors | |
FuncGrid2D ()=default | |
default constructor | |
FuncGrid2D (const std::vector< double > x, const std::vector< double > y, const std::vector< std::vector< double >> fxy, const std::string interpType) | |
constructor More... | |
~FuncGrid2D ()=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_x () 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... | |
double | size_y () const |
get the private member FuncGrid::m_size More... | |
double | ymin () const |
get the private member FuncGrid::m_ymin More... | |
double | ymax () const |
get the private member FuncGrid::m_ymax More... | |
Functions of generic usage | |
void | free () |
free the GSL objects | |
double | operator() (const double xx, const double yy) const |
overloading of the () operator More... | |
std::vector< double > | eval_func (const std::vector< std::vector< double >> xx) const |
evaluate the function at the xx points More... | |
double | IntegrateVegas (const double xmin, const double xmax, const double ymin, const double ymax) const |
evaluate the 2D integral of the interpolated function using the Vegas routine from CUBA libraries More... | |
double | IntegrateSuave (const double xmin, const double xmax, const double ymin, const double ymax) const |
evaluate the 2D integral of the interpolated function using the Suave routine from CUBA libraries More... | |
double | IntegrateDivonne (const double xmin, const double xmax, const double ymin, const double ymax) const |
evaluate the 2D integral of the interpolated function using the Divonne routine from CUBA libraries More... | |
double | IntegrateCuhre (const double xmin, const double xmax, const double ymin, const double ymax) const |
evaluate the 2D integral of the interpolated function using the Cuhre routine from CUBA libraries More... | |
Private Attributes | |
std::vector< double > | m_x |
x values | |
std::vector< double > | m_y |
y values | |
std::shared_ptr< double > | m_fxy |
y values | |
size_t | m_size_x |
size of the x vector | |
size_t | m_size_y |
size of the x vector | |
std::string | m_interpType |
method used to interpolate | |
const gsl_interp2d_type * | m_type |
GSL object used to set the interpolation type. | |
std::shared_ptr< gsl_interp_accel > | m_acc_x |
GSL accelerator object. | |
std::shared_ptr< gsl_interp_accel > | m_acc_y |
GSL accelerator object. | |
std::shared_ptr< gsl_spline2d > | m_spline |
GSL object used to interpolate. | |
double | m_xmin |
minimum x value | |
double | m_xmax |
maximum x value | |
double | m_ymin |
minimum x value | |
double | m_ymax |
maximum x value | |
The class FuncGrid2D.
This class is used to handle 2D functions stored on a grid. Specifically, it contains member functions to interpolate.
Definition at line 301 of file FuncGrid.h.
cbl::glob::FuncGrid2D::FuncGrid2D | ( | const std::vector< double > | x, |
const std::vector< double > | y, | ||
const std::vector< std::vector< double >> | fxy, | ||
const std::string | interpType | ||
) |
constructor
x | vector containing the x values |
y | vector containing the y values |
fxy | matrix containing the func values |
interpType | interpolation method |
Definition at line 253 of file FuncGrid.cpp.
std::vector< double > cbl::glob::FuncGrid2D::eval_func | ( | const std::vector< 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 341 of file FuncGrid.cpp.
double cbl::glob::FuncGrid2D::IntegrateCuhre | ( | const double | xmin, |
const double | xmax, | ||
const double | ymin, | ||
const double | ymax | ||
) | const |
evaluate the 2D integral of the interpolated function using the Cuhre routine from CUBA libraries
xmin | lower limit for x variable |
xmax | upper limit for x variable |
ymin | lower limit for y variable |
ymax | upper limit for y variable |
Definition at line 403 of file FuncGrid.cpp.
double cbl::glob::FuncGrid2D::IntegrateDivonne | ( | const double | xmin, |
const double | xmax, | ||
const double | ymin, | ||
const double | ymax | ||
) | const |
evaluate the 2D integral of the interpolated function using the Divonne routine from CUBA libraries
xmin | lower limit for x variable |
xmax | upper limit for x variable |
ymin | lower limit for y variable |
ymax | upper limit for y variable |
Definition at line 387 of file FuncGrid.cpp.
double cbl::glob::FuncGrid2D::IntegrateSuave | ( | const double | xmin, |
const double | xmax, | ||
const double | ymin, | ||
const double | ymax | ||
) | const |
evaluate the 2D integral of the interpolated function using the Suave routine from CUBA libraries
xmin | lower limit for x variable |
xmax | upper limit for x variable |
ymin | lower limit for y variable |
ymax | upper limit for y variable |
Definition at line 371 of file FuncGrid.cpp.
double cbl::glob::FuncGrid2D::IntegrateVegas | ( | const double | xmin, |
const double | xmax, | ||
const double | ymin, | ||
const double | ymax | ||
) | const |
evaluate the 2D integral of the interpolated function using the Vegas routine from CUBA libraries
xmin | lower limit for x variable |
xmax | upper limit for x variable |
ymin | lower limit for y variable |
ymax | upper limit for y variable |
Definition at line 355 of file FuncGrid.cpp.
double cbl::glob::FuncGrid2D::operator() | ( | const double | xx, |
const double | yy | ||
) | const |
overloading of the () operator
xx | the value at which the function will be evaluated |
yy | the value at which the function will be evaluated |
Definition at line 319 of file FuncGrid.cpp.
|
inline |
get the private member FuncGrid::m_size
Definition at line 417 of file FuncGrid.h.
|
inline |
get the private member FuncGrid::m_size
Definition at line 435 of file FuncGrid.h.
|
inline |
get the private member FuncGrid::m_x
Definition at line 389 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 397 of file FuncGrid.h.
|
inline |
get the private member FuncGrid::m_xmax
Definition at line 429 of file FuncGrid.h.
|
inline |
get the private member FuncGrid::m_xmin
Definition at line 423 of file FuncGrid.h.
|
inline |
get the private member FuncGrid::m_y
Definition at line 403 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 411 of file FuncGrid.h.
|
inline |
get the private member FuncGrid::m_ymax
Definition at line 447 of file FuncGrid.h.
|
inline |
get the private member FuncGrid::m_ymin
Definition at line 441 of file FuncGrid.h.