#include <lsh_table.h>
Public Types | |
| typedef std::map< BucketKey, Bucket > | BucketsSpace |
| typedef std::vector< Bucket > | BucketsSpeed |
Public Member Functions | |
| void | add (unsigned int value, const ElementType *feature) |
| void | add (const std::vector< std::pair< size_t, ElementType * > > &features) |
| const Bucket * | getBucketFromKey (BucketKey key) const |
| size_t | getKey (const ElementType *) const |
| template<> | |
| size_t | getKey (const unsigned char *feature) const |
| LshStats | getStats () const |
| template<> | |
| LshStats | getStats () const |
| LshTable () | |
| LshTable (unsigned int, unsigned int) | |
| template<> | |
| LshTable (unsigned int feature_size, unsigned int subsignature_size) | |
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 125 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 133 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 138 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 252 of file lsh_table.h.
|
inline |
Default constructor
Definition at line 142 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 151 of file lsh_table.h.
|
inline |
Definition at line 358 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 161 of file lsh_table.h.
|
inline |
Add a set of features to the table
| dataset | the values to store |
Definition at line 188 of file lsh_table.h.
|
inline |
|
inline |
Compute the sub-signature of a feature
Definition at line 234 of file lsh_table.h.
|
inline |
Return the Subsignature of a feature
| feature | the feature to analyze |
Definition at line 399 of file lsh_table.h.
| LshStats rtflann::lsh::LshTable< ElementType >::getStats | ( | ) | const |
Get statistics about the table
|
inline |
Definition at line 432 of file lsh_table.h.
|
inlineprivate |
Initialize some variables
Definition at line 259 of file lsh_table.h.
|
inlineprivate |
Optimize the table for speed/space
Definition at line 267 of file lsh_table.h.
|
inlineprivate |
Definition at line 301 of file lsh_table.h.
|
friend |
Definition at line 325 of file lsh_table.h.
|
private |
The hash table of all the buckets in case we cannot use the speed version
Definition at line 333 of file lsh_table.h.
|
private |
The vector of all the buckets if they are held for speed
Definition at line 329 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 341 of file lsh_table.h.
|
private |
The size of the sub-signature in bits
Definition at line 345 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 351 of file lsh_table.h.
|
private |
What is used to store the data
Definition at line 336 of file lsh_table.h.