private double allowableError ( int rank ) { // NOTE: according to CKMS, this should be count, not size, but this // leads // to error larger than the error bounds. Leaving it like this is // essentially a HACK, and blows up memory, but does "work". // int size = count; int size = sample . size ( ) ; double minError = size + 1 ; for ( Quantile q : quantiles ) { double error ; if ( rank <= q . quantile * size ) { error = q . u * ( size - rank ) ; } else { error = q . v * rank ; } if ( error < minError ) { minError = error ; } } return minError ; }
Specifies the allowable error for this rank depending on which quantiles are being targeted .