00001 00002 #ifndef FROMMER_STATISTIC_H 00003 #define FROMMER_STATISTIC_H 00004 00005 #if _MSC_VER > 1000 00006 #pragma once 00007 #endif // _MSC_VER > 1000 00008 #include <assert.h> 00009 00015 #include <iostream> 00016 00017 #include "typedefs.h" 00018 00019 using namespace std; 00020 00021 namespace nCenterFocus 00022 { 00023 00024 00034 template <bool safe=true> 00035 class Statistic 00036 { 00037 private: 00038 int startAt_m; 00039 00040 int arrayLength; 00041 00042 00046 long64* values; 00047 inline void testbounds(int maxbound) const; 00048 00049 00050 public: 00051 00055 Statistic(int maxExpectedNumOfVanishedFocalValuesToLog, int startAt = 0); 00056 Statistic(const Statistic&); 00057 00058 virtual ~Statistic(); 00062 void clear(); 00063 00064 Statistic& operator=(const Statistic&); 00065 00066 00069 00070 void addStatistic(int numberOfFirstSuccessiveVanishedFocalValues); 00071 00078 00079 void addFormula1Try(int characteristic); 00080 00084 void addFormula1And2Try(int characteristic); 00085 00086 00090 void addFormula1And23Try(int characteristic); 00091 00097 void correctSecondFocalValueStatistic(int vanishedTrials); 00098 00099 00100 void correctHamiltonComponentStatistic(int focalValueNum, int correctedVanishedFocalValuesCount ); 00101 00102 void correctNonHamiltonComponentStatistic(int focalValueNum, int vanishedFocalValuesToSubtract ); 00103 00109 00110 long64 getTrialCountWithGivenNumOfFirstSuccessiveVanishedFocalValues(int i); 00111 00113 long64 getTrialCount(); 00114 00116 int getMaxLoggedSuccessiveVanishedFocalValues(); 00117 00123 void print(ostream& o); 00126 private: 00129 inline long64 & getStatisticEntryRef(int index); 00130 00131 inline long64 getStatisticEntry(int index) const; 00132 00135 }; 00136 00137 00138 00139 }; 00140 00141 #include "Statistik.cpp" 00142 00143 00144 #endif // !defined(FROMMER_STATISTIC_H)