1
0
mirror of https://github.com/aportelli/LatAnalyze.git synced 2024-11-13 01:35:35 +00:00

fits: covariance matrix is inverted using pseudoinverse, the interface allows to se the SVD tolerance

This commit is contained in:
Antonin Portelli 2016-02-29 19:50:28 +00:00
parent e90d620096
commit a435caeecb
3 changed files with 46 additions and 32 deletions

View File

@ -233,7 +233,7 @@ void Chi2Function::initBuffer(void) const
lowerYX = upperYX.transpose();
// inversion
buffer_->invVar = buffer_->invVar.inverse().eval();
buffer_->invVar = buffer_->invVar.pInverse(data_->getSvdTolerance());
buffer_->isInit = true;
}

View File

@ -128,6 +128,11 @@ Index FitInterface::getStatXDim(void) const
return isXExact_.size() - isXExact_.sum();
}
double FitInterface::getSvdTolerance(void) const
{
return svdTolerance_;
}
void FitInterface::setFitInterface(const FitInterface &fitInterface)
{
if (&fitInterface != this)
@ -138,6 +143,7 @@ void FitInterface::setFitInterface(const FitInterface &fitInterface)
isYYCorr_ = fitInterface.isYYCorr_;
isYXCorr_ = fitInterface.isYXCorr_;
isDataCorr_ = fitInterface.isDataCorr_;
svdTolerance_ = fitInterface.svdTolerance_;
}
}
@ -156,6 +162,11 @@ void FitInterface::setYDim(const Index yDim)
resize(getNData(), getXDim(), yDim);
}
void FitInterface::setSvdTolerance(const double tolerance)
{
svdTolerance_ = tolerance;
}
void FitInterface::resize(const Index nData, const Index xDim, const Index yDim)
{
isXExact_.setConstant(xDim, 0);

View File

@ -58,10 +58,12 @@ public:
Index getXDim(void) const;
Index getYDim(void) const;
Index getStatXDim(void) const;
double getSvdTolerance(void) const;
void setFitInterface(const FitInterface &fitInterface);
void setNData(const Index nData);
void setXDim(const Index xDim);
void setYDim(const Index yDim);
void setSvdTolerance(const double tolerance);
void resize(const Index nData, const Index xDim, const Index yDim);
// test
bool isFitPoint(const Index k) const;
@ -73,6 +75,7 @@ public:
private:
IVec isXExact_, isFitPoint_;
IMat isXXCorr_, isYYCorr_, isYXCorr_, isDataCorr_;
double svdTolerance_{1.0e-10};
};
END_LATAN_NAMESPACE