0.1.4-dev-4 #86

Merged
altavir merged 38 commits from dev into master 2020-04-30 11:36:59 +03:00
2 changed files with 4 additions and 3 deletions
Showing only changes of commit 0cb53792b1 - Show all commits

View File

@ -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")

View File

@ -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<T>(val space: Space<T>) : ComposableStatistic<T, Pair<T, Int>, T> {
/**
* Non-composable median
*/
class Median<T>(comparator: Comparator<T>) : Statistic<T, T> {
class Median<T>(private val comparator: Comparator<T>) : Statistic<T, T> {
override suspend fun invoke(data: Buffer<T>): 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 {