Example usage for org.apache.commons.math3.stat.descriptive DescriptiveStatistics getN

List of usage examples for org.apache.commons.math3.stat.descriptive DescriptiveStatistics getN

Introduction

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

Prototype

public long getN() 

Source Link

Document

Returns the number of available values

Usage

From source file:com.github.jessemull.microflex.stat.statbiginteger.NBigIntegerTest.java

/**
 * Tests the aggregated plate statistics method using an array.
 *//*from www  .j  av  a 2s  .  c  om*/
@Test
public void testAggregatedPlateArray() {

    Map<PlateBigInteger, Integer> aggregatedReturnedMap = n.platesAggregated(array);
    Map<PlateBigInteger, Integer> aggregatedResultMap = new TreeMap<PlateBigInteger, Integer>();

    for (PlateBigInteger plate : array) {

        List<Double> resultList = new ArrayList<Double>();

        for (WellBigInteger well : plate) {

            for (BigInteger bi : well) {
                resultList.add(bi.doubleValue());
            }

        }

        double[] inputAggregated = new double[resultList.size()];

        for (int i = 0; i < resultList.size(); i++) {
            inputAggregated[i] = resultList.get(i);
        }

        DescriptiveStatistics statAggregated = new DescriptiveStatistics(inputAggregated);
        double resultAggregated = statAggregated.getN();

        aggregatedResultMap.put(plate, (int) resultAggregated);
    }

    for (PlateBigInteger plate : array) {

        int result = aggregatedResultMap.get(plate);
        int returned = aggregatedReturnedMap.get(plate);

        assertEquals(result, returned);
    }

}

From source file:com.github.jessemull.microflexbigdecimal.stat.NTest.java

/**
 * Tests the aggregated plate statistics method using a collection.
 *//* w w w .j av a 2  s.  c  o m*/
@Test
public void testAggregatedPlateCollection() {

    List<Plate> collection = Arrays.asList(array);
    Map<Plate, Integer> aggregatedReturnedMap = n.platesAggregated(collection);
    Map<Plate, Integer> aggregatedResultMap = new TreeMap<Plate, Integer>();

    for (Plate plate : collection) {

        List<Double> resultList = new ArrayList<Double>();

        for (Well well : plate) {

            for (BigDecimal bd : well) {
                resultList.add(bd.doubleValue());
            }

        }

        double[] inputAggregated = new double[resultList.size()];

        for (int i = 0; i < resultList.size(); i++) {
            inputAggregated[i] = resultList.get(i);
        }

        DescriptiveStatistics statAggregated = new DescriptiveStatistics(inputAggregated);
        double resultAggregated = statAggregated.getN();

        aggregatedResultMap.put(plate, (int) resultAggregated);
    }

    for (Plate plate : collection) {

        int result = aggregatedResultMap.get(plate);
        int returned = aggregatedReturnedMap.get(plate);

        assertEquals(result, returned);
    }
}

From source file:com.github.jessemull.microflexbigdecimal.stat.NTest.java

/**
 * Tests the aggregated plate statistics method using an array.
 *//*from  w  ww.  j  a  v  a 2 s.  c  o m*/
@Test
public void testAggregatedPlateArray() {

    Map<Plate, Integer> aggregatedReturnedMap = n.platesAggregated(array);
    Map<Plate, Integer> aggregatedResultMap = new TreeMap<Plate, Integer>();

    for (Plate plate : array) {

        List<Double> resultList = new ArrayList<Double>();

        for (Well well : plate) {

            for (BigDecimal bd : well) {
                resultList.add(bd.doubleValue());
            }

        }

        double[] inputAggregated = new double[resultList.size()];

        for (int i = 0; i < resultList.size(); i++) {
            inputAggregated[i] = resultList.get(i);
        }

        DescriptiveStatistics statAggregated = new DescriptiveStatistics(inputAggregated);
        double resultAggregated = statAggregated.getN();

        aggregatedResultMap.put(plate, (int) resultAggregated);
    }

    for (Plate plate : array) {

        int result = aggregatedResultMap.get(plate);
        int returned = aggregatedReturnedMap.get(plate);

        assertEquals(result, returned);
    }

}

From source file:com.github.jessemull.microflexbiginteger.stat.NTest.java

/**
 * Tests the aggregated plate statistics method using a collection.
 *//* w  w  w  . j  a  va  2s.c om*/
