Update kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/IndexedHistogramGroup.kt

Co-authored-by: Iaroslav Postovalov <38042667+CommanderTvis@users.noreply.github.com>
This commit is contained in:
Alexander Nozik 2022-04-10 10:29:44 +03:00 committed by GitHub
parent eba3a2526e
commit 86d89f89f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -68,8 +68,9 @@ public interface IndexedHistogramGroup<T : Comparable<T>, V : Any> : Group<Index
public fun produce(builder: HistogramBuilder<T, V>.() -> Unit): IndexedHistogram<T, V> public fun produce(builder: HistogramBuilder<T, V>.() -> Unit): IndexedHistogram<T, V>
override fun add(left: IndexedHistogram<T, V>, right: IndexedHistogram<T, V>): IndexedHistogram<T, V> { override fun add(left: IndexedHistogram<T, V>, right: IndexedHistogram<T, V>): IndexedHistogram<T, V> {
require(left.histogramSpace == this) { "Can't operate on a histogram produced by external space" } require(left.histogramSpace == this && right.histogramSpace == this) {
require(right.histogramSpace == this) { "Can't operate on a histogram produced by external space" } "A histogram belonging to a different group cannot be operated."
}
return IndexedHistogram(this, histogramValueAlgebra { left.values + right.values }) return IndexedHistogram(this, histogramValueAlgebra { left.values + right.values })
} }