diff lshlib.h @ 519:fdcd436d7cbd multiprobeLSH

lshlib MultiProbe glue added. Compiles and links against audioDB. Fails LSH tests at the moment.
author mas01mc
date Mon, 26 Jan 2009 05:42:15 +0000
parents 01cb73dfcddd
children 83e37b76b483
line wrap: on
line diff
--- a/lshlib.h	Mon Jan 26 02:50:44 2009 +0000
+++ b/lshlib.h	Mon Jan 26 05:42:15 2009 +0000
@@ -33,6 +33,7 @@
 #ifdef MT19937
 #include "mt19937/mt19937ar.h"
 #endif
+#include "multiprobe.h"
 
 #define IntT int
 #define LongUns64T long long unsigned
@@ -107,10 +108,14 @@
 
 #define LSH_CORE_ARRAY_BIT (0x80000000) //  LSH_CORE_ARRAY test bit for list head
 
-using namespace std;
+#ifndef LSH_MULTI_PROBE_COUNT
+#define LSH_MULTI_PROBE_COUNT 1 // How many adjacent hash-buckets to probe in LSH retrieval
+#endif
 
 Uns32T get_page_logn();
 
+using namespace std;
+
 // Disk table entry
 typedef class SerialElement SerialElementT;
 class SerialElement {
@@ -232,6 +237,7 @@
   Uns32T t2;       // second hash table key
   Uns32T P;        // hash table prime number
 
+  
   Uns32T N; // num rows per table
   Uns32T C; // num collision per row
   Uns32T k; // num projections per hash function
@@ -242,6 +248,9 @@
   float w;     // width of hash slots (relative to normalized feature space)
   float radius;// scaling coefficient for data (1./radius)
 
+  MultiProbe* multiProbePtr; // Utility class for handling multi-probe queries
+  float ** boundaryDistances; // Array of query bucket-boundary-distances per hashtable
+
   void initialize_data_structures();
   void initialize_lsh_functions();
   void initialize_partial_functions();
@@ -275,6 +284,7 @@
   // Interface to hash functions
   void compute_hash_functions(vector<float>& v);
   void generate_hash_keys(Uns32T* g, Uns32T* r1, Uns32T* r2);
+  void generate_multiprobe_keys(Uns32T*g, Uns32T* r1, Uns32T* r2);
   Uns32T get_t1(){return t1;} // hash-key t1
   Uns32T get_t2(){return t2;} // hash-key t2
 };