removed references to the StatisticalMultivariateSummaryValues class
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@620290 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
513804d9d4
commit
7953b0007a
|
@ -190,28 +190,12 @@ public class MultivariateSummaryStatisticsTest extends TestCase {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetSummary() throws DimensionMismatchException {
|
|
||||||
MultivariateSummaryStatistics u = new MultivariateSummaryStatistics(2, true);
|
|
||||||
StatisticalMultivariateSummary summary = u.getSummary();
|
|
||||||
verifySummary(u, summary);
|
|
||||||
u.addValue(new double[] { 1, 2 });
|
|
||||||
summary = u.getSummary();
|
|
||||||
verifySummary(u, summary);
|
|
||||||
u.addValue(new double[] { 2, 5 });
|
|
||||||
summary = u.getSummary();
|
|
||||||
verifySummary(u, summary);
|
|
||||||
u.addValue(new double[] { 2, 2 });
|
|
||||||
summary = u.getSummary();
|
|
||||||
verifySummary(u, summary);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testSerialization() throws DimensionMismatchException {
|
public void testSerialization() throws DimensionMismatchException {
|
||||||
MultivariateSummaryStatistics u = new MultivariateSummaryStatistics(2, true);
|
MultivariateSummaryStatistics u = new MultivariateSummaryStatistics(2, true);
|
||||||
// Empty test
|
// Empty test
|
||||||
TestUtils.checkSerializedEquality(u);
|
TestUtils.checkSerializedEquality(u);
|
||||||
MultivariateSummaryStatistics s = (MultivariateSummaryStatistics) TestUtils.serializeAndRecover(u);
|
MultivariateSummaryStatistics s = (MultivariateSummaryStatistics) TestUtils.serializeAndRecover(u);
|
||||||
StatisticalMultivariateSummary summary = s.getSummary();
|
assertEquals(u, s);
|
||||||
verifySummary(u, summary);
|
|
||||||
|
|
||||||
// Add some data
|
// Add some data
|
||||||
u.addValue(new double[] { 2d, 1d });
|
u.addValue(new double[] { 2d, 1d });
|
||||||
|
@ -223,8 +207,7 @@ public class MultivariateSummaryStatisticsTest extends TestCase {
|
||||||
// Test again
|
// Test again
|
||||||
TestUtils.checkSerializedEquality(u);
|
TestUtils.checkSerializedEquality(u);
|
||||||
s = (MultivariateSummaryStatistics) TestUtils.serializeAndRecover(u);
|
s = (MultivariateSummaryStatistics) TestUtils.serializeAndRecover(u);
|
||||||
summary = s.getSummary();
|
assertEquals(u, s);
|
||||||
verifySummary(u, summary);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -269,26 +252,4 @@ public class MultivariateSummaryStatisticsTest extends TestCase {
|
||||||
assertEquals(emptyHash, u.hashCode());
|
assertEquals(emptyHash, u.hashCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void verifySummary(MultivariateSummaryStatistics u, StatisticalMultivariateSummary s) {
|
|
||||||
assertEquals(s.getN(), u.getN());
|
|
||||||
for (int i = 0; i < u.getDimension(); ++i) {
|
|
||||||
checkValue(s.getSum()[i], u.getSum()[i], 1.0e-10);
|
|
||||||
checkValue(s.getStandardDeviation()[i], u.getStandardDeviation()[i], 1.0e-10);
|
|
||||||
checkValue(s.getMean()[i], u.getMean()[i], 1.0e-10);
|
|
||||||
checkValue(s.getMin()[i], u.getMin()[i], 1.0e-10);
|
|
||||||
checkValue(s.getMax()[i], u.getMax()[i], 1.0e-10);
|
|
||||||
checkValue(s.getSumSq()[i], u.getSumSq()[i], 1.0e-10);
|
|
||||||
checkValue(s.getSumLog()[i], u.getSumLog()[i], 1.0e-10);
|
|
||||||
checkValue(s.getMax()[i], u.getMax()[i], 1.0e-10);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void checkValue(double expected, double actual, double tolerance) {
|
|
||||||
if (Double.isNaN(expected)) {
|
|
||||||
assertTrue(Double.isNaN(actual));
|
|
||||||
} else {
|
|
||||||
assertEquals(expected, actual, tolerance);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue