37 if (err.
size() == 1 && err(0, 0) < prec.
Eps()) {
41 if (err.
size() == 1 && err(0, 0) > prec.
Eps()) {
46 double epspdf = std::max(1.e-6, prec.
Eps2());
47 double dgmin = err(0, 0);
49 for (
unsigned int i = 0; i < err.
Nrow(); i++) {
51 print.
Warn(
"non-positive diagonal element in covariance matrix[", i,
"] =", err(i, i));
53 if (err(i, i) < dgmin)
59 dg = 0.5 + epspdf - dgmin;
62 print.
Warn(
"Added to diagonal of Error matrix a value", dg);
69 for (
unsigned int i = 0; i < err.
Nrow(); i++) {
73 s(i) = 1. / std::sqrt(err(i, i));
74 for (
unsigned int j = 0; j <= i; j++) {
75 p(i, j) = err(i, j) * s(i) * s(j);
81 double pmin = eval(0);
82 double pmax = eval(eval.
size() - 1);
84 pmax = std::max(std::fabs(pmax), 1.);
85 if (pmin > epspdf * pmax)
88 double padd = 0.001 * pmax - pmin;
90 for (
unsigned int i = 0; i < err.
Nrow(); i++)
91 err(i, i) *= (1. + padd);
93 print.
Debug([&](std::ostream &os) {
95 for (
unsigned i = 0; i < err.
Nrow(); ++i)
96 os <<
"\n " << eval(i);
101 print.
Warn(
"Matrix forced pos-def by adding to diagonal", padd);
winID h TVirtualViewer3D TVirtualGLPainter p
Class describing a symmetric matrix of size n.
unsigned int Nrow() const
unsigned int size() const
unsigned int size() const
MinimumError keeps the inv.
MinimumState keeps the information (position, Gradient, 2nd deriv, etc) after one minimization step (...
const MinimumError & Error() const
const MinimumParameters & Parameters() const
const FunctionGradient & Gradient() const
Sets the relative floating point (double) arithmetic precision.
double Eps() const
eps returns the smallest possible number so that 1.+eps > 1.
double Eps2() const
eps2 returns 2*sqrt(eps)
MinimumState operator()(const MinimumState &, const MnMachinePrecision &) const
void Debug(const Ts &... args)
void Warn(const Ts &... args)
LAVector eigenvalues(const LASymMatrix &mat)
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.