Compare commits
No commits in common. "fc0393436f1e9698370099b0e9d03fc53ceb85cf" and "2fe04040c6316912969eeef5cbfe1ca799aef736" have entirely different histories.
fc0393436f
...
2fe04040c6
@ -6,7 +6,7 @@ plugins {
|
|||||||
id("org.jetbrains.kotlinx.kover") version "0.7.6"
|
id("org.jetbrains.kotlinx.kover") version "0.7.6"
|
||||||
}
|
}
|
||||||
|
|
||||||
val attributesVersion by extra("0.2.0")
|
val attributesVersion by extra("0.1.0")
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
repositories {
|
repositories {
|
||||||
|
@ -17,4 +17,4 @@ own `MemoryBuffer.create()` factory).
|
|||||||
## Buffer performance
|
## Buffer performance
|
||||||
|
|
||||||
One should avoid using default boxing buffer wherever it is possible. Try to use primitive buffers or memory buffers
|
One should avoid using default boxing buffer wherever it is possible. Try to use primitive buffers or memory buffers
|
||||||
instead.
|
instead .
|
||||||
|
@ -68,9 +68,6 @@ public operator fun ShapeND.component3(): Int = get(2)
|
|||||||
*/
|
*/
|
||||||
public fun ShapeND.toArray(): IntArray = array.copyOf()
|
public fun ShapeND.toArray(): IntArray = array.copyOf()
|
||||||
|
|
||||||
/**
|
|
||||||
* Provide internal content of [ShapeND]. Must not be modified.
|
|
||||||
*/
|
|
||||||
@UnsafeKMathAPI
|
@UnsafeKMathAPI
|
||||||
public fun ShapeND.asArray(): IntArray = array
|
public fun ShapeND.asArray(): IntArray = array
|
||||||
|
|
||||||
|
@ -38,9 +38,9 @@ class MinuitParameter {
|
|||||||
* @param name a [String] object.
|
* @param name a [String] object.
|
||||||
* @param val a double.
|
* @param val a double.
|
||||||
*/
|
*/
|
||||||
constructor(num: Int, name: String, value: Double) {
|
constructor(num: Int, name: String, `val`: Double) {
|
||||||
theNum = num
|
theNum = num
|
||||||
theValue = value
|
theValue = `val`
|
||||||
theConst = true
|
theConst = true
|
||||||
theName = name
|
theName = name
|
||||||
}
|
}
|
||||||
@ -53,9 +53,9 @@ class MinuitParameter {
|
|||||||
* @param val a double.
|
* @param val a double.
|
||||||
* @param err a double.
|
* @param err a double.
|
||||||
*/
|
*/
|
||||||
constructor(num: Int, name: String, value: Double, err: Double) {
|
constructor(num: Int, name: String, `val`: Double, err: Double) {
|
||||||
theNum = num
|
theNum = num
|
||||||
theValue = value
|
theValue = `val`
|
||||||
theError = err
|
theError = err
|
||||||
theName = name
|
theName = name
|
||||||
}
|
}
|
||||||
@ -70,9 +70,9 @@ class MinuitParameter {
|
|||||||
* @param min a double.
|
* @param min a double.
|
||||||
* @param max a double.
|
* @param max a double.
|
||||||
*/
|
*/
|
||||||
constructor(num: Int, name: String, value: Double, err: Double, min: Double, max: Double) {
|
constructor(num: Int, name: String, `val`: Double, err: Double, min: Double, max: Double) {
|
||||||
theNum = num
|
theNum = num
|
||||||
theValue = value
|
theValue = `val`
|
||||||
theError = err
|
theError = err
|
||||||
theLoLimit = min
|
theLoLimit = min
|
||||||
theUpLimit = max
|
theUpLimit = max
|
||||||
@ -288,8 +288,8 @@ class MinuitParameter {
|
|||||||
*
|
*
|
||||||
* @param val a double.
|
* @param val a double.
|
||||||
*/
|
*/
|
||||||
fun setValue(value: Double) {
|
fun setValue(`val`: Double) {
|
||||||
theValue = value
|
theValue = `val`
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -77,8 +77,8 @@ abstract class MnApplication {
|
|||||||
* @param val a double.
|
* @param val a double.
|
||||||
* @param name a [String] object.
|
* @param name a [String] object.
|
||||||
*/
|
*/
|
||||||
fun add(name: String, value: Double, err: Double) {
|
fun add(name: String, `val`: Double, err: Double) {
|
||||||
theState.add(name, value, err)
|
theState.add(name, `val`, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -90,8 +90,8 @@ abstract class MnApplication {
|
|||||||
* @param val a double.
|
* @param val a double.
|
||||||
* @param err a double.
|
* @param err a double.
|
||||||
*/
|
*/
|
||||||
fun add(name: String, value: Double, err: Double, low: Double, up: Double) {
|
fun add(name: String, `val`: Double, err: Double, low: Double, up: Double) {
|
||||||
theState.add(name, value, err, low, up)
|
theState.add(name, `val`, err, low, up)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -100,8 +100,8 @@ abstract class MnApplication {
|
|||||||
* @param name a [String] object.
|
* @param name a [String] object.
|
||||||
* @param val a double.
|
* @param val a double.
|
||||||
*/
|
*/
|
||||||
fun add(name: String, value: Double) {
|
fun add(name: String, `val`: Double) {
|
||||||
theState.add(name, value)
|
theState.add(name, `val`)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -471,8 +471,8 @@ abstract class MnApplication {
|
|||||||
* @param index a int.
|
* @param index a int.
|
||||||
* @param val a double.
|
* @param val a double.
|
||||||
*/
|
*/
|
||||||
fun setValue(index: Int, value: Double) {
|
fun setValue(index: Int, `val`: Double) {
|
||||||
theState.setValue(index, value)
|
theState.setValue(index, `val`)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -482,8 +482,8 @@ abstract class MnApplication {
|
|||||||
* @param name a [String] object.
|
* @param name a [String] object.
|
||||||
* @param val a double.
|
* @param val a double.
|
||||||
*/
|
*/
|
||||||
fun setValue(name: String?, value: Double) {
|
fun setValue(name: String?, `val`: Double) {
|
||||||
theState.setValue(name, value)
|
theState.setValue(name, `val`)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -106,8 +106,8 @@ class MnMinos(fcn: MultiFunction?, min: FunctionMinimum?, stra: MnStrategy?) {
|
|||||||
val para = intArrayOf(par)
|
val para = intArrayOf(par)
|
||||||
val upar: MnUserParameterState = theMinimum!!.userState().copy()
|
val upar: MnUserParameterState = theMinimum!!.userState().copy()
|
||||||
val err: Double = upar.error(par)
|
val err: Double = upar.error(par)
|
||||||
val value: Double = upar.value(par) - err
|
val `val`: Double = upar.value(par) - err
|
||||||
val xmid = doubleArrayOf(value)
|
val xmid = doubleArrayOf(`val`)
|
||||||
val xdir = doubleArrayOf(-err)
|
val xdir = doubleArrayOf(-err)
|
||||||
val ind: Int = upar.intOfExt(par)
|
val ind: Int = upar.intOfExt(par)
|
||||||
val m: MnAlgebraicSymMatrix = theMinimum!!.error().matrix()
|
val m: MnAlgebraicSymMatrix = theMinimum!!.error().matrix()
|
||||||
@ -121,7 +121,7 @@ class MnMinos(fcn: MultiFunction?, min: FunctionMinimum?, stra: MnStrategy?) {
|
|||||||
upar.setValue(ext, upar.value(ext) - xdev)
|
upar.setValue(ext, upar.value(ext) - xdev)
|
||||||
}
|
}
|
||||||
upar.fix(par)
|
upar.fix(par)
|
||||||
upar.setValue(par, value)
|
upar.setValue(par, `val`)
|
||||||
val toler = 0.1
|
val toler = 0.1
|
||||||
val cross = MnFunctionCross(theFCN, upar, theMinimum!!.fval(), theStrategy, errDef)
|
val cross = MnFunctionCross(theFCN, upar, theMinimum!!.fval(), theStrategy, errDef)
|
||||||
val aopt: MnCross = cross.cross(para, xmid, xdir, toler, maxcalls)
|
val aopt: MnCross = cross.cross(para, xmid, xdir, toler, maxcalls)
|
||||||
@ -330,8 +330,8 @@ class MnMinos(fcn: MultiFunction?, min: FunctionMinimum?, stra: MnStrategy?) {
|
|||||||
val para = intArrayOf(par)
|
val para = intArrayOf(par)
|
||||||
val upar: MnUserParameterState = theMinimum!!.userState().copy()
|
val upar: MnUserParameterState = theMinimum!!.userState().copy()
|
||||||
val err: Double = upar.error(par)
|
val err: Double = upar.error(par)
|
||||||
val value: Double = upar.value(par) + err
|
val `val`: Double = upar.value(par) + err
|
||||||
val xmid = doubleArrayOf(value)
|
val xmid = doubleArrayOf(`val`)
|
||||||
val xdir = doubleArrayOf(err)
|
val xdir = doubleArrayOf(err)
|
||||||
val ind: Int = upar.intOfExt(par)
|
val ind: Int = upar.intOfExt(par)
|
||||||
val m: MnAlgebraicSymMatrix = theMinimum!!.error().matrix()
|
val m: MnAlgebraicSymMatrix = theMinimum!!.error().matrix()
|
||||||
@ -345,7 +345,7 @@ class MnMinos(fcn: MultiFunction?, min: FunctionMinimum?, stra: MnStrategy?) {
|
|||||||
upar.setValue(ext, upar.value(ext) + xdev)
|
upar.setValue(ext, upar.value(ext) + xdev)
|
||||||
}
|
}
|
||||||
upar.fix(par)
|
upar.fix(par)
|
||||||
upar.setValue(par, value)
|
upar.setValue(par, `val`)
|
||||||
val toler = 0.1
|
val toler = 0.1
|
||||||
val cross = MnFunctionCross(theFCN, upar, theMinimum!!.fval(), theStrategy, errDef)
|
val cross = MnFunctionCross(theFCN, upar, theMinimum!!.fval(), theStrategy, errDef)
|
||||||
val aopt: MnCross = cross.cross(para, xmid, xdir, toler, maxcalls)
|
val aopt: MnCross = cross.cross(para, xmid, xdir, toler, maxcalls)
|
||||||
|
@ -52,9 +52,17 @@ internal class MnSeedGenerator : MinimumSeedGenerator {
|
|||||||
val delta: Double = hgrd.getSecond().getEntry(i)
|
val delta: Double = hgrd.getSecond().getEntry(i)
|
||||||
if (abs(calculated - provided) > delta) {
|
if (abs(calculated - provided) > delta) {
|
||||||
MINUITPlugin.logStatic(
|
MINUITPlugin.logStatic(
|
||||||
"""gradient discrepancy of external parameter "%d" (internal parameter "%d") too large. Expected: "%f", provided: "%f"""",
|
""
|
||||||
|
+ "gradient discrepancy of external parameter \"%d\" "
|
||||||
|
+ "(internal parameter \"%d\") too large. Expected: \"%f\", provided: \"%f\"",
|
||||||
st.getTransformation().extOfInt(i), i, provided, calculated
|
st.getTransformation().extOfInt(i), i, provided, calculated
|
||||||
)
|
)
|
||||||
|
|
||||||
|
//
|
||||||
|
// MINUITPlugin.logStatic("gradient discrepancy of external parameter "
|
||||||
|
// + st.getTransformation().extOfInt(i)
|
||||||
|
// + " (internal parameter " + i + ") too large.");
|
||||||
|
// good = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!good) {
|
if (!good) {
|
||||||
@ -76,7 +84,10 @@ internal class MnSeedGenerator : MinimumSeedGenerator {
|
|||||||
dcovar = 0.0
|
dcovar = 0.0
|
||||||
} else {
|
} else {
|
||||||
for (i in 0 until n) {
|
for (i in 0 until n) {
|
||||||
mat[i, i] = if (abs(dgrad.getGradientDerivative().getEntry(i)) > prec.eps2()
|
mat[i, i] = if (abs(
|
||||||
|
dgrad.getGradientDerivative()
|
||||||
|
.getEntry(i)
|
||||||
|
) > prec.eps2()
|
||||||
) 1.0 / dgrad.getGradientDerivative().getEntry(i) else 1.0
|
) 1.0 / dgrad.getGradientDerivative().getEntry(i) else 1.0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -235,9 +235,9 @@ class MnUserParameterState {
|
|||||||
* @param val a double.
|
* @param val a double.
|
||||||
* @param name a [String] object.
|
* @param name a [String] object.
|
||||||
*/
|
*/
|
||||||
fun add(name: String, value: Double, err: Double) {
|
fun add(name: String, `val`: Double, err: Double) {
|
||||||
theParameters.add(name, value, err)
|
theParameters.add(name, `val`, err)
|
||||||
theIntParameters.add(value)
|
theIntParameters.add(`val`)
|
||||||
theCovarianceValid = false
|
theCovarianceValid = false
|
||||||
theGCCValid = false
|
theGCCValid = false
|
||||||
theValid = true
|
theValid = true
|
||||||
@ -252,10 +252,10 @@ class MnUserParameterState {
|
|||||||
* @param err a double.
|
* @param err a double.
|
||||||
* @param up a double.
|
* @param up a double.
|
||||||
*/
|
*/
|
||||||
fun add(name: String, value: Double, err: Double, low: Double, up: Double) {
|
fun add(name: String, `val`: Double, err: Double, low: Double, up: Double) {
|
||||||
theParameters.add(name, value, err, low, up)
|
theParameters.add(name, `val`, err, low, up)
|
||||||
theCovarianceValid = false
|
theCovarianceValid = false
|
||||||
theIntParameters.add(ext2int(index(name), value))
|
theIntParameters.add(ext2int(index(name), `val`))
|
||||||
theGCCValid = false
|
theGCCValid = false
|
||||||
theValid = true
|
theValid = true
|
||||||
}
|
}
|
||||||
@ -266,8 +266,8 @@ class MnUserParameterState {
|
|||||||
* @param name a [String] object.
|
* @param name a [String] object.
|
||||||
* @param val a double.
|
* @param val a double.
|
||||||
*/
|
*/
|
||||||
fun add(name: String, value: Double) {
|
fun add(name: String, `val`: Double) {
|
||||||
theParameters.add(name, value)
|
theParameters.add(name, `val`)
|
||||||
theValid = true
|
theValid = true
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -331,8 +331,8 @@ class MnUserParameterState {
|
|||||||
return theParameters.errors()
|
return theParameters.errors()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun ext2int(i: Int, value: Double): Double {
|
fun ext2int(i: Int, `val`: Double): Double {
|
||||||
return theParameters.trafo().ext2int(i, value)
|
return theParameters.trafo().ext2int(i, `val`)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -426,8 +426,8 @@ class MnUserParameterState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// transformation internal <-> external
|
// transformation internal <-> external
|
||||||
fun int2ext(i: Int, value: Double): Double {
|
fun int2ext(i: Int, `val`: Double): Double {
|
||||||
return theParameters.trafo().int2ext(i, value)
|
return theParameters.trafo().int2ext(i, `val`)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun intCovariance(): MnUserCovariance {
|
fun intCovariance(): MnUserCovariance {
|
||||||
@ -700,14 +700,14 @@ class MnUserParameterState {
|
|||||||
* @param e a int.
|
* @param e a int.
|
||||||
* @param val a double.
|
* @param val a double.
|
||||||
*/
|
*/
|
||||||
fun setValue(e: Int, value: Double) {
|
fun setValue(e: Int, `val`: Double) {
|
||||||
theParameters.setValue(e, value)
|
theParameters.setValue(e, `val`)
|
||||||
if (!parameter(e).isFixed() && !parameter(e).isConst()) {
|
if (!parameter(e).isFixed() && !parameter(e).isConst()) {
|
||||||
val i = intOfExt(e)
|
val i = intOfExt(e)
|
||||||
if (parameter(e).hasLimits()) {
|
if (parameter(e).hasLimits()) {
|
||||||
theIntParameters[i] = ext2int(e, value)
|
theIntParameters[i] = ext2int(e, `val`)
|
||||||
} else {
|
} else {
|
||||||
theIntParameters[i] = value
|
theIntParameters[i] = `val`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -719,8 +719,8 @@ class MnUserParameterState {
|
|||||||
* @param name a [String] object.
|
* @param name a [String] object.
|
||||||
* @param val a double.
|
* @param val a double.
|
||||||
*/
|
*/
|
||||||
fun setValue(name: String?, value: Double) {
|
fun setValue(name: String?, `val`: Double) {
|
||||||
setValue(index(name), value)
|
setValue(index(name), `val`)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
|
@ -65,8 +65,8 @@ class MnUserParameters {
|
|||||||
* @param val a double.
|
* @param val a double.
|
||||||
* @param name a [String] object.
|
* @param name a [String] object.
|
||||||
*/
|
*/
|
||||||
fun add(name: String, value: Double, err: Double) {
|
fun add(name: String, `val`: Double, err: Double) {
|
||||||
theTransformation.add(name, value, err)
|
theTransformation.add(name, `val`, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -78,8 +78,8 @@ class MnUserParameters {
|
|||||||
* @param val a double.
|
* @param val a double.
|
||||||
* @param err a double.
|
* @param err a double.
|
||||||
*/
|
*/
|
||||||
fun add(name: String, value: Double, err: Double, low: Double, up: Double) {
|
fun add(name: String, `val`: Double, err: Double, low: Double, up: Double) {
|
||||||
theTransformation.add(name, value, err, low, up)
|
theTransformation.add(name, `val`, err, low, up)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -88,8 +88,8 @@ class MnUserParameters {
|
|||||||
* @param name a [String] object.
|
* @param name a [String] object.
|
||||||
* @param val a double.
|
* @param val a double.
|
||||||
*/
|
*/
|
||||||
fun add(name: String, value: Double) {
|
fun add(name: String, `val`: Double) {
|
||||||
theTransformation.add(name, value)
|
theTransformation.add(name, `val`)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -344,8 +344,8 @@ class MnUserParameters {
|
|||||||
* @param index a int.
|
* @param index a int.
|
||||||
* @param val a double.
|
* @param val a double.
|
||||||
*/
|
*/
|
||||||
fun setValue(index: Int, value: Double) {
|
fun setValue(index: Int, `val`: Double) {
|
||||||
theTransformation.setValue(index, value)
|
theTransformation.setValue(index, `val`)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -355,8 +355,8 @@ class MnUserParameters {
|
|||||||
* @param name a [String] object.
|
* @param name a [String] object.
|
||||||
* @param val a double.
|
* @param val a double.
|
||||||
*/
|
*/
|
||||||
fun setValue(name: String?, value: Double) {
|
fun setValue(name: String?, `val`: Double) {
|
||||||
theTransformation.setValue(name, value)
|
theTransformation.setValue(name, `val`)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
|
@ -64,12 +64,12 @@ class MnUserTransformation {
|
|||||||
* @param err
|
* @param err
|
||||||
* @param val
|
* @param val
|
||||||
*/
|
*/
|
||||||
fun add(name: String, value: Double, err: Double) {
|
fun add(name: String, `val`: Double, err: Double) {
|
||||||
require(!nameMap.containsKey(name)) { "duplicate name: $name" }
|
require(!nameMap.containsKey(name)) { "duplicate name: $name" }
|
||||||
nameMap[name] = theParameters.size
|
nameMap[name] = theParameters.size
|
||||||
theExtOfInt.add(theParameters.size)
|
theExtOfInt.add(theParameters.size)
|
||||||
theCache.add(value)
|
theCache.add(`val`)
|
||||||
theParameters.add(MinuitParameter(theParameters.size, name, value, err))
|
theParameters.add(MinuitParameter(theParameters.size, name, `val`, err))
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -77,12 +77,12 @@ class MnUserTransformation {
|
|||||||
* @param up
|
* @param up
|
||||||
* @param low
|
* @param low
|
||||||
*/
|
*/
|
||||||
fun add(name: String, value: Double, err: Double, low: Double, up: Double) {
|
fun add(name: String, `val`: Double, err: Double, low: Double, up: Double) {
|
||||||
require(!nameMap.containsKey(name)) { "duplicate name: $name" }
|
require(!nameMap.containsKey(name)) { "duplicate name: $name" }
|
||||||
nameMap[name] = theParameters.size
|
nameMap[name] = theParameters.size
|
||||||
theExtOfInt.add(theParameters.size)
|
theExtOfInt.add(theParameters.size)
|
||||||
theCache.add(value)
|
theCache.add(`val`)
|
||||||
theParameters.add(MinuitParameter(theParameters.size, name, value, err, low, up))
|
theParameters.add(MinuitParameter(theParameters.size, name, `val`, err, low, up))
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -90,11 +90,11 @@ class MnUserTransformation {
|
|||||||
* @param name
|
* @param name
|
||||||
* @param val
|
* @param val
|
||||||
*/
|
*/
|
||||||
fun add(name: String, value: Double) {
|
fun add(name: String, `val`: Double) {
|
||||||
require(!nameMap.containsKey(name)) { "duplicate name: $name" }
|
require(!nameMap.containsKey(name)) { "duplicate name: $name" }
|
||||||
nameMap[name] = theParameters.size
|
nameMap[name] = theParameters.size
|
||||||
theCache.add(value)
|
theCache.add(`val`)
|
||||||
theParameters.add(MinuitParameter(theParameters.size, name, value))
|
theParameters.add(MinuitParameter(theParameters.size, name, `val`))
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -107,20 +107,20 @@ class MnUserTransformation {
|
|||||||
return MnUserTransformation(this)
|
return MnUserTransformation(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun dInt2Ext(i: Int, value: Double): Double {
|
fun dInt2Ext(i: Int, `val`: Double): Double {
|
||||||
var dd = 1.0
|
var dd = 1.0
|
||||||
val parm: MinuitParameter = theParameters[theExtOfInt[i]]
|
val parm: MinuitParameter = theParameters[theExtOfInt[i]]
|
||||||
if (parm.hasLimits()) {
|
if (parm.hasLimits()) {
|
||||||
dd = if (parm.hasUpperLimit() && parm.hasLowerLimit()) {
|
dd = if (parm.hasUpperLimit() && parm.hasLowerLimit()) {
|
||||||
theDoubleLimTrafo.dInt2Ext(
|
theDoubleLimTrafo.dInt2Ext(
|
||||||
value,
|
`val`,
|
||||||
parm.upperLimit(),
|
parm.upperLimit(),
|
||||||
parm.lowerLimit()
|
parm.lowerLimit()
|
||||||
)
|
)
|
||||||
} else if (parm.hasUpperLimit() && !parm.hasLowerLimit()) {
|
} else if (parm.hasUpperLimit() && !parm.hasLowerLimit()) {
|
||||||
theUpperLimTrafo.dInt2Ext(value, parm.upperLimit())
|
theUpperLimTrafo.dInt2Ext(`val`, parm.upperLimit())
|
||||||
} else {
|
} else {
|
||||||
theLowerLimTrafo.dInt2Ext(value, parm.lowerLimit())
|
theLowerLimTrafo.dInt2Ext(`val`, parm.lowerLimit())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return dd
|
return dd
|
||||||
@ -143,30 +143,30 @@ class MnUserTransformation {
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
fun ext2int(i: Int, value: Double): Double {
|
fun ext2int(i: Int, `val`: Double): Double {
|
||||||
val parm: MinuitParameter = theParameters[i]
|
val parm: MinuitParameter = theParameters[i]
|
||||||
return if (parm.hasLimits()) {
|
return if (parm.hasLimits()) {
|
||||||
if (parm.hasUpperLimit() && parm.hasLowerLimit()) {
|
if (parm.hasUpperLimit() && parm.hasLowerLimit()) {
|
||||||
theDoubleLimTrafo.ext2int(
|
theDoubleLimTrafo.ext2int(
|
||||||
value,
|
`val`,
|
||||||
parm.upperLimit(),
|
parm.upperLimit(),
|
||||||
parm.lowerLimit(),
|
parm.lowerLimit(),
|
||||||
precision()
|
precision()
|
||||||
)
|
)
|
||||||
} else if (parm.hasUpperLimit() && !parm.hasLowerLimit()) {
|
} else if (parm.hasUpperLimit() && !parm.hasLowerLimit()) {
|
||||||
theUpperLimTrafo.ext2int(
|
theUpperLimTrafo.ext2int(
|
||||||
value,
|
`val`,
|
||||||
parm.upperLimit(),
|
parm.upperLimit(),
|
||||||
precision()
|
precision()
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
theLowerLimTrafo.ext2int(
|
theLowerLimTrafo.ext2int(
|
||||||
value,
|
`val`,
|
||||||
parm.lowerLimit(),
|
parm.lowerLimit(),
|
||||||
precision()
|
precision()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else value
|
} else `val`
|
||||||
}
|
}
|
||||||
|
|
||||||
fun extOfInt(internal: Int): Int {
|
fun extOfInt(internal: Int): Int {
|
||||||
@ -200,21 +200,21 @@ class MnUserTransformation {
|
|||||||
return nameMap[name]!!
|
return nameMap[name]!!
|
||||||
}
|
}
|
||||||
|
|
||||||
fun int2ext(i: Int, value: Double): Double {
|
fun int2ext(i: Int, `val`: Double): Double {
|
||||||
val parm: MinuitParameter = theParameters[theExtOfInt[i]]
|
val parm: MinuitParameter = theParameters[theExtOfInt[i]]
|
||||||
return if (parm.hasLimits()) {
|
return if (parm.hasLimits()) {
|
||||||
if (parm.hasUpperLimit() && parm.hasLowerLimit()) {
|
if (parm.hasUpperLimit() && parm.hasLowerLimit()) {
|
||||||
theDoubleLimTrafo.int2ext(
|
theDoubleLimTrafo.int2ext(
|
||||||
value,
|
`val`,
|
||||||
parm.upperLimit(),
|
parm.upperLimit(),
|
||||||
parm.lowerLimit()
|
parm.lowerLimit()
|
||||||
)
|
)
|
||||||
} else if (parm.hasUpperLimit() && !parm.hasLowerLimit()) {
|
} else if (parm.hasUpperLimit() && !parm.hasLowerLimit()) {
|
||||||
theUpperLimTrafo.int2ext(value, parm.upperLimit())
|
theUpperLimTrafo.int2ext(`val`, parm.upperLimit())
|
||||||
} else {
|
} else {
|
||||||
theLowerLimTrafo.int2ext(value, parm.lowerLimit())
|
theLowerLimTrafo.int2ext(`val`, parm.lowerLimit())
|
||||||
}
|
}
|
||||||
} else value
|
} else `val`
|
||||||
}
|
}
|
||||||
|
|
||||||
fun int2extCovariance(vec: RealVector, cov: MnAlgebraicSymMatrix): MnUserCovariance {
|
fun int2extCovariance(vec: RealVector, cov: MnAlgebraicSymMatrix): MnUserCovariance {
|
||||||
@ -235,13 +235,13 @@ class MnUserTransformation {
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
fun int2extError(i: Int, value: Double, err: Double): Double {
|
fun int2extError(i: Int, `val`: Double, err: Double): Double {
|
||||||
var dx = err
|
var dx = err
|
||||||
val parm: MinuitParameter = theParameters[theExtOfInt[i]]
|
val parm: MinuitParameter = theParameters[theExtOfInt[i]]
|
||||||
if (parm.hasLimits()) {
|
if (parm.hasLimits()) {
|
||||||
val ui = int2ext(i, value)
|
val ui = int2ext(i, `val`)
|
||||||
var du1 = int2ext(i, value + dx) - ui
|
var du1 = int2ext(i, `val` + dx) - ui
|
||||||
val du2 = int2ext(i, value - dx) - ui
|
val du2 = int2ext(i, `val` - dx) - ui
|
||||||
if (parm.hasUpperLimit() && parm.hasLowerLimit()) {
|
if (parm.hasUpperLimit() && parm.hasLowerLimit()) {
|
||||||
if (dx > 1.0) {
|
if (dx > 1.0) {
|
||||||
du1 = parm.upperLimit() - parm.lowerLimit()
|
du1 = parm.upperLimit() - parm.lowerLimit()
|
||||||
@ -354,13 +354,13 @@ class MnUserTransformation {
|
|||||||
setUpperLimit(index(name), up)
|
setUpperLimit(index(name), up)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setValue(index: Int, value: Double) {
|
fun setValue(index: Int, `val`: Double) {
|
||||||
theParameters[index].setValue(value)
|
theParameters[index].setValue(`val`)
|
||||||
theCache[index] = value
|
theCache[index] = `val`
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setValue(name: String?, value: Double) {
|
fun setValue(name: String?, `val`: Double) {
|
||||||
setValue(index(name), value)
|
setValue(index(name), `val`)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun transform(pstates: RealVector): ArrayRealVector {
|
fun transform(pstates: RealVector): ArrayRealVector {
|
||||||
|
@ -71,7 +71,10 @@ internal object NegativeG2LineSearch {
|
|||||||
} while (iter++ < 2 * n && iterate)
|
} while (iter++ < 2 * n && iterate)
|
||||||
val mat = MnAlgebraicSymMatrix(n)
|
val mat = MnAlgebraicSymMatrix(n)
|
||||||
for (i in 0 until n) {
|
for (i in 0 until n) {
|
||||||
mat[i, i] = if (abs(dgrad.getGradientDerivative().getEntry(i)) > prec.eps2()
|
mat[i, i] = if (abs(
|
||||||
|
dgrad.getGradientDerivative()
|
||||||
|
.getEntry(i)
|
||||||
|
) > prec.eps2()
|
||||||
) 1.0 / dgrad.getGradientDerivative().getEntry(i) else 1.0
|
) 1.0 / dgrad.getGradientDerivative().getEntry(i) else 1.0
|
||||||
}
|
}
|
||||||
val err = MinimumError(mat, 1.0)
|
val err = MinimumError(mat, 1.0)
|
||||||
|
@ -41,7 +41,10 @@ internal class SimplexSeedGenerator : MinimumSeedGenerator {
|
|||||||
val mat = MnAlgebraicSymMatrix(n)
|
val mat = MnAlgebraicSymMatrix(n)
|
||||||
val dcovar = 1.0
|
val dcovar = 1.0
|
||||||
for (i in 0 until n) {
|
for (i in 0 until n) {
|
||||||
mat[i, i] = if (abs(dgrad.getGradientDerivative().getEntry(i)) > prec.eps2()
|
mat[i, i] = if (abs(
|
||||||
|
dgrad.getGradientDerivative()
|
||||||
|
.getEntry(i)
|
||||||
|
) > prec.eps2()
|
||||||
) 1.0 / dgrad.getGradientDerivative().getEntry(i) else 1.0
|
) 1.0 / dgrad.getGradientDerivative().getEntry(i) else 1.0
|
||||||
}
|
}
|
||||||
val err = MinimumError(mat, dcovar)
|
val err = MinimumError(mat, dcovar)
|
||||||
|
Loading…
Reference in New Issue
Block a user