CosmoBolognaLib
Free Software C++/Python libraries for cosmological calculations
LegendrePolynomials.h
Go to the documentation of this file.
1 /*******************************************************************
2  * Copyright (C) 2010 by Federico Marulli *
3  * federico.marulli3@unibo.it *
4  * *
5  * This program is free software; you can redistribute it and/or *
6  * modify it under the terms of the GNU General Public License as *
7  * published by the Free Software Foundation; either version 2 of *
8  * the License, or (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful,*
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public *
16  * License along with this program; if not, write to the Free *
17  * Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  *******************************************************************/
20 
33 #ifndef __LEGPOLS__
34 #define __LEGPOLS__
35 
36 #include "Func.h"
37 
38 namespace cbl {
39 
40  namespace glob {
41 
53 
54  protected:
55 
57  size_t m_nOrders;
58 
60  Eigen::MatrixXd m_coefficients;
61 
77  void m_set_coefficients (const int lMax);
78 
79  public:
80 
85 
90 
99  LegendrePolynomials (const int lMax, const bool safe=false);
100 
107 
109 
117  void set (const int lMax);
118 
129  double operator () (const double x, const int ell);
130 
140  std::vector<double> operator () (const double x);
141 
151  double integral (const double x_min, const double x_max, const int ell);
152 
161  std::vector<double> integral (const double x_min, const double x_max);
162 
173  std::vector<std::vector<double>> triangle (const double r12, const double r13, const double r23);
174 
191  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);
192  };
193  }
194 }
195 
196 #endif
Useful generic functions.
The class LegendrePolynomials.
double operator()(const double x, const int ell)
evaluate the Legendre polynomial of order ell at x
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...
double integral(const double x_min, const double x_max, const int ell)
evaluate the bin-averaged Legendre polynomial of order ell
std::vector< std::vector< double > > triangle(const double r12, const double r13, const double r23)
evaluate the Legendre polynomials for triangle angles.
void set(const int lMax)
set maximum order of expansion
Eigen::MatrixXd m_coefficients
Coefficients of the Legendre polynomials.
~LegendrePolynomials()
Default destructor.
void m_set_coefficients(const int lMax)
set internal attribute m_coefficients
LegendrePolynomials()
Default constructor of LegendrePolynomials.
size_t m_nOrders
Number of Legendre polynomial.
The global namespace of the CosmoBolognaLib
Definition: CAMB.h:38