• Main Page
  • Related Pages
  • Classes
  • Files
  • File List
  • File Members

ocsRanNumGen.hh

Go to the documentation of this file.
00001 // $Id: ocsRanNumGen.hh,v 1.2 2008/08/08 02:23:11 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 
00108   float GetRanNum(void);
00109 
00110 
00111 
00113 
00114   float GetRanCosineBiased(double alpha, double beta, 
00115                            double *LikelihoodRatio);
00116   float GetLikelihoodRatioForRanCosineBiased(double alpha,
00117                                double ValFunction);                        
00118                            
00119   float GetRanSignBiased(double alpha, 
00120                          double *LikelihoodRatio);
00121 
00122 
00134   float GetRanCosineBiased(double alpha, double *LikelihoodRatio);
00135 
00138 
00143   float GetGaussianDeviate(void);
00144 
00147 
00148   void ReadRanSeqParameters(string InFileName);
00149 
00151 
00153   void WriteRanSeqParameters(string OutFileName);
00154 
00155 
00156 private:
00157 
00158   static const long IM1 = 2147483563;
00159   static const long IM2 = 2147483399;
00160   static const double AM = 1.0/2147483563;
00161   static const long IMM1 = IM1 - 1;
00162   static const long IA1 =  40014;
00163   static const long IA2 = 40692;
00164   static const long IQ1 = 53668;
00165   static const long IQ2 = 52774;
00166   static const long IR1 = 12211;
00167   static const long IR2 = 3791;
00168   static const int NTAB = 32;
00169   static const long NDIV = (1+IMM1/NTAB);
00170   //static const double EPS = 1.2e-7;
00171   //static const double RNMX = 1.0-EPS;
00172 
00173   static const double RNMX = 1.0 - 1.2e-7;
00174 
00175   long idum,  idumStart;
00176   long idum2, idum2Start;
00177   long iy, iyStart;
00178   long iv[NTAB], ivStart[NTAB];
00179 
00181 
00182   string ContinuationFileName;
00183 
00186 
00187   string RestartFileName;
00188 
00190 
00196   int DebugLevel;
00197 
00198 };
00199 
00200 #endif  /* _OCS_RAN_NUM_GEN_HH_ */
00201 

Generated on Fri Jul 2 2010 12:57:47 for OCS by  doxygen 1.7.1