the coefficients of the equations is: Bi86_vector_Fazekas.txt (423 Bytes) Aij86_matrix_Fazekas.txt (3.2 KB)
ant the result by my c++ code is:
4.234800822336149e+02
-8.156127777281255e+02
5.942013904498536e+02
-1.698128947296208e+02
-1.814064793026619e+01
2.684494321505973e+01
-7.809183721387632e+00
1.025160202933659e+00
-5.279662705325613e-02
and the result by linear algebra of root is:
4.232980e+02
-8.507327e+02
6.020703e+02
-1.683711e+02
-2.084173e+01
2.803771e+01
-8.073064e+00
1.055285e+00
-5.421381e-02
I would check the matrix condition, it is normal that if the condition is large you are getting numerical error.
You can try using also a different decomposition for the matrix or a different tolerance.
Look on how the Determinant is computed and you can play with that code.
See ROOT: math/matrix/src/TMatrixT.cxx Source File
I do not kwon why the big difference between your result and mine occurs, it seems the results shauld be the same.
and sorry for “Your standalone code does not compile for me”, my codes are compiled by visual studio 2019 on windows 10 platform.
I change all datas of long double to double in my c++ codes, the results are exactly same. so i doubt linear algebra in root can not keep high precision at equations solving.
and by the way, how to control tolerance of linear algebra in root?
Hi,
This explains then the difference. Linear algebra in ROOT is based on double precision.
TO control the tolerance you can try to use TMatrixD::SetTol( tolerance).
The default value is already the double precision tolerance 2.2204460e-16. So if you want to decrease, I don’t think it will work, but you can increase it
I used “Determinant Solution” and “Decomposition Solution” to do equation solving, the root codes are upload: EquationSolving.cpp (6.3 KB) MatrixDecomposition.cpp (2.0 KB)
the result from “Determinant Solution” is:
4.232980e+02
-8.507327e+02
6.020703e+02
-1.683711e+02
-2.084173e+01
2.803771e+01
-8.073064e+00
1.055285e+00
-5.421381e-02
the result from “Decomposition Solution” is:
4.325485e+02
-8.299728e+02
6.008439e+02
-1.683699e+02
-2.084173e+01
2.803771e+01
-8.073064e+00
1.055285e+00
-5.421381e-02