-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathhashFunction.h
99 lines (73 loc) · 2.21 KB
/
hashFunction.h
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
#ifndef Included_HashFunction_H
#define Included_HashFunction_H
#include "dataTypes.h"
#include "euclideanNode.h"
#include <bitset>
#include "List.h"
#include "clusterNode.h"
#include "hashFunctionCosine.h"
#include "psedoRandomNumbers.h"
#include "hashFunctionEuclidean.h"
#include "hashFunctionMatrix.h"
#define MAXINT 4294967291 //2^32-5
template<class T> //prototype gia thn hashFunction
class HashFunction
{
private:
public:
HashFunction();
unsigned int HashFunctionHash(T key); //prepei na pairnei to key kai na epistrefei to bucket
};
template<>
class HashFunction<ClusterNode<Vector*>*>
{
private:
const int dimensions;
const int kHashFunctions;
HashFunctionCosine** gFunction;
public:
HashFunction(int K, int Dimensions);
~HashFunction();
unsigned int HashFunctionHash(ClusterNode<Vector*>* key);
};
template<>
class HashFunction<ClusterNode<Hamming*>*>
{
private:
const int kHashFunctions;
const int noBits;
int* gFunction;
public:
HashFunction(int K, int noBts);
~HashFunction();
unsigned int HashFunctionHash(ClusterNode<Hamming*>* key);
};
template<>
class HashFunction<ClusterNode<EuclideanNode*>*>
{
private:
const int dimensions;
const int kHashFunctions;
const int nBuckets;
HashFunctionEuclidean** gFunction;
int* rVariables;
public:
HashFunction(int K, int Dimensions, int W, int noBuckets);
~HashFunction();
unsigned int HashFunctionHash(ClusterNode<EuclideanNode*>* key);
int hashFunctionID(ClusterNode<EuclideanNode*>* key);
};
template<>
class HashFunction<ClusterNode<MatrixPoint*>*>
{
private:
const int kHashFunctions;
HashFunctionMatrix** gFunction;
ClusterNode<MatrixPoint*>* getPoint(List<ClusterNode<MatrixPoint*>*>* myList, int pos);
public:
HashFunction(int K, List<ClusterNode<MatrixPoint*>*>* myInput);
~HashFunction();
unsigned int HashFunctionHash(ClusterNode<MatrixPoint*>* key);
};
unsigned int modulo(int x1, int x2);
#endif