81void solveLinear(
Double_t eps = 1.e-12)
83 cout <<
"Perform the fit y = c0 + c1 * x in four different ways" << endl;
85 const Int_t nrVar = 2;
86 const Int_t nrPnts = 4;
103 cout <<
" - 1. solve through Normal Equations" << endl;
107 cout <<
" - 2. solve through SVD" << endl;
113 for (
Int_t irow = 0; irow < A.GetNrows(); irow++) {
120 const TVectorD c_svd = svd.Solve(yw,ok);
122 cout <<
" - 3. solve with pseudo inverse" << endl;
124 const TMatrixD pseudo1 = svd.Invert();
126 c_pseudo1 *= pseudo1;
128 cout <<
" - 4. solve with pseudo inverse, calculated brute force" << endl;
131 const TMatrixD pseudo2 = AtA.Invert() * Aw.
T();
133 c_pseudo2 *= pseudo2;
135 cout <<
" - 5. Minuit through TGraph" << endl;
141 c_graph(0) =
f1->GetParameter(0);
142 c_graph(1) =
f1->GetParameter(1);
154 cout <<
" All solutions are the same within tolerance of " << eps << endl;
156 cout <<
" Some solutions differ more than the allowed tolerance of " << eps << endl;
int Int_t
Signed integer 4 bytes (int).
bool Bool_t
Boolean (0=false, 1=true) (bool).
double Double_t
Double 8 bytes.
TVectorD NormalEqn(const TMatrixD &A, const TVectorD &b)
Solve min {(A .
TMatrixTSym< Double_t > TMatrixDSym
TMatrixTRow< Double_t > TMatrixDRow
TMatrixTColumn< Double_t > TMatrixDColumn
TMatrixT< Double_t > TMatrixD
TVectorT< Double_t > TVectorD
Single Value Decomposition class.
TMatrixT< Element > & T()
Bool_t VerifyVectorIdentity(const TVectorT< Element > &m1, const TVectorT< Element > &m2, Int_t verbose, Element maxDevAllow)
Verify that elements of the two vectors are equal within maxDevAllow .