Static Value-Flow Analysis
fastcluster.h
Go to the documentation of this file.
1 //
2 // C++ standalone version of fastcluster by Daniel Muellner
3 //
4 // Copyright: Daniel Muellner, 2011
5 // Christoph Dalitz, 2020
6 // License: BSD style license
7 // (see the file LICENSE for details)
8 //
9 
10 #ifndef fastclustercpp_H
11 #define fastclustercpp_H
12 
13 //
14 // Assigns cluster labels (0, ..., nclust-1) to the n points such
15 // that the cluster result is split into nclust clusters.
16 //
17 // Input arguments:
18 // n = number of observables
19 // merge = clustering result in R format
20 // nclust = number of clusters
21 // Output arguments:
22 // labels = allocated integer array of size n for result
23 //
24 void cutree_k(int n, const int* merge, int nclust, int* labels);
25 
26 //
27 // Assigns cluster labels (0, ..., nclust-1) to the n points such
28 // that the hierarchical clustering is stopped at cluster distance cdist
29 //
30 // Input arguments:
31 // n = number of observables
32 // merge = clustering result in R format
33 // height = cluster distance at each merge step
34 // cdist = cutoff cluster distance
35 // Output arguments:
36 // labels = allocated integer array of size n for result
37 //
38 void cutree_cdist(int n, const int* merge, double* height, double cdist, int* labels);
39 
40 //
41 // Hierarchical clustering with one of Daniel Muellner's fast algorithms
42 //
43 // Input arguments:
44 // n = number of observables
45 // distmat = condensed distance matrix, i.e. an n*(n-1)/2 array representing
46 // the upper triangle (without diagonal elements) of the distance
47 // matrix, e.g. for n=4:
48 // d00 d01 d02 d03
49 // d10 d11 d12 d13 -> d01 d02 d03 d12 d13 d23
50 // d20 d21 d22 d23
51 // d30 d31 d32 d33
52 // method = cluster metric (see enum hclust_fast_methods)
53 // Output arguments:
54 // merge = allocated (n-1)x2 matrix (2*(n-1) array) for storing result.
55 // Result follows R hclust convention:
56 // - observable indices start with one
57 // - merge[i][] contains the merged nodes in step i
58 // - merge[i][j] is negative when the node is an atom
59 // height = allocated (n-1) array with distances at each merge step
60 // Return code:
61 // 0 = ok
62 // 1 = invalid method
63 //
64 int hclust_fast(int n, double* distmat, int method, int* merge, double* height);
66 {
67  // single link with the minimum spanning tree algorithm (Rohlf, 1973)
69  // complete link with the nearest-neighbor-chain algorithm (Murtagh, 1984)
71  // complete link with the nearest-neighbor-chain algorithm (Murtagh, 1984)
73  // median link with the generic algorithm (Müllner, 2011)
75  // To indicate to try all methods and pick the best.
77 };
78 
79 
80 #endif
cJSON * n
Definition: cJSON.cpp:2558
hclust_fast_methods
Definition: fastcluster.h:66
@ HCLUST_METHOD_AVERAGE
Definition: fastcluster.h:72
@ HCLUST_METHOD_COMPLETE
Definition: fastcluster.h:70
@ HCLUST_METHOD_SVF_BEST
Definition: fastcluster.h:76
@ HCLUST_METHOD_MEDIAN
Definition: fastcluster.h:74
@ HCLUST_METHOD_SINGLE
Definition: fastcluster.h:68
void cutree_k(int n, const int *merge, int nclust, int *labels)
Definition: fastcluster.cpp:37
void cutree_cdist(int n, const int *merge, double *height, double cdist, int *labels)
int hclust_fast(int n, double *distmat, int method, int *merge, double *height)