1
0
mirror of https://github.com/aportelli/LatAnalyze.git synced 2025-04-11 03:20:46 +01:00

fit: various fixes

This commit is contained in:
Antonin Portelli 2016-04-05 20:55:11 +01:00
parent 681d6589e2
commit 27bc092f55
4 changed files with 14 additions and 31 deletions

View File

@ -36,6 +36,7 @@ FitInterface::FitInterface(void)
void FitInterface::copyInterface(const FitInterface &d) void FitInterface::copyInterface(const FitInterface &d)
{ {
*this = d; *this = d;
scheduleFitVarMatInit();
} }
// add dimensions ////////////////////////////////////////////////////////////// // add dimensions //////////////////////////////////////////////////////////////
@ -471,6 +472,7 @@ void FitInterface::registerDataPoint(const Index k, const Index j)
void FitInterface::scheduleDataCoordInit(void) void FitInterface::scheduleDataCoordInit(void)
{ {
initDataCoord_ = true; initDataCoord_ = true;
scheduleFitVarMatInit();
} }
void FitInterface::updateDataCoord(void) const void FitInterface::updateDataCoord(void) const

View File

@ -99,11 +99,8 @@ void Minimizer::setHighLimit(const Index i, const double l)
{ {
resize(i + 1); resize(i + 1);
} }
else highLimit_(i) = l;
{ useHighLimit(i);
highLimit_(i) = l;
useHighLimit(i);
}
} }
void Minimizer::setHighLimit(const PlaceHolder ph __dumb, const DVec &l) void Minimizer::setHighLimit(const PlaceHolder ph __dumb, const DVec &l)
@ -112,11 +109,8 @@ void Minimizer::setHighLimit(const PlaceHolder ph __dumb, const DVec &l)
{ {
resize(l.size()); resize(l.size());
} }
else highLimit_ = l;
{ useHighLimit(_);
highLimit_ = l;
useHighLimit(_);
}
} }
void Minimizer::setLowLimit(const Index i, const double l) void Minimizer::setLowLimit(const Index i, const double l)
@ -125,11 +119,8 @@ void Minimizer::setLowLimit(const Index i, const double l)
{ {
resize(i + 1); resize(i + 1);
} }
else lowLimit_(i) = l;
{ useLowLimit(i);
lowLimit_(i) = l;
useLowLimit(i);
}
} }
void Minimizer::setLowLimit(const PlaceHolder ph __dumb, const DVec &l) void Minimizer::setLowLimit(const PlaceHolder ph __dumb, const DVec &l)
@ -138,11 +129,8 @@ void Minimizer::setLowLimit(const PlaceHolder ph __dumb, const DVec &l)
{ {
resize(l.size()); resize(l.size());
} }
else lowLimit_ = l;
{ useLowLimit(_);
lowLimit_ = l;
useLowLimit(_);
}
} }
void Minimizer::useHighLimit(const Index i, const bool use) void Minimizer::useHighLimit(const Index i, const bool use)
@ -151,10 +139,7 @@ void Minimizer::useHighLimit(const Index i, const bool use)
{ {
resize(i + 1); resize(i + 1);
} }
else hasHighLimit_(i) = use;
{
hasHighLimit_(i) = use;
}
} }
void Minimizer::useHighLimit(const PlaceHolder ph __dumb, const bool use) void Minimizer::useHighLimit(const PlaceHolder ph __dumb, const bool use)
@ -168,10 +153,7 @@ void Minimizer::useLowLimit(const Index i, const bool use)
{ {
resize(i + 1); resize(i + 1);
} }
else hasLowLimit_(i) = use;
{
hasLowLimit_(i) = use;
}
} }
void Minimizer::useLowLimit(const PlaceHolder ph __dumb, const bool use) void Minimizer::useLowLimit(const PlaceHolder ph __dumb, const bool use)

View File

@ -92,6 +92,7 @@ const DVec & MinuitMinimizer::operator()(const DoubleFunction &f)
// create and set minimizer // create and set minimizer
min.reset(new Minuit2Minimizer(minuitAlg)); min.reset(new Minuit2Minimizer(minuitAlg));
min->SetStrategy(2);
min->SetMaxFunctionCalls(getMaxIteration()); min->SetMaxFunctionCalls(getMaxIteration());
min->SetTolerance(getPrecision()); min->SetTolerance(getPrecision());
min->SetPrintLevel(printLevel); min->SetPrintLevel(printLevel);
@ -130,7 +131,6 @@ const DVec & MinuitMinimizer::operator()(const DoubleFunction &f)
int status; int status;
unsigned int n = 0; unsigned int n = 0;
min->SetStrategy(2);
do do
{ {
if (getVerbosity() >= Verbosity::Normal) if (getVerbosity() >= Verbosity::Normal)

View File

@ -244,7 +244,6 @@ void XYSampleData::setDataToSample(const Index s)
{ {
data_.y(p.first, j) = p.second[s]; data_.y(p.first, j) = p.second[s];
} }
data_.copyInterface(*this);
dataSample_ = s; dataSample_ = s;
initData_ = false; initData_ = false;
} }
@ -474,7 +473,7 @@ void XYSampleData::computeVarMat(void)
} }
if (initVarMat()) if (initVarMat())
{ {
data_.scheduleFitVarMatInit(); data_.copyInterface(*this);
scheduleFitVarMatInit(false); scheduleFitVarMatInit(false);
} }
} }