norlab-ulaval / libnabo

A fast K Nearest Neighbor library for low-dimensional spaces
http://norlab-ulaval.github.io/libnabo/
BSD 3-Clause "New" or "Revised" License
440 stars 144 forks source link

indices don't specify if there is not a match #2

Closed fcolas closed 6 years ago

fcolas commented 11 years ago

In knn(...) the indicesVector/Matrix will be filled with 0 for empty entries (no match). It doesn't seem to be a great idea as 0 is also an acceptable value for a match.

stephanemagnenat commented 11 years ago

Indeed. The original reason for using 0 is that 0 is the only value known to exist for any integer type. This is important because in the implementation of the search heap (index_heap.h) the type of index is a template parameter. One solution could be to get its maximal value using numeric_limits, which would conflict must less with actual point indices than 0.

magehrig commented 6 years ago

Should be resolved with https://github.com/ethz-asl/libnabo/pull/79