Search oracle. More...
#include <kgraph.h>
Public Member Functions | |
| virtual unsigned | size () const =0 |
| Returns the size of the dataset. | |
| virtual float | operator() (unsigned i) const =0 |
| Computes similarity. More... | |
| unsigned | search (unsigned K, float epsilon, unsigned *ids, float *dists=nullptr) const |
| Search with brutal force. More... | |
Search oracle.
The search oracle is the user-supplied plugin that computes the distance between the query and a arbitrary object in the dataset. It is used for online k-NN search.
|
pure virtual |
Computes similarity.
0 <= i < size() are the index of an objects in the dataset. This method return the distance between the query and object i.
Implemented in kgraph::MatrixOracle< DATA_TYPE, DIST_TYPE >::SearchOracle.
| unsigned kgraph::SearchOracle::search | ( | unsigned | K, |
| float | epsilon, | ||
| unsigned * | ids, | ||
| float * | dists = nullptr |
||
| ) | const |
Search with brutal force.
Search results are guaranteed to be ranked in ascending order of distance.
| K | Return at most K nearest neighbors. |
| epsilon | Only returns nearest neighbors within distance epsilon. |
| ids | Pointer to the memory where neighbor IDs are returned. |
| dists | Pointer to the memory where distance values are returned, can be nullptr. |
1.8.5