DenseVectorSummarizer extends BaseVectorSummarizer { @Override public BaseVectorSummary toSummary() { DenseVectorSummary summary = new DenseVectorSummary(); summary.count = count; summary.sum = sum; summary.squareSum = squareSum; summary.normL1 = normL1; summary.min = min; summary.max = max; return summary; } DenseVectorSummarizer();  DenseVectorSummarizer(boolean calculateOuterProduction); @Override BaseVectorSummarizer visit(Vector vec); @Override String toString(); @Override BaseVectorSummary toSummary(); public DenseVector sum; public DenseVector squareSum; public DenseVector min; public DenseVector max; public DenseVector normL1; public DenseVector numNonZero; }
@Test public void toSummary() { DenseVectorSummary summary = (DenseVectorSummary) summarizer().toSummary(); assertEquals(5, summary.count); assertArrayEquals(new double[]{15.0, -15.0, 15.0}, summary.sum.getData(), 10e-6); assertArrayEquals(new double[]{55.0, 55.0, 45.0}, summary.squareSum.getData(), 10e-6); assertArrayEquals(new double[]{1.0, -5.0, 3.0}, summary.min.getData(), 10e-6); assertArrayEquals(new double[]{5.0, -1.0, 3.0}, summary.max.getData(), 10e-6); assertArrayEquals(new double[]{15.0, 15.0, 15.0}, summary.normL1.getData(), 10e-6); }