diff options
author | Joe Zhao <ztuowen@gmail.com> | 2015-05-18 22:22:11 +0800 |
---|---|---|
committer | Joe Zhao <ztuowen@gmail.com> | 2015-05-18 22:22:11 +0800 |
commit | def2bcd3f41a36e52b179aa435c5bf29c94dab5e (patch) | |
tree | eaf8673aa3d682e5d29f88f56fe5d38892de7858 /tools/dataProvider.h | |
parent | d2b066e22c6d76928fc037bd858f1baa082a8fe1 (diff) | |
download | ranksvm-def2bcd3f41a36e52b179aa435c5bf29c94dab5e.tar.gz ranksvm-def2bcd3f41a36e52b179aa435c5bf29c94dab5e.tar.bz2 ranksvm-def2bcd3f41a36e52b179aa435c5bf29c94dab5e.zip |
added openmp directivesingle
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; }; }; |