diff options
Diffstat (limited to 'tools/dataProvider.h')
-rw-r--r-- | tools/dataProvider.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tools/dataProvider.h b/tools/dataProvider.h index 47946c8..65a6b63 100644 --- a/tools/dataProvider.h +++ b/tools/dataProvider.h @@ -128,6 +128,28 @@ public: { return getuSize()*getqSize(); } + inline double getBha(int x){ + int a,b,q=getqSize(); + a=x/q; + b=x%q; + double res = 0; + Eigen::VectorXd *id,*oth; + if (single) + { + id = &(uniq[a]->feature); + oth = &(other[b]->feature); + } + else { + id = &(all[a]->feature); + if (b<a) + oth = &(all[b]->feature); + else + oth = &(all[b+1]->feature); + } + for (int i=0;i<n;++i) + res += sqrt((*id)[i] * (*oth)[i]); + return -log(res); + } inline Eigen::VectorXd getVec(int x){ int a,b,q=getqSize(); a=x/q; |