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 22306049c..6c04f01bf 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 @@ -28,20 +28,20 @@ public data class DomainBin, out V>( * @param V the type of bin value */ public class IndexedHistogram, V : Any>( - public val histogramSpace: IndexedHistogramGroup, + public val histogramGroup: IndexedHistogramGroup, public val values: StructureND, ) : Histogram> { override fun get(point: Point): DomainBin? { - val index = histogramSpace.getIndex(point) ?: return null - return histogramSpace.produceBin(index, values[index]) + val index = histogramGroup.getIndex(point) ?: return null + return histogramGroup.produceBin(index, values[index]) } - override val dimension: Int get() = histogramSpace.shape.size + override val dimension: Int get() = histogramGroup.shape.size override val bins: Iterable> - get() = DefaultStrides(histogramSpace.shape).asSequence().map { - histogramSpace.produceBin(it, values[it]) + get() = DefaultStrides(histogramGroup.shape).asSequence().map { + histogramGroup.produceBin(it, values[it]) }.asIterable() } @@ -68,14 +68,14 @@ public interface IndexedHistogramGroup, V : Any> : Group.() -> Unit): IndexedHistogram override fun add(left: IndexedHistogram, right: IndexedHistogram): IndexedHistogram { - require(left.histogramSpace == this && right.histogramSpace == this) { + require(left.histogramGroup == this && right.histogramGroup == this) { "A histogram belonging to a different group cannot be operated." } return IndexedHistogram(this, histogramValueAlgebra { left.values + right.values }) } override fun scale(a: IndexedHistogram, value: Double): IndexedHistogram { - require(a.histogramSpace == this) { "A histogram belonging to a different group cannot be operated." } + require(a.histogramGroup == this) { "A histogram belonging to a different group cannot be operated." } return IndexedHistogram(this, histogramValueAlgebra { a.values * value }) } diff --git a/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/UniformHistogram1D.kt b/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/UniformHistogram1D.kt index 93eca192f..cb6572af9 100644 --- a/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/UniformHistogram1D.kt +++ b/kmath-histograms/src/commonMain/kotlin/space/kscience/kmath/histogram/UniformHistogram1D.kt @@ -46,7 +46,7 @@ public class UniformHistogram1DGroup( public val startPoint: Double = 0.0, ) : Group>, ScaleOperations> where A : Ring, A : ScaleOperations { - override val zero: UniformHistogram1D by lazy { UniformHistogram1D(this, emptyMap()) } + override val zero: UniformHistogram1D = UniformHistogram1D(this, emptyMap()) /** * Get index of a bin