MultivariateSummaryStatistics implements StatisticalMultivariateSummary, Serializable { public void addValue(double[] value) throws DimensionMismatchException { checkDimension(value.length); for (int i = 0; i < k; ++i) { double v = value[i]; sumImpl[i].increment(v); sumSqImpl[i].increment(v); minImpl[i].increment(v); maxImpl[i].increment(v); sumLogImpl[i].increment(v); geoMeanImpl[i].increment(v); meanImpl[i].increment(v); } covarianceImpl.increment(value); n++; } MultivariateSummaryStatistics(int k, boolean isCovarianceBiasCorrected); void addValue(double[] value); int getDimension(); long getN(); double[] getSum(); double[] getSumSq(); double[] getSumLog(); double[] getMean(); double[] getStandardDeviation(); RealMatrix getCovariance(); double[] getMax(); double[] getMin(); double[] getGeometricMean(); @Override String toString(); void clear(); @Override boolean equals(Object object); @Override int hashCode(); StorelessUnivariateStatistic[] getSumImpl(); void setSumImpl(StorelessUnivariateStatistic[] sumImpl); StorelessUnivariateStatistic[] getSumsqImpl(); void setSumsqImpl(StorelessUnivariateStatistic[] sumsqImpl); StorelessUnivariateStatistic[] getMinImpl(); void setMinImpl(StorelessUnivariateStatistic[] minImpl); StorelessUnivariateStatistic[] getMaxImpl(); void setMaxImpl(StorelessUnivariateStatistic[] maxImpl); StorelessUnivariateStatistic[] getSumLogImpl(); void setSumLogImpl(StorelessUnivariateStatistic[] sumLogImpl); StorelessUnivariateStatistic[] getGeoMeanImpl(); void setGeoMeanImpl(StorelessUnivariateStatistic[] geoMeanImpl); StorelessUnivariateStatistic[] getMeanImpl(); void setMeanImpl(StorelessUnivariateStatistic[] meanImpl);  }
@Test public void testDimension() { try { createMultivariateSummaryStatistics(2, true).addValue(new double[3]); Assert.fail("Expecting DimensionMismatchException"); } catch (DimensionMismatchException dme) { } }
@Test public void testSerialization() { MultivariateSummaryStatistics u = createMultivariateSummaryStatistics(2, true); TestUtils.checkSerializedEquality(u); MultivariateSummaryStatistics s = (MultivariateSummaryStatistics) TestUtils.serializeAndRecover(u); Assert.assertEquals(u, s); u.addValue(new double[] { 2d, 1d }); u.addValue(new double[] { 1d, 1d }); u.addValue(new double[] { 3d, 1d }); u.addValue(new double[] { 4d, 1d }); u.addValue(new double[] { 5d, 1d }); TestUtils.checkSerializedEquality(u); s = (MultivariateSummaryStatistics) TestUtils.serializeAndRecover(u); Assert.assertEquals(u, s); }