Example usage for org.apache.commons.math3.stat.descriptive StatisticalSummary getSum

List of usage examples for org.apache.commons.math3.stat.descriptive StatisticalSummary getSum

Introduction

In this page you can find the example usage for org.apache.commons.math3.stat.descriptive StatisticalSummary getSum.

Prototype

double getSum();

Source Link

Document

Returns the sum of the values that have been added to Univariate.

Usage

From source file:com.isentropy.accumulo.test.AccumuloMapTest.java

public void testMultiMap(Connector c, int maxValues)
        throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
    AccumuloSortedMap<Number, Number> mm = new AccumuloSortedMap(c, Util.randomHexString(10));
    mm.setMaxValuesPerKey(maxValues);// w w  w . ja v  a2s.co  m
    assertTrue(mm.getMaxValuesPerKey() == maxValues);
    System.out.println("mm.getMultiMapMaxValues() == " + mm.getMaxValuesPerKey());
    mm.put(1, 2);
    mm.put(1, 3);
    mm.put(1, 4);
    mm.put(2, 22);
    StatisticalSummary row1 = mm.rowStats().get(1);
    assertTrue(row1.getMean() == 3.0);
    assertTrue(row1.getMax() == 4.0);
    // size should reflect # keys
    assertTrue(mm.size() == 2);
    // count multiple values
    assertTrue(mm.sizeAsLong(true) == 4);
    //4 +22
    assertTrue(mm.valueStats().getSum() == 26);
    //2+3+4+22
    StatisticalSummary stats = mm.valueStats(true);
    double sum = stats.getSum();
    assertTrue(mm.valueStats(true).getSum() == 31);

}