#include "alm.h" template Alm::Alm(const TVector& clin, const r_8 fwhm) { /*======================================================================= creates the a_lm from the power spectrum, assuming they are gaussian and complex with a variance given by C(l) the input file should contain : l and C(l) with *consecutive* l's (missing C(l) are put to 0.) because the map is real we have : a_l-m = (-)^m conjug(a_lm) so we actually compute them only for m >= 0 =======================================================================*/ int_4 nlmax= clin.NElts()-1; //alm.ReSize(nlmax); ReSizeRow(nlmax+1); r_8 sig_smooth = fwhm/sqrt(8.*log(2.))/(60.*180.)* M_PI; int_4 n_l = nlmax+1; // --- smoothes the initial power spectrum --- TVector cl=clin; for (int l=0;l zeta1(NorRand()); (*this)(l,0) = zeta1 * rms; //------ m > 0 ------ for (int m=1;m<=l;m++) { complex aux1(hsqrt2); complex aux2(NorRand(),NorRand()); zeta1=aux1*aux2; (*this)(l,m)=rms*zeta1; } } } template TVector Alm::powerSpectrum() const { int_4 nlmax=Lmax(); TVector pow(nlmax+1); pow.SetTemp(true); for (int l=0; l<=nlmax;l++) { pow(l)=( (*this)(l,0) ).real()*( (*this)(l,0) ).real(); for (int m=1; m<=l; m++) { pow(l)+=2.*( (*this)(l,m) ).real()*( (*this)(l,m) ).real()+ 2.*( (*this)(l,m) ).imag()*( (*this)(l,m) ).imag(); } pow(l)/=(2.*l+1.); } return pow; } #ifdef __CXX_PRAGMA_TEMPLATES__ #pragma define_template Alm #pragma define_template Alm #endif #if defined(ANSI_TEMPLATES) || defined(GNU_TEMPLATES) template class Alm; template class Alm; #endif