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

ocsHistogram.hh

Go to the documentation of this file.
00001 // $Id: ocsHistogram.hh,v 1.2 2005/07/06 16:27:58 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 #ifndef _OCS_HISTOGRAM_HH_
00016 #define  _OCS_HISTOGRAM_HH_
00017 
00018 
00019 #ifndef _OCS_SYSTEM_HDRS_
00020 #define _OCS_SYSTEM_HDRS_
00021 
00022 #include <iostream.h>
00023 #include <string.h>
00024 #include <math.h> 
00025 #include <fstream.h>
00026 #include <complex.h>
00027 #include <stdlib.h>
00028 #include <stdio.h>
00029 #include <strstream>
00030 
00031 #include <string>
00032   using namespace std;
00033 
00034 
00035 #endif /* _OCS_SYSTEM_HDRS_ */
00036 
00037 #include "ocsConst.hh"
00038 #include "ocsReducedModelTools.hh"
00039 #include "ocsReadWriteTools.hh"
00040 #include "ocsRanNumGen.hh"
00041 
00042 
00043 // ##### Class Histogram
00044 
00046 
00053 class Histogram
00054 {
00055    public:
00056 
00059 
00060       Histogram() {};
00061 
00063 
00064       Histogram(int qtBins2,double MinRange2, double MaxRange2);
00065 
00067 
00068       Histogram(string InFileName);
00069 
00072 
00073       void InitHistogram(string InFileName);
00074 
00076 
00079       ~Histogram();
00080 
00082       void ReleaseMemory(void);
00083 
00084 
00086       void ClearHistogram(void);
00087 
00088 
00090 
00096       void AddSample(double vSample);
00097 
00099 
00100       void AddImportantSample(double vSample, double LikelihoodRatio);
00101 
00104 
00105       void ImportData(string InFileName, int Column,int qtColumns);
00106 
00109 
00110       void ImportData(string InFileName);
00111 
00112 
00113       void SetFileNameWithSamples(string FileNameWithSamples2);
00114 
00115 
00117 
00118       void Obtain_pdf(void); // the pdf will be pdfY:  pdfX x pdfY
00119 
00120 
00121 
00122       //void InitBalanceHeuristicDataStorage(double BiasingParam2,
00123       //                                     int qtRamdomSourcesPerSample2); 
00124 
00126 
00127       void MultipleHeuristicBalanceImport(string InFileName, 
00128                                           int Convert2dB_Scale);
00129 
00138       void MergeMultipleConditionalHeuristicBalance(string InFileName, 
00139                                           double z_min, double z_max,
00140                                           int Convert2dB_Scale);
00141 
00142 
00151       void MergeMultipleConditionalHeuristicBalance(string InFileName, 
00152                                           double z_min, double z_max,
00153                                           double w_min, double w_max,
00154                                           int Convert2dB_Scale);
00155 
00156 
00157       //void MultipleBalanceHeuristicImport(string InFileName); //## Best
00158 
00159 
00161 
00162       void MultipleWeightedImport(string InFileName);
00163 
00166 
00209       void MultipleSelectMaxRelNumHitsImport(string InFileName,
00210                                              int Convert2dB_Scale);
00211 
00214 
00215       void MultipleSelectiveImport(string InFileName);
00216 
00218 
00219       void ConditionalMultipleSelectiveImport(string InFileName,
00220                                               int Convert2dB_Scale);
00222 
00223       void MultipleImport(string InFileName, int Convert2dB_Scale);
00224 
00226 
00235       void MultipleUnbiasedImport(string InFileName);
00236 
00237 
00240 
00241       void WriteFile_pdf(string OutFileName);
00242 
00245 
00246       void WriteFile_cdf(string OutFileName);
00247 
00251 
00252       void WriteFile_cdfc(string OutFileName);
00253 
00255 
00256       void WriteFileQtSamplesBin(string OutFileName);
00257 
00259 
00260       void WriteFileBinValues(string OutFileName);
00261 
00262 
00264 
00265       void WriteFilePDF(string OutFileName);
00266 
00269 
00270       void WriteFileMaxwell_pdf(string OutFileName, int qtPoints);    
00271  
00273 
00274      void WriteFileSndOrderPDV_pdf(string OutFileName, int qtPoints);
00275   
00279 
00280       void WriteFileGaussian_pdf(string OutFileName, int qtPoints);      
00281       void WriteFileGaussian_cdf(string OutFileName, int qtPoints);
00282       void WriteFileGaussian_cdfc(string OutFileName, int qtPoints);
00283 
00284       int GetQtBins(void) {return qtBins;};
00285       double GetMinRange(void) {return MinRange;};
00286       double GetMaxRange(void) {return MaxRange;};
00287       long GetQtSamples(void) {return qtSamples;};     
00288       long GetQtSamplesInRange(void) {return qtSamplesInRange;};        
00289 
00290       void SetBin(int NumBin, double ValueBin) 
00291             { Bin[NumBin] = ValueBin;}; //## Be careful with this!!!
00292       double GetBin(int NumBin) {return Bin[NumBin];};
00293       double Get_cdfBin(int NumBin) {return cdfBin[NumBin];};
00294       double Get_cdfcBin(int NumBin) {return cdfcBin[NumBin];};            
00295       int GetIndex_pdf(double vSample);      
00296       long GetQtSamplesBin(int NumBin) {return qtSamplesBin[NumBin];};
00297       double GetSumLikelihoodRatio(void) {return SumLikelihoodRatio;};
00298       double GetMean(void) {return MeanTmp
00299                             /SumLikelihoodRatio;};
00300       double GetMeanSquare(void) {return MeanSquareTmp
00301                                   /SumLikelihoodRatio;};
00302 
00304 
00305       double GetStdDev(void);      
00306       double GetMinSample() {return MinSample;};
00307       double GetMaxSample() {return MaxSample;};
00308 
00310 
00311       double GetSumProbabilities(void); 
00312 
00313       double Get_pdfX(int ii) {return pdfX[ii];};
00314       double Get_pdfY(int ii) {return pdfY[ii];};
00315       double Get_pdfConfidence(int ii) {return pdfConfidence[ii];};
00316       double Get_cdfConfidence(int ii) {return cdfConfidence[ii];};      
00317       double Get_cdfcConfidence(int ii) {return cdfcConfidence[ii];};       
00318    private:   
00319 
00321 
00328       void InitHistogram(int qtBins2,double MinRange2, double MaxRange2);
00329 
00330 
00331 
00332       int ObjectInitialized;
00333 
00334       int Index_pdf;
00335 
00341 
00342       int MakeFileWithSamples;
00343 
00344       
00349 
00350       string FileNameWithSamples;
00351 
00353 
00356       string HistInFileName;
00357 
00359       int qtBins;
00360 
00361       int qtBinsLast;
00362 
00364 
00365       double MinRange;
00366 
00368 
00369       double MaxRange;
00370   
00373 
00398       double *Bin;
00399 
00400 
00403 
00407       double *BinSquare;
00408 
00411 
00416    double *cdfBin;
00417    
00418    double *cdfcBin;  //## For the computation of the outage probability
00419    
00420    double *cdfBinSquare;
00421    
00422    double *cdfcBinSquare;
00423 
00424       long *qtSamplesBin;
00425 
00427 
00428       long qtSamples;
00429 
00431 
00432       long qtSamplesInRange; 
00433 
00435       double SumLikelihoodRatio;  
00436 
00439       double SumUnitaryLikelihoodRatio;
00440 
00441       
00442 
00444       double *pdfX;
00445 
00448        double  *pdfY;
00449        
00451 
00454        double  *pdfConfidence;             
00455        int PreviouslyComputed_pdfConfidenceFlag;
00456        
00457        double *cdfConfidence;
00458        
00459        double *cdfcConfidence;
00460 
00461        double MeanTmp, MeanSquareTmp;
00462 
00464       double MinSample;
00466       double  MaxSample;   
00467       ofstream *OutFileWithSamples;
00468       double *ExpPolynomialCoef;
00469 
00471 
00472       int DebugLevel;
00473       
00474        /*
00475       //## Extra variables for the Heuristic Balance
00476       double BiasingParam;
00477       int qtRandomSourcesPerSample; 
00478       int BalanceHeuristicInitialized;
00479       */
00480 };      
00481 
00482 
00483 #endif /*  _OCS_HISTOGRAM_HH_ */
00484 
00485 
00486 
00487 
00488 
00489 
00490 

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