Changeset 3615 in Sophya for trunk/SophyaLib/BaseTools


Ignore:
Timestamp:
May 1, 2009, 1:34:31 PM (16 years ago)
Author:
cmv
Message:

Modifs relatives a l'introduction de RandomGeneratorInterface + delete de srandgen.c, cmv 01/05/2009

Location:
trunk/SophyaLib/BaseTools
Files:
1 deleted
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/BaseTools/Makefile

    r3602 r3615  
    44 
    55clean:
    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.o
     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
    77        rm -f $(SOPHYALIBP)libBaseTools.a
    88 
    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)srandgen.o $(SOPHYAOBJP)stsrand.o $(SOPHYAOBJP)timestamp.o
     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)stsrand.o $(SOPHYAOBJP)timestamp.o
    1010        $(AR) $(ARFLAGS) $@ $?
    1111        touch $(SOPHYAINCP)/SophyaConfInfo/libsophya.objlist
     
    8484  pexceptions.h ppersist.h gnumd5.h ppfbinstream.h rawstream.h \
    8585  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   dsfmtflags.h dSFMT.h fiosegdb.h segdatablock.h thsafeop.h \
    88   ppftpointerio.h ppfwrapstlv.h sversion.h
     86  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
    8989        $(CXXCOMPILE) $(CXXTEMPFLG) -o $@  sophyainit.cc
    9090 
     
    107107        $(CCOMPILE) -o $@  gnumd5.c
    108108 
    109 $(SOPHYAOBJP)srandgen.o: srandgen.c $(SOPHYAINCP)machdefs.h \
    110   srandgen.h smathconst.h
    111         $(CCOMPILE) -o $@  srandgen.c
    112  
  • trunk/SophyaLib/BaseTools/objlist.list

    r3602 r3615  
    1515rawstream.o
    1616sophyainit.o
    17 srandgen.o
    1817stsrand.o
    1918timestamp.o
  • trunk/SophyaLib/BaseTools/randfmt.cc

    r3603 r3615  
    1919FMTRandGen::~FMTRandGen()
    2020{
     21}
     22
     23void FMTRandGen::ShowRandom()
     24{
     25  cout<<"RandomGenerator is FMTRandGen"<<endl;
    2126}
    2227
  • trunk/SophyaLib/BaseTools/randfmt.h

    r3602 r3615  
    3030  virtual void SetSeed(vector<uint_4> seed);
    3131  virtual void AutoInit(int lp=0);
     32  virtual void ShowRandom();
    3233
    3334  friend class ObjFileIO<FMTRandGen> ;
  • trunk/SophyaLib/BaseTools/randinterf.cc

    r3611 r3615  
    2828
    2929   \sa frand01 drand01 frandpm1 drandpm1
    30    \sa GauRnd PoissRand
     30   \sa Gaussian Poisson
    3131
    3232*/
     
    6262}
    6363
     64void RandomGeneratorInterface::ShowRandom()
     65{
     66  cout<<"RandomGenerator is RandomGeneratorInterface i.e. UNDEFINED"<<endl;
     67}
    6468
    6569/////////////////////////////////////////////////////////////////////////
     
    172176}
    173177
     178void RandomGeneratorInterface::AutoInit(int lp)
     179{
     180  printf("RandomGeneratorInterface::AutoInit(): undefined code !!!\n");
     181  throw MathExc("RandomGeneratorInterface::AutoInit(): undefined code !!!");
     182}
     183
    174184/////////////////////////////////////////////////////////////////////////
    175185/////////////////////////////////////////////////////////////////////////
     
    773783}
    774784
     785/////////////////////////////////////////////////////////////////////////
     786/////////////////////////////////////////////////////////////////////////
     787/////////////////////////////////////////////////////////////////////////
     788
     789int 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{
     826double a,b,sa;
     827
     828if( ro <= -1. || ro >= 1. ) return 1;
     829
     830while( (b=Flat01()) == 0. );
     831b = sqrt(-2.*log(b));
     832a = 2.*M_PI * Flat01();
     833sa = sin(a);
     834
     835x = mx + sx*b*(sqrt(1.-ro*ro)*cos(a)+ro*sa);
     836y = my + sy*b*sa;
     837
     838return 0;
     839}
     840
     841void 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{
     864double c,s,X,Y;
     865
     866while( (s = Flat01()) == 0. );
     867s = sqrt(-2.*log(s));
     868c = 2.*M_PI * Flat01();
     869
     870X = sa*s*cos(c);
     871Y = sb*s*sin(c);
     872
     873c = cos(teta); s = sin(teta);
     874x = mx + c*X - s*Y;
     875y = my + s*X + c*Y;
     876}
    775877
    776878}  /* namespace SOPHYA */
     
    780882/////////////////////////////////////////////////////////////////
    781883/*
    782 **** Remarques sur complex< r_8 > ComplexGaussRan(double sig) ****
     884**** Remarques sur complex< r_8 > ComplexGaussian(double sig) ****
    783885
    784886--- variables gaussiennes x,y independantes
  • trunk/SophyaLib/BaseTools/randinterf.h

    r3612 r3615  
    110110
    111111  // --- Le tirage gaussien complexe (cf texte a la fin du .cc)
    112   inline complex< r_8 > ComplexGaussRan(void)
     112  inline complex< r_8 > ComplexGaussian(void)
    113113         {return complex< r_8 >(Gaussian(),Gaussian());}
    114   inline complex< r_8 > ComplexGaussRan(double sig)
     114  inline complex< r_8 > ComplexGaussian(double sig)
    115115         {return complex< r_8 >(sig*Gaussian(),sig*Gaussian());}
    116116  /*! \brief Returns the module of a random complex number generated by ComplexGaussRan */
    117   inline double ModComplexGaussRan(double sig=1.)
     117  inline double ModComplexGaussian(double sig=1.)
    118118         {double r=-log(1.-Next()); return sig*sqrt(2.*r);}
    119119
    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
    121126  static inline RandomGeneratorInterface* GetGlobalRandGenP()
    122127    { return gl_rndgen_p; }
    123128
    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
    125136  static void SetGlobalRandGenP(RandomGeneratorInterface* rgp);
    126137
  • trunk/SophyaLib/BaseTools/randr48.cc

    r3604 r3615  
    1616DR48RandGen::~DR48RandGen()
    1717{
     18}
     19
     20void DR48RandGen::ShowRandom()
     21{
     22  cout<<"RandomGenerator is DR48RandGen"<<endl;
    1823}
    1924
     
    112117}
    113118
     119
     120void ThSDR48RandGen::ShowRandom()
     121{
     122  cout<<"RandomGenerator is ThSDR48RandGen"<<endl;
     123}
    114124
    115125void ThSDR48RandGen::SetSeed(long int seed)
  • trunk/SophyaLib/BaseTools/randr48.h

    r3612 r3615  
    1414#include "randinterf.h"
    1515
     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
     22extern "C" {
     23#endif
     24unsigned short int * seed48(unsigned short int seed16v[3]);
     25void 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
    1634namespace SOPHYA {
    1735
     
    2745  virtual void GetSeed(uint_2 seed[3]);
    2846  virtual void AutoInit(int lp=0);
     47  virtual void ShowRandom();
    2948
    3049  friend class ObjFileIO<DR48RandGen> ;
     
    5473  virtual void GetSeed(uint_2 seed[3]);
    5574  virtual void AutoInit(int lp=0);
     75  virtual void ShowRandom();
    5676
    5777  friend class ObjFileIO<ThSDR48RandGen> ;
  • trunk/SophyaLib/BaseTools/smakefile

    r3602 r3615  
    44 
    55clean:
    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.o
     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
    77        rm -f $(SOPHYALIBP)libBaseTools.a
    88 
    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)srandgen.o $(SOPHYAOBJP)stsrand.o $(SOPHYAOBJP)timestamp.o
     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)stsrand.o $(SOPHYAOBJP)timestamp.o
    1010        $(AR) $(ARFLAGS) $@ $?
    1111        touch $(SOPHYAINCP)/SophyaConfInfo/libsophya.objlist
     
    8484  pexceptions.h ppersist.h gnumd5.h ppfbinstream.h rawstream.h \
    8585  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   dsfmtflags.h dSFMT.h fiosegdb.h segdatablock.h thsafeop.h \
    88   ppftpointerio.h ppfwrapstlv.h sversion.h
     86  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
    8989        $(CXXCOMPILE) $(CXXTEMPFLG) -o $@  sophyainit.cc
    9090 
     
    107107        $(CCOMPILE) -o $@  gnumd5.c
    108108 
    109 $(SOPHYAOBJP)srandgen.o: srandgen.c $(SOPHYAINCP)machdefs.h \
    110   srandgen.h smathconst.h
    111         $(CCOMPILE) -o $@  srandgen.c
    112  
  • 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 */
    44
    55#ifndef SRANDGEN_H_SEEN
     
    88#include "machdefs.h"
    99#include <stdlib.h>
     10#include <complex>
     11#include "randinterf.h"
    1012
    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*/
    2814
    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() ); }
     15namespace SOPHYA {
    3416
    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 #else
    39 /* les memes en define pour du C */
    40 #define frand01() ( (float) drand48() )
    41 #define drand01() ( drand48() )
    42 #define ranf01() drand01()
    4317
    44 #define frandpm1() ( 2. * frand01() - 1.)
    45 #define drandpm1() ( 2. * drand01() - 1.)
    46 #define ranfpm1() drandpm1()
    47 #endif
     18inline double drand01()
     19  {return RandomGeneratorInterface::GetGlobalRandGenP()->Flat01();}
     20inline double drandpm1()
     21  {return RandomGeneratorInterface::GetGlobalRandGenP()->Flatpm1();}
    4822
    49 struct tirage_alea {
    50   int Nbin;
    51   double Min,Max,Lbin;
    52   double *Tab;
    53 };
    54 typedef struct tirage_alea TIREALEA;
     23inline double NorRand()
     24  {return RandomGeneratorInterface::GetGlobalRandGenP()->Gaussian();}
     25inline double Gaussian(double sigma,double mu)
     26  {return RandomGeneratorInterface::GetGlobalRandGenP()->Gaussian(sigma,mu);}
    5527
    56 #ifdef __cplusplus
    57 extern "C" {
    58 #endif
     28inline complex< r_8 > ComplexGaussian()
     29  {return RandomGeneratorInterface::GetGlobalRandGenP()->ComplexGaussian();}
     30inline complex< r_8 > ComplexGaussian(double sig)
     31  {return RandomGeneratorInterface::GetGlobalRandGenP()->ComplexGaussian(sig);}
     32inline double ModComplexGaussian(double sig=1.)
     33  {return RandomGeneratorInterface::GetGlobalRandGenP()->ModComplexGaussian(sig);}
    5934
    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);
     35inline double Poisson(double mu, double mumax=-1)
     36  {return RandomGeneratorInterface::GetGlobalRandGenP()->Poisson(mu,mumax);}
    6437
    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);
     38inline double Exponential()
     39  {return RandomGeneratorInterface::GetGlobalRandGenP()->Exponential();}
    7440
    75 int PoissRand(double mu);
    76 unsigned long PoissRandLimit(double mu,double mumax /* =10. */ );
     41inline 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);}
     43inline 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);}
    7745
    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);
     46inline void AutoInitRand(int lp)
     47  {return RandomGeneratorInterface::GetGlobalRandGenP()->AutoInit(lp);}
    8148
    82 #ifdef __cplusplus
    83 }
    84 #endif
     49inline void ShowRandom()
     50  {return RandomGeneratorInterface::GetGlobalRandGenP()->ShowRandom();}
     51
     52}  /* namespace SOPHYA */
    8553
    8654#endif
    87 
Note: See TracChangeset for help on using the changeset viewer.