aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2019-02-05 03:51:13 -0500
committerPaul Duncan <pabs@pablotron.org>2019-02-05 03:51:13 -0500
commit7907db7627aafa35a45f7246e79f5369b6714828 (patch)
treee66dd3c36b1204d4ad5fee65882acb380bc92de1 /src
parent4041516e6cca8a44de6cb7f7e6feb0930df4c1b6 (diff)
downloadkmeans-7907db7627aafa35a45f7246e79f5369b6714828.tar.bz2
kmeans-7907db7627aafa35a45f7246e79f5369b6714828.zip
populate README, clean up comments, remove unused includes
Diffstat (limited to 'src')
-rw-r--r--src/km-find.c3
-rw-r--r--src/km-rand-erand48.c6
-rw-r--r--src/km-rand-path.c3
-rw-r--r--src/km-solve.c1
4 files changed, 5 insertions, 8 deletions
diff --git a/src/km-find.c b/src/km-find.c
index 657c645..5ae5948 100644
--- a/src/km-find.c
+++ b/src/km-find.c
@@ -1,10 +1,7 @@
#include <stdbool.h> // bool
-#include <math.h> // fabsf()
#include "util.h"
#include "km.h"
-#define MIN_CLUSTER_DISTANCE 0.0001
-
static float
get_mean_cluster_size(
const km_set_t * const set
diff --git a/src/km-rand-erand48.c b/src/km-rand-erand48.c
index de84b93..3d7b02d 100644
--- a/src/km-rand-erand48.c
+++ b/src/km-rand-erand48.c
@@ -1,7 +1,6 @@
#include <stdbool.h> // bool
#define _DEFAULT_SOURCE
-#include <stdlib.h> // drand48_r()
-#include <stdio.h> // fopen()
+#include <stdlib.h> // erand48()
#include "util.h"
#include "km.h"
@@ -62,7 +61,8 @@ ERAND48_RAND_CBS = {
.fini = on_fini,
};
-// init system random source (uses system rand())
+// init erand48 random source (uses erand48(), seeded with the lower
+// 48-bits of the seed parameter)
bool
km_rand_init_erand48(
km_rand_t * const rs,
diff --git a/src/km-rand-path.c b/src/km-rand-path.c
index 6597038..c1d011d 100644
--- a/src/km-rand-path.c
+++ b/src/km-rand-path.c
@@ -114,7 +114,8 @@ PATH_RAND_CBS = {
.fini = on_fini,
};
-// init system random source (uses system rand())
+// init random source from a file (e.g. "/dev/urandom")
+// (NOTE: this method is horribly slow, don't use it)
bool
km_rand_init_path(
km_rand_t * const rs,
diff --git a/src/km-solve.c b/src/km-solve.c
index 4730eb4..b6d98d6 100644
--- a/src/km-solve.c
+++ b/src/km-solve.c
@@ -1,7 +1,6 @@
#include <stdbool.h> // bool
#include <string.h> // memset()
#include <float.h> // FLT_MAX
-#include <math.h> // sqrt()
#include "util.h"
#include "km.h"