List of usage examples for java.math BigInteger doubleValue
public double doubleValue()
From source file:com.github.jessemull.microflex.stat.statbiginteger.MinBigIntegerTest.java
/** * Tests the plate statistics method./*from www. j av a2 s. 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]); } } }
From source file:com.github.jessemull.microflex.stat.statbiginteger.SkewnessBigIntegerTest.java
/** * Tests the plate statistics method.//from w w w. j av a 2 s . co m */ @Test public void testPlate() { for (PlateBigInteger plate : array) { Map<WellBigInteger, BigDecimal> resultMap = new TreeMap<WellBigInteger, BigDecimal>(); Map<WellBigInteger, BigDecimal> returnedMap = skewness.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.getSkewness(); 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]); } } }
From source file:com.github.jessemull.microflex.stat.statbiginteger.StandardDeviationBigIntegerTest.java
/** * Tests set calculation.//from w w w . j a va2 s . com */ @Test public void testSet() { for (PlateBigInteger plate : array) { Map<WellBigInteger, BigDecimal> resultMap = new TreeMap<WellBigInteger, BigDecimal>(); Map<WellBigInteger, BigDecimal> returnedMap = deviation.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.getStandardDeviation(); 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]); } } }
From source file:com.github.jessemull.microflex.stat.statbiginteger.SumBigIntegerTest.java
/** * Tests the plate statistics method./* w w w . j a va2 s . c o m*/ */ @Test public void testPlate() { for (PlateBigInteger plate : array) { Map<WellBigInteger, BigDecimal> resultMap = new TreeMap<WellBigInteger, BigDecimal>(); Map<WellBigInteger, BigDecimal> returnedMap = sum.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.getSum(); 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]); } } }
From source file:com.github.jessemull.microflexbiginteger.stat.KurtosisTest.java
/** * Tests set calculation.//w w w. j a va 2 s .c o m */ @Test public void testSet() { for (Plate plate : array) { Map<Well, BigDecimal> resultMap = new TreeMap<Well, BigDecimal>(); Map<Well, BigDecimal> returnedMap = kurtosis.set(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.getKurtosis(); 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.microflexbiginteger.stat.SkewnessTest.java
/** * Tests set calculation./*from w w w.ja v a 2 s .c om*/ */ @Test public void testSet() { for (Plate plate : array) { Map<Well, BigDecimal> resultMap = new TreeMap<Well, BigDecimal>(); Map<Well, BigDecimal> returnedMap = skewness.set(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.getSkewness(); 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.microflexbiginteger.stat.SumTest.java
/** * Tests the plate statistics method using the values between the indices. *///from ww w.ja va2 s. c om @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 = sum.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.getSum(); 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.microflexbiginteger.stat.SumTest.java
/** * Tests set calculation using indices.//w w w . j ava 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 = sum.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.getSum(); 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.statbiginteger.KurtosisBigIntegerTest.java
/** * Tests set calculation.// w ww . 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 = kurtosis.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.getKurtosis(); 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]); } } }
From source file:com.github.jessemull.microflex.stat.statbiginteger.MaxBigIntegerTest.java
/** * Tests set calculation.//w w w .ja v a 2 s . c om */ @Test public void testSet() { for (PlateBigInteger plate : array) { Map<WellBigInteger, BigDecimal> resultMap = new TreeMap<WellBigInteger, BigDecimal>(); Map<WellBigInteger, BigDecimal> returnedMap = max.set(plate.dataSet()); 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.getMax(); 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]); } } }