@@ -0,0 +1,1322 @@
+package univ.ml.sparse.algorithm;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0Aimport org.apache.commons.math3.linear.RealVector;%0A%0Aimport univ.ml.sparse.SparseCentroidCluster;%0Aimport univ.ml.sparse.SparseWeightableVector;%0A%0Apublic class SparseKmeansCoresetAlgorithm implements SparseCoresetAlgorithm %7B%0A%0A    private static final long serialVersionUID = 6378586987151382195L;%0A%0A    private int sampleSize;%0A%0A    public SparseKmeansCoresetAlgorithm() %7B%0A        this(0);%0A    %7D%0A%0A    public SparseKmeansCoresetAlgorithm(int sampleSize) %7B%0A        this.sampleSize = sampleSize;%0A    %7D%0A%0A    @Override%0A    public List%3CSparseWeightableVector%3E takeSample(final List%3CSparseWeightableVector%3E pointset) %7B%0A        if (pointset.size() %3C= sampleSize)%0A            return pointset;%0A%0A        final SparseWeightedKMeansPlusPlus kmeans = new SparseWeightedKMeansPlusPlus(sampleSize);%0A        final List%3CSparseCentroidCluster%3E clusters = kmeans.cluster(pointset);%0A%0A        final List%3CSparseWeightableVector%3E results = new ArrayList%3C%3E();%0A        for (final SparseCentroidCluster cluster : clusters) %7B%0A            final RealVector center = cluster.getCenter().getVector();%0A            final int weight = cluster.getPoints().size();%0A            results.add(new SparseWeightableVector(center, weight));%0A        %7D%0A%0A        return results;%0A    %7D%0A%7D%0A

Add SDM coreset version for sparse data