AIDA is broken, rollback to standalone histograms

This commit is contained in:
Alexander Nozik 2018-10-27 10:08:07 +03:00
parent ae34346437
commit c7575caeee
6 changed files with 44 additions and 49 deletions

View File

@ -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")
}

View File

@ -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()) }

View File

@ -1,23 +0,0 @@
package scientifik.kmath.aida
import hep.aida.IHistogram1D
import hep.aida.IHistogram2D
fun Iterable<Double>.histogram(range: ClosedFloatingPointRange<Double>, 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<Double>, bins: Int = 100, path: String = ""): IHistogram1D {
return histogramFactory.createHistogram1D(path, bins, range.start, range.endInclusive)
}
fun create2D(xRange: ClosedFloatingPointRange<Double>, yRange: ClosedFloatingPointRange<Double>, xBins: Int = 100, yBins: Int = 100, path: String = ""): IHistogram2D {
return histogramFactory.createHistogram2D(path, xBins, xRange.start, xRange.endInclusive, yBins, yRange.start, yRange.endInclusive)
}
}

View File

@ -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<out B : Bin> {
fun createBin(point: RealVector): B
}
interface Histogram<out B : Bin> : Iterable<B> {
/**
* Find existing bin, corresponding to given coordinates
*/
fun findBin(point: RealVector): B?
/**
* Dimension of the histogram
*/
val dimension: Int
}
interface HistogramSpace<B : Bin, H : Histogram<B>> : Space<H> {
/**
* Rules for performing operations on bins
*/
val binSpace: Space<Bin>
}

View File

@ -181,7 +181,6 @@ interface Vector<T : Any> : SpaceElement<Vector<T>, VectorSpace<T>> {
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<T : Any> internal constructor(override val context: ArrayVecto
override val self: ArrayVector<T> get() = this
}
typealias RealVector = Vector<Double>
/**
* A group of methods to resolve equation A dot X = B, where A and B are matrices or vectors
*/

View File

@ -10,6 +10,5 @@ enableFeaturePreview('GRADLE_METADATA')
rootProject.name = 'kmath'
include ':kmath-core'
include ':kmath-aida'
include ':kmath-jmh'