#include <lsh-index.h>
Inheritance diagram for lshkit::LshIndex< LSH, KEY >:
Public Types | |
typedef LSH::Parameter | Parameter |
typedef LSH::Domain | Domain |
typedef KEY | Key |
Public Member Functions | |
LshIndex () | |
Constructor. | |
template<typename Engine> | |
void | init (const Parameter ¶m, Engine &engine, unsigned L) |
Initialize the hash tables. | |
void | load (std::istream &ar) |
Constructor. | |
void | save (std::ostream &ar) |
Save the LSH index to a stream. | |
void | insert (Key key, Domain value) |
Insert an item to the index. | |
template<typename SCANNER> | |
void | query (Domain obj, SCANNER &scanner) const |
Query for K-NNs. | |
Protected Types | |
typedef std::vector< Key > | Bin |
Protected Attributes | |
std::vector< LSH > | lshs_ |
std::vector< std::vector< Bin > > | tables_ |
Flat LSH index is implemented as L hash tables using mutually independent LSH functions. Given a query point q, the points in the bins to which q is hashed to are scanned for the nearest neighbors of q.
LSH | The LSH class. | |
KEY | The key type. |
void lshkit::LshIndex< LSH, KEY >::init | ( | const Parameter & | param, | |
Engine & | engine, | |||
unsigned | L | |||
) | [inline] |
Initialize the hash tables.
param | parameter of LSH function. | |
engine | random number generator. | |
L | number of hash table maintained. |
void lshkit::LshIndex< LSH, KEY >::insert | ( | Key | key, | |
Domain | value | |||
) | [inline] |
Insert an item to the index.
key | the key to the item. | |
value | the value of the key. |
void lshkit::LshIndex< LSH, KEY >::load | ( | std::istream & | ar | ) | [inline] |
void lshkit::LshIndex< LSH, KEY >::query | ( | Domain | obj, | |
SCANNER & | scanner | |||
) | const [inline] |
Query for K-NNs.
obj | the query object. | |
scanner | the scanner object. |