Boost logo

Boost Users :

Subject: Re: [Boost-users] can not compile nearest neighbors in d dimensions
From: Ilja Honkonen (ilja.honkonen_at_[hidden])
Date: 2014-04-16 09:21:05


> Thanks for the replies, now it is clearer. However, the minimum
> dimension I have in my datasets is 100 and I want to run NN with
> dimension 10000.
> So, how I am going to initialize a point?
> template <int CompileTimeDimension>
> void fill(point& tmp)
> {
> for(int j = CompileTimeDimension - 1 ; j >= 0 ; --j) {
> bg::set<CompileTimeDimension-->(tmp, 5);
> }
> }

Maybe something like this (untested, you might have to put these inside
a class and make CTD a template parameter of the class, etc.):

template <int CTD>
void fill(point& tmp)
{
   bg::set<CTD>(tmp, 5);
   fill<CTD - 1>(tmp, 5);
}

template <> void fill<0>(point& tmp)
{
   bg::set<0>(tmp, 5);
}

Ilja


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net