diff options
Diffstat (limited to 'tools/dataProvider.h')
-rw-r--r-- | tools/dataProvider.h | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/tools/dataProvider.h b/tools/dataProvider.h index 586965e..59b989a 100644 --- a/tools/dataProvider.h +++ b/tools/dataProvider.h @@ -82,9 +82,23 @@ public: else uniq.push_back(d); } + inline DataEntry* getU(int x) + { + return uniq[x]; + } + inline DataEntry* getO(int x) + { + return other[x]; + } + inline std::string getQid(int x) + { + int a,b,n=getqSize(); + a=x/n; + return getU(a)->qid; + } inline int getqSize() { - return (int)(uniq.size()+other.size()-1); + return (int)other.size(); } inline int getuSize() { @@ -99,24 +113,14 @@ public: a=x/n; b=x%n; Eigen::VectorXd vec; - if (b<a) - vec=uniq[a]->feature-uniq[b]->feature; - else - if (b<uniq.size()-1) - vec=uniq[a]->feature-uniq[b+1]->feature; - else - vec=uniq[a]->feature-other[b-uniq.size()+1]->feature; - return vec.cwiseAbs(); + return (uniq[a]->feature-other[b]->feature).cwiseAbs(); }; inline double getL(int x){ int a,b,n=getqSize(); a=x/n; b=x%n; - if (b<uniq.size()-1) - return -1; - else - if (std::fabs(other[b-uniq.size()+1]->rank - a) < 1e-5) - return 1; + if (std::fabs(other[b]->rank - a) < 1e-5) + return 1; return -1; }; }; |