Refactor/ndalgebra #197
@ -68,11 +68,12 @@ benchmark {
|
|||||||
targets.register("benchmarks")
|
targets.register("benchmarks")
|
||||||
// This one matches sourceSet name above
|
// This one matches sourceSet name above
|
||||||
|
|
||||||
configurations.register("fast") {
|
configurations.register("dot") {
|
||||||
warmups = 1 // number of warmup iterations
|
warmups = 1 // number of warmup iterations
|
||||||
iterations = 3 // number of iterations
|
iterations = 3 // number of iterations
|
||||||
iterationTime = 500 // time in seconds per iteration
|
iterationTime = 500 // time in seconds per iteration
|
||||||
iterationTimeUnit = "ms" // time unity for iterationTime, default is seconds
|
iterationTimeUnit = "ms" // time unity for iterationTime, default is seconds
|
||||||
|
include("DotBenchmark")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,18 @@
|
|||||||
plugins { id("ru.mipt.npm.mpp") }
|
plugins { id("ru.mipt.npm.mpp") }
|
||||||
|
|
||||||
kotlin.sourceSets.commonMain {
|
kotlin.sourceSets {
|
||||||
|
commonMain {
|
||||||
dependencies {
|
dependencies {
|
||||||
api(project(":kmath-core"))
|
api(project(":kmath-core"))
|
||||||
api(project(":kmath-for-real"))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
commonTest{
|
||||||
|
dependencies{
|
||||||
|
implementation(project(":kmath-for-real"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
readme {
|
||||||
|
this.maturity = ru.mipt.npm.gradle.Maturity.PROTOTYPE
|
||||||
|
}
|
||||||
|
@ -5,7 +5,6 @@ import kscience.kmath.histogram.fill
|
|||||||
import kscience.kmath.histogram.put
|
import kscience.kmath.histogram.put
|
||||||
import kscience.kmath.real.RealVector
|
import kscience.kmath.real.RealVector
|
||||||
import kscience.kmath.real.invoke
|
import kscience.kmath.real.invoke
|
||||||
import kscience.kmath.structures.Buffer
|
|
||||||
import kotlin.random.Random
|
import kotlin.random.Random
|
||||||
import kotlin.test.*
|
import kotlin.test.*
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package kscience.kmath.histogram
|
package kscience.kmath.histogram
|
||||||
|
|
||||||
import kscience.kmath.real.RealVector
|
import kscience.kmath.linear.Point
|
||||||
import kscience.kmath.structures.Buffer
|
import kscience.kmath.structures.Buffer
|
||||||
import kscience.kmath.structures.asBuffer
|
import kscience.kmath.structures.asBuffer
|
||||||
import java.util.*
|
import java.util.*
|
||||||
@ -11,12 +11,12 @@ import kotlin.math.floor
|
|||||||
public class UnivariateBin(
|
public class UnivariateBin(
|
||||||
public val position: Double,
|
public val position: Double,
|
||||||
public val size: Double,
|
public val size: Double,
|
||||||
public val counter: LongCounter = LongCounter()
|
public val counter: LongCounter = LongCounter(),
|
||||||
) : Bin<Double> {
|
) : Bin<Double> {
|
||||||
//TODO add weighting
|
//TODO add weighting
|
||||||
public override val value: Number get() = counter.sum()
|
public override val value: Number get() = counter.sum()
|
||||||
|
|
||||||
public override val center: RealVector get() = doubleArrayOf(position).asBuffer()
|
public override val center: Point<Double> get() = doubleArrayOf(position).asBuffer()
|
||||||
public override val dimension: Int get() = 1
|
public override val dimension: Int get() = 1
|
||||||
|
|
||||||
public operator fun contains(value: Double): Boolean = value in (position - size / 2)..(position + size / 2)
|
public operator fun contains(value: Double): Boolean = value in (position - size / 2)..(position + size / 2)
|
||||||
@ -27,8 +27,9 @@ public class UnivariateBin(
|
|||||||
/**
|
/**
|
||||||
* Univariate histogram with log(n) bin search speed
|
* Univariate histogram with log(n) bin search speed
|
||||||
*/
|
*/
|
||||||
public class UnivariateHistogram private constructor(private val factory: (Double) -> UnivariateBin) :
|
public class UnivariateHistogram private constructor(
|
||||||
MutableHistogram<Double, UnivariateBin> {
|
private val factory: (Double) -> UnivariateBin,
|
||||||
|
) : MutableHistogram<Double, UnivariateBin> {
|
||||||
|
|
||||||
private val bins: TreeMap<Double, UnivariateBin> = TreeMap()
|
private val bins: TreeMap<Double, UnivariateBin> = TreeMap()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user