I'm using Eigen (a C++ library for numerical linear algebra) to solve a linear equation with the the bi-conjugate gradient BICGSTAB algorithm with Incomplete LU preconditioner. However, the result bg.error()("estimated error")
becomes -1.#IND
after 1 iteration. The size of the linear system is $N=20000$. Could anyone help me about this problem? I also tried smaller system, e.g, $N=200$, and that worked OK.
1 Answer
This is an old question and it does not contain enough information to answer it with certainty. But since I already stumbled on it once, I want to propose a list of actions which should be able to help resolve it with all the uncertainties.
- The very first action to do is to check if the original matrix itself contains valid entries.
hasNaN()
andallFinite()
methods will help. - Incomplete LU preconditioner provides the
info()
function, that will answer the question if the computation of ILU was successful. - One can try playing with the ILU parameters, such as tolerance and fill-factor via
setDropTol()
andsetFillfactor()
and see if it results in a differentinfo()
outcome or helps the iterative solution process. - It is also unclear if Eigen is linked against some BLAS/LAPACK library (say, Intel MKL) and/or sparse solver (say, SuperLU). Turning those options on/off can certainly help to identify the source of the problem. The cleanest run, where Eigen is linked against the reliable BLAS/LAPACK without any additional libraries should be expected to be successful, provided 1-3 are alright.
Next, it is unclear, if the system being solved is sparse or dense. If the original matrix is dense, there might be a memory problem. For $N=200$, dense matrix together with the preconditioner will take only a few megabytes; however, in case of a dense matrix, $N=20000$, large fill-in and tolerance in the preconditioner, one can certainly exceed the memory, say, while trying to "invert" the ILU.
- Check the memory usage and requirements for your problems.
If something very peculiar happens, it is very interesting to understand what kind of beast we are trying to solve. Then:
- Plot the singular values for your matrix
- Calculate the condition number
The same debugging algorithm generally should apply to other similar problems with slight variations on the preconditioner parameters.