52 m_n_sph = gsl_sf_legendre_array_n(m_lmax);
54 vector<vector<complex<double>>> _alm(m_nbins, vector<complex<double>>(m_n_sph, 0));
56 vector<double> normalization (m_n_sph);
58 vector<double> Plm(m_n_sph, 0);
59 vector<complex<double>> sph(m_n_sph);
61 for (
int l=0; l<m_norder; l++)
62 for (
int m=0; m<l+1; m++) {
64 normalization[n] = gsl_sf_fact (l - m) / gsl_sf_fact ( l + m);
68 m_normalization = normalization;
80 for (
int b=0; b<m_nbins; b++)
81 for (
int k1=0; k1<m_n_sph; k1++)
96 m_sph[1].real(cosTheta);
100 double Plm1 = cosTheta;
106 for (
int l = 1; l < m_norder-1; l++) {
108 Plm2 = ((2*l+1)*cosTheta*Plm1-l*Plm0)/(l+1);
109 m_sph[q*(q+1)/2].real(Plm2);
110 m_sph[q*(q+1)/2].imag(0.);
115 double sinTheta = sqrt(1 - cosTheta*cosTheta);
117 double cosPhi = xx/sinTheta;
118 double sinPhi = yy/sinTheta;
120 double old_cc_real = 1.;
121 double old_cc_imag = 0.;
122 double cc_real = cosPhi;
123 double cc_imag = sinPhi;
127 for (
int m=1; m<m_norder; m++) {
130 Plm1 = -(2*(m-1)+1)*Plm0*sinTheta;
132 m_sph[l*(l+1)/2+m].real(Plm1*cc_real);
133 m_sph[l*(l+1)/2+m].imag(Plm1*cc_imag);
135 Plm2 = cosTheta*(2*l+1)*Plm1;
136 m_sph[lp1*(lp1+1)/2+m].real(Plm2*cc_real);
137 m_sph[lp1*(lp1+1)/2+m].imag(Plm2*cc_imag);
139 for (
int lp2=lp1+1; lp2<m_norder; lp2++) {
140 Plm3 = ((2.*lp2-1.)*cosTheta*Plm2-(lp2+m-1)*Plm1)/(lp2-m);
144 m_sph[lp2*(lp2+1)/2+m].real(Plm3*cc_real);
145 m_sph[lp2*(lp2+1)/2+m].imag(Plm3*cc_imag);
148 old_cc_real = cc_real;
149 old_cc_imag = cc_imag;
150 cc_real = old_cc_real*cosPhi-old_cc_imag*sinPhi;
151 cc_imag = old_cc_real*sinPhi+old_cc_imag*cosPhi;
155 for (
int m=1; m<m_norder; m++) {
159 m_sph[l*(l+1)/2+m].real(0.);
160 m_sph[l*(l+1)/2+m].imag(0.);
162 m_sph[lp1*(lp1+1)/2+m].real(0.);
163 m_sph[lp1*(lp1+1)/2+m].imag(0.);
165 for (
int lp2=lp1+1; lp2<m_norder; lp2++) {
166 Plm3 = ((2.*lp2-1.)*cosTheta*Plm2-(lp2+m-1)*Plm1)/(lp2-m);
168 m_sph[lp2*(lp2+1)/2+m].real(0.);
169 m_sph[lp2*(lp2+1)/2+m].imag(0.);
184 for(
int n=0; n<m_n_sph; n++)
185 m_alm[bin][n] += ww*alm[n];
194 vector<complex<double>> alm = this->alm (xx, yy, zz);
195 for(
int n=0; n<m_n_sph; n++)
196 m_alm[bin][n] += ww*alm[n];
205 const int min_n = l*(l+1)/2;
206 double power = m_normalization[min_n]*(real(min_n, bin1)*real(min_n, bin2)+imag(min_n, bin1)*imag(min_n, bin2));
207 for (
int m=1; m<l+1; m++) {
208 const int pos = min_n+m;
209 power += 2.*m_normalization[pos]*(real(pos, bin1)*real(pos, bin2)+imag(pos, bin1)*imag(pos, bin2));
Generic functions that use one or more classes of the CosmoBolognaLib.
void reset()
reset the internal quantities
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 > > 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
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