1
0
mirror of https://github.com/aportelli/LatAnalyze.git synced 2024-11-10 08:55:37 +00:00

XYStatData fixes

This commit is contained in:
Antonin Portelli 2021-12-26 22:21:03 +01:00
parent bac8356de5
commit 8cd29c2bee

View File

@ -216,7 +216,7 @@ DVec XYStatData::getXError(const Index i) const
DVec XYStatData::getYError(const Index j) const DVec XYStatData::getYError(const Index j) const
{ {
checkXDim(j); checkYDim(j);
return yyVar_(j, j).diagonal().cwiseSqrt(); return yyVar_(j, j).diagonal().cwiseSqrt();
} }
@ -385,12 +385,15 @@ XYStatData XYStatData::getNormalisedResiduals(const FitResult &fit)
for (Index j = 0; j < getNYDim(); ++j) for (Index j = 0; j < getNYDim(); ++j)
{ {
const DoubleFunction &f = fit.getModel(j); const DoubleFunction &f = fit.getModel(j);
const DVec err = getYError(j);
Index row = 0;
for (auto &p: yData_[j]) for (auto &p: yData_[j])
{ {
res.y(p.first, j) -= f(x(p.first)); res.y(p.first, j) -= f(x(p.first));
res.y(p.first, j) /= sqrt(getYYVar(j, j)(p.first, p.first)); res.y(p.first, j) /= err(row);
row++;
} }
} }