convert kmeans_incr threshold
[actl.git] / clustering.h
blob394a34e14b7eb73be9255343d438dae12542f5e6
1 /*
2 * Copyright (c) 2017 Mohamed Aslan <maslan@sce.carleton.ca>
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 #ifndef CLUSTERING_H
18 #define CLUSTERING_H
20 struct cluster {
21 double head;
22 double val;
23 size_t n_points;
26 struct kmeans_seq {
27 size_t n_clusters;
28 size_t n_points;
29 struct cluster *clusters;
32 #define KMEANS_INCR_MAXTHRESH 1024
33 struct kmeans_incr {
34 double threshold;
35 size_t n_clusters;
36 struct cluster *clusters;
39 void kmeans_seq_init(struct kmeans_seq *, size_t);
40 void kmeans_seq_insert(struct kmeans_seq *, double, double);
41 double kmeans_seq_find(struct kmeans_seq *, double);
42 void kmeans_seq_print(struct kmeans_seq *, const char *);
43 void kmeans_incr_init(struct kmeans_incr *, double);
44 void kmeans_incr_insert(struct kmeans_incr *, double, double);
45 double kmeans_incr_find(struct kmeans_incr *, double);
46 void kmeans_incr_print(struct kmeans_incr *, const char *);
48 #endif