diff options
-rw-r--r-- | tools/dataProvider.h | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/tools/dataProvider.h b/tools/dataProvider.h index 59b989a..bf47856 100644 --- a/tools/dataProvider.h +++ b/tools/dataProvider.h @@ -98,7 +98,7 @@ public: } inline int getqSize() { - return (int)other.size(); + return (int)(uniq.size()+other.size()-1); } inline int getuSize() { @@ -113,13 +113,23 @@ public: a=x/n; b=x%n; Eigen::VectorXd vec; - return (uniq[a]->feature-other[b]->feature).cwiseAbs(); + 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(); }; inline double getL(int x){ int a,b,n=getqSize(); a=x/n; b=x%n; - if (std::fabs(other[b]->rank - a) < 1e-5) + if (b<uniq.size()-1) + return -1; + else + if (std::fabs(other[b-uniq.size()+1]->rank - a) < 1e-5) return 1; return -1; }; |