GMRES Fails Silently From Stagnation
GMRES often fails to converge when restart is less than the problem dimension, but will return **without indicating failure.**
This failure (likely due to stagnation) seems to depend on the absolute difference between the problem dimension and the Krylov subspace dimension (restart.) ie. roughly 90% of the time GMRES will fail silently on a problem of dimension 25 if restart = 24, and will still fail 90% of the time with a problem of dimension 100 if restart = 99. For a difference in dimension of 5, the test below returns an incorrect value greater than 99% of the time.
Reproducing code:
```
import IterativeSolvers: gmres
import LinearAlgebra: cond, norm
for problem_dim in [25, 100]
for excess_dim in [0, 1, 5]
succeeded = 0
restart = problem_dim - excess_dim
for i = 1:100
condition_number = Inf
matrix = nothing
while condition_number > 1000
matrix = randn(Float64, (problem_dim, problem_dim))
condition_number = cond(matrix)
end
true_vec = randn(Float64, (problem_dim,))
b = matrix * true_vec
julia_soln = gmres(
matrix, b, restart=restart, log=false, abstol=1e-7
)
residual_norm = norm(julia_soln - true_vec)
succeeded += (residual_norm < 1) # very loose tolerance!
end
println("problem dim: $problem_dim. restart dim: $restart. succeeded: $succeeded")
end
end
```
0 条评论