e2fd3463cce3ae5bf7d68220f28b8625ef52578f
[synclust.git] / src / sources / kmeansClustering.h
1 #ifndef SYNCLUST_KMEANSCLUSTERING_H
2 #define SYNCLUST_KMEANSCLUSTERING_H
3
4 #include <cgds/Vector.h>
5
6 // auxiliary function to obtain a random sample of 1..n with K elements
7 void sample(
8 int* centers,
9 int n,
10 int K
11 );
12
13 // auxiliary function to compare two sets of centers
14 int unequalCenters(
15 int* ctrs1,
16 int* ctrs2,
17 int n,
18 int K
19 );
20
21 // assign a vector (represented by its distances to others, as distances[index,])
22 // to a cluster, represented by its center index ==> output is integer in 0..K-1
23 int assignCluster(
24 int index,
25 double* distances,
26 int* centers,
27 int n,
28 int K
29 );
30
31 // k-means based on a distance matrix (nstart=10, maxiter=100)
32 int* kmeansWithDistances_core(
33 double* pDistances,
34 int n,
35 int K,
36 int nstart,
37 int maxiter
38 );
39
40 #endif