Add function contracts and perform some refactoring #130
@ -29,4 +29,4 @@ class SamplerSpace<T : Any>(val space: Space<T>) : Space<Sampler<T>> {
|
|||||||
override fun multiply(a: Sampler<T>, k: Number): Sampler<T> = BasicSampler { generator ->
|
override fun multiply(a: Sampler<T>, k: Number): Sampler<T> = BasicSampler { generator ->
|
||||||
a.sample(generator).map { space { it * k.toDouble() } }
|
a.sample(generator).map { space { it * k.toDouble() } }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -93,4 +93,4 @@ class Median<T>(private val comparator: Comparator<T>) : Statistic<T, T> {
|
|||||||
companion object {
|
companion object {
|
||||||
val real: Median<Double> = Median(Comparator { a: Double, b: Double -> a.compareTo(b) })
|
val real: Median<Double> = Median(Comparator { a: Double, b: Double -> a.compareTo(b) })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,4 +17,4 @@ inline class ViktorBuffer(val flatArray: F64FlatArray) : MutableBuffer<Double> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override operator fun iterator(): Iterator<Double> = flatArray.data.iterator()
|
override operator fun iterator(): Iterator<Double> = flatArray.data.iterator()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user