Main Page Namespace List Class Hierarchy Compound List File List Namespace Members Compound Members File Members Related Pages

# Stats.h

Go to the documentation of this file.

    00001
    00033 #ifndef __STATS_H__
    00034 #define __STATS_H__
    00035
    00036 #include <DAG.h>
    00037 #include <DAGDatabase.h>
    00038 #include <Debug.h>
    00039
    00040 // NOT_SET is a big negative number that is easy to spot when computing stats
    00041 #define NOT_SET -100
    00042
    00043 #define MAXPOS 10000
    00044 #define MAXVIEW 128
    00045
    00046 class STATINFO
    00047 {
    00048 public:
    00049         bool bCompViewStats;
    00050     leda_array<MatchInfo> matchList;
    00051     int nParamsToSet;
    00052
    00053         class INFOVAR
    00054         {
    00055                 int nDAGId;                                     //<! ID of the dag.
    00056                 double dSimilarity;             //<! Assigned indexing or matching similarity
    00057
    00058                 int nBestRankingPosition;   //<! Best position in either the indexing or matching ranking
    00059                 int nWorstRankingPosition;  //<! Worst position in either the indexing or matching ranking
    00060
    00061                 int nBestIdxPos;                //<! Best position in the index (only if appropiate)
    00062                 int nWorstIdxPos;               //<! Worst position in the index (only if appropiate)
    00063
    00064         public:
    00065                 INFOVAR() { Clear(); }
    00066                 void Clear();
    00067                 int GetDAGId() const { return nDAGId; }
    00068
    00069                 void SetRankPos(int currentRankPos, const leda_array<MatchInfo>& rankList);
    00070                 void SetRankPos(int currentRankPos, const leda_array<MatchInfo>& rankList, const INFOVAR& queryPos);
    00071                 void SetIdxPos(int currentIdxPos, const leda_array<MatchInfo>& idxRankList);
    00072                 void SetIdxPos(int currentIdxPos, const leda_array<MatchInfo>& idxRankList, const INFOVAR& queryPos);
    00073
    00074                 bool IsNotSet() const;
    00075
    00076                 static int GetBestPos(int i, const leda_array<MatchInfo>& matches);
    00077                 static int GetWorstPos(int i, const leda_array<MatchInfo>& matches);
    00078
    00079                 friend ostream& operator<<(ostream &os, const INFOVAR& v);
    00080         };
    00081
    00082     INFOVAR queryObj;   //<! query object
    00083     INFOVAR rightClass; //<! first object of the same class than the query object
    00084     INFOVAR wrongClass; //<! first object of a different class than the query object
    00085     INFOVAR neigType1;  //<! type-3 closest neig. in the viewing sphere
    00086     INFOVAR neigType2;  //<! type-9 closest neig. (including the type-3 closest neigbours)
    00087     INFOVAR topRanked;  //<! info of the first ranked DAG, whatever the DAG is.
    00088
    00089         STATINFO() { bCompViewStats = false; }
    00090         void InitStats();
    00091
    00095         int GetParamCount() const { return nParamsToSet; }
    00096
    00097         void ComputeStats(const DAG* pQueryDag);
    00098         void ComputeCrossRankingIdxStats(const STATINFO& matStats);
    00099         int FindDAGPos(int nDAGId) const;
    00100
    00101         static void WriteHeader(ostream& os, int nFileIdx, int nIdxKBest, double dMaxOcclusionRate);
    00102         static void Write(ostream& os, int i, int nViewNum, const STATINFO& idxSt, const STATINFO& matSt,
    00103                 double dCompTime, double dOcclusionRate);
    00104         static void WriteTailer(ostream& os);
    00105
    00106         friend ostream& operator<<(ostream& os, const STATINFO& v);
    00107 };
    00108
    00109 bool GetClosestViews(int i, int res, int& a, int &b, int &c);
    00110 bool GetClosestViews2(int i, int res, SmartArray<int>& neigs, bool bIncludeFirstLevel);
    00111 SmartArray<int> GetClosestViewsByRange(int i, int res, const double& range);
    00112 SmartArray<int> GetSymmetricViewMap();
    00113
    00114 #endif //__STATS_H__