aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/main.c b/main.c
index f071804..6acaf60 100644
--- a/main.c
+++ b/main.c
@@ -141,17 +141,7 @@ find_on_init(
void *cb_data
) {
ctx_t * const ctx = cb_data;
- km_rand_t * const rs = &(ctx->rs);
-
- switch(ctx->init_type) {
- case KM_INIT_TYPE_RAND:
- return km_init_rand(cs, num_clusters, set->shape.num_floats, rs);
- case KM_INIT_TYPE_FORGY:
- return km_init_forgy(cs, num_clusters, set, rs);
- default:
- die("unknown cluster init method");
- return false;
- }
+ return km_init(cs, ctx->init_type, num_clusters, set, &(ctx->rs));
}
static bool
@@ -338,7 +328,7 @@ int main(int argc, char *argv[]) {
ctx_t ctx;
memset(&ctx, 0, sizeof(ctx_t));
km_rand_init_system(&(ctx.rs));
- ctx.init_type = km_get_init_type(init_type_name);
+ ctx.init_type = km_init_get_type(init_type_name);
// init data set
km_set_t set;
@@ -346,7 +336,7 @@ int main(int argc, char *argv[]) {
die("km_load_path(\"%s\") failed", data_path);
}
- // init data set
+ // normalize data set
if (!km_set_normalize(&set)) {
die("km_set_normalize() failed");
}