lshkit::LshIndex< LSH, KEY > Class Template Reference

Flat LSH index. More...

#include <lsh-index.h>

Inheritance diagram for lshkit::LshIndex< LSH, KEY >:

lshkit::MultiProbeLshIndex< KEY > List of all members.

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 &param, 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_

Detailed Description

template<typename LSH, typename KEY>
class lshkit::LshIndex< LSH, KEY >

Flat LSH index.

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.

Parameters:
LSH The LSH class.
KEY The key type.


Member Function Documentation

template<typename LSH, typename KEY>
template<typename Engine>
void lshkit::LshIndex< LSH, KEY >::init ( const Parameter &  param,
Engine &  engine,
unsigned  L 
) [inline]

Initialize the hash tables.

Parameters:
param parameter of LSH function.
engine random number generator.
L number of hash table maintained.

template<typename LSH, typename KEY>
void lshkit::LshIndex< LSH, KEY >::insert ( Key  key,
Domain  value 
) [inline]

Insert an item to the index.

Parameters:
key the key to the item.
value the value of the key.
The inserted object is not explicitly given, but is obtained by accessor(key).

template<typename LSH, typename KEY>
void lshkit::LshIndex< LSH, KEY >::load ( std::istream &  ar  )  [inline]

Constructor.

Load the LSH index from a stream.

Reimplemented in lshkit::MultiProbeLshIndex< KEY >.

template<typename LSH, typename KEY>
template<typename SCANNER>
void lshkit::LshIndex< LSH, KEY >::query ( Domain  obj,
SCANNER &  scanner 
) const [inline]

Query for K-NNs.

Parameters:
obj the query object.
scanner the scanner object.
The scanner is an invokable object. LSH index will pass every candidate key to scanner by invoking scanner(key).


The documentation for this class was generated from the following file:
Get LSHKIT at SourceForge.net. Fast, secure and Free Open Source software downloads doxygen