@Test
public void testAggregatedPlateCollection() {

    List<Plate> collection = Arrays.asList(array);
    Map<Plate, Integer> aggregatedReturnedMap = n.platesAggregated(collection);
    Map<Plate, Integer> aggregatedResultMap = new TreeMap<Plate, Integer>();

    for (Plate plate : collection) {

        List<Double> resultList = new ArrayList<Double>();

        for (Well well : plate) {

            for (BigInteger bi : well) {
                resultList.add(bi.doubleValue());
            }

        }

        double[] inputAggregated = new double[resultList.size()];

        for (int i = 0; i < resultList.size(); i++) {
            inputAggregated[i] = resultList.get(i);
        }

        DescriptiveStatistics statAggregated = new DescriptiveStatistics(inputAggregated);
        double resultAggregated = statAggregated.getN();

        aggregatedResultMap.put(plate, (int) resultAggregated);
    }

    for (Plate plate : collection) {

        int result = aggregatedResultMap.get(plate);
        int returned = aggregatedReturnedMap.get(plate);

        assertEquals(result, returned);
    }
}

From source file:com.github.jessemull.microflexbiginteger.stat.NTest.java

/**
 * Tests the aggregated plate statistics method using an array.
 *//*from ww w .  java 2 s.c om*/
@Test
public void testAggregatedPlateArray() {

    Map<Plate, Integer> aggregatedReturnedMap = n.platesAggregated(array);
    Map<Plate, Integer> aggregatedResultMap = new TreeMap<Plate, Integer>();

    for (Plate plate : array) {

        List<Double> resultList = new ArrayList<Double>();

        for (Well well : plate) {

            for (BigInteger bi : well) {
                resultList.add(bi.doubleValue());
            }

        }

        double[] inputAggregated = new double[resultList.size()];

        for (int i = 0; i < resultList.size(); i++) {
            inputAggregated[i] = resultList.get(i);
        }

        DescriptiveStatistics statAggregated = new DescriptiveStatistics(inputAggregated);
        double resultAggregated = statAggregated.getN();

        aggregatedResultMap.put(plate, (int) resultAggregated);
    }

    for (Plate plate : array) {

        int result = aggregatedResultMap.get(plate);
        int returned = aggregatedReturnedMap.get(plate);

        assertEquals(result, returned);
    }

}

From source file:com.github.jessemull.microflex.stat.statinteger.NIntegerTest.java

/**
 * Tests the aggregated plate statistics method using a collection.
 *//*from w w w. j  a v  a2 s  .c  om*/
@Test
public void testAggregatedSetCollection() {

    List<WellSetInteger> collection = new ArrayList<WellSetInteger>();

    for (PlateInteger plate : array) {
        collection.add(plate.dataSet());
    }

    Map<WellSetInteger, Integer> aggregatedReturnedMap = n.setsAggregated(collection);
    Map<WellSetInteger, Integer> aggregatedResultMap = new TreeMap<WellSetInteger, Integer>();

    for (WellSetInteger set : collection) {

        List<Double> resultList = new ArrayList<Double>();

        for (WellInteger well : set) {

            for (double db : well) {
                resultList.add(db);
            }

        }

        double[] inputAggregated = new double[resultList.size()];

        for (int i = 0; i < resultList.size(); i++) {
            inputAggregated[i] = resultList.get(i);
        }

        DescriptiveStatistics statAggregated = new DescriptiveStatistics(inputAggregated);
        double resultAggregated = statAggregated.getN();

        aggregatedResultMap.put(set, (int) resultAggregated);
    }

    for (WellSetInteger set : collection) {

        int result = aggregatedResultMap.get(set);
        int returned = aggregatedReturnedMap.get(set);

        assertEquals(result, returned);
    }
}

From source file:com.github.jessemull.microflexdouble.stat.NTest.java

/**
 * Tests the aggregated plate statistics method using a collection.
 *//*  w  w  w . j  av  a2  s .com*/
@Test
public void testAggregatedSetCollection() {

    List<WellSet> collection = new ArrayList<WellSet>();

    for (Plate plate : array) {
        collection.add(plate.dataSet());
    }

    Map<WellSet, Integer> aggregatedReturnedMap = n.setsAggregated(collection);
    Map<WellSet, Integer> aggregatedResultMap = new TreeMap<WellSet, Integer>();

    for (WellSet set : collection) {

        List<Double> resultList = new ArrayList<Double>();

        for (Well well : set) {

            for (double db : well) {
                resultList.add(db);
            }

        }

        double[] inputAggregated = new double[resultList.size()];

        for (int i = 0; i < resultList.size(); i++) {
            inputAggregated[i] = resultList.get(i);
        }

        DescriptiveStatistics statAggregated = new DescriptiveStatistics(inputAggregated);
        double resultAggregated = statAggregated.getN();

        aggregatedResultMap.put(set, (int) resultAggregated);
    }

    for (WellSet set : collection) {

        int result = aggregatedResultMap.get(set);
        int returned = aggregatedReturnedMap.get(set);

        assertEquals(result, returned);
    }
}

From source file:com.github.jessemull.microflex.stat.statdouble.NDoubleTest.java

/**
 * Tests the aggregated plate statistics method using a collection.
 *//*  www  . ja v  a2s. c o m*/
@Test
public void testAggregatedSetCollection() {

    List<WellSetDouble> collection = new ArrayList<WellSetDouble>();

    for (PlateDouble plate : array) {
        collection.add(plate.dataSet());
    }

    Map<WellSetDouble, Integer> aggregatedReturnedMap = n.setsAggregated(collection);
    Map<WellSetDouble, Integer> aggregatedResultMap = new TreeMap<WellSetDouble, Integer>();

    for (WellSetDouble set : collection) {

        List<Double> resultList = new ArrayList<Double>();

        for (WellDouble well : set) {

            for (double db : well) {
                resultList.add(db);
            }

        }

        double[] inputAggregated = new double[resultList.size()];

        for (int i = 0; i < resultList.size(); i++) {
            inputAggregated[i] = resultList.get(i);
        }

        DescriptiveStatistics statAggregated = new DescriptiveStatistics(inputAggregated);
        double resultAggregated = statAggregated.getN();

        aggregatedResultMap.put(set, (int) resultAggregated);
    }

    for (WellSetDouble set : collection) {

        int result = aggregatedResultMap.get(set);
        int returned = aggregatedReturnedMap.get(set);

        assertEquals(result, returned);
    }
}

From source file:com.github.jessemull.microflex.stat.statinteger.NIntegerTest.java

/**
 * Tests the aggregated plate statistics method using an array.
 *///from  w  w  w .  j  a  v a  2 s .  co m
@Test
public void testAggregatedSetArray() {

    WellSetInteger[] setArray = new WellSetInteger[array.length];

    for (int i = 0; i < setArray.length; i++) {
        setArray[i] = array[i].dataSet();
    }

    Map<WellSetInteger, Integer> aggregatedReturnedMap = n.setsAggregated(setArray);
    Map<WellSetInteger, Integer> aggregatedResultMap = new TreeMap<WellSetInteger, Integer>();

    for (WellSetInteger set : setArray) {

        List<Double> resultList = new ArrayList<Double>();

        for (WellInteger well : set) {

            for (double db : well) {
                resultList.add(db);
            }

        }

        double[] inputAggregated = new double[resultList.size()];

        for (int i = 0; i < resultList.size(); i++) {
            inputAggregated[i] = resultList.get(i);
        }

        DescriptiveStatistics statAggregated = new DescriptiveStatistics(inputAggregated);
        double resultAggregated = statAggregated.getN();

        aggregatedResultMap.put(set, (int) resultAggregated);
    }

    for (WellSetInteger set : setArray) {

        int result = aggregatedResultMap.get(set);
        int returned = aggregatedReturnedMap.get(set);

        assertEquals(result, returned);
    }

}

From source file:com.github.jessemull.microflexdouble.stat.NTest.java

/**
 * Tests the aggregated plate statistics method using an array.
 *//*from  ww w . j a v a2s  .co  m*/
@Test
public void testAggregatedSetArray() {

    WellSet[] setArray = new WellSet[array.length];

    for (int i = 0; i < setArray.length; i++) {
        setArray[i] = array[i].dataSet();
    }

    Map<WellSet, Integer> aggregatedReturnedMap = n.setsAggregated(setArray);
    Map<WellSet, Integer> aggregatedResultMap = new TreeMap<WellSet, Integer>();

    for (WellSet set : setArray) {

        List<Double> resultList = new ArrayList<Double>();

        for (Well well : set) {

            for (double db : well) {
                resultList.add(db);
            }

        }

        double[] inputAggregated = new double[resultList.size()];

        for (int i = 0; i < resultList.size(); i++) {
            inputAggregated[i] = resultList.get(i);
        }

        DescriptiveStatistics statAggregated = new DescriptiveStatistics(inputAggregated);
        double resultAggregated = statAggregated.getN();

        aggregatedResultMap.put(set, (int) resultAggregated);
    }

    for (WellSet set : setArray) {

        int result = aggregatedResultMap.get(set);
        int returned = aggregatedReturnedMap.get(set);

        assertEquals(result, returned);
    }

}