From 46649a1ddf7e479f9ddedd09585f49dbb6690420 Mon Sep 17 00:00:00 2001 From: Iaroslav Date: Mon, 8 Jun 2020 18:02:15 +0700 Subject: [PATCH] Delete unused InternalUtils functions --- .../kmath/prob/samplers/InternalUtils.kt | 21 ------------------- 1 file changed, 21 deletions(-) diff --git a/kmath-prob/src/commonMain/kotlin/scientifik/kmath/prob/samplers/InternalUtils.kt b/kmath-prob/src/commonMain/kotlin/scientifik/kmath/prob/samplers/InternalUtils.kt index f2f1b3865..c83f35d32 100644 --- a/kmath-prob/src/commonMain/kotlin/scientifik/kmath/prob/samplers/InternalUtils.kt +++ b/kmath-prob/src/commonMain/kotlin/scientifik/kmath/prob/samplers/InternalUtils.kt @@ -18,24 +18,6 @@ internal object InternalUtils { fun factorial(n: Int): Long = FACTORIALS[n] - fun validateProbabilities(probabilities: DoubleArray): Double { - require(probabilities.isNotEmpty()) { "Probabilities must not be empty." } - var sumProb = 0.0 - - probabilities.forEach { prob -> - validateProbability(prob) - sumProb += prob - } - - require(!(sumProb.isInfinite() || sumProb <= 0)) { "Invalid sum of probabilities: $sumProb" } - return sumProb - } - - private fun validateProbability(probability: Double): Unit = - require(!(probability < 0 || probability.isInfinite() || probability.isNaN())) { - "Invalid probability: $probability" - } - class FactorialLog private constructor( numValues: Int, cache: DoubleArray? @@ -64,9 +46,6 @@ internal object InternalUtils { } } - fun withCache(cacheSize: Int): FactorialLog = - FactorialLog(cacheSize, logFactorials) - fun value(n: Int): Double { if (n < logFactorials.size) return logFactorials[n]