-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHash_core+lsh.h
More file actions
124 lines (77 loc) · 2.02 KB
/
Hash_core+lsh.h
File metadata and controls
124 lines (77 loc) · 2.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#ifndef PRJ_HASH_H
#define PRJ_HASH_H
#include <vector>
#include <stdlib.h>
#include <iostream>
#include <list>
#include <cmath>
#include <array>
#include <set>
#include "Datapoint.h"
using namespace std;
set<Datapoint *> aaaaaaaa(Datapoint &query, double radius, vector<Datapoint> &whole_dataset, int mode);
class Hashtable_class
{
private:
//int size;
int id;
int num_buckets;
int dimension;
//hash random variables
std::vector<int> vi;
std::vector<int> ti;
std::vector<vector<float>> v;
std::vector<float> t;
std::vector<int> r;
int w;
vector<vector<int> > *g_values;
public:
std::list<Datapoint *> *table;
explicit Hashtable_class(int, int, vector<vector<float>>, vector<float>, vector<int>);
~Hashtable_class();
void insert(Datapoint *d);
pair<int, vector<int>> hash_eucl(Datapoint &d);
int hash_cos(Datapoint &d);
int hash_eucl_hypercube(Datapoint &d);
set<Datapoint *> search(Datapoint &q, double maxRange);
void print_table();
friend class Hypercube;
};
class H_family
{
private:
std::vector<vector<float>> v;
std::vector<float> t;
vector<int> r;
int dimension;
int L;
public:
vector<Hashtable_class *> hashtables;
explicit H_family(int num_buckets, int L, int dimension);
~H_family();
set<Datapoint *> search(Datapoint &q, double maxRange);
void insert(Datapoint *d); //insert to all
void insert(vector<Datapoint> &whole_dataset); //insert whole dataset to all
};
/////////////////////////////////////// H Y P E R C U B E ////////////////////////////////////////////////
class Hypercube
{
private:
std::vector<vector<float>> v;
std::vector<float> t;
vector<int> r;
int dimension_cube;
int dimension_vectors;
int num_buckets;
int M;
int probes;
public:
explicit Hypercube(int dimension_vectors, int dimension_cube, int probes, int Max_points);
~Hypercube();
Hashtable_class *cube;
set<Datapoint *> search(Datapoint &q, double maxRange);
void insert(Datapoint *d);
void insert(vector<Datapoint> &whole_dataset);
void print();
};
#endif //PRJ_HASH_H