![]() |
CosmoBolognaLib
Free Software C++/Python libraries for cosmological calculations
|
The class LegendrePolynomials. More...
#include "Headers/LegendrePolynomials.h"
Public Member Functions | |
void | set (const int lMax) |
set maximum order of expansion More... | |
double | operator() (const double x, const int ell) |
evaluate the Legendre polynomial of order ell at x More... | |
std::vector< double > | operator() (const double x) |
evaluate the Legendre polynomial up to lMax at x More... | |
double | integral (const double x_min, const double x_max, const int ell) |
evaluate the bin-averaged Legendre polynomial of order ell More... | |
std::vector< double > | integral (const double x_min, const double x_max) |
evaluate the bin-averaged Legendre polynomials More... | |
std::vector< std::vector< double > > | triangle (const double r12, const double r13, const double r23) |
evaluate the Legendre polynomials for triangle angles. More... | |
std::vector< double > | triangle_integral (const double r12_min, const double r12_max, const double r13_min, const double r13_max, const double r23_min, const double r23_max, const double rel_err=1.e-4, const int nevals=10000) |
evaluate the bin-averaged Legendre polynomials over a triangle. Triangle side can vary from a minimum to a maximum value More... | |
Constructors/destructors | |
LegendrePolynomials () | |
Default constructor of LegendrePolynomials. | |
LegendrePolynomials (const int lMax, const bool safe=false) | |
Constructor of LegendrePolynomials. More... | |
~LegendrePolynomials () | |
Default destructor. | |
Protected Member Functions | |
void | m_set_coefficients (const int lMax) |
set internal attribute m_coefficients More... | |
Protected Attributes | |
size_t | m_nOrders |
Number of Legendre polynomial. | |
Eigen::MatrixXd | m_coefficients |
Coefficients of the Legendre polynomials. | |
The class LegendrePolynomials.
This class is used to handle Legendre polynomials. It contains all methods to compute Legendre polynomials as well as their integrals.
Definition at line 52 of file LegendrePolynomials.h.
cbl::glob::LegendrePolynomials::LegendrePolynomials | ( | const int | lMax, |
const bool | safe = false |
||
) |
Constructor of LegendrePolynomials.
lMax | maximum order of Legendre polynomials |
safe | True \(\rightarrow \) check input range is among -1 a 1 False \( \rightarrow \) do not check input |
Definition at line 88 of file LegendrePolynomials.cpp.
vector< double > cbl::glob::LegendrePolynomials::integral | ( | const double | x_min, |
const double | x_max | ||
) |
evaluate the bin-averaged Legendre polynomials
x_min | the lower bin edge |
x_max | the up bin edge |
Definition at line 167 of file LegendrePolynomials.cpp.
double cbl::glob::LegendrePolynomials::integral | ( | const double | x_min, |
const double | x_max, | ||
const int | ell | ||
) |
evaluate the bin-averaged Legendre polynomial of order ell
x_min | the lower bin edge |
x_max | the up bin edge |
ell | the order of the Legendre polynomial |
Definition at line 144 of file LegendrePolynomials.cpp.
|
protected |
set internal attribute m_coefficients
Set the coefficients of the Legendre Polynomials according to the following recursive relation:
\[ P_{n}(x)=2^{n} \sum_{k=0}^{n} x^{k}\left(\begin{array}{l} n \\ k \end{array}\right)\left(\begin{array}{c} \frac{n+k-1}{2} \\ n \end{array}\right) \]
lMax | maximum order of Legendre polynomials |
Definition at line 48 of file LegendrePolynomials.cpp.
vector< double > cbl::glob::LegendrePolynomials::operator() | ( | const double | x | ) |
evaluate the Legendre polynomial up to lMax at x
x | the point to evaluate Legendre polynomials |
Definition at line 124 of file LegendrePolynomials.cpp.
double cbl::glob::LegendrePolynomials::operator() | ( | const double | x, |
const int | ell | ||
) |
evaluate the Legendre polynomial of order ell at x
x | the point to evaluate Legendre polynomial |
ell | the order of the Legendre polynomial |
Definition at line 107 of file LegendrePolynomials.cpp.
void cbl::glob::LegendrePolynomials::set | ( | const int | lMax | ) |
set maximum order of expansion
lMax | maximum order of Legendre polynomials |
Definition at line 98 of file LegendrePolynomials.cpp.
vector< vector< double > > cbl::glob::LegendrePolynomials::triangle | ( | const double | r12, |
const double | r13, | ||
const double | r23 | ||
) |
evaluate the Legendre polynomials for triangle angles.
r12 | first triangle side |
r13 | second triangle side |
r23 | third triangle side |
Definition at line 192 of file LegendrePolynomials.cpp.
vector< double > cbl::glob::LegendrePolynomials::triangle_integral | ( | const double | r12_min, |
const double | r12_max, | ||
const double | r13_min, | ||
const double | r13_max, | ||
const double | r23_min, | ||
const double | r23_max, | ||
const double | rel_err = 1.e-4 , |
||
const int | nevals = 10000 |
||
) |
evaluate the bin-averaged Legendre polynomials over a triangle. Triangle side can vary from a minimum to a maximum value
r12_min | the first side lower edge |
r12_max | the first side upper edge |
r13_min | the second side lower edge |
r13_max | the second side upper edge |
r23_min | the third side lower edge |
r23_max | the third side upper edge |
rel_err | the relative integration error |
nevals | maximum number of function evaluation |
Definition at line 210 of file LegendrePolynomials.cpp.