mirror of
https://github.com/aportelli/LatAnalyze.git
synced 2024-11-10 00:45:36 +00:00
minor fixes
This commit is contained in:
parent
9e6bbd95c3
commit
89cf008fb8
@ -17,22 +17,24 @@ int main(void)
|
||||
// generate fake data
|
||||
XYStatData data(nPoint, 1, 1);
|
||||
RandGen rg;
|
||||
double x_k;
|
||||
double x_k, y_k;
|
||||
CompiledDoubleModel f(1, 2, "return p_1*exp(-x_0*p_0);");
|
||||
|
||||
for (Index k = 0; k < nPoint; ++k)
|
||||
{
|
||||
x_k = k*dx;
|
||||
y_k = f(&x_k, exactPar) + rg.gaussian(0.0, 0.1);
|
||||
cout << x_k << " " << y_k << " " << 0.1 << endl;
|
||||
data.x(0, k) = x_k;
|
||||
data.y(0, k) = f(&x_k, exactPar) + rg.gaussian(0.0, 0.1);
|
||||
data.y(0, k) = y_k;
|
||||
}
|
||||
data.yyVar(0, 0).diagonal() = DMat::Constant(nPoint, 1, 0.1*0.1);
|
||||
data.assumeXExact(0);
|
||||
|
||||
|
||||
// fit
|
||||
DVec init = DVec::Constant(2, 0.5);
|
||||
FitResult p;
|
||||
MinuitMinimizer minimizer;
|
||||
MinuitMinimizer minimizer(2);
|
||||
|
||||
data.fitAllPoints();
|
||||
p = data.fit(minimizer, init, f);
|
||||
|
@ -18,7 +18,7 @@ int main(int argc, char* argv[])
|
||||
source = argv[1];
|
||||
|
||||
CompiledDoubleFunction f(1, source);
|
||||
MinuitMinimizer minimizer;
|
||||
MinuitMinimizer minimizer(1);
|
||||
double min;
|
||||
|
||||
minimizer.setVerbosity(Minimizer::Verbosity::Debug);
|
||||
|
@ -11,7 +11,7 @@ int main(void)
|
||||
DoubleFunction f1(2, [a](const double *x){return a*(1.-x[0]);});
|
||||
DoubleFunction f2(2, [b](const double *x){return b*(x[1]-x[0]*x[0]);});
|
||||
vector<DoubleFunction *> system = {&f1, &f2};
|
||||
GslHybridRootFinder solve;
|
||||
GslHybridRootFinder solve(2);
|
||||
DVec init(2), x;
|
||||
|
||||
solve.setVerbosity(Solver::Verbosity::Debug);
|
||||
|
@ -68,7 +68,10 @@ double TabFunction::operator()(const double *arg) const
|
||||
|
||||
if ((x < value_.begin()->first)||(x >= value_.rbegin()->first))
|
||||
{
|
||||
LATAN_ERROR(Range, "tabulated function variable out of range");
|
||||
LATAN_ERROR(Range, "tabulated function variable out of range (x= "
|
||||
+ strFrom(x) + " not in ["
|
||||
+ strFrom(value_.begin()->first) + ", "
|
||||
+ strFrom(value_.rbegin()->first) + "])");
|
||||
}
|
||||
|
||||
auto i = value_.equal_range(x);
|
||||
|
@ -53,7 +53,7 @@ public:
|
||||
const Index j = 0) const;
|
||||
private:
|
||||
DSample chi2_;
|
||||
Index nDof_{0};
|
||||
double nDof_{0.};
|
||||
std::vector<DoubleFunctionSample> model_;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user