forked from kscience/kmath
Histogram bin fix
This commit is contained in:
parent
668d13c9d1
commit
ea8c0db854
@ -1,8 +1,8 @@
|
||||
package scientifik.kmath.histogram
|
||||
|
||||
import scientifik.kmath.linear.Point
|
||||
import scientifik.kmath.real.asVector
|
||||
import scientifik.kmath.operations.SpaceOperations
|
||||
import scientifik.kmath.real.asVector
|
||||
import scientifik.kmath.structures.*
|
||||
import kotlin.math.floor
|
||||
|
||||
@ -21,7 +21,7 @@ data class BinDef<T : Comparable<T>>(val space: SpaceOperations<Point<T>>, val c
|
||||
|
||||
class MultivariateBin<T : Comparable<T>>(val def: BinDef<T>, override val value: Number) : Bin<T> {
|
||||
|
||||
override fun contains(vector: Point<out T>): Boolean = def.contains(vector)
|
||||
override fun contains(point: Point<T>): Boolean = def.contains(point)
|
||||
|
||||
override val dimension: Int
|
||||
get() = def.center.size
|
||||
|
@ -16,7 +16,7 @@ class UnivariateBin(val position: Double, val size: Double, val counter: LongCou
|
||||
|
||||
operator fun contains(value: Double): Boolean = value in (position - size / 2)..(position + size / 2)
|
||||
|
||||
override fun contains(vector: Buffer<out Double>): Boolean = contains(vector[0])
|
||||
override fun contains(point: Buffer<Double>): Boolean = contains(point[0])
|
||||
|
||||
internal operator fun inc() = this.also { counter.increment() }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user