| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- #ifndef _MeanEstimate_h_
- #define _MeanEstimate_h_
- #include "../Pattern/Singleton.h"
- #include <cstdio>
- #include <map>
- #include <vector>
- #include <functional>
- #define VARIATION_COEF 0.02
- class CDebugOutput : public Singleton< CDebugOutput >
- {
- public:
- void Init();
- void OpenFile();
- void WriteToFile();
- std::map< int, double > m_diameter;
- std::map< int, double > m_estimate2;
- std::map< int, double > m_distensibility;
- std::map< int, double > m_distensibility20;
-
- FILE* m_file;
- int currentIndex;
- int m_minIndex;
- int m_maxIndex;
- protected:
-
- friend class Singleton< CDebugOutput >;
-
- CDebugOutput();
- };
- class CMeanEstimate
- {
- public:
-
- static bool IsANumber(double x);
- static void RemoveNanValues(std::vector<double> *A);
- static void RemoveValues(std::vector<double> *A, double value);
- static void RemoveOutOfBoundsValues(std::vector<double> *A, double percent);//precent : Bounds are the means +/- percent of the mean
- static void FindMinMax(std::vector<double> *A, double &min, double &max);
- static void FindMinMaxWithinBoundsValues(std::vector<double> *A, double percent, double &min, double &max);
- static double GetVariance(std::vector<double> *A);
- static double GetStandardDeviation(std::vector<double> *A);
- static double GetMean(std::vector<double> *A);
- static double GetMeanEstimate(std::vector<double> *A, double similarityCoef);
- static double GetMeanEstimate(std::vector<double> *A);
- static double GetMeanEstimateFileOutput(std::vector<double> *A, double similarityCoef=VARIATION_COEF);
- static void writeFileOutput(char* text);
- static void endFileOutput();
- static void PrintMeanEstimate(std::vector<double> *A, std::vector<double> *B);
- static void PrintMeanEstimate(std::vector<double> *A, std::vector<double> *B, double similarityCoef);
- static void startFileOutput(char *filename);
- static void titleFileOutput(char *title, std::vector<double> *A, std::vector<double> *B);
- static void titleFileOutput(std::vector<double> *A);
- //static void OutputToFile(char* filename, std::vector<double> *A, std::vector<double *B);
- protected:
- CMeanEstimate();
- virtual ~CMeanEstimate();
- };
- #endif
|