List of usage examples for org.apache.commons.math3.stat.descriptive DescriptiveStatistics getMin
public double getMin()
From source file:com.github.jessemull.microflexbiginteger.stat.MinTest.java
/** * Tests set calculation.//w w w . j a v a 2 s . com */ @Test public void testSet() { for (Plate plate : array) { Map<Well, BigDecimal> resultMap = new TreeMap<Well, BigDecimal>(); Map<Well, BigDecimal> returnedMap = min.set(plate.dataSet()); for (Well well : plate) { double[] input = new double[well.size()]; int index = 0; for (BigInteger bi : well) { input[index++] = bi.doubleValue(); } DescriptiveStatistics stat = new DescriptiveStatistics(input); double resultDouble = stat.getMin(); BigDecimal result = new BigDecimal(resultDouble); resultMap.put(well, result); } for (Well well : plate) { BigDecimal result = resultMap.get(well); BigDecimal returned = returnedMap.get(well); BigDecimal[] corrected = correctRoundingErrors(result, returned); assertEquals(corrected[0], corrected[1]); } } }
From source file:com.github.jessemull.microflex.stat.statbigdecimal.MinBigDecimalTest.java
/** * Tests the aggregated plate statistics method using the values between the indices of * the array.//from www .ja v a2 s. c om */ @Test public void testAggregatedPlateArrayIndices() { int size = arrayIndices[0].first().size(); int begin = random.nextInt(size - 5); int end = (begin + 4) + random.nextInt(size - (begin + 4) + 1); Map<PlateBigDecimal, BigDecimal> aggregatedReturnedMap = min.platesAggregated(arrayIndices, begin, end - begin); Map<PlateBigDecimal, BigDecimal> aggregatedResultMap = new TreeMap<PlateBigDecimal, BigDecimal>(); for (PlateBigDecimal plate : arrayIndices) { List<BigDecimal> resultList = new ArrayList<BigDecimal>(); for (WellBigDecimal well : plate) { resultList.addAll(well.data().subList(begin, end)); } double[] inputAggregated = new double[resultList.size()]; for (int i = 0; i < resultList.size(); i++) { inputAggregated[i] = resultList.get(i).doubleValue(); } DescriptiveStatistics statAggregated = new DescriptiveStatistics(inputAggregated); double resultAggregatedDouble = statAggregated.getMin(); BigDecimal aggregatedResult = new BigDecimal(resultAggregatedDouble); aggregatedResultMap.put(plate, aggregatedResult); } for (PlateBigDecimal plate : arrayIndices) { BigDecimal result = aggregatedResultMap.get(plate); BigDecimal returned = aggregatedReturnedMap.get(plate); BigDecimal[] corrected = correctRoundingErrors(result, returned); assertEquals(corrected[0], corrected[1]); } }
From source file:com.github.jessemull.microflexbigdecimal.stat.MinTest.java
/** * Tests the aggregated plate statistics method using the values between the indices of * the collection.//from w ww . jav a 2s . co m */ @Test public void testAggregatedSetCollectionIndices() { int size = arrayIndices[0].first().size(); int begin = random.nextInt(size - 5); int end = (begin + 4) + random.nextInt(size - (begin + 4) + 1); List<WellSet> collection = new ArrayList<WellSet>(); for (Plate plate : arrayIndices) { collection.add(plate.dataSet()); } Map<WellSet, BigDecimal> aggregatedReturnedMap = min.setsAggregated(collection, begin, end - begin); Map<WellSet, BigDecimal> aggregatedResultMap = new TreeMap<WellSet, BigDecimal>(); for (WellSet set : collection) { List<BigDecimal> resultList = new ArrayList<BigDecimal>(); for (Well well : set) { resultList.addAll(well.data().subList(begin, end)); } double[] inputAggregated = new double[resultList.size()]; for (int i = 0; i < resultList.size(); i++) { inputAggregated[i] = resultList.get(i).doubleValue(); } DescriptiveStatistics statAggregated = new DescriptiveStatistics(inputAggregated); double resultAggregatedDouble = statAggregated.getMin(); BigDecimal aggregatedResult = new BigDecimal(resultAggregatedDouble); aggregatedResultMap.put(set, aggregatedResult); } for (WellSet set : collection) { BigDecimal result = aggregatedResultMap.get(set); BigDecimal returned = aggregatedReturnedMap.get(set); BigDecimal[] corrected = correctRoundingErrors(result, returned); assertEquals(corrected[0], corrected[1]); } }
From source file:com.github.jessemull.microflex.stat.statbigdecimal.MinBigDecimalTest.java
/** * Tests the aggregated plate statistics method using a collection. *//*from w w w .j a v a2s. c o m*/ @Test public void testAggregatedSetCollection() { List<WellSetBigDecimal> collection = new ArrayList<WellSetBigDecimal>(); for (PlateBigDecimal plate : array) { collection.add(plate.dataSet()); } Map<WellSetBigDecimal, BigDecimal> aggregatedReturnedMap = min.setsAggregated(collection); Map<WellSetBigDecimal, BigDecimal> aggregatedResultMap = new TreeMap<WellSetBigDecimal, BigDecimal>(); for (WellSetBigDecimal set : collection) { List<BigDecimal> resultList = new ArrayList<BigDecimal>(); for (WellBigDecimal well : set) { resultList.addAll(well.data()); } double[] inputAggregated = new double[resultList.size()]; for (int i = 0; i < resultList.size(); i++) { inputAggregated[i] = resultList.get(i).doubleValue(); } DescriptiveStatistics statAggregated = new DescriptiveStatistics(inputAggregated); double resultAggregatedDouble = statAggregated.getMin(); BigDecimal aggregatedResult = new BigDecimal(resultAggregatedDouble); aggregatedResultMap.put(set, aggregatedResult); } for (WellSetBigDecimal set : collection) { BigDecimal result = aggregatedResultMap.get(set); BigDecimal returned = aggregatedReturnedMap.get(set); BigDecimal[] corrected = correctRoundingErrors(result, returned); assertEquals(corrected[0], corrected[1]); } }
From source file:com.github.jessemull.microflexbigdecimal.stat.MinTest.java
/** * Tests the plate statistics method using the values between the indices. *///from w ww. j a v a2s.c o m @Test public void testPlateIndices() { for (Plate plate : arrayIndices) { int size = arrayIndices[0].first().size(); int begin = random.nextInt(size - 5); int end = (begin + 4) + random.nextInt(size - (begin + 4) + 1); Map<Well, BigDecimal> resultMap = new TreeMap<Well, BigDecimal>(); Map<Well, BigDecimal> returnedMap = min.plate(plate, begin, end - begin); for (Well well : plate) { double[] input = new double[well.size()]; int index = 0; for (BigDecimal bd : well) { input[index++] = bd.doubleValue(); } DescriptiveStatistics stat = new DescriptiveStatistics(ArrayUtils.subarray(input, begin, end)); double resultDouble = stat.getMin(); BigDecimal result = new BigDecimal(resultDouble); resultMap.put(well, result); } for (Well well : plate) { BigDecimal result = resultMap.get(well); BigDecimal returned = returnedMap.get(well); BigDecimal[] corrected = correctRoundingErrors(result, returned); assertEquals(corrected[0], corrected[1]); } } }
From source file:com.github.jessemull.microflexbigdecimal.stat.MinTest.java
/** * Tests set calculation using indices./*from w ww . j a v a 2 s.com*/ */ @Test public void testSetIndices() { for (Plate plate : arrayIndices) { int size = arrayIndices[0].first().size(); int begin = random.nextInt(size - 5); int end = (begin + 4) + random.nextInt(size - (begin + 4) + 1); Map<Well, BigDecimal> resultMap = new TreeMap<Well, BigDecimal>(); Map<Well, BigDecimal> returnedMap = min.set(plate.dataSet(), begin, end - begin); for (Well well : plate) { double[] input = new double[well.size()]; int index = 0; for (BigDecimal bd : well) { input[index++] = bd.doubleValue(); } DescriptiveStatistics stat = new DescriptiveStatistics(ArrayUtils.subarray(input, begin, end)); double resultDouble = stat.getMin(); BigDecimal result = new BigDecimal(resultDouble); resultMap.put(well, result); } for (Well well : plate) { BigDecimal result = resultMap.get(well); BigDecimal returned = returnedMap.get(well); BigDecimal[] corrected = correctRoundingErrors(result, returned); assertEquals(corrected[0], corrected[1]); } } }
From source file:com.github.jessemull.microflexbigdecimal.stat.MinTest.java
/** * Tests the aggregated plate statistics method using the values between the indices of * the array./*from w ww . j av a2 s. c o m*/ */ @Test public void testAggregatedSetArrayIndices() { int size = arrayIndices[0].first().size(); int begin = random.nextInt(size - 5); int end = (begin + 4) + random.nextInt(size - (begin + 4) + 1); WellSet[] setArrayIndices = new WellSet[arrayIndices.length]; for (int i = 0; i < setArrayIndices.length; i++) { setArrayIndices[i] = arrayIndices[i].dataSet(); } Map<WellSet, BigDecimal> aggregatedReturnedMap = min.setsAggregated(setArrayIndices, begin, end - begin); Map<WellSet, BigDecimal> aggregatedResultMap = new TreeMap<WellSet, BigDecimal>(); for (WellSet set : setArrayIndices) { List<BigDecimal> resultList = new ArrayList<BigDecimal>(); for (Well well : set) { resultList.addAll(well.data().subList(begin, end)); } double[] inputAggregated = new double[resultList.size()]; for (int i = 0; i < resultList.size(); i++) { inputAggregated[i] = resultList.get(i).doubleValue(); } DescriptiveStatistics statAggregated = new DescriptiveStatistics(inputAggregated); double resultAggregatedDouble = statAggregated.getMin(); BigDecimal aggregatedResult = new BigDecimal(resultAggregatedDouble); aggregatedResultMap.put(set, aggregatedResult); } for (WellSet plate : setArrayIndices) { BigDecimal result = aggregatedResultMap.get(plate); BigDecimal returned = aggregatedReturnedMap.get(plate); BigDecimal[] corrected = correctRoundingErrors(result, returned); assertEquals(corrected[0], corrected[1]); } }
From source file:com.github.jessemull.microflex.stat.statbigdecimal.MinBigDecimalTest.java
/** * Tests the aggregated plate statistics method using the values between the indices of * the collection.//w w w. ja va 2 s .c o m */ @Test public void testAggregatedPlateCollectionIndices() { List<PlateBigDecimal> collection = Arrays.asList(arrayIndices); int size = arrayIndices[0].first().size(); int begin = random.nextInt(size - 5); int end = (begin + 4) + random.nextInt(size - (begin + 4) + 1); Map<PlateBigDecimal, BigDecimal> aggregatedReturnedMap = min.platesAggregated(arrayIndices, begin, end - begin); Map<PlateBigDecimal, BigDecimal> aggregatedResultMap = new TreeMap<PlateBigDecimal, BigDecimal>(); for (PlateBigDecimal plate : collection) { List<BigDecimal> resultList = new ArrayList<BigDecimal>(); for (WellBigDecimal well : plate) { resultList.addAll(well.data().subList(begin, end)); } double[] inputAggregated = new double[resultList.size()]; for (int i = 0; i < resultList.size(); i++) { inputAggregated[i] = resultList.get(i).doubleValue(); } DescriptiveStatistics statAggregated = new DescriptiveStatistics(inputAggregated); double resultAggregatedDouble = statAggregated.getMin(); BigDecimal aggregatedResult = new BigDecimal(resultAggregatedDouble); aggregatedResultMap.put(plate, aggregatedResult); } for (PlateBigDecimal plate : arrayIndices) { BigDecimal result = aggregatedResultMap.get(plate); BigDecimal returned = aggregatedReturnedMap.get(plate); BigDecimal[] corrected = correctRoundingErrors(result, returned); assertEquals(corrected[0], corrected[1]); } }
From source file:com.github.jessemull.microflex.stat.statbigdecimal.MinBigDecimalTest.java
/** * Tests the aggregated plate statistics method using an array. */// www .j ava 2 s. com @Test public void testAggregatedSetArray() { WellSetBigDecimal[] setArray = new WellSetBigDecimal[array.length]; for (int i = 0; i < setArray.length; i++) { setArray[i] = array[i].dataSet(); } Map<WellSetBigDecimal, BigDecimal> aggregatedReturnedMap = min.setsAggregated(setArray); Map<WellSetBigDecimal, BigDecimal> aggregatedResultMap = new TreeMap<WellSetBigDecimal, BigDecimal>(); for (WellSetBigDecimal set : setArray) { List<BigDecimal> resultList = new ArrayList<BigDecimal>(); for (WellBigDecimal well : set) { resultList.addAll(well.data()); } double[] inputAggregated = new double[resultList.size()]; for (int i = 0; i < resultList.size(); i++) { inputAggregated[i] = resultList.get(i).doubleValue(); } DescriptiveStatistics statAggregated = new DescriptiveStatistics(inputAggregated); double resultAggregatedDouble = statAggregated.getMin(); BigDecimal aggregatedResult = new BigDecimal(resultAggregatedDouble); aggregatedResultMap.put(set, aggregatedResult); } for (WellSetBigDecimal set : setArray) { BigDecimal result = aggregatedResultMap.get(set); BigDecimal returned = aggregatedReturnedMap.get(set); BigDecimal[] corrected = correctRoundingErrors(result, returned); assertEquals(corrected[0], corrected[1]); } }
From source file:com.github.jessemull.microflex.stat.statbiginteger.MinBigIntegerTest.java
/** * Tests the plate statistics method./* w w w . jav a 2s.co m*/ */ @Test public void testPlate() { for (PlateBigInteger plate : array) { Map<WellBigInteger, BigDecimal> resultMap = new TreeMap<WellBigInteger, BigDecimal>(); Map<WellBigInteger, BigDecimal> returnedMap = min.plate(plate); for (WellBigInteger well : plate) { double[] input = new double[well.size()]; int index = 0; for (BigInteger bi : well) { input[index++] = bi.doubleValue(); } DescriptiveStatistics stat = new DescriptiveStatistics(input); double resultDouble = stat.getMin(); BigDecimal result = new BigDecimal(resultDouble); resultMap.put(well, result); } for (WellBigInteger well : plate) { BigDecimal result = resultMap.get(well); BigDecimal returned = returnedMap.get(well); BigDecimal[] corrected = correctRoundingErrors(result, returned); assertEquals(corrected[0], corrected[1]); } } }