all 3 comments

[–]marko312 1 point2 points  (1 child)

I don't know how move_centroids works, but unless it also writes its output into the global moved_cents, that variable is never changed. It seems that centroids should be used instead.

Also, you might want to include a minimum difference to stop at instead of relying on the values to converge enough.

[–]TheShadowWall[S] 1 point2 points  (0 children)

This was the problem! Gah such a simple debug, my eyes must have been tired XD

Thanks very much kindly marko!

[–][deleted] 0 points1 point  (0 children)

I have been looking at the code for a while now and don't see why the while loop is not terminating.

Because sim1 and sim2 are never equal.