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;
126 c_pseudo1 *= pseudo1;
128 cout <<
" - 4. solve with pseudo inverse, calculated brute force" << endl;
133 c_pseudo2 *= pseudo2;
135 cout <<
" - 5. Minuit through TGraph" << endl;
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;
TVectorD NormalEqn(const TMatrixD &A, const TVectorD &b)
Solve min {(A .
TMatrixTRow< Double_t > TMatrixDRow
TMatrixTColumn< Double_t > TMatrixDColumn
Single Value Decomposition class.
virtual Double_t GetParameter(Int_t ipar) const
A TGraphErrors is a TGraph with error bars.
virtual TFitResultPtr Fit(const char *formula, Option_t *option="", Option_t *goption="", Axis_t xmin=0, Axis_t xmax=0)
Fit this graph with function with name fname.
TMatrixT< Element > & T()
TMatrixT< Element > & Invert(Double_t *det=nullptr)
Invert the matrix and calculate its determinant.
TVectorT< Element > & Use(Int_t lwb, Int_t upb, Element *data)
Use the array data to fill the vector lwb..upb].
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 .