-
Notifications
You must be signed in to change notification settings - Fork 0
/
clust_knn.h
executable file
·89 lines (72 loc) · 2.2 KB
/
clust_knn.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
#pragma once // later: restore and min-heap
#ifndef HEADER_CLUST_KNN_H
#define HEADER_CLUST_KNN_H
#include "SA.h"
#include <queue>
#include "sas.cpp"
#include "glut.h"
#include "pick.h"
#include "global.h"
#include <pthread.h>
extern int KNN_USE;
using namespace std;
using namespace _SA;
// namespace myglut{
class GLUTWindow;
class GLUT3d;
class GLUT2d;
class clust_knn;
void distance_calculation();
void distance_calculation(size_t i);
class clust_knn{
public:
int N, Rand_Iter_Max, nj; // nj = number of points used
vector < SA<float> * > * float_buffers; // float data
SA<int> origIndex;
SA<float> dat; //the sampled data set (a subset of the full data set).
SA<int> nnIndex; //listing the indices of the nearest neighbors of each of the data points.
SA<float> nnD; //the listing of distances between each point and it's K-nearest neighbors.
vector< vector<unsigned int> > classmembers;
SAS<float> ** D_j;
SA<float> dE;
SA<int> knn_indices;
vector<int> knn_J_indices;
int nkci; // next knn class index;
int n_knn_centres, NRow, NCol;
clust_knn(int _NRow, int _NCol);
void init(GLUT3d * _my3d,
GLUT2d * _my2d,
vector < SA<float> * > * _float_buffers,
int nskip); //calculate nj from N and nskip.
// );
void init(GLUT3d * _my3d,
GLUT2d * _my2d,
vector < SA<float> * > * _float_buffers,
int nskip, //calculate nj from N and nskip.
bool re_init);
int getK(){
return KNN_USE;
}
void reinit(int nskip);
float densityEstimate(int j);
int classf(int j,
SA<int> * highestdensityneighborindex,
SA<float> * highestdensityneighbordensity);
void knn_clustering();
int get_n_knn_centres();
int get_n_knn_elements(int centre_index);
float get_centre_coord(int centre_index, int elem_ind, int coord);
float get_centre_coord( int centre_index, int coord);
float distance(int i, int j);
float euclidean_distance(int i, int j);
float T3_distance(int i, int j);
float normalized_euclidean_distance(int i, int j);
void set_Rand_Iter_Max(int rim){
Rand_Iter_Max = rim;
}
int get_Rand_Iter_Max(){
return Rand_Iter_Max;
}
};
// }
#endif