use of org.apache.commons.math3.stat.descriptive.moment.SecondMoment in project uPortal by Jasig.
the class JpaStatisticalSummaryTest method testSummaryStatisticsJson.
// @Test
// public void testJpaStatisticalSummary() {
// final long id = this.executeInTransaction(new Callable<Long>() {
// @Override
// public Long call() throws Exception {
// final JpaStatisticalSummary jpaStatisticalSummary = new
// JpaStatisticalSummary();
//
// final Random r = new Random(0);
// for (int i = 0; i < 10; i++) {
// final int nextInt = r.nextInt(100000000);
// jpaStatisticalSummary.addValue(nextInt);
// }
//
// getEntityManager().persist(jpaStatisticalSummary);
//
// System.out.println(jpaStatisticalSummary);
//
// return jpaStatisticalSummary.getStatSummaryId();
// }
// });
//
// System.out.println(id);
//
// this.executeInTransaction(new CallableWithoutResult() {
// @Override
// protected void callWithoutResult() {
// final JpaStatisticalSummary jpaStatisticalSummary =
// getEntityManager().find(JpaStatisticalSummary.class, id);
//
// System.out.println(jpaStatisticalSummary);
// }
// });
// }
@Ignore
@Test
public void testSummaryStatisticsJson() throws Exception {
final SecondMoment secondMoment = new SecondMoment();
final Sum sum = new Sum();
final SumOfSquares sumsq = new SumOfSquares();
final Min min = new Min();
final Max max = new Max();
final SumOfLogs sumLog = new SumOfLogs();
final Random r = new Random(0);
for (int i = 0; i < 10; i++) {
final int nextInt = r.nextInt(100000000);
secondMoment.increment(nextInt);
sum.increment(nextInt);
sumsq.increment(nextInt);
min.increment(nextInt);
max.increment(nextInt);
sumLog.increment(nextInt);
}
testStorelessUnivariateStatistic(secondMoment, 7.513432791665536E15);
testStorelessUnivariateStatistic(sum, 6.01312177E8);
testStorelessUnivariateStatistic(sumsq, 4.3671066212513456E16);
testStorelessUnivariateStatistic(min, 2116447.0);
testStorelessUnivariateStatistic(max, 8.5505948E7);
testStorelessUnivariateStatistic(sumLog, 175.91713800250577);
}
Aggregations