kmeans and spade compile