List of usage examples for java.math BigInteger doubleValue
public double doubleValue()
From source file:com.github.jessemull.microflex.stat.statbiginteger.MeanBigIntegerTest.java
/** * Tests the plate statistics method.//from w w w . j a v a 2 s . c om */ @Test public void testPlate() { for (PlateBigInteger plate : array) { Map<WellBigInteger, BigDecimal> resultMap = new TreeMap<WellBigInteger, BigDecimal>(); Map<WellBigInteger, BigDecimal> returnedMap = mean.plate(plate, mc); 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.getMean(); BigDecimal result = new BigDecimal(resultDouble, mc); 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]); } } }
From source file:com.github.jessemull.microflexbiginteger.stat.MeanTest.java
/** * Tests the plate statistics method using the values between the indices. *//*from w ww.j a v a2 s . c om*/ @Test public void testPlateIndices() { for (Plate plate : arrayIndices) { int begin = random.nextInt(plate.first().size() - 4); int end = begin + random.nextInt(3) + 3; Map<Well, BigDecimal> resultMap = new TreeMap<Well, BigDecimal>(); Map<Well, BigDecimal> returnedMap = mean.plate(plate, begin, end - begin, mc); 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(ArrayUtils.subarray(input, begin, end)); double resultDouble = stat.getMean(); BigDecimal result = new BigDecimal(resultDouble, mc); 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.microflexbiginteger.stat.MeanTest.java
/** * Tests set calculation using indices./*from ww w . j a va2s. c o m*/ */ @Test public void testSetIndices() { for (Plate plate : arrayIndices) { int begin = random.nextInt(plate.first().size() - 4); int end = begin + random.nextInt(3) + 3; Map<Well, BigDecimal> resultMap = new TreeMap<Well, BigDecimal>(); Map<Well, BigDecimal> returnedMap = mean.set(plate.dataSet(), begin, end - begin, mc); 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(ArrayUtils.subarray(input, begin, end)); double resultDouble = stat.getMean(); BigDecimal result = new BigDecimal(resultDouble, mc); 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.statbiginteger.MeanBigIntegerTest.java
/** * Tests set calculation./*from w w w. ja v a 2 s. c o m*/ */ @Test public void testSet() { for (PlateBigInteger plate : array) { Map<WellBigInteger, BigDecimal> resultMap = new TreeMap<WellBigInteger, BigDecimal>(); Map<WellBigInteger, BigDecimal> returnedMap = mean.set(plate.dataSet(), mc); 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.getMean(); BigDecimal result = new BigDecimal(resultDouble, mc); 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]); } } }
From source file:com.github.jessemull.microflexbiginteger.stat.MeanTest.java
/** * Tests the aggregated plate statistics method. *//*from w w w.j a v a 2s. com*/ @Test public void testAggregatedPlate() { for (Plate plate : array) { List<BigDecimal> resultList = new ArrayList<BigDecimal>(); BigDecimal aggregatedReturned = mean.platesAggregated(plate, mc); 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.getMean(); BigDecimal result = new BigDecimal(resultDouble, mc); resultList.add(result); } 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.getMean(); BigDecimal aggregatedResult = new BigDecimal(resultAggregatedDouble, mc); BigDecimal[] corrected = correctRoundingErrors(aggregatedResult, aggregatedReturned); assertEquals(corrected[0], corrected[1]); } }
From source file:com.github.jessemull.microflexbiginteger.stat.MeanTest.java
/** * Tests the aggregated plate statistics method. *///from w w w . j a v a 2 s . c o m @Test public void testAggregatedSet() { for (Plate plate : array) { List<BigDecimal> resultList = new ArrayList<BigDecimal>(); BigDecimal aggregatedReturned = mean.setsAggregated(plate.dataSet(), mc); 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.getMean(); BigDecimal result = new BigDecimal(resultDouble, mc); resultList.add(result); } 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.getMean(); BigDecimal aggregatedResult = new BigDecimal(resultAggregatedDouble, mc); BigDecimal[] corrected = correctRoundingErrors(aggregatedResult, aggregatedReturned); assertEquals(corrected[0], corrected[1]); } }
From source file:com.github.jessemull.microflex.stat.statbiginteger.MeanBigIntegerTest.java
/** * Tests the plate statistics method using the values between the indices. *///from www. j a v a 2 s.c o m @Test public void testPlateIndices() { for (PlateBigInteger plate : arrayIndices) { int begin = random.nextInt(plate.first().size() - 4); int end = begin + random.nextInt(3) + 3; Map<WellBigInteger, BigDecimal> resultMap = new TreeMap<WellBigInteger, BigDecimal>(); Map<WellBigInteger, BigDecimal> returnedMap = mean.plate(plate, begin, end - begin, mc); 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(ArrayUtils.subarray(input, begin, end)); double resultDouble = stat.getMean(); BigDecimal result = new BigDecimal(resultDouble, mc); 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]); } } }
From source file:com.github.jessemull.microflex.stat.statbiginteger.MeanBigIntegerTest.java
/** * Tests set calculation using indices.// ww w.jav a 2s .c o m */ @Test public void testSetIndices() { for (PlateBigInteger plate : arrayIndices) { int begin = random.nextInt(plate.first().size() - 4); int end = begin + random.nextInt(3) + 3; Map<WellBigInteger, BigDecimal> resultMap = new TreeMap<WellBigInteger, BigDecimal>(); Map<WellBigInteger, BigDecimal> returnedMap = mean.set(plate.dataSet(), begin, end - begin, mc); 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(ArrayUtils.subarray(input, begin, end)); double resultDouble = stat.getMean(); BigDecimal result = new BigDecimal(resultDouble, mc); 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]); } } }
From source file:com.github.jessemull.microflex.stat.statbiginteger.MeanBigIntegerTest.java
/** * Tests the aggregated plate statistics method. */// w ww.j a v a 2s .c o m @Test public void testAggregatedPlate() { for (PlateBigInteger plate : array) { List<BigDecimal> resultList = new ArrayList<BigDecimal>(); BigDecimal aggregatedReturned = mean.platesAggregated(plate, mc); 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.getMean(); BigDecimal result = new BigDecimal(resultDouble, mc); resultList.add(result); } 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.getMean(); BigDecimal aggregatedResult = new BigDecimal(resultAggregatedDouble, mc); BigDecimal[] corrected = correctRoundingErrors(aggregatedResult, aggregatedReturned); assertEquals(corrected[0], corrected[1]); } }
From source file:com.github.jessemull.microflex.stat.statbiginteger.MeanBigIntegerTest.java
/** * Tests the aggregated plate statistics method. *//*from w w w .ja v a 2 s. c om*/ @Test public void testAggregatedSet() { for (PlateBigInteger plate : array) { List<BigDecimal> resultList = new ArrayList<BigDecimal>(); BigDecimal aggregatedReturned = mean.setsAggregated(plate.dataSet(), mc); 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.getMean(); BigDecimal result = new BigDecimal(resultDouble, mc); resultList.add(result); } 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.getMean(); BigDecimal aggregatedResult = new BigDecimal(resultAggregatedDouble, mc); BigDecimal[] corrected = correctRoundingErrors(aggregatedResult, aggregatedReturned); assertEquals(corrected[0], corrected[1]); } }