Clustering algorithms have been a big part of the research I have conducted over the last four years.
The k-Means clustering algorithm works as follows;
This is implemented in C using CUDA kernels for the assignment, calculating new cluster centers and checking for movement. It is important to note that this was written for a purpose so may not be robust when used for other things. It is published here as it may be useful for others.
To run it is the filename followed by k value and then number of columns in your data. e.g.
It assumes a space seperated file of points. e.g.