@Override public Double apply(Double level) { return QUANTILE_SAMPLE_INTERPOLATION.quantileWithExtrapolationFromUnsorted(level, UNSORTED_100); } };
@Override public Double apply(Double level) { return QUANTILE_SAMPLE_INTERPOLATION.quantileWithExtrapolationFromUnsorted(level, UNSORTED_123); } };
@Override public Double apply(Double level) { return QUANTILE_SAMPLE_INTERPOLATION.quantileWithExtrapolationFromUnsorted(level, UNSORTED_100); } };
public void interpolation_sample_0001_100() { double quantileExpected = SORTED_100.get(0); // Java index start at 0. double quantileComputed = QUANTILE_SAMPLE_INTERPOLATION.quantileWithExtrapolationFromUnsorted( LEVEL4, UNSORTED_100); assertEquals(quantileComputed, quantileExpected, TOL); }
public void interpolation_sample_095_123() { double indexDouble = LEVEL3 * SAMPLE_SIZE_123; int indexCeil = (int) Math.ceil(indexDouble); int indexFloor = (int) Math.floor(indexDouble); double quantileCeil = SORTED_123.get(indexCeil - 1); // Java index start at 0. double quantileFloor = SORTED_123.get(indexFloor - 1); double pi = (double) indexFloor / (double) SAMPLE_SIZE_123; double pi1 = (double) indexCeil / (double) SAMPLE_SIZE_123; double quantileExpected = quantileFloor + (LEVEL3 - pi) / (pi1 - pi) * (quantileCeil - quantileFloor); double quantileComputed = QUANTILE_SAMPLE_INTERPOLATION.quantileFromUnsorted(LEVEL3, UNSORTED_123); assertEquals(quantileComputed, quantileExpected, TOL); double quantileExtrapComputed = QUANTILE_SAMPLE_INTERPOLATION.quantileWithExtrapolationFromUnsorted( LEVEL3, UNSORTED_123); assertEquals(quantileExtrapComputed, quantileComputed); }