List of usage examples for java.math BigInteger doubleValue
public double doubleValue()
From source file:com.github.jessemull.microflex.stat.statbiginteger.SampleVarianceBigIntegerWeightsTest.java
/** * Tests the plate statistics method.//from ww 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 = variance.plate(plate, weights, mc); for (WellBigInteger well : plate) { double[] input = new double[well.size()]; int index = 0; for (BigInteger bi : well) { input[index] = bi.doubleValue() * weights[index]; index++; } DescriptiveStatistics stat = new DescriptiveStatistics(input); double resultDouble = stat.getVariance(); 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.SampleVarianceWeightsTest.java
/** * Tests the plate statistics method.//w ww .j a va 2s. c o m */ @Test public void testPlate() { for (Plate plate : array) { Map<Well, BigDecimal> resultMap = new TreeMap<Well, BigDecimal>(); Map<Well, BigDecimal> returnedMap = variance.plate(plate, weights, mc); for (Well well : plate) { double[] input = new double[well.size()]; int index = 0; for (BigInteger bi : well) { input[index] = bi.doubleValue() * weights[index]; index++; } DescriptiveStatistics stat = new DescriptiveStatistics(input); double resultDouble = stat.getVariance(); 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.MeanBigIntegerWeightsTest.java
/** * Tests the plate statistics method.// ww w . j a va 2 s. c o m */ @Test public void testPlate() { for (PlateBigInteger plate : array) { Map<WellBigInteger, BigDecimal> resultMap = new TreeMap<WellBigInteger, BigDecimal>(); Map<WellBigInteger, BigDecimal> returnedMap = mean.plate(plate, weights, mc); for (WellBigInteger well : plate) { double[] input = new double[well.size()]; int index = 0; for (BigInteger bi : well) { input[index] = bi.doubleValue() * weights[index]; index++; } 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.microflex.stat.statbiginteger.SumBigIntegerWeightsTest.java
/** * Tests the plate statistics method.//w w w . j a v a2s . c om */ @Test public void testPlate() { for (PlateBigInteger plate : array) { Map<WellBigInteger, BigDecimal> resultMap = new TreeMap<WellBigInteger, BigDecimal>(); Map<WellBigInteger, BigDecimal> returnedMap = sum.plate(plate, weights, mc); for (WellBigInteger well : plate) { double[] input = new double[well.size()]; int index = 0; for (BigInteger bi : well) { input[index] = bi.doubleValue() * weights[index]; index++; } DescriptiveStatistics stat = new DescriptiveStatistics(input); double resultDouble = stat.getSum(); 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.SumOfSquaresBigIntegerWeightsTest.java
/** * Tests the plate statistics method./*w w w . ja v a 2s . com*/ */ @Test public void testPlate() { for (PlateBigInteger plate : array) { Map<WellBigInteger, BigDecimal> resultMap = new TreeMap<WellBigInteger, BigDecimal>(); Map<WellBigInteger, BigDecimal> returnedMap = sum.plate(plate, weights, mc); for (WellBigInteger well : plate) { double[] input = new double[well.size()]; int index = 0; for (BigInteger bi : well) { input[index] = bi.doubleValue() * weights[index]; index++; } DescriptiveStatistics stat = new DescriptiveStatistics(input); double resultDouble = stat.getSumsq(); 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.MeanWeightsTest.java
/** * Tests the plate statistics method.//w w w .jav a 2 s. c o m */ @Test public void testPlate() { for (Plate plate : array) { Map<Well, BigDecimal> resultMap = new TreeMap<Well, BigDecimal>(); Map<Well, BigDecimal> returnedMap = mean.plate(plate, weights, mc); for (Well well : plate) { double[] input = new double[well.size()]; int index = 0; for (BigInteger bi : well) { input[index] = bi.doubleValue() * weights[index]; index++; } DescriptiveStatistics stat = new DescriptiveStatistics(input); 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.SumOfSquaresWeightsTest.java
/** * Tests the plate statistics method.//from w ww.ja v a2 s . co m */ @Test public void testPlate() { for (Plate plate : array) { Map<Well, BigDecimal> resultMap = new TreeMap<Well, BigDecimal>(); Map<Well, BigDecimal> returnedMap = sum.plate(plate, weights, mc); for (Well well : plate) { double[] input = new double[well.size()]; int index = 0; for (BigInteger bi : well) { input[index] = bi.doubleValue() * weights[index]; index++; } DescriptiveStatistics stat = new DescriptiveStatistics(input); double resultDouble = stat.getSumsq(); 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.SumWeightsTest.java
/** * Tests the plate statistics method.//from ww w . ja v a 2s. c o m */ @Test public void testPlate() { for (Plate plate : array) { Map<Well, BigDecimal> resultMap = new TreeMap<Well, BigDecimal>(); Map<Well, BigDecimal> returnedMap = sum.plate(plate, weights, mc); for (Well well : plate) { double[] input = new double[well.size()]; int index = 0; for (BigInteger bi : well) { input[index] = bi.doubleValue() * weights[index]; index++; } DescriptiveStatistics stat = new DescriptiveStatistics(input); double resultDouble = stat.getSum(); 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.SampleVarianceBigIntegerWeightsTest.java
/** * Tests set calculation./*from w ww.j a va 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 = variance.set(plate.dataSet(), weights, mc); for (WellBigInteger well : plate) { double[] input = new double[well.size()]; int index = 0; for (BigInteger bi : well) { input[index] = bi.doubleValue() * weights[index]; index++; } DescriptiveStatistics stat = new DescriptiveStatistics(input); double resultDouble = stat.getVariance(); 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.SampleVarianceWeightsTest.java
/** * Tests set calculation./*from w ww .j av a 2s . c o m*/ */ @Test public void testSet() { for (Plate plate : array) { Map<Well, BigDecimal> resultMap = new TreeMap<Well, BigDecimal>(); Map<Well, BigDecimal> returnedMap = variance.set(plate.dataSet(), weights, mc); for (Well well : plate) { double[] input = new double[well.size()]; int index = 0; for (BigInteger bi : well) { input[index] = bi.doubleValue() * weights[index]; index++; } DescriptiveStatistics stat = new DescriptiveStatistics(input); double resultDouble = stat.getVariance(); 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]); } } }