diff options
author | Paul Duncan <pabs@pablotron.org> | 2019-02-03 16:12:04 -0500 |
---|---|---|
committer | Paul Duncan <pabs@pablotron.org> | 2019-02-03 16:12:04 -0500 |
commit | aa74bd04f66217ff4d617924630b13d721578159 (patch) | |
tree | ec81d0f964ab4f9cb47d3be60547c234b8db591a /km.h | |
parent | 7667c7d7d7473b41c3065cd8fbdb291b45d69fe7 (diff) | |
download | kmeans-aa74bd04f66217ff4d617924630b13d721578159.tar.bz2 kmeans-aa74bd04f66217ff4d617924630b13d721578159.zip |
add km_set_init_rand_points()
Diffstat (limited to 'km.h')
-rw-r--r-- | km.h | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -11,6 +11,7 @@ typedef struct km_rand_t_ km_rand_t; // random number source callbacks typedef struct { _Bool (*fill)(km_rand_t * const, const size_t, float * const); + _Bool (*fill_sizes)(km_rand_t * const, const size_t, size_t * const); void (*fini)(km_rand_t * const); } km_rand_cbs_t; @@ -23,6 +24,9 @@ struct km_rand_t_ { // fill buffer with N random floats _Bool km_rand_fill(km_rand_t * const, const size_t, float * const); +// fill buffer with N random size_ts +_Bool km_rand_fill_sizes(km_rand_t * const, const size_t, size_t * const); + // finalize random source void km_rand_fini(km_rand_t * const); @@ -82,6 +86,15 @@ _Bool km_set_init_rand_clusters( km_rand_t * ); +// init a set with num_clusters clusters of random points from the +// given set +_Bool km_set_init_rand_points( + km_set_t * const, + const km_set_t * const, + const size_t, + km_rand_t * +); + typedef struct { float d2; size_t cluster; |