Changeset 3510 in Sophya for trunk/SophyaLib/Samba/alm.cc
- Timestamp:
- Aug 8, 2008, 3:11:45 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/Samba/alm.cc
r2885 r3510 1 1 #include "sopnamsp.h" 2 2 #include "alm.h" 3 4 5 /*! 6 \class Alm 7 \ingroup Samba 8 Class for manipulating the coefficients \f$a_{lm}\f$ of the development 9 in spherical harmonics of a function efined on a sphere. 10 */ 11 12 /*! 13 fwhm specifies the gaussian beam half witdh in arc.minutes 14 */ 3 15 template <class T> 4 16 Alm<T>::Alm(const TVector<T>& clin, const r_8 fwhm) 5 17 6 18 { 19 int_4 nlmax= clin.NElts()-1; 20 21 //alm.ReSize(nlmax); 22 this->ReSizeRow(nlmax+1); 23 RandomGenerator rg(1, false); 24 GenFromCl(clin, fwhm, rg); 25 } 26 27 /*! 28 fwhm specifies the gaussian beam half witdh in arc.minutes 29 */ 30 template <class T> 31 Alm<T>::Alm(const TVector<T>& clin, const r_8 fwhm, RandomGenerator & rg) 32 { 33 int_4 nlmax= clin.NElts()-1; 34 35 //alm.ReSize(nlmax); 36 this->ReSizeRow(nlmax+1); 37 GenFromCl(clin, fwhm, rg); 38 } 7 39 8 40 41 42 template <class T> 43 void Alm<T>::GenFromCl(const TVector<T> & clin, const r_8 fwhm, RandomGenerator & rg) 44 { 9 45 /*======================================================================= 10 46 creates the a_lm from the power spectrum, … … 21 57 int_4 nlmax= clin.NElts()-1; 22 58 23 //alm.ReSize(nlmax);24 this->ReSizeRow(nlmax+1);25 26 59 r_8 sig_smooth = fwhm/sqrt(8.*log(2.))/(60.*180.)* M_PI; 27 60 int_4 n_l = nlmax+1; … … 29 62 30 63 // --- smoothes the initial power spectrum --- 31 TVector<T> cl =clin;64 TVector<T> cl(clin, false); 32 65 int l; 33 66 for (l=0;l<n_l;l++) … … 45 78 T rms=sqrt(cl(l)); 46 79 // ------ m = 0 ------ 47 complex<T> zeta1( NorRand());80 complex<T> zeta1((T)rg.Gaussian() ); 48 81 (*this)(l,0) = zeta1 * rms; 49 82 … … 52 85 { 53 86 complex<T> aux1(hsqrt2); 54 complex<T> aux2( NorRand(),NorRand());87 complex<T> aux2((T)rg.Gaussian() , (T)rg.Gaussian() ); 55 88 zeta1=aux1*aux2; 56 89 (*this)(l,m)=rms*zeta1; … … 79 112 return powsp; 80 113 } 114 115 /*! 116 \class Bm 117 \ingroup Samba 118 Class for a vector with an index running from \f$-m_{max}\f$ to \f$+m_{max}\f$ 119 (then the size of the vector will be actually \f$2m_{max}+1)\f$. 120 This class is used by the spherical harmonics transform server 121 */ 122 81 123 82 124 #ifdef __CXX_PRAGMA_TEMPLATES__
Note:
See TracChangeset
for help on using the changeset viewer.