Basic functions for clustering data: k-means, dp-means, etc.