@Test
public void updateSumMatrixSparseTest() {

    int sampleWeight = 1;
    KMeansPredictModelData predictModelData = new KMeansModelDataConverter().load(modelRows);
    int vectorSize = predictModelData.params.vectorSize;
    List<FastDistanceVectorData> samples = new ArrayList<>();
    List<Vector> vectorList = new ArrayList<>();
    for (int i = 0; i < length; i++) {
        vectorList.add(new SparseVector(vectorSize, new int[]{i % vectorSize}, new double[]{i * i}));
    }
    vectorList.forEach(vec -> samples
        .add((predictModelData.params.distanceType.getFastDistance()).prepareVectorData(Tuple2.of(vec, null))));
    DenseMatrix distanceMatrix = new DenseMatrix(predictModelData.params.k, 1);
    double[] sumMatrix = new double[predictModelData.params.k * (vectorSize + 1)];
    for (FastDistanceVectorData sample : samples) {
        KMeansUtil.updateSumMatrix(
            sample,
            sampleWeight,
            predictModelData.centroids,
            predictModelData.params.vectorSize,
            sumMatrix,
            predictModelData.params.k,
            predictModelData.params.distanceType.getFastDistance(),
            distanceMatrix);
    }
    Arrays.equals(sumMatrix, new double[] {117.0, 65.0, 89.0, 6.0, 9.0, 1.0, 4.0, 4.0});
}