diff multiprobe.h @ 517:807c8be7dd45 multiprobeLSH

Completed multiprobe framework for LSH. Requires testing.
author mas01mc
date Sun, 25 Jan 2009 06:10:38 +0000
parents 2a7bad47a4a7
children ca1ee92c359c
line wrap: on
line diff
--- a/multiprobe.h	Sat Jan 24 19:51:46 2009 +0000
+++ b/multiprobe.h	Sun Jan 25 06:10:38 2009 +0000
@@ -20,6 +20,8 @@
 #include <queue>
 #include <vector>
 #include <set>
+#include <algorithm>
+#include <iostream>
 
 using namespace std ;
 
@@ -33,6 +35,7 @@
   greater<min_heap_element> 
   > min_heap_of_perturbation_set ;
 typedef pair<double, pair<int, int> > sorted_distance_functions ;
+typedef vector<sorted_distance_functions> vector_of_sorted_distance_functions;
 
 bool operator>(const min_heap_element& a, const min_heap_element& b){
   return a.second > b.second;
@@ -43,31 +46,33 @@
 }
 
 bool operator>(const sorted_distance_functions& a, const sorted_distance_functions& b){
-  return a.second > b.second;
+  return a.first > b.first;
 }
 
 bool operator<(const sorted_distance_functions& a, const sorted_distance_functions& b){
-  return a.second < b.second;
+  return a.first < b.first;
 }
 
 class MultiProbe{
 protected:
   min_heap_of_perturbation_set* minHeap;
   vector_of_perturbation_set* outSets;
-  sorted_distance_functions distFuns;
+  vector_of_sorted_distance_functions* distFuns;
+  unsigned numHashBoundaries;
 public: 
   MultiProbe();
   ~MultiProbe();
 
   // perturbation set operations
-  perturbation_set& shift(perturbation_set);
-  perturbation_set& expand(perturbation_set);
+  perturbation_set& shift(perturbation_set&);
+  perturbation_set& expand(perturbation_set&);
   double score(perturbation_set&);
   bool valid(perturbation_set&);
 
   // generation of perturbation sets
-  void generatePerturbationSets(int, vector<int>&);
-  sorted_distance_functions& makeSortedDistFuns(vector<int> &);
+  void generatePerturbationSets(int, vector<double>&);
+  void makeSortedDistFuns(vector<double> &);
+  void dump(perturbation_set& );
 };
 
 /* NOTES: