Georgios Samaras wrote:
I do not have a big experience with NNs, but it seems a very very interesting problem to me! However, I thought that this would be the case (that you do not care about the order, maybe an argument for sorted results or not, would be nice).
It is a possiblity but on the other hand the interface should be as simple as possible. The user may sort the result if he/she needs it.
The query iterators worked as expected, but what is the difference? I mean, why the iterators return sorted results and the other method doesn't? Is the other method faster than iterators (in datasets with really many points or really high dimensions)?
During the interator incrementation the next value must be found somehow. In the case of kNN the most obvious candidate is the next closest value. The alternative would be to find all k NNs and then somehow iterate over them but then we wouldn't need the iterators. This way you can also start iterating over some big number of k-NNs and brake at some point when some condition is met. Yes, the iterators are slightly slower. Regards, Adam P.S. Please don't top-post -> http://www.boost.org/community/policy.html