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 1


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.

  1. The very first action to do is to check if the original matrix itself contains valid entries. hasNaN() and allFinite() methods will help.
  2. Incomplete LU preconditioner provides the info() function, that will answer the question if the computation of ILU was successful.
  3. One can try playing with the ILU parameters, such as tolerance and fill-factor via setDropTol() and setFillfactor() and see if it results in a different info() outcome or helps the iterative solution process.
  4. 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.

  1. Check the memory usage and requirements for your problems.
  2. 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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.