14#if defined(DEBUG) || defined(WARNINGMSG)
39 if(err.
size() == 1 && err(0,0) < prec.
Eps()) {
43 if(err.
size() == 1 && err(0,0) > prec.
Eps()) {
48 double epspdf = std::max(1.e-6, prec.
Eps2());
49 double dgmin = err(0,0);
51 for(
unsigned int i = 0; i < err.
Nrow(); i++) {
54 MN_INFO_VAL2(
"negative or zero diagonal element in covariance matrix",i);
56 if(err(i,i) < dgmin) dgmin = err(i,i);
61 dg = 0.5 + epspdf - dgmin;
64 MN_INFO_VAL2(
"added to diagonal of Error matrix a value",dg);
71 for(
unsigned int i = 0; i < err.
Nrow(); i++) {
73 if(err(i,i) < 0.) err(i,i) = 1.;
74 s(i) = 1./
sqrt(err(i,i));
75 for(
unsigned int j = 0; j <= i; j++) {
76 p(i,j) = err(i,j)*
s(i)*
s(j);
82 double pmin = eval(0);
83 double pmax = eval(eval.
size() - 1);
85 pmax = std::max(
fabs(pmax), 1.);
88 double padd = 0.001*pmax - pmin;
90 std::cout<<
"eigenvalues: "<<std::endl;
92 for(
unsigned int i = 0; i < err.
Nrow(); i++) {
93 err(i,i) *= (1. + padd);
95 std::cout<<eval(i)<<std::endl;
100 MN_INFO_VAL2(
"matrix forced pos-def by adding to diagonal",padd);
#define MN_INFO_VAL2(loc, x)
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
determines the relative floating point 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
VecExpr< UnaryOp< Fabs< T >, VecExpr< A, T, D >, T >, T, D > fabs(const VecExpr< A, T, D > &rhs)
LAVector eigenvalues(const LASymMatrix &mat)
Namespace for new ROOT classes and functions.
static constexpr double s