Welcome to the Bug Tracking System for the DUNE project.
Due to increasing spam attacks, we had to disable the feature of anonymous bug reports. You will have to register before you are able to report a new bug.
In case you experience any problems, let us know at http://www.dune-project.org/mailinglists.html .
Due to increasing spam attacks, we had to disable the feature of anonymous bug reports. You will have to register before you are able to report a new bug.
In case you experience any problems, let us know at http://www.dune-project.org/mailinglists.html .
FS#729 - Singularity detection in FieldMatrix' LU decomposition buggy
Attached to Project:
Dune
Opened by Andreas Lauser (andlaus) - Thursday, 28 January 2010, 12:04 GMT+2
Opened by Andreas Lauser (andlaus) - Thursday, 28 January 2010, 12:04 GMT+2
|
DetailsThe singularity detection in the FieldMatrix' LU decompostion throws an exception for the following matrix
1, 0, 0, 0 -3.02852e-07, 1, -0.00434667, 1.08683e-09 0, 0, 1, 0 -4248.83, -9.22043e+09, 0, 1 This is due to the fact, that the ratio between the largest and the smallest entry is 18 decimal orders of magnitute which is above machine precision of about 16 orders of magnitute. On the other hand, the matrix clearly isn't singular and it emerges naturally from a physical problem. Disabling the singularity detection makes the LU decomposition (and my model) work without any problems, which is due to the fact that very large and very small numbers are never added during the course of the decomposition. |
This task depends upon
ludecomp.cc
But your matrix is very ill-conditioned (condition ~ 10^19) -- it is not a complete surprise it is rejected by the algorithm.
-- Christian and Sven
To fix the problem properly, I think that the singularity threshold needs to be be dependent on the largest entry that occurs in a column during the decomposition. I just have trouble finding a efficient way to implement this. In the mean time I would like to propose the attached patch to fix the problem, if compiled with -DNDEBUG the singularity detection just breaks down to a comparison with 0, else the singularity thershold is column specific.
0) just call Dune::FMatrixPrecision<>::set_singular_limit(0.0);
1) Rescaling is the way to go if the matrix is like in your case, although you should better scale the last line by 1e-9.
2) Full pivoting would be the proper fix, but your suggested fix isn't a fix at all.
If you just force dune to invert your matrix, you A*A^-1 is a lot worse compared to the scaled version (see code attached):
============orig=============
1 0 0 6.53252e-21
9.04729e-24 1 4.69256e-19 -1.55248e-27
0 0 1 0
-3.41061e-13 0 0 1
============scaled=============
1 0 0 0
2.67283e-23 1 1.07997e-19 -1.70084e-18
0 0 1 0
1.12579e-21 7.75205e-18 7.72219e-18 1