alpmestan/kmeans-vector — pull request #2 by aleator (2012-04-03 10:11:58+00:00)
Title: Expanded interface, snappier code

A common usecase for K-Means is to cluster data elements by clustering their feature vectors, and unfortunately, the original kmeans code has no clear way of identifying the elements after the clustering.

I expanded the interface by making the K-Means cluster `(Vec,a)` pairs, which allows recovering the original data object (image, text etc.) from the clustering result. Moreover, I found that by using few inline pragmas and `Data.Vector.accum` I could further improve the performance by nearly 50%. Even if you don't want to keep the new interface, these changes could improve the performance of the original version.