From d02db8a3c7d6692dd8ca0ba19f7f61be13d1bd76 Mon Sep 17 00:00:00 2001 From: Darafei Praliaskouski Date: Tue, 2 Jan 2018 14:09:50 +0000 Subject: [PATCH] Fix KMeans initialization issue that lost clusters sometimes. Closes #3965 Closes https://github.com/postgis/postgis/pull/179 git-svn-id: http://svn.osgeo.org/postgis/branches/2.3@16214 b70326c6-7e19-0410-871a-916f4a2858ee --- NEWS | 5 +++-- liblwgeom/lwkmeans.c | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 2933bd364..9dc2c6442 100644 --- a/NEWS +++ b/NEWS @@ -1,10 +1,11 @@ PostGIS 2.3.6 -2017/xx/xx +2018/xx/xx * Bug Fixes and Enhancements - #3713, Support encodings that happen to output a '\' character - + - #3965, ST_ClusterKMeans used to lose some clusters on initialization + (Darafei Praliaskouski) PostGIS 2.3.5 2017/11/15 diff --git a/liblwgeom/lwkmeans.c b/liblwgeom/lwkmeans.c index 7500c9464..53d02aecc 100644 --- a/liblwgeom/lwkmeans.c +++ b/liblwgeom/lwkmeans.c @@ -194,6 +194,7 @@ lwgeom_cluster_2d_kmeans(const LWGEOM **geoms, int ngeoms, int k) if (seen[j] == closest) { closest = (closest + 1) % config.num_objs; + j = 0; } else { -- 2.50.1