fun computeInPlace(vararg dataset: Double): Double { checkArgument(dataset.size > 0, "Cannot calculate quantiles of an empty dataset")if (containsNaN(dataset))  return NaN } val numerator = index as Long * (dataset.size - 1) val quotient = LongMath.divide(numerator, scale, RoundingMode.DOWN) as Int val remainder = (numerator - quotient.toLong() * scale) as Int selectInPlace(quotient, dataset, 0, dataset.size - 1) return if (remainder == 0) { dataset[quotient] } else { selectInPlace(quotient + 1, dataset, quotient + 1, dataset.size - 1) interpolate(dataset[quotient], dataset[quotient + 1], remainder, scale) } }
Computes the quantile value of the given dataset , performing the computation in-place .