Changeset 3510 in Sophya for trunk/SophyaLib/Samba/alm.cc


Ignore:
Timestamp:
Aug 8, 2008, 3:11:45 PM (17 years ago)
Author:
ansari
Message:

Nettoyage alm.h .cc , utilisation RandomGenerator par Alm<T> et SphericalTransformServer , Reza 08/08/2008

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/Samba/alm.cc

    r2885 r3510  
    11#include "sopnamsp.h"
    22#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*/
    315template <class T>
    416Alm<T>::Alm(const TVector<T>& clin, const r_8 fwhm)
    517
    618{
     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*/
     30template <class T>
     31Alm<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}
    739
    840
     41
     42template <class T>
     43void Alm<T>::GenFromCl(const TVector<T> & clin, const r_8 fwhm, RandomGenerator & rg)
     44{
    945  /*=======================================================================
    1046     creates the a_lm from the power spectrum,
     
    2157  int_4 nlmax= clin.NElts()-1;
    2258
    23   //alm.ReSize(nlmax);
    24   this->ReSizeRow(nlmax+1);
    25 
    2659  r_8 sig_smooth = fwhm/sqrt(8.*log(2.))/(60.*180.)* M_PI;
    2760  int_4 n_l = nlmax+1;
     
    2962
    3063  //    --- smoothes the initial power spectrum ---
    31   TVector<T> cl=clin;
     64  TVector<T> cl(clin, false);
    3265  int l;
    3366  for (l=0;l<n_l;l++)
     
    4578      T rms=sqrt(cl(l));
    4679      //        ------ m = 0 ------
    47       complex<T> zeta1(NorRand());
     80      complex<T> zeta1((T)rg.Gaussian() );
    4881      (*this)(l,0)   = zeta1 * rms;
    4982
     
    5285        {
    5386          complex<T> aux1(hsqrt2);
    54           complex<T> aux2(NorRand(),NorRand());
     87          complex<T> aux2((T)rg.Gaussian() , (T)rg.Gaussian() );
    5588          zeta1=aux1*aux2;
    5689          (*this)(l,m)=rms*zeta1;
     
    79112  return powsp;
    80113}
     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
    81123 
    82124#ifdef __CXX_PRAGMA_TEMPLATES__
Note: See TracChangeset for help on using the changeset viewer.