List of usage examples for java.math BigInteger doubleValue
public double doubleValue()
From source file:com.github.jessemull.microflexbiginteger.stat.SumOfSquaresWeightsTest.java
/** * Tests well calculation.// w w w. j ava 2 s . c om */ @Test public void testWell() { for (Plate plate : array) { 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 returned = sum.well(well, weights, mc); BigDecimal result = new BigDecimal(resultDouble, mc); BigDecimal[] corrected = correctRoundingErrors(returned, result); assertEquals(corrected[0], corrected[1]); } } }
From source file:com.github.jessemull.microflexbiginteger.stat.SumWeightsTest.java
/** * Tests well calculation./*w w w . j a v a 2 s . c o m*/ */ @Test public void testWell() { for (Plate plate : array) { 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 returned = sum.well(well, weights, mc); BigDecimal result = new BigDecimal(resultDouble, mc); BigDecimal[] corrected = correctRoundingErrors(returned, result); assertEquals(corrected[0], corrected[1]); } } }
From source file:com.github.jessemull.microflex.stat.statbiginteger.SampleVarianceBigIntegerWeightsTest.java
/** * Tests well calculation using indices. *//* w w w . j a va2s .co m*/ @Test public void testWellIndices() { for (PlateBigInteger plate : arrayIndices) { for (WellBigInteger well : plate) { double[] input = new double[well.size()]; int index = 0; for (BigInteger bi : well) { input[index] = bi.doubleValue() * weightsIndices[index]; index++; } int begin = random.nextInt(well.size() - 4); int end = begin + random.nextInt(3) + 3; DescriptiveStatistics stat = new DescriptiveStatistics(ArrayUtils.subarray(input, begin, end)); double resultDouble = stat.getVariance(); BigDecimal returned = variance.well(well, ArrayUtils.subarray(weightsIndices, begin, end), begin, end - begin, mc); BigDecimal result = new BigDecimal(resultDouble, mc); BigDecimal[] corrected = correctRoundingErrors(returned, result); assertEquals(corrected[0], corrected[1]); } } }
From source file:com.github.jessemull.microflexbiginteger.stat.SampleVarianceWeightsTest.java
/** * Tests well calculation using indices. *//*from w ww . jav a 2 s. co m*/ @Test public void testWellIndices() { for (Plate plate : arrayIndices) { for (Well well : plate) { double[] input = new double[well.size()]; int index = 0; for (BigInteger bi : well) { input[index] = bi.doubleValue() * weightsIndices[index]; index++; } int begin = random.nextInt(well.size() - 4); int end = begin + random.nextInt(3) + 3; DescriptiveStatistics stat = new DescriptiveStatistics(ArrayUtils.subarray(input, begin, end)); double resultDouble = stat.getVariance(); BigDecimal returned = variance.well(well, ArrayUtils.subarray(weightsIndices, begin, end), begin, end - begin, mc); BigDecimal result = new BigDecimal(resultDouble, mc); BigDecimal[] corrected = correctRoundingErrors(returned, result); assertEquals(corrected[0], corrected[1]); } } }
From source file:com.github.jessemull.microflex.stat.statbiginteger.MeanBigIntegerWeightsTest.java
/** * Tests well calculation using indices. *///from ww w .j a va 2 s. c om @Test public void testWellIndices() { for (PlateBigInteger plate : arrayIndices) { for (WellBigInteger well : plate) { double[] input = new double[well.size()]; int index = 0; for (BigInteger bi : well) { input[index] = bi.doubleValue() * weightsIndices[index]; index++; } int begin = random.nextInt(well.size() - 4); int end = begin + random.nextInt(3) + 3; DescriptiveStatistics stat = new DescriptiveStatistics(ArrayUtils.subarray(input, begin, end)); double resultDouble = stat.getMean(); BigDecimal returned = mean.well(well, ArrayUtils.subarray(weightsIndices, begin, end), begin, end - begin, mc); BigDecimal result = new BigDecimal(resultDouble, mc); BigDecimal[] corrected = correctRoundingErrors(returned, result); assertEquals(corrected[0], corrected[1]); } } }
From source file:com.github.jessemull.microflex.stat.statbiginteger.SumBigIntegerWeightsTest.java
/** * Tests well calculation using indices. *//*from w ww .java2 s. c o m*/ @Test public void testWellIndices() { for (PlateBigInteger plate : arrayIndices) { for (WellBigInteger well : plate) { double[] input = new double[well.size()]; int index = 0; for (BigInteger bi : well) { input[index] = bi.doubleValue() * weightsIndices[index]; index++; } int begin = random.nextInt(well.size() - 4); int end = begin + random.nextInt(3) + 3; DescriptiveStatistics stat = new DescriptiveStatistics(ArrayUtils.subarray(input, begin, end)); double resultDouble = stat.getSum(); BigDecimal returned = sum.well(well, ArrayUtils.subarray(weightsIndices, begin, end), begin, end - begin, mc); BigDecimal result = new BigDecimal(resultDouble, mc); BigDecimal[] corrected = correctRoundingErrors(returned, result); assertEquals(corrected[0], corrected[1]); } } }
From source file:com.github.jessemull.microflex.stat.statbiginteger.SumOfSquaresBigIntegerWeightsTest.java
/** * Tests well calculation using indices. *//* w w w . j a v a 2 s .co m*/ @Test public void testWellIndices() { for (PlateBigInteger plate : arrayIndices) { for (WellBigInteger well : plate) { double[] input = new double[well.size()]; int index = 0; for (BigInteger bi : well) { input[index] = bi.doubleValue() * weightsIndices[index]; index++; } int begin = random.nextInt(well.size() - 4); int end = begin + random.nextInt(3) + 3; DescriptiveStatistics stat = new DescriptiveStatistics(ArrayUtils.subarray(input, begin, end)); double resultDouble = stat.getSumsq(); BigDecimal returned = sum.well(well, ArrayUtils.subarray(weightsIndices, begin, end), begin, end - begin, mc); BigDecimal result = new BigDecimal(resultDouble, mc); BigDecimal[] corrected = correctRoundingErrors(returned, result); assertEquals(corrected[0], corrected[1]); } } }
From source file:com.github.jessemull.microflexbiginteger.stat.MeanWeightsTest.java
/** * Tests well calculation using indices. *//*from w w w . j ava 2s. c o m*/ @Test public void testWellIndices() { for (Plate plate : arrayIndices) { for (Well well : plate) { double[] input = new double[well.size()]; int index = 0; for (BigInteger bi : well) { input[index] = bi.doubleValue() * weightsIndices[index]; index++; } int begin = random.nextInt(well.size() - 4); int end = begin + random.nextInt(3) + 3; DescriptiveStatistics stat = new DescriptiveStatistics(ArrayUtils.subarray(input, begin, end)); double resultDouble = stat.getMean(); BigDecimal returned = mean.well(well, ArrayUtils.subarray(weightsIndices, begin, end), begin, end - begin, mc); BigDecimal result = new BigDecimal(resultDouble, mc); BigDecimal[] corrected = correctRoundingErrors(returned, result); assertEquals(corrected[0], corrected[1]); } } }
From source file:com.github.jessemull.microflexbiginteger.stat.SumOfSquaresWeightsTest.java
/** * Tests well calculation using indices. *///from w w w.ja va2s .c om @Test public void testWellIndices() { for (Plate plate : arrayIndices) { for (Well well : plate) { double[] input = new double[well.size()]; int index = 0; for (BigInteger bi : well) { input[index] = bi.doubleValue() * weightsIndices[index]; index++; } int begin = random.nextInt(well.size() - 4); int end = begin + random.nextInt(3) + 3; DescriptiveStatistics stat = new DescriptiveStatistics(ArrayUtils.subarray(input, begin, end)); double resultDouble = stat.getSumsq(); BigDecimal returned = sum.well(well, ArrayUtils.subarray(weightsIndices, begin, end), begin, end - begin, mc); BigDecimal result = new BigDecimal(resultDouble, mc); BigDecimal[] corrected = correctRoundingErrors(returned, result); assertEquals(corrected[0], corrected[1]); } } }
From source file:com.github.jessemull.microflexbiginteger.stat.SumWeightsTest.java
/** * Tests well calculation using indices. */// www . j ava 2 s. c om @Test public void testWellIndices() { for (Plate plate : arrayIndices) { for (Well well : plate) { double[] input = new double[well.size()]; int index = 0; for (BigInteger bi : well) { input[index] = bi.doubleValue() * weightsIndices[index]; index++; } int begin = random.nextInt(well.size() - 4); int end = begin + random.nextInt(3) + 3; DescriptiveStatistics stat = new DescriptiveStatistics(ArrayUtils.subarray(input, begin, end)); double resultDouble = stat.getSum(); BigDecimal returned = sum.well(well, ArrayUtils.subarray(weightsIndices, begin, end), begin, end - begin, mc); BigDecimal result = new BigDecimal(resultDouble, mc); BigDecimal[] corrected = correctRoundingErrors(returned, result); assertEquals(corrected[0], corrected[1]); } } }