Description Usage Arguments Value Author(s) See Also Examples
Given a vector of sorted double values vec of size
n and a vector of m query objects q.
findNN determines for each element q[i] in q
the nearest neighbor index o so that the following remains true:
there is no element k with 1 ≤ k
≤ n and k is not o so that
abs(vec[k] - q[i]) < abs(vec[o] - q[i]).
The internal algorithm of findNN is implemented as binary search.
findNN has O(m * log(n)) time complexity.
1 |
q |
a double vector which can be considered as query objects. |
vec |
a sorted double vector which can be considered as a data base. |
an integer vector
Lucas Schmidt, Christian Panse
protViz::findNN's cpluplus implementation.
1 2 3 4 5 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.