Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NaN in bicgstabl when using preconditioners #296

Open
davidschlegel opened this issue Apr 30, 2021 · 2 comments
Open

NaN in bicgstabl when using preconditioners #296

davidschlegel opened this issue Apr 30, 2021 · 2 comments

Comments

@davidschlegel
Copy link

In some cases, using a preconditioner results in NaNs in the bicgstabl function.
Tested with ilu preconditioner and DiagonalPreconditioner.
Here is an example:

using SparseArrays
using IncompleteLU
using IterativeSolvers

N = Int(1e5) #
d = 1e-4  # sparseness density
drop_tol = 0.1 # absolute drop tolerance for ilu
mat = sprand(N, N, d)
x = ones(N)  # solution vector
b = mat * x

prec = ilu(mat, τ=drop_tol)
@show nnz(prec)/nnz(mat)
sol, hist = bicgstabl(mat, b, Pl = prec, log = true, verbose = true)
@davidschlegel davidschlegel changed the title Nan in bicgstabl when using preconditioners NaN in bicgstabl when using preconditioners Apr 30, 2021
@deltaeecs
Copy link
Contributor

So do mine!

@davidschlegel
Copy link
Author

I now think, it's actually due to the problem and not because of the algorithm itself.
There are many reasons why bicgstabl might fail. One of them is the structure of the problem, i.e. the properties of the matrix. In some cases I find that making the system diagonally dominant, for instance by doing a reverse-Cuthill-McKee reordering of indices, the solver converges when the initial problem does not converge. It could be interesting though to have such a feature of index reordering as a parameter to the solver which is known in the numerics community to work well on a large class of problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants