From 86d89f89f904c8dd7bd70f5f596c78d63560a82f Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Sun, 10 Apr 2022 10:29:44 +0300 Subject: [PATCH] Update kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/IndexedHistogramGroup.kt Co-authored-by: Iaroslav Postovalov <38042667+CommanderTvis@users.noreply.github.com> --- .../space/kscience/kmath/histogram/IndexedHistogramGroup.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/IndexedHistogramGroup.kt b/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/IndexedHistogramGroup.kt index 9749f8403..b1d317a15 100644 --- a/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/IndexedHistogramGroup.kt +++ b/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/IndexedHistogramGroup.kt @@ -68,8 +68,9 @@ public interface IndexedHistogramGroup, V : Any> : Group.() -> Unit): IndexedHistogram override fun add(left: IndexedHistogram, right: IndexedHistogram): IndexedHistogram { - require(left.histogramSpace == this) { "Can't operate on a histogram produced by external space" } - require(right.histogramSpace == this) { "Can't operate on a histogram produced by external space" } + require(left.histogramSpace == this && right.histogramSpace == this) { + "A histogram belonging to a different group cannot be operated." + } return IndexedHistogram(this, histogramValueAlgebra { left.values + right.values }) }