k-means clustering implementation for Luca