1164 static int cluster_size = 100;
1165 static int num_clusters = 4;
1166 static double spread = 1.5;
1167 int N = cluster_size * num_clusters;
1174 for (j = 0; j < num_clusters; j++) {
1175 for (i = 0; i < cluster_size; i++)
1177 double u1 = 1.0 * rand() / RAND_MAX;
1178 double u2 = 1.0 * rand() / RAND_MAX;
1179 double z1 = spread * j + sqrt(-2*log2(u1))*cos(2*M_PI*u2);
1180 double z2 = spread * j + sqrt(-2*log2(u1))*sin(2*M_PI*u2);
1196 for (i = 0; i < k; i++)
LWPOINT * lwpoint_make2d(int srid, double x, double y)
void lwgeom_free(LWGEOM *geom)
#define SRID_UNKNOWN
Unknown SRID value.
int * lwgeom_cluster_2d_kmeans(const LWGEOM **geoms, int ngeoms, int k)
Take a list of LWGEOMs and a number of clusters and return an integer array indicating which cluster ...
LWGEOM * lwpoint_as_lwgeom(const LWPOINT *obj)
void * lwalloc(size_t size)