mirror of
https://github.com/aportelli/LatAnalyze.git
synced 2024-11-14 09:45:36 +00:00
fits: covariance matrix is inverted using pseudoinverse, the interface allows to se the SVD tolerance
This commit is contained in:
parent
e90d620096
commit
a435caeecb
@ -233,7 +233,7 @@ void Chi2Function::initBuffer(void) const
|
|||||||
lowerYX = upperYX.transpose();
|
lowerYX = upperYX.transpose();
|
||||||
|
|
||||||
// inversion
|
// inversion
|
||||||
buffer_->invVar = buffer_->invVar.inverse().eval();
|
buffer_->invVar = buffer_->invVar.pInverse(data_->getSvdTolerance());
|
||||||
buffer_->isInit = true;
|
buffer_->isInit = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,16 +128,22 @@ Index FitInterface::getStatXDim(void) const
|
|||||||
return isXExact_.size() - isXExact_.sum();
|
return isXExact_.size() - isXExact_.sum();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double FitInterface::getSvdTolerance(void) const
|
||||||
|
{
|
||||||
|
return svdTolerance_;
|
||||||
|
}
|
||||||
|
|
||||||
void FitInterface::setFitInterface(const FitInterface &fitInterface)
|
void FitInterface::setFitInterface(const FitInterface &fitInterface)
|
||||||
{
|
{
|
||||||
if (&fitInterface != this)
|
if (&fitInterface != this)
|
||||||
{
|
{
|
||||||
isXExact_ = fitInterface.isXExact_;
|
isXExact_ = fitInterface.isXExact_;
|
||||||
isFitPoint_ = fitInterface.isFitPoint_;
|
isFitPoint_ = fitInterface.isFitPoint_;
|
||||||
isXXCorr_ = fitInterface.isXXCorr_;
|
isXXCorr_ = fitInterface.isXXCorr_;
|
||||||
isYYCorr_ = fitInterface.isYYCorr_;
|
isYYCorr_ = fitInterface.isYYCorr_;
|
||||||
isYXCorr_ = fitInterface.isYXCorr_;
|
isYXCorr_ = fitInterface.isYXCorr_;
|
||||||
isDataCorr_ = fitInterface.isDataCorr_;
|
isDataCorr_ = fitInterface.isDataCorr_;
|
||||||
|
svdTolerance_ = fitInterface.svdTolerance_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,6 +162,11 @@ void FitInterface::setYDim(const Index yDim)
|
|||||||
resize(getNData(), getXDim(), 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)
|
void FitInterface::resize(const Index nData, const Index xDim, const Index yDim)
|
||||||
{
|
{
|
||||||
isXExact_.setConstant(xDim, 0);
|
isXExact_.setConstant(xDim, 0);
|
||||||
|
@ -39,30 +39,32 @@ public:
|
|||||||
// destructor
|
// destructor
|
||||||
virtual ~FitInterface(void) = default;
|
virtual ~FitInterface(void) = default;
|
||||||
// access
|
// access
|
||||||
void assumeXExact(const Index i, const bool isExact = true);
|
void assumeXExact(const Index i, const bool isExact = true);
|
||||||
void assumeXXCorrelated(const Index i1, const Index i2,
|
void assumeXXCorrelated(const Index i1, const Index i2,
|
||||||
const bool isCorrelated = true);
|
const bool isCorrelated = true);
|
||||||
void assumeYYCorrelated(const Index j1, const Index j2,
|
void assumeYYCorrelated(const Index j1, const Index j2,
|
||||||
const bool isCorrelated = true);
|
const bool isCorrelated = true);
|
||||||
void assumeYXCorrelated(const Index j, const Index i,
|
void assumeYXCorrelated(const Index j, const Index i,
|
||||||
const bool isCorrelated = true);
|
const bool isCorrelated = true);
|
||||||
void assumeDataCorrelated(const Index k1, const Index k2,
|
void assumeDataCorrelated(const Index k1, const Index k2,
|
||||||
const bool isCorrelated = true);
|
const bool isCorrelated = true);
|
||||||
void assumeDataCorrelated(const bool isCorrelated = true);
|
void assumeDataCorrelated(const bool isCorrelated = true);
|
||||||
void fitPoint(const Index k, const bool isFitPoint = true);
|
void fitPoint(const Index k, const bool isFitPoint = true);
|
||||||
void fitPointRange(const Index k1, const Index k2,
|
void fitPointRange(const Index k1, const Index k2,
|
||||||
const bool isFitPoint = true);
|
const bool isFitPoint = true);
|
||||||
void fitAllPoints(const bool isFitPoint = true);
|
void fitAllPoints(const bool isFitPoint = true);
|
||||||
Index getNData(void) const;
|
Index getNData(void) const;
|
||||||
Index getNFitPoint(void) const;
|
Index getNFitPoint(void) const;
|
||||||
Index getXDim(void) const;
|
Index getXDim(void) const;
|
||||||
Index getYDim(void) const;
|
Index getYDim(void) const;
|
||||||
Index getStatXDim(void) const;
|
Index getStatXDim(void) const;
|
||||||
void setFitInterface(const FitInterface &fitInterface);
|
double getSvdTolerance(void) const;
|
||||||
void setNData(const Index nData);
|
void setFitInterface(const FitInterface &fitInterface);
|
||||||
void setXDim(const Index xDim);
|
void setNData(const Index nData);
|
||||||
void setYDim(const Index yDim);
|
void setXDim(const Index xDim);
|
||||||
void resize(const Index nData, const Index xDim, const Index yDim);
|
void setYDim(const Index yDim);
|
||||||
|
void setSvdTolerance(const double tolerance);
|
||||||
|
void resize(const Index nData, const Index xDim, const Index yDim);
|
||||||
// test
|
// test
|
||||||
bool isFitPoint(const Index k) const;
|
bool isFitPoint(const Index k) const;
|
||||||
bool isXExact(const Index i) const;
|
bool isXExact(const Index i) const;
|
||||||
@ -71,8 +73,9 @@ public:
|
|||||||
bool isYXCorrelated(const Index j, const Index i) const;
|
bool isYXCorrelated(const Index j, const Index i) const;
|
||||||
bool isDataCorrelated(const Index k1, const Index k2) const;
|
bool isDataCorrelated(const Index k1, const Index k2) const;
|
||||||
private:
|
private:
|
||||||
IVec isXExact_, isFitPoint_;
|
IVec isXExact_, isFitPoint_;
|
||||||
IMat isXXCorr_, isYYCorr_, isYXCorr_, isDataCorr_;
|
IMat isXXCorr_, isYYCorr_, isYXCorr_, isDataCorr_;
|
||||||
|
double svdTolerance_{1.0e-10};
|
||||||
};
|
};
|
||||||
|
|
||||||
END_LATAN_NAMESPACE
|
END_LATAN_NAMESPACE
|
||||||
|
Loading…
Reference in New Issue
Block a user