Main Page   Namespace List   Compound List   File List   Compound Members   File Members  

copy-ocsRanNumGen.hh

Go to the documentation of this file.
00001 // $Id: ocsRanNumGen.hh,v 1.11 2002/06/21 21:20:36 zweck Exp $
00002 
00003 //###################################################################
00004 //
00005 //           Optical Communication Systems Simulator
00006 //
00007 //       Copyright (2000):
00008 //       Optical Fiber Communications Laboratory (OFCL)
00009 //       Computer Science & Electrical Engineering Department (CSEE)
00010 //       University of Maryland Baltimore County (UMBC)
00011 //
00012 //###################################################################
00013 
00014 
00015 
00016 //## Method for generation of random number for importance 
00017 //#  sampling by Ivan Lima
00018 
00019 #ifndef _OCS_RAN_NUM_GEN_HH_
00020 #define  _OCS_RAN_NUM_GEN_HH_
00021 
00022 #ifndef _OCS_SYSTEM_HDRS_
00023 #define _OCS_SYSTEM_HDRS_
00024 
00025 #include <iostream.h>
00026 #include <string.h>
00027 #include <math.h> 
00028 #include <fstream.h>
00029 #include <complex.h>
00030 #include <stdlib.h>
00031 #include <stdio.h>
00032 #include <strstream>
00033 
00034 #include <string>
00035   using namespace std;
00036 
00037 
00038 #endif /* _OCS_SYSTEM_HDRS_ */
00039 
00040 #include "ocsConst.hh"
00041 #include "ocsReducedModelTools.hh"
00042 #include "ocsReadWriteTools.hh"
00043 
00044 
00046 
00069 class RanNumGen
00070 {
00071 
00072 public:
00073 
00075   
00076   RanNumGen(string InFileName);
00077 
00079 
00086   ~RanNumGen();
00087 
00089 
00092   void SaveCurrentState(void);
00093 
00096   
00097 
00098   void ResetRanNumGen(void);
00099 
00101 
00106   float GetRanNum(void);
00107 
00108 
00109 
00111 
00112   float GetRanCosineBiased(double alpha, double beta, 
00113                            double *LikelihoodRatio);
00114   float GetRanSignBiased(double alpha, 
00115                          double *LikelihoodRatio);
00116 
00117 
00129   float GetRanCosineBiased(double alpha, double *LikelihoodRatio);
00130 
00133 
00138   float GetGaussianDeviate(void);
00139 
00142 
00143   void ReadRanSeqParameters(string InFileName);
00144 
00146 
00148   void WriteRanSeqParameters(string OutFileName);
00149 
00150 
00151 private:
00152 
00153   static const long IM1 = 2147483563;
00154   static const long IM2 = 2147483399;
00155   static const double AM = 1.0/2147483563;
00156   static const long IMM1 = IM1 - 1;
00157   static const long IA1 =  40014;
00158   static const long IA2 = 40692;
00159   static const long IQ1 = 53668;
00160   static const long IQ2 = 52774;
00161   static const long IR1 = 12211;
00162   static const long IR2 = 3791;
00163   static const int NTAB = 32;
00164   static const long NDIV = (1+IMM1/NTAB);
00165   static const double EPS = 1.2e-7;
00166   static const double RNMX = 1.0-EPS;
00167 
00168   long idum,  idumStart;
00169   long idum2, idum2Start;
00170   long iy, iyStart;
00171   long iv[NTAB], ivStart[NTAB];
00172 
00174 
00175   string ContinuationFileName;
00176 
00179 
00180   string RestartFileName;
00181 
00182 };
00183 
00184 #endif  /* _OCS_RAN_NUM_GEN_HH_ */

Generated at Mon Jun 9 20:08:10 2003 for OCS by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000