One-step restarted GMRES stagnation example (source code)

= One-step restarted GMRES stagnation example
{title2=$A=\operatorname{diag}(1,-1),\quad b=(1,1)^T,\quad x_0=0$}

One step of restarted <GMRES> searches along the current residual. In the displayed nonsingular system, the first residual minimization is $\min_\alpha[(1-\alpha)^2+(1+\alpha)^2]$, whose minimizer is zero. Restarting then repeats the same problem forever and never moves. Unrestarted <GMRES> instead solves exactly at step two, since $b,Ab$ span the entire space. Thus a smaller search-space cost can come at the price of stagnation; nonsingularity alone does not guarantee progress for one-step restarting.