#include <lsh_table.h>
Public Types | |
typedef std::map< BucketKey, Bucket > | BucketsSpace |
typedef std::vector< Bucket > | BucketsSpeed |
Public Member Functions | |
void | add (const std::vector< std::pair< size_t, ElementType * > > &features) |
void | add (unsigned int value, const ElementType *feature) |
const Bucket * | getBucketFromKey (BucketKey key) const |
size_t | getKey (const ElementType *) const |
size_t | getKey (const unsigned char *feature) const |
LshStats | getStats () const |
LshStats | getStats () const |
LshTable () | |
LshTable (unsigned int feature_size, unsigned int subsignature_size) | |
LshTable (unsigned int, unsigned int) | |
Private Types | |
enum | SpeedLevel { kArray, kBitsetHash, kHash } |
Private Member Functions | |
void | initialize (size_t key_size) |
void | optimize () |
template<typename Archive > | |
void | serialize (Archive &ar) |
Private Attributes | |
BucketsSpace | buckets_space_ |
BucketsSpeed | buckets_speed_ |
DynamicBitset | key_bitset_ |
unsigned int | key_size_ |
std::vector< size_t > | mask_ |
SpeedLevel | speed_level_ |
Friends | |
struct | serialization::access |
Lsh hash table. As its key is a sub-feature, and as usually the size of it is pretty small, we keep it as a continuous memory array. The value is an index in the corpus of features (we keep it as an unsigned int for pure memory reasons, it could be a size_t)
Definition at line 186 of file lsh_table.h.
typedef std::map<BucketKey, Bucket> rtflann::lsh::LshTable< ElementType >::BucketsSpace |
A container of all the feature indices. Optimized for space
Definition at line 194 of file lsh_table.h.
typedef std::vector<Bucket> rtflann::lsh::LshTable< ElementType >::BucketsSpeed |
A container of all the feature indices. Optimized for speed
Definition at line 199 of file lsh_table.h.
|
private |
defines the speed fo the implementation kArray uses a vector for storing data kBitsetHash uses a hash map but checks for the validity of a key with a bitset kHash uses a hash map only
Enumerator | |
---|---|
kArray | |
kBitsetHash | |
kHash |
Definition at line 313 of file lsh_table.h.
|
inline |
Default constructor
Definition at line 203 of file lsh_table.h.
|
inline |
Default constructor Create the mask and allocate the memory
feature_size | is the size of the feature (considered as a ElementType[]) |
key_size | is the number of bits that are turned on in the feature |
Definition at line 212 of file lsh_table.h.
|
inline |
Definition at line 419 of file lsh_table.h.
|
inline |
Add a set of features to the table
dataset | the values to store |
Definition at line 249 of file lsh_table.h.
|
inline |
Add a feature to the table
value | the value to store for that feature |
feature | the feature itself |
Definition at line 222 of file lsh_table.h.
|
inline |
|
inline |
Compute the sub-signature of a feature
Definition at line 295 of file lsh_table.h.
|
inline |
Return the Subsignature of a feature
feature | the feature to analyze |
Definition at line 462 of file lsh_table.h.
LshStats rtflann::lsh::LshTable< ElementType >::getStats | ( | ) | const |
Get statistics about the table
|
inline |
Definition at line 495 of file lsh_table.h.
|
inlineprivate |
Initialize some variables
Definition at line 320 of file lsh_table.h.
|
inlineprivate |
Optimize the table for speed/space
Definition at line 328 of file lsh_table.h.
|
inlineprivate |
Definition at line 362 of file lsh_table.h.
|
friend |
Definition at line 386 of file lsh_table.h.
|
private |
The hash table of all the buckets in case we cannot use the speed version
Definition at line 394 of file lsh_table.h.
|
private |
The vector of all the buckets if they are held for speed
Definition at line 390 of file lsh_table.h.
|
private |
If the subkey is small enough, it will keep track of which subkeys are set through that bitset That is just a speedup so that we don't look in the hash table (which can be mush slower that checking a bitset)
Definition at line 402 of file lsh_table.h.
|
private |
The size of the sub-signature in bits
Definition at line 406 of file lsh_table.h.
|
private |
The mask to apply to a feature to get the hash key Only used in the unsigned char case
Definition at line 412 of file lsh_table.h.
|
private |
What is used to store the data
Definition at line 397 of file lsh_table.h.