diff --git a/kmath-aida/build.gradle.kts b/kmath-aida/build.gradle.kts deleted file mode 100644 index 2e7deb8b0..000000000 --- a/kmath-aida/build.gradle.kts +++ /dev/null @@ -1,15 +0,0 @@ -plugins { - kotlin("jvm") -} - -repositories { - mavenCentral() - maven ("http://dl.bintray.com/kotlin/kotlin-eap") - maven("http://java.freehep.org/maven2/") -} - -dependencies { - implementation(kotlin("stdlib")) - api(project(":kmath-core")) - api(group = "org.freehep", name = "freehep-jaida", version = "3.4.13") -} \ No newline at end of file diff --git a/kmath-aida/src/main/kotlin/scientifik/kmath/aida/AIDA.kt b/kmath-aida/src/main/kotlin/scientifik/kmath/aida/AIDA.kt deleted file mode 100644 index fc7a044d3..000000000 --- a/kmath-aida/src/main/kotlin/scientifik/kmath/aida/AIDA.kt +++ /dev/null @@ -1,9 +0,0 @@ -package scientifik.kmath.aida - -import hep.aida.IAnalysisFactory -import hep.aida.IHistogramFactory -import hep.aida.ITreeFactory - -val analysisFactory: IAnalysisFactory by lazy { IAnalysisFactory.create() } -val treeFactory: ITreeFactory by lazy { analysisFactory.createTreeFactory() } -val histogramFactory: IHistogramFactory by lazy { analysisFactory.createHistogramFactory(treeFactory.create()) } \ No newline at end of file diff --git a/kmath-aida/src/main/kotlin/scientifik/kmath/aida/Histograms.kt b/kmath-aida/src/main/kotlin/scientifik/kmath/aida/Histograms.kt deleted file mode 100644 index 974fa64a5..000000000 --- a/kmath-aida/src/main/kotlin/scientifik/kmath/aida/Histograms.kt +++ /dev/null @@ -1,23 +0,0 @@ -package scientifik.kmath.aida - -import hep.aida.IHistogram1D -import hep.aida.IHistogram2D - -fun Iterable.histogram(range: ClosedFloatingPointRange, bins: Int = 100, path: String = ""): IHistogram1D{ - val h1d = Histograms.create1D(range,bins,path) - forEach{ - h1d.fill(it) - } - return h1d -} - - -object Histograms { - fun create1D(range: ClosedFloatingPointRange, bins: Int = 100, path: String = ""): IHistogram1D { - return histogramFactory.createHistogram1D(path, bins, range.start, range.endInclusive) - } - - fun create2D(xRange: ClosedFloatingPointRange, yRange: ClosedFloatingPointRange, xBins: Int = 100, yBins: Int = 100, path: String = ""): IHistogram2D { - return histogramFactory.createHistogram2D(path, xBins, xRange.start, xRange.endInclusive, yBins, yRange.start, yRange.endInclusive) - } -} \ No newline at end of file diff --git a/kmath-core/src/commonMain/kotlin/scientifik/kmath/histogram/Histogram.kt b/kmath-core/src/commonMain/kotlin/scientifik/kmath/histogram/Histogram.kt new file mode 100644 index 000000000..0a781e613 --- /dev/null +++ b/kmath-core/src/commonMain/kotlin/scientifik/kmath/histogram/Histogram.kt @@ -0,0 +1,42 @@ +package scientifik.kmath.histogram + +import scientifik.kmath.linear.RealVector +import scientifik.kmath.operations.Space + +/** + * The bin in the histogram. The histogram is by definition always done in the real space + */ +interface Bin { + /** + * The value of this bin + */ + val value: Number + val center: RealVector +} + +/** + * Creates a new bin with zero count corresponding to given point + */ +interface BinFactory { + fun createBin(point: RealVector): B +} + +interface Histogram : Iterable { + + /** + * Find existing bin, corresponding to given coordinates + */ + fun findBin(point: RealVector): B? + + /** + * Dimension of the histogram + */ + val dimension: Int +} + +interface HistogramSpace> : Space { + /** + * Rules for performing operations on bins + */ + val binSpace: Space +} \ No newline at end of file diff --git a/kmath-core/src/commonMain/kotlin/scientifik/kmath/linear/LinearAlgrebra.kt b/kmath-core/src/commonMain/kotlin/scientifik/kmath/linear/LinearAlgrebra.kt index 097a65bb4..333292997 100644 --- a/kmath-core/src/commonMain/kotlin/scientifik/kmath/linear/LinearAlgrebra.kt +++ b/kmath-core/src/commonMain/kotlin/scientifik/kmath/linear/LinearAlgrebra.kt @@ -181,7 +181,6 @@ interface Vector : SpaceElement, VectorSpace> { fun ofReal(size: Int, initializer: (Int) -> Double) = ArrayVector(ArrayVectorSpace(size, DoubleField, realNDFieldFactory), initializer) - fun equals(v1: Vector<*>, v2: Vector<*>): Boolean { if (v1 === v2) return true if (v1.context != v2.context) return false @@ -268,6 +267,8 @@ class ArrayVector internal constructor(override val context: ArrayVecto override val self: ArrayVector get() = this } +typealias RealVector = Vector + /** * A group of methods to resolve equation A dot X = B, where A and B are matrices or vectors */ diff --git a/settings.gradle b/settings.gradle index 90567bfb2..e35188620 100644 --- a/settings.gradle +++ b/settings.gradle @@ -10,6 +10,5 @@ enableFeaturePreview('GRADLE_METADATA') rootProject.name = 'kmath' include ':kmath-core' -include ':kmath-aida' include ':kmath-jmh'