lshkit::TopkScanner< ACCESSOR, METRIC > Class Template Reference

Top-K scanner. More...

#include <topk.h>

List of all members.

Public Types

typedef ACCESSOR::Key Key
 Key type.
typedef ACCESSOR::Value Value
 Value type.

Public Member Functions

 TopkScanner (const ACCESSOR &accessor, const METRIC &metric, unsigned K, float R=std::numeric_limits< float >::max())
 Constructor.
void reset (Value query)
 Reset the query.
unsigned cnt () const
 Number of points scanned for the current query.
const Topk< Key > & topk () const
 TopK results.
void operator() (Key key)
 Update the current query by scanning key.


Detailed Description

template<typename ACCESSOR, typename METRIC>
class lshkit::TopkScanner< ACCESSOR, METRIC >

Top-K scanner.

Scans keys for top-K query. This is the object passed into the LSH query interface.


Constructor & Destructor Documentation

template<typename ACCESSOR, typename METRIC>
lshkit::TopkScanner< ACCESSOR, METRIC >::TopkScanner ( const ACCESSOR &  accessor,
const METRIC &  metric,
unsigned  K,
float  R = std::numeric_limits<float>::max() 
) [inline]

Constructor.

Parameters:
accessor The scanner use accessor to retrieva values from keys.
metric The distance metric.
K value used to reset internal Topk class.
R value used to reset internal Topk class.
(ACCESSOR)accessor is used as a function. Given a key, accessor(key) returns an object (or reference) of the type LSH::Domain. That object is used to calculate a hash value. The key is saved in the hash table. When the associated object is needed, e.g. when scanning a bin, accessor(key) is called to access the object.

Metric metric is also used as a function. It accepts two parameters of the type LSH::Domain and returns the distance between the two.


Member Function Documentation

template<typename ACCESSOR, typename METRIC>
void lshkit::TopkScanner< ACCESSOR, METRIC >::operator() ( Key  key  )  [inline]

Update the current query by scanning key.

This is normally invoked by the LSH index structure.

template<typename ACCESSOR, typename METRIC>
void lshkit::TopkScanner< ACCESSOR, METRIC >::reset ( Value  query  )  [inline]

Reset the query.

This function should be invoked before each query.


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