diff --git a/build.gradle.kts b/build.gradle.kts index f3a3c13d4..1034f3f44 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,5 +1,5 @@ plugins { - id("scientifik.publish") version "0.3.1" apply false + id("scientifik.publish") version "0.4.1" apply false } val kmathVersion by extra("0.1.4-dev-1") diff --git a/kmath-prob/src/commonMain/kotlin/scientifik/kmath/prob/Statistic.kt b/kmath-prob/src/commonMain/kotlin/scientifik/kmath/prob/Statistic.kt index 1af2570b0..804aed089 100644 --- a/kmath-prob/src/commonMain/kotlin/scientifik/kmath/prob/Statistic.kt +++ b/kmath-prob/src/commonMain/kotlin/scientifik/kmath/prob/Statistic.kt @@ -11,6 +11,7 @@ import scientifik.kmath.coroutines.mapParallel import scientifik.kmath.operations.* import scientifik.kmath.structures.Buffer import scientifik.kmath.structures.asIterable +import scientifik.kmath.structures.asSequence /** * A function, that transforms a buffer of random quantities to some resulting value @@ -83,9 +84,9 @@ class Mean(val space: Space) : ComposableStatistic, T> { /** * Non-composable median */ -class Median(comparator: Comparator) : Statistic { +class Median(private val comparator: Comparator) : Statistic { override suspend fun invoke(data: Buffer): T { - return data.asIterable().toList()[data.size / 2] //TODO check if this is correct + return data.asSequence().sortedWith(comparator).toList()[data.size / 2] //TODO check if this is correct } companion object {