Mercurial > hg > audiodb
diff multiprobe.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 | ca1ee92c359c |
children |
line wrap: on
line diff
--- a/multiprobe.h Mon Jan 26 02:50:44 2009 +0000 +++ b/multiprobe.h Mon Jan 26 05:42:15 2009 +0000 @@ -34,8 +34,8 @@ typedef class MinHeapElement{ public: perturbation_set perturbs; - double score; - MinHeapElement(perturbation_set a, double s); + float score; + MinHeapElement(perturbation_set a, float s); virtual ~MinHeapElement(); } min_heap_element; @@ -44,23 +44,7 @@ greater<min_heap_element> > min_heap_of_perturbation_set ; -typedef pair<double, pair<int, int> > sorted_distance_functions ; - -bool operator> (const min_heap_element& a, const min_heap_element& b){ - return a.score > b.score; -} - -bool operator< (const min_heap_element& a, const min_heap_element& b){ - return a.score < b.score; -} - -bool operator>(const sorted_distance_functions& a, const sorted_distance_functions& b){ - return a.first > b.first; -} - -bool operator<(const sorted_distance_functions& a, const sorted_distance_functions& b){ - return a.first < b.first; -} +typedef pair<float, pair<int, int> > sorted_distance_functions ; class MultiProbe{ protected: @@ -76,20 +60,27 @@ // perturbation set operations perturbation_set& shift(perturbation_set&); perturbation_set& expand(perturbation_set&); - double score(perturbation_set&); + float score(perturbation_set&); bool valid(perturbation_set&); - void makeSortedDistFuns(vector<double> &); + void makeSortedDistFuns(vector<float> &); + void makeSortedDistFuns(float* x, unsigned N); + + // perturbation set generation algorithm + void algorithm1(unsigned T); public: MultiProbe(); ~MultiProbe(); // generation of perturbation sets - void generatePerturbationSets(vector<double>& vectorOfBounaryDistances, int numSetsToGenerate); + void generatePerturbationSets(vector<float>& vectorOfBounaryDistances, unsigned numSetsToGenerate); + void generatePerturbationSets(float* arrayOfBoundaryDistances, unsigned numDistances, unsigned numSetsToGenerate); perturbation_set getNextPerturbationSet(); void dump(perturbation_set); size_t size(); // Number of perturbation sets are in the output queue bool empty(); // predicate for empty MultiProbe set + int getIndex(perturbation_set::iterator it); // return index of hash function for given set entry + int getBoundary(perturbation_set::iterator it); // return boundary {-1,+1} for given set entry };