From c69b39a9f149cc6b5c7270d7d864fb677bc83b34 Mon Sep 17 00:00:00 2001 From: Joe Zhao Date: Mon, 11 May 2015 18:38:39 +0800 Subject: RidFile tested --- tools/dataProvider.h | 11 +++++++++-- tools/fileDataProvider.h | 6 +++++- 2 files changed, 14 insertions(+), 3 deletions(-) (limited to 'tools') diff --git a/tools/dataProvider.h b/tools/dataProvider.h index 1d430e4..028980e 100644 --- a/tools/dataProvider.h +++ b/tools/dataProvider.h @@ -40,7 +40,11 @@ public: DataEntry* dat = new DataEntry; dat->rank = d->rank; dat->qid = d->qid; - dat->feature = d->feature; + dat->feature.resize(d->feature.rows()); + for (int i=0;ifeature.rows();++i) + { + dat->feature(i)=d->feature(i); + } return dat; } inline std::vector& getData(){ @@ -59,7 +63,7 @@ public: DataProvider():eof(false){}; bool EOFile(){return eof;} - void getAllData(DataList &out){\ + void getAllDataSet(DataList &out){\ out.clear(); DataList buf; while (!EOFile()) @@ -68,9 +72,12 @@ public: // won't work as data are discarded with every call to getDataSet // out.getData().insert(out.getData().end(),buf.getData().begin(),buf.getData().end()); for (int i=0;i & dat = d.getData(); for (int i=0;irank=1; dat[i]->qid=std::to_string(qid); + dat[i]->rank=qid; } else { @@ -103,12 +106,13 @@ public: e->feature.resize(d.getfSize()); e->qid=std::to_string(qid); for (int j = 0; j < fsize; ++j) { - e->feature(i) = fabs(dat[i]->feature(j) -dat[pos]->feature(j)); + e->feature(j) = fabs(dat[i]->feature(j) -dat[pos]->feature(j)); } out.addEntry(e); } dat[pos]->qid=std::to_string(qid); ++qid; + dat[pos]->rank=qid; while (posrank!=-1) ++pos; if (pos==d.getSize()) -- cgit v1.2.3-70-g09d2