CosmoBolognaLib
Free Software C++/Python libraries for cosmological calculations
SphericalHarmonics_Coefficients.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 
34 #ifndef __SHCOEFF__
35 #define __SHCOEFF__
36 
37 #include "Func.h"
38 
39 namespace cbl {
40 
41  namespace glob {
42 
58 
59  protected:
60 
62  int m_nbins;
63 
65  int m_norder;
66 
68  int m_lmax;
69 
71  int m_n_sph;
72 
74  std::vector<int> m_n_sph_l;
75 
77  std::vector<std::vector<std::complex<double>>> m_alm;
78 
80  std::vector<double> m_normalization;
81 
83  std::vector<double> m_Plm;
84 
86  std::vector<std::complex<double>> m_sph;
87 
88  public:
93 
100 
110  SphericalHarmonics_Coefficients (const int norder, const int nbins=1) { initialize(norder, nbins); }
111 
118 
120 
133  double real (const int n, const int bin=0) { return m_alm[bin][n].real();}
134 
147  double imag (const int n, const int bin=0) { return m_alm[bin][n].imag();}
148 
158  void initialize (const int norder, const int nbins=1);
159 
165  void reset ();
166 
180  std::vector<std::complex<double>> alm(const double xx, const double yy, const double zz);
181 
194  void add (const std::vector<std::complex<double>> alm, const double ww, const int bin=0);
195 
213  void add (const double xx, const double yy, const double zz, const double ww, const int bin=0);
214 
235  double power (const int l, const int bin1, const int bin2);
236  };
237 
238  }
239 }
240 
241 #endif
Useful generic functions.
The class SphericalHarmonics_Coefficients.
SphericalHarmonics_Coefficients(const int norder, const int nbins=1)
default constructor
double power(const int l, const int bin1, const int bin2)
compute the product of the in two separation bin
std::vector< std::complex< double > > m_sph
vector for temporary computation of spherical harmonics
int m_n_sph
the total number of spherical harmonics
std::vector< int > m_n_sph_l
the number of spherical harmonics for a given choice of
std::vector< std::complex< double > > alm(const double xx, const double yy, const double zz)
compute the for the normalized coordinates
void initialize(const int norder, const int nbins=1)
initialize the internal quantities
double real(const int n, const int bin=0)
return the real part of the n-th coefficient of the expansion for a given separation bin
std::vector< std::vector< std::complex< double > > > m_alm
the spherical harmonics expansion coefficients in separation bins
double imag(const int n, const int bin=0)
return the imaginary part of the n-th coefficient of the expansion for a given separation bin
std::vector< double > m_normalization
the normalization
std::vector< double > m_Plm
vector for temporary computation of associated legendre polynomials
void add(const std::vector< std::complex< double >> alm, const double ww, const int bin=0)
add the to a specific separation bin with a weight
The global namespace of the CosmoBolognaLib
Definition: CAMB.h:38