changeset 521:237d5a03d317 multiprobeLSH

Working version of multiprobe LSH. Passes tests. But needs testing vis-a-vis TP improvement. In the process, found a bug in hash function projections on rare occasions admitting negative values. This only shows for large datasets and was fatal for multiprobe.
author mas01mc
date Tue, 27 Jan 2009 03:49:19 +0000
parents 0767731a6cce
children dad3d252462a
files Makefile lshlib.cpp
diffstat 2 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Mon Jan 26 13:19:09 2009 +0000
+++ b/Makefile	Tue Jan 27 03:49:19 2009 +0000
@@ -17,7 +17,7 @@
 MINORVERSION=0
 LIBRARY=lib$(EXECUTABLE).so.$(SOVERSION).$(MINORVERSION)
 
-override CFLAGS+=-g -ggdb -fPIC
+override CFLAGS+=-O3 -g -fPIC
 
 # set to DUMP hashtables on QUERY load
 #override CFLAGS+=-DLSH_DUMP_CORE_TABLES
--- a/lshlib.cpp	Mon Jan 26 13:19:09 2009 +0000
+++ b/lshlib.cpp	Tue Jan 27 03:49:19 2009 +0000
@@ -324,7 +324,10 @@
 	tmp += *pA++ * *vi++;  // project
       tmp += *pb;              // translate
       tmp *= iw;               // scale
-      *pg = (Uns32T) (floor(tmp));      // hash function g_j(v)=[x1 x2 ... xk]; xk \in Z
+      tmp = floor(tmp);        // handle negative values
+      while(tmp<0)             // wrap around 0 to N
+	tmp += H::N;
+      *pg = (Uns32T) tmp;      // hash function g_j(v)=[x1 x2 ... xk]; xk \in Z
       *bd = (tmp - *pg++);//*w;       // boundary distance -1
       *(bd+1) = (1.0f - *bd); //*w;    // boundary distance +1
       bd+=2;