class KMeansUtil implements Serializable {

    public static Tuple2<Integer, Double> getClosestClusterIndex(FastDistanceVectorData sample,
                                                                 FastDistanceMatrixData centroids,
                                                                 int k,
                                                                 FastDistance distance,
                                                                 DenseMatrix distanceMatrix) {
        getClusterDistances(sample, centroids, distance, distanceMatrix);
        double[] data = distanceMatrix.getData();
        int index = getMinPointIndex(data, k);
        return Tuple2.of(index, data[index]);
    }

}