-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.cpp
43 lines (38 loc) · 1.18 KB
/
test.cpp
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
#include "fndbscan.hpp"
//g++ test.cpp fndbscan.cpp kdtree2.cpp -o3 -o fndbscan
int main()
{
int N,d,rn;
//Dosyadan okuyup array2dfloat içine veriyi aktarma. (Normal array gibi kullanılabiliniyor).
array2dfloat realdata=readFromFile(&N,&d,"test3.txt");
float **sups=findSupremums(realdata,N, d); //Supremumları buluyor.
float dmax=calcDmax(sups,d); //Dmax hesaplama.
float deps = calcDeps(dmax,0.995,1,EXP); //Deps hesaplama Exp
cout<< deps <<endl;
deps = calcDeps(dmax,0.995,1,LIN); //Deps hesaplama Lin
cout<< deps <<endl;
KDTree* tree;
KDTreeResultVector results;
tree = new KDTree(realdata,true);
tree->sort_results = true;
/*tree->n_nearest_around_point(100,0,20,results);
rn = results.size();
cout<< rn <<endl;
for(KDTreeResult ii : results)
{
cout << ii.idx << " " << ii.dis << '\n';
}*/
tree->r_nearest_around_point(100,0,deps,results); //Deps komşuluğundaki noktaları getir.
rn = results.size();
cout<< rn <<endl;
for(KDTreeResult ii : results)
{
cout << ii.idx << " " << ii.dis << "->";
for(int j=0;j<d;j++)
{
cout << realdata[ii.idx][j] <<" ";
}
cout << neighborhoodDegree(ii.dis,1,dmax,LIN) << " ";
cout<< endl;
}
}