From a3792d8769d2dc8ee0abae758c6fae3a35b5dfbc Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Sat, 2 Feb 2019 03:25:59 -0500 Subject: add km_search() --- km.h | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'km.h') diff --git a/km.h b/km.h index ef0f0d9..0c49832 100644 --- a/km.h +++ b/km.h @@ -8,7 +8,7 @@ typedef struct km_rand_src_t_ km_rand_src_t; // random number source callbacks typedef struct { - bool (*fill)(km_rand_src_t * const, const size_t, float * const); + _Bool (*fill)(km_rand_src_t * const, const size_t, float * const); void (*fini)(km_rand_src_t * const); } km_rand_src_cbs_t; @@ -79,4 +79,26 @@ km_clusters_solve( void * const ); +typedef struct { + const km_set_t * const cluster_set; + const size_t num_clusters; + const float mean_distance; + const size_t num_empty_clusters; +} km_search_row_t; + +typedef void (*km_search_row_cb_t)( + const km_search_row_t * const, + void * +); + +// repeatedly test different cluster sizes and report results +_Bool +km_search( + const km_set_t * const set, + const size_t max_clusters, + const size_t num_tests, + const km_search_row_cb_t on_row, + void *cb_data +); + #endif /* KM_H */ -- cgit v1.2.3