Changeset 3615 in Sophya for trunk/SophyaLib/BaseTools
- Timestamp:
- May 1, 2009, 1:34:31 PM (16 years ago)
- Location:
- trunk/SophyaLib/BaseTools
- Files:
-
- 1 deleted
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/BaseTools/Makefile
r3602 r3615 4 4 5 5 clean: 6 rm -f $(SOPHYAOBJP)datatype.o $(SOPHYAOBJP)dvlist.o $(SOPHYAOBJP)fiondblock.o $(SOPHYAOBJP)mutyv.o $(SOPHYAOBJP)ndatablock.o $(SOPHYAOBJP)pexceptions.o $(SOPHYAOBJP)ppersist.o $(SOPHYAOBJP)ppfbinstream.o $(SOPHYAOBJP)ppftpointerio.o $(SOPHYAOBJP)randfmt.o $(SOPHYAOBJP)randinterf.o $(SOPHYAOBJP)randr48.o $(SOPHYAOBJP)rawstream.o $(SOPHYAOBJP)sophyainit.o $(SOPHYAOBJP)stsrand.o $(SOPHYAOBJP)timestamp.o $(SOPHYAOBJP)dSFMT.o $(SOPHYAOBJP)gnumd5.o $(SOPHYAOBJP)srandgen.o6 rm -f $(SOPHYAOBJP)datatype.o $(SOPHYAOBJP)dvlist.o $(SOPHYAOBJP)fiondblock.o $(SOPHYAOBJP)mutyv.o $(SOPHYAOBJP)ndatablock.o $(SOPHYAOBJP)pexceptions.o $(SOPHYAOBJP)ppersist.o $(SOPHYAOBJP)ppfbinstream.o $(SOPHYAOBJP)ppftpointerio.o $(SOPHYAOBJP)randfmt.o $(SOPHYAOBJP)randinterf.o $(SOPHYAOBJP)randr48.o $(SOPHYAOBJP)rawstream.o $(SOPHYAOBJP)sophyainit.o $(SOPHYAOBJP)stsrand.o $(SOPHYAOBJP)timestamp.o $(SOPHYAOBJP)dSFMT.o $(SOPHYAOBJP)gnumd5.o 7 7 rm -f $(SOPHYALIBP)libBaseTools.a 8 8 9 $(SOPHYALIBP)libBaseTools.a : $(SOPHYAOBJP)datatype.o $(SOPHYAOBJP)dSFMT.o $(SOPHYAOBJP)dvlist.o $(SOPHYAOBJP)fiondblock.o $(SOPHYAOBJP)gnumd5.o $(SOPHYAOBJP)mutyv.o $(SOPHYAOBJP)ndatablock.o $(SOPHYAOBJP)pexceptions.o $(SOPHYAOBJP)ppersist.o $(SOPHYAOBJP)ppfbinstream.o $(SOPHYAOBJP)ppftpointerio.o $(SOPHYAOBJP)randfmt.o $(SOPHYAOBJP)randinterf.o $(SOPHYAOBJP)randr48.o $(SOPHYAOBJP)rawstream.o $(SOPHYAOBJP)sophyainit.o $(SOPHYAOBJP)s randgen.o $(SOPHYAOBJP)stsrand.o $(SOPHYAOBJP)timestamp.o9 $(SOPHYALIBP)libBaseTools.a : $(SOPHYAOBJP)datatype.o $(SOPHYAOBJP)dSFMT.o $(SOPHYAOBJP)dvlist.o $(SOPHYAOBJP)fiondblock.o $(SOPHYAOBJP)gnumd5.o $(SOPHYAOBJP)mutyv.o $(SOPHYAOBJP)ndatablock.o $(SOPHYAOBJP)pexceptions.o $(SOPHYAOBJP)ppersist.o $(SOPHYAOBJP)ppfbinstream.o $(SOPHYAOBJP)ppftpointerio.o $(SOPHYAOBJP)randfmt.o $(SOPHYAOBJP)randinterf.o $(SOPHYAOBJP)randr48.o $(SOPHYAOBJP)rawstream.o $(SOPHYAOBJP)sophyainit.o $(SOPHYAOBJP)stsrand.o $(SOPHYAOBJP)timestamp.o 10 10 $(AR) $(ARFLAGS) $@ $? 11 11 touch $(SOPHYAINCP)/SophyaConfInfo/libsophya.objlist … … 84 84 pexceptions.h ppersist.h gnumd5.h ppfbinstream.h rawstream.h \ 85 85 ppfnametag.h fiondblock.h ndatablock.h anydataobj.h dvlist.h objfio.h \ 86 mutyv.h timestamp.h stsrand.h randr48.h randinterf.h randfmt.h \87 d sfmtflags.h dSFMT.h fiosegdb.h segdatablock.h thsafeop.h \88 ppf tpointerio.h ppfwrapstlv.h sversion.h86 mutyv.h timestamp.h randr48.h randinterf.h randfmt.h dsfmtflags.h \ 87 dSFMT.h fiosegdb.h segdatablock.h thsafeop.h ppftpointerio.h \ 88 ppfwrapstlv.h sversion.h 89 89 $(CXXCOMPILE) $(CXXTEMPFLG) -o $@ sophyainit.cc 90 90 … … 107 107 $(CCOMPILE) -o $@ gnumd5.c 108 108 109 $(SOPHYAOBJP)srandgen.o: srandgen.c $(SOPHYAINCP)machdefs.h \110 srandgen.h smathconst.h111 $(CCOMPILE) -o $@ srandgen.c112 -
trunk/SophyaLib/BaseTools/objlist.list
r3602 r3615 15 15 rawstream.o 16 16 sophyainit.o 17 srandgen.o18 17 stsrand.o 19 18 timestamp.o -
trunk/SophyaLib/BaseTools/randfmt.cc
r3603 r3615 19 19 FMTRandGen::~FMTRandGen() 20 20 { 21 } 22 23 void FMTRandGen::ShowRandom() 24 { 25 cout<<"RandomGenerator is FMTRandGen"<<endl; 21 26 } 22 27 -
trunk/SophyaLib/BaseTools/randfmt.h
r3602 r3615 30 30 virtual void SetSeed(vector<uint_4> seed); 31 31 virtual void AutoInit(int lp=0); 32 virtual void ShowRandom(); 32 33 33 34 friend class ObjFileIO<FMTRandGen> ; -
trunk/SophyaLib/BaseTools/randinterf.cc
r3611 r3615 28 28 29 29 \sa frand01 drand01 frandpm1 drandpm1 30 \sa Gau Rnd PoissRand30 \sa Gaussian Poisson 31 31 32 32 */ … … 62 62 } 63 63 64 void RandomGeneratorInterface::ShowRandom() 65 { 66 cout<<"RandomGenerator is RandomGeneratorInterface i.e. UNDEFINED"<<endl; 67 } 64 68 65 69 ///////////////////////////////////////////////////////////////////////// … … 172 176 } 173 177 178 void RandomGeneratorInterface::AutoInit(int lp) 179 { 180 printf("RandomGeneratorInterface::AutoInit(): undefined code !!!\n"); 181 throw MathExc("RandomGeneratorInterface::AutoInit(): undefined code !!!"); 182 } 183 174 184 ///////////////////////////////////////////////////////////////////////// 175 185 ///////////////////////////////////////////////////////////////////////// … … 773 783 } 774 784 785 ///////////////////////////////////////////////////////////////////////// 786 ///////////////////////////////////////////////////////////////////////// 787 ///////////////////////////////////////////////////////////////////////// 788 789 int RandomGeneratorInterface::Gaussian2DRho(double &x,double &y,double mx,double my,double sx,double sy,double ro) 790 /* 791 ++ 792 | Tirage de 2 nombres aleatoires x et y distribues sur une gaussienne 2D 793 | de centre (mx,my), de coefficient de correlation rho (ro) et telle que 794 | les sigmas finals des variables x et y soient sx,sy (ce sont 795 | les valeurs des distributions marginales des variables aleatoires x et y 796 | c'est a dire les sigmas des projections x et y de l'histogramme 2D 797 | de la gaussienne). Retourne 0 si ok. 798 | 799 | - La densite de probabilite (normalisee a 1) sur laquelle on tire est: 800 | N*exp[-0.5*{[(dx/sx)^2-2*ro/(sx*sy)*dx*dy+(dy/sy)^2]/(1-ro^2)}] 801 | avec dx = x-mx, dy = y-my et N = 1/[2Pi*sx*sy*sqrt(1-ro^2)] 802 | - Dans ce cas la distribution marginale est (ex en X): 803 | 1/(sqrt(2Pi)*sx) * exp[-0.5*{dx^2/sx^2}] 804 | - La matrice des covariances C des variables x,y est: 805 | | sx^2 ro*sx*sy | 806 | | | et det(C) = (1-ro^2)*sx^2*sy^2 807 | | ro*sx*sy sy^2 | 808 | - La matrice inverse C^(-1) est: 809 | | 1/sx^2 -ro/(sx*sy) | 810 | | | * 1/(1-ro^2) 811 | | -ro/(sx*sy) 1/sy^2 | 812 | 813 | - Remarque: 814 | le sigma que l'on obtient quand on fait une coupe de la gaussienne 2D 815 | en y=0 (ou x=0) est: SX0(y=0) = sx*sqrt(1-ro^2) different de sx 816 | SY0(x=0) = sy*sqrt(1-ro^2) different de sy 817 | La distribution qui correspond a des sigmas SX0,SY0 818 | pour les coupes en y=0,x=0 de la gaussienne 2D serait: 819 | N*exp[-0.5*{ (dx/SX0)^2-2*ro/(SX0*SY0)*dx*dy+(dy/SY0)^2 }] 820 | avec N = sqrt(1-ro^2)/(2Pi*SX0*SY0) et les variances 821 | des variables x,y sont toujours 822 | sx=SX0/sqrt(1-ro^2), sy=SY0/sqrt(1-ro^2) 823 -- 824 */ 825 { 826 double a,b,sa; 827 828 if( ro <= -1. || ro >= 1. ) return 1; 829 830 while( (b=Flat01()) == 0. ); 831 b = sqrt(-2.*log(b)); 832 a = 2.*M_PI * Flat01(); 833 sa = sin(a); 834 835 x = mx + sx*b*(sqrt(1.-ro*ro)*cos(a)+ro*sa); 836 y = my + sy*b*sa; 837 838 return 0; 839 } 840 841 void RandomGeneratorInterface::Gaussian2DAng(double &x,double &y,double mx,double my,double sa,double sb,double teta) 842 /* 843 ++ 844 | Tirage de 2 nombres aleatoires x et y distribues sur une gaussienne 2D 845 | de centre (x=mx,y=my), de sigmas grand axe et petit axe (sa,sb) 846 | et dont le grand axe fait un angle teta (radian) avec l'axe des x. 847 | 848 | - La densite de probabilite (normalisee a 1) sur laquelle on tire est: 849 | N*exp[-0.5*{ (A/sa)**2+(C/sc)**2 }], N=1/(2Pi*sa*sc) 850 | ou A et B sont les coordonnees selon le grand axe et le petit axe 851 | et teta = angle(x,A), le resultat subit ensuite une rotation d'angle teta. 852 | - La matrice des covariances C des variables A,B est: 853 | | sa^2 0 | 854 | | | et det(C) = (1-ro^2)*sa^2*sb^2 855 | | 0 sb^2 | 856 | - La distribution x,y resultante est: 857 | N*exp[-0.5*{[(dx/sx)^2-2*ro/(sx*sy)*dx*dy+(dy/sy)^2]/(1-ro^2)}] 858 | ou N est donne dans NormCo et sx,sy,ro sont calcules a partir 859 | de sa,sc,teta (voir fonctions paramga ou gaparam). La matrice des 860 | covariances des variables x,y est donnee dans la fonction NormCo. 861 -- 862 */ 863 { 864 double c,s,X,Y; 865 866 while( (s = Flat01()) == 0. ); 867 s = sqrt(-2.*log(s)); 868 c = 2.*M_PI * Flat01(); 869 870 X = sa*s*cos(c); 871 Y = sb*s*sin(c); 872 873 c = cos(teta); s = sin(teta); 874 x = mx + c*X - s*Y; 875 y = my + s*X + c*Y; 876 } 775 877 776 878 } /* namespace SOPHYA */ … … 780 882 ///////////////////////////////////////////////////////////////// 781 883 /* 782 **** Remarques sur complex< r_8 > ComplexGauss Ran(double sig) ****884 **** Remarques sur complex< r_8 > ComplexGaussian(double sig) **** 783 885 784 886 --- variables gaussiennes x,y independantes -
trunk/SophyaLib/BaseTools/randinterf.h
r3612 r3615 110 110 111 111 // --- Le tirage gaussien complexe (cf texte a la fin du .cc) 112 inline complex< r_8 > ComplexGauss Ran(void)112 inline complex< r_8 > ComplexGaussian(void) 113 113 {return complex< r_8 >(Gaussian(),Gaussian());} 114 inline complex< r_8 > ComplexGauss Ran(double sig)114 inline complex< r_8 > ComplexGaussian(double sig) 115 115 {return complex< r_8 >(sig*Gaussian(),sig*Gaussian());} 116 116 /*! \brief Returns the module of a random complex number generated by ComplexGaussRan */ 117 inline double ModComplexGauss Ran(double sig=1.)117 inline double ModComplexGaussian(double sig=1.) 118 118 {double r=-log(1.-Next()); return sig*sqrt(2.*r);} 119 119 120 //! Return the pointer to the default global RandomGenerator object 120 // --- Le tirage sur une distribution gaussienne a 2D 121 /*! \brief Return 2 random numbers following a gaussian 2D distribution */ 122 virtual int Gaussian2DRho(double &x,double &y,double mx,double my,double sx,double sy,double ro); 123 virtual void Gaussian2DAng(double &x,double &y,double mx,double my,double sa,double sb,double teta); 124 125 //! Return the pointer to the default global RandomGenerator object 121 126 static inline RandomGeneratorInterface* GetGlobalRandGenP() 122 127 { return gl_rndgen_p; } 123 128 124 // Permet de definir l'instance global du generateur aleatoire 129 //! Initialisation automatique 130 virtual void AutoInit(int lp=0); 131 132 //! Print 133 virtual void ShowRandom(); 134 135 // Permet de definir l'instance global du generateur aleatoire 125 136 static void SetGlobalRandGenP(RandomGeneratorInterface* rgp); 126 137 -
trunk/SophyaLib/BaseTools/randr48.cc
r3604 r3615 16 16 DR48RandGen::~DR48RandGen() 17 17 { 18 } 19 20 void DR48RandGen::ShowRandom() 21 { 22 cout<<"RandomGenerator is DR48RandGen"<<endl; 18 23 } 19 24 … … 112 117 } 113 118 119 120 void ThSDR48RandGen::ShowRandom() 121 { 122 cout<<"RandomGenerator is ThSDR48RandGen"<<endl; 123 } 114 124 115 125 void ThSDR48RandGen::SetSeed(long int seed) -
trunk/SophyaLib/BaseTools/randr48.h
r3612 r3615 14 14 #include "randinterf.h" 15 15 16 17 /* ------- SPECIFIQUE Mac Darwin OSX <= 10.2 (gcc < 3.x) -------- */ 18 #if defined(Darwin) && defined(__GNUC__) && (__GNUC__ < 3) 19 #include "osx_values.h" 20 /* Declaration de drand48 et srand48 etc , mis ds SysSpec, Reza 11/02/2003 */ 21 #ifdef __cplusplus 22 extern "C" { 23 #endif 24 unsigned short int * seed48(unsigned short int seed16v[3]); 25 void srand48(long seedval); 26 #ifdef __cplusplus 27 } 28 #endif 29 #define drand48() ((double)(random())/LONG_MAX) 30 #endif 31 /* ------- FIN SPECIFIQUE Mac OSX / Darwin V <= 10.2 --------- */ 32 33 16 34 namespace SOPHYA { 17 35 … … 27 45 virtual void GetSeed(uint_2 seed[3]); 28 46 virtual void AutoInit(int lp=0); 47 virtual void ShowRandom(); 29 48 30 49 friend class ObjFileIO<DR48RandGen> ; … … 54 73 virtual void GetSeed(uint_2 seed[3]); 55 74 virtual void AutoInit(int lp=0); 75 virtual void ShowRandom(); 56 76 57 77 friend class ObjFileIO<ThSDR48RandGen> ; -
trunk/SophyaLib/BaseTools/smakefile
r3602 r3615 4 4 5 5 clean: 6 rm -f $(SOPHYAOBJP)datatype.o $(SOPHYAOBJP)dvlist.o $(SOPHYAOBJP)fiondblock.o $(SOPHYAOBJP)mutyv.o $(SOPHYAOBJP)ndatablock.o $(SOPHYAOBJP)pexceptions.o $(SOPHYAOBJP)ppersist.o $(SOPHYAOBJP)ppfbinstream.o $(SOPHYAOBJP)ppftpointerio.o $(SOPHYAOBJP)randfmt.o $(SOPHYAOBJP)randinterf.o $(SOPHYAOBJP)randr48.o $(SOPHYAOBJP)rawstream.o $(SOPHYAOBJP)sophyainit.o $(SOPHYAOBJP)stsrand.o $(SOPHYAOBJP)timestamp.o $(SOPHYAOBJP)dSFMT.o $(SOPHYAOBJP)gnumd5.o $(SOPHYAOBJP)srandgen.o6 rm -f $(SOPHYAOBJP)datatype.o $(SOPHYAOBJP)dvlist.o $(SOPHYAOBJP)fiondblock.o $(SOPHYAOBJP)mutyv.o $(SOPHYAOBJP)ndatablock.o $(SOPHYAOBJP)pexceptions.o $(SOPHYAOBJP)ppersist.o $(SOPHYAOBJP)ppfbinstream.o $(SOPHYAOBJP)ppftpointerio.o $(SOPHYAOBJP)randfmt.o $(SOPHYAOBJP)randinterf.o $(SOPHYAOBJP)randr48.o $(SOPHYAOBJP)rawstream.o $(SOPHYAOBJP)sophyainit.o $(SOPHYAOBJP)stsrand.o $(SOPHYAOBJP)timestamp.o $(SOPHYAOBJP)dSFMT.o $(SOPHYAOBJP)gnumd5.o 7 7 rm -f $(SOPHYALIBP)libBaseTools.a 8 8 9 $(SOPHYALIBP)libBaseTools.a : $(SOPHYAOBJP)datatype.o $(SOPHYAOBJP)dSFMT.o $(SOPHYAOBJP)dvlist.o $(SOPHYAOBJP)fiondblock.o $(SOPHYAOBJP)gnumd5.o $(SOPHYAOBJP)mutyv.o $(SOPHYAOBJP)ndatablock.o $(SOPHYAOBJP)pexceptions.o $(SOPHYAOBJP)ppersist.o $(SOPHYAOBJP)ppfbinstream.o $(SOPHYAOBJP)ppftpointerio.o $(SOPHYAOBJP)randfmt.o $(SOPHYAOBJP)randinterf.o $(SOPHYAOBJP)randr48.o $(SOPHYAOBJP)rawstream.o $(SOPHYAOBJP)sophyainit.o $(SOPHYAOBJP)s randgen.o $(SOPHYAOBJP)stsrand.o $(SOPHYAOBJP)timestamp.o9 $(SOPHYALIBP)libBaseTools.a : $(SOPHYAOBJP)datatype.o $(SOPHYAOBJP)dSFMT.o $(SOPHYAOBJP)dvlist.o $(SOPHYAOBJP)fiondblock.o $(SOPHYAOBJP)gnumd5.o $(SOPHYAOBJP)mutyv.o $(SOPHYAOBJP)ndatablock.o $(SOPHYAOBJP)pexceptions.o $(SOPHYAOBJP)ppersist.o $(SOPHYAOBJP)ppfbinstream.o $(SOPHYAOBJP)ppftpointerio.o $(SOPHYAOBJP)randfmt.o $(SOPHYAOBJP)randinterf.o $(SOPHYAOBJP)randr48.o $(SOPHYAOBJP)rawstream.o $(SOPHYAOBJP)sophyainit.o $(SOPHYAOBJP)stsrand.o $(SOPHYAOBJP)timestamp.o 10 10 $(AR) $(ARFLAGS) $@ $? 11 11 touch $(SOPHYAINCP)/SophyaConfInfo/libsophya.objlist … … 84 84 pexceptions.h ppersist.h gnumd5.h ppfbinstream.h rawstream.h \ 85 85 ppfnametag.h fiondblock.h ndatablock.h anydataobj.h dvlist.h objfio.h \ 86 mutyv.h timestamp.h stsrand.h randr48.h randinterf.h randfmt.h \87 d sfmtflags.h dSFMT.h fiosegdb.h segdatablock.h thsafeop.h \88 ppf tpointerio.h ppfwrapstlv.h sversion.h86 mutyv.h timestamp.h randr48.h randinterf.h randfmt.h dsfmtflags.h \ 87 dSFMT.h fiosegdb.h segdatablock.h thsafeop.h ppftpointerio.h \ 88 ppfwrapstlv.h sversion.h 89 89 $(CXXCOMPILE) $(CXXTEMPFLG) -o $@ sophyainit.cc 90 90 … … 107 107 $(CCOMPILE) -o $@ gnumd5.c 108 108 109 $(SOPHYAOBJP)srandgen.o: srandgen.c $(SOPHYAINCP)machdefs.h \110 srandgen.h smathconst.h111 $(CCOMPILE) -o $@ srandgen.c112 -
trunk/SophyaLib/BaseTools/srandgen.h
r3597 r3615 1 /* fonctions pour generateurs aleatoires 2 /* cmv 23/06/94*/3 /* R.Ansari 04/2000 Copie de nbrand.h .c*/1 /* fonctions pour generateurs aleatoires cmv 23/06/94 */ 2 /* Copie de nbrand.h .c .Ansari 04/2000 */ 3 /* interface avec RandomGeneratorInterface cmv 04/2009 */ 4 4 5 5 #ifndef SRANDGEN_H_SEEN … … 8 8 #include "machdefs.h" 9 9 #include <stdlib.h> 10 #include <complex> 11 #include "randinterf.h" 10 12 11 /* ------- SPECIFIQUE Mac Darwin OSX <= 10.2 (gcc < 3.x) -------- */ 12 #if defined(Darwin) && defined(__GNUC__) && (__GNUC__ < 3) 13 #include "osx_values.h" 14 /* Declaration de drand48 et srand48 etc , mis ds SysSpec 15 Reza 11/02/2003 */ 16 #ifdef __cplusplus 17 extern "C" { 18 #endif 19 unsigned short int * seed48(unsigned short int seed16v[3]); 20 void srand48(long seedval); 21 /* Faute de mieux pour le moment : */ 22 #ifdef __cplusplus 23 } 24 #endif 25 #define drand48() ((double)(random())/LONG_MAX) 26 #endif 27 /* ------- FIN SPECIFIQUE Mac OSX / Darwin V <= 10.2 --------- */ 13 /* Declaration en fonctions inline interface avec RandomGeneratorInterface global*/ 28 14 29 #ifdef __cplusplus 30 /* Declaration en fonctions inlines pour du C++ */ 31 inline float frand01() { return ( (float) drand48() ); } 32 inline double drand01() { return ( drand48() ); } 33 inline double ranf01() { return ( drand48() ); } 15 namespace SOPHYA { 34 16 35 inline float frandpm1() { return ( 2. * (float) drand48() - 1.); }36 inline double drandpm1() { return ( 2. * drand48() - 1.); }37 inline double ranfpm1() { return ( 2. * drand48() - 1.); }38 #else39 /* les memes en define pour du C */40 #define frand01() ( (float) drand48() )41 #define drand01() ( drand48() )42 #define ranf01() drand01()43 17 44 #define frandpm1() ( 2. * frand01() - 1.) 45 #define drandpm1() ( 2. * drand01() - 1.) 46 #define ranfpm1() drandpm1() 47 #endif 18 inline double drand01() 19 {return RandomGeneratorInterface::GetGlobalRandGenP()->Flat01();} 20 inline double drandpm1() 21 {return RandomGeneratorInterface::GetGlobalRandGenP()->Flatpm1();} 48 22 49 struct tirage_alea { 50 int Nbin; 51 double Min,Max,Lbin; 52 double *Tab; 53 }; 54 typedef struct tirage_alea TIREALEA; 23 inline double NorRand() 24 {return RandomGeneratorInterface::GetGlobalRandGenP()->Gaussian();} 25 inline double Gaussian(double sigma,double mu) 26 {return RandomGeneratorInterface::GetGlobalRandGenP()->Gaussian(sigma,mu);} 55 27 56 #ifdef __cplusplus 57 extern "C" { 58 #endif 28 inline complex< r_8 > ComplexGaussian() 29 {return RandomGeneratorInterface::GetGlobalRandGenP()->ComplexGaussian();} 30 inline complex< r_8 > ComplexGaussian(double sig) 31 {return RandomGeneratorInterface::GetGlobalRandGenP()->ComplexGaussian(sig);} 32 inline double ModComplexGaussian(double sig=1.) 33 {return RandomGeneratorInterface::GetGlobalRandGenP()->ModComplexGaussian(sig);} 59 34 60 void Ini_Ranf_Quick(long seed_val, int lp); 61 void Ini_Ranf(unsigned short seed_16v[3], int lp); 62 void Get_Ranf(unsigned short seed_16v[3], int lp); 63 void Auto_Ini_Ranf(int lp); 35 inline double Poisson(double mu, double mumax=-1) 36 {return RandomGeneratorInterface::GetGlobalRandGenP()->Poisson(mu,mumax);} 64 37 65 void SetGauRange(double range); 66 double NorRand1(void); 67 double GauRnd1(double am, double s); 68 double NorRand(void); 69 double GauRnd(double am, double s); 70 int NormCo(double *a,double *b 71 ,double mx,double my,double sx,double sy,double ro); 72 void NormGau(double *x,double *y 73 ,double mx,double my,double sa,double sb,double teta); 38 inline double Exponential() 39 {return RandomGeneratorInterface::GetGlobalRandGenP()->Exponential();} 74 40 75 int PoissRand(double mu); 76 unsigned long PoissRandLimit(double mu,double mumax /* =10. */ ); 41 inline int Gaussian2DRho(double &x,double &y,double mx,double my,double sx,double sy,double ro) 42 {return RandomGeneratorInterface::GetGlobalRandGenP()->Gaussian2DRho(x,y,mx,my,sx,sy,ro);} 43 inline void Gaussian2DAng(double &x,double &y,double mx,double my,double sa,double sb,double teta) 44 {return RandomGeneratorInterface::GetGlobalRandGenP()->Gaussian2DAng(x,y,mx,my,sa,sb,teta);} 77 45 78 TIREALEA *init_tirage_alea(int nbin,double xmin,double xmax,double (*fonc) (double)); 79 double tirage_alea(TIREALEA *alea); 80 int end_tirage_alea(TIREALEA *alea); 46 inline void AutoInitRand(int lp) 47 {return RandomGeneratorInterface::GetGlobalRandGenP()->AutoInit(lp);} 81 48 82 #ifdef __cplusplus 83 } 84 #endif 49 inline void ShowRandom() 50 {return RandomGeneratorInterface::GetGlobalRandGenP()->ShowRandom();} 51 52 } /* namespace SOPHYA */ 85 53 86 54 #endif 87
Note:
See TracChangeset
for help on using the changeset viewer.