Algorithm Search⌘K

Proofs: GMRES

These are the human proofs of GMRES, at full length.

Operation count of GMRES full

This proof shows: time.worst, time.restarted, space.extra, space.restarted, matvecs.worst, flops.worst.

Count flops (one addition or multiplication each) for kk Arnoldi steps on an n×nn \times n matrix with zz nonzeros, with the dense helpers replaced by CSR products as in the implementation.

Step jj (L4 to L8). L4 is one matvec: zz multiplications and at most zz additions, so 2z2 z flops. L5 performs jj inner products (2n−12 n - 1 flops each) and jj updates w←w−hvw \leftarrow w - h v (2n2 n flops each): j(4n−1)j(4 n - 1) flops. L6 is a norm and a scaling, 3n+O(1)3 n + O(1) flops and one square root. L7 applies j−1j - 1 rotations to a column and forms one, 6j+O(1)6 j + O(1) flops, independent of nn. Total for step jj: 2z+4jn+O(n+j)2 z + 4 j n + O(n + j).

Full GMRES, kk steps. Summing, ∑j=1k(2z+4jn+O(n))=2kz+2k(k+1)n+O(kn)=2kz+2k2n+O(kn)\sum_{j=1}^{k} (2 z + 4 j n + O(n)) = 2 k z + 2 k(k+1) n + O(k n) = 2 k z + 2 k^2 n + O(k n) flops. L9 adds k2k^2 flops for the triangular solve and 2kn2 k n for VkyV_k y, and L1 a matvec and O(n)O(n). So the flop count is 2kz+2k2n+O(kn)2 k z + 2 k^2 n + O(k n), the number of matvecs is kk (plus one per restart for r0r_0), and the time is O(kz+k2n)O(k z + k^2 n).

Restarted, GMRES(mm). Each cycle has at most mm steps, and in step j≤mj \le m the Gram-Schmidt cost is 4jn≤4mn4 j n \le 4 m n; so kk steps in total cost at most 2kz+4kmn+O(kn)2 k z + 4 k m n + O(k n) flops, which is O(kz+kmn)O(k z + k m n), plus ⌈k/m⌉\lceil k/m \rceil extra matvecs for the restarts.

Space. The basis v1,…,vj+1v_1, \dots, v_{j+1} takes (j+1)n(j + 1) n words, HH and the rotations O(j2)O(j^2), and xx, rr, ww another 3n3 n. With j≤kj \le k this is Θ(kn)\Theta(k n) for k≤nk \le n (the basis is stored in full, so the bound is attained), and with j≤mj \le m it is Θ(mn)\Theta(m n). ■\blacksquare

GMRES minimizes the residual over the Krylov subspace and terminates full

This proof shows: correctness, termination.

Exact arithmetic throughout. Notation of the page: AA nonsingular of order nn, r0=b−Ax0≠0r_0 = b - A x_0 \ne 0, β=∥r0∥2\beta = \|r_0\|_2, Kj=Kj(A,r0)\mathcal K_j = \mathcal K_j(A, r_0), Pj0\mathcal P_j^0 the polynomials of degree at most jj with value 11 at 00. Let dd be the grade of r0r_0: the least dd with Adr0∈KdA^d r_0 \in \mathcal K_d. Then dim⁡Kj=j\dim \mathcal K_j = j for j≤dj \le d and d≤nd \le n.

Lemma 1 (Arnoldi). For j≤dj \le d, after step jj of L4 to L6 the vectors v1,…,vjv_1, \dots, v_j are orthonormal and span Kj\mathcal K_j, hj+1,j=0h_{j+1,j} = 0 if and only if j=dj = d, and if j<dj < d then vj+1v_{j+1} is a unit vector orthogonal to v1,…,vjv_1, \dots, v_j with span⁡{v1,…,vj+1}=Kj+1\operatorname{span}\{v_1, \dots, v_{j+1}\} = \mathcal K_{j+1}. In all cases Avj=∑i=1j+1hijviA v_j = \sum_{i=1}^{j+1} h_{ij} v_i (with hj+1,jvj+1h_{j+1,j} v_{j+1} read as 00 when hj+1,j=0h_{j+1,j} = 0), that is AVj=Vj+1HˉjA V_j = V_{j+1} \bar H_j.

Proof. Induction on jj. For j=1j = 1, v1=r0/βv_1 = r_0 / \beta spans K1\mathcal K_1. Assume the claim for v1,…,vjv_1, \dots, v_j. Modified Gram-Schmidt in L5 subtracts from w=Avjw = A v_j its components along v1,…,vjv_1, \dots, v_j one at a time; because the viv_i are orthonormal, the coefficient viTwv_i^T w computed from the partially reduced ww equals viTAvjv_i^T A v_j (the earlier subtractions are along vectors orthogonal to viv_i). So the final w=Avj−∑i≤jhijviw = A v_j - \sum_{i \le j} h_{ij} v_i is orthogonal to v1,…,vjv_1, \dots, v_j, and Avj=∑i≤jhijvi+wA v_j = \sum_{i \le j} h_{ij} v_i + w. Since vj∈Kjv_j \in \mathcal K_j has a nonzero component along Aj−1r0A^{j-1} r_0 (the viv_i span a strictly increasing chain), Avj∈Kj+1∖KjA v_j \in \mathcal K_{j+1} \setminus \mathcal K_j when dim⁡Kj+1=j+1\dim \mathcal K_{j+1} = j + 1, i.e. when j<dj < d; then w≠0w \ne 0, hj+1,j=∥w∥2>0h_{j+1,j} = \|w\|_2 > 0 and vj+1=w/hj+1,jv_{j+1} = w / h_{j+1,j} completes an orthonormal basis of Kj+1\mathcal K_{j+1}. When j=dj = d, Avj∈AKd⊆KdA v_j \in A \mathcal K_d \subseteq \mathcal K_d, so w=0w = 0. □\square

Lemma 2 (least squares form). For x=x0+Vjyx = x_0 + V_j y, ∥b−Ax∥2=∥βe1−Hˉjy∥2\|b - A x\|_2 = \|\beta e_1 - \bar H_j y\|_2.

Proof. b−Ax=r0−AVjy=βv1−Vj+1Hˉjy=Vj+1(βe1−Hˉjy)b - A x = r_0 - A V_j y = \beta v_1 - V_{j+1} \bar H_j y = V_{j+1} (\beta e_1 - \bar H_j y), and Vj+1V_{j+1} has orthonormal columns, so it preserves the 2-norm. (If hj+1,j=0h_{j+1,j} = 0 the last row of Hˉj\bar H_j is zero and the same holds with VjV_j.) □\square

Lemma 3 (Givens). Let Qj=Gj⋯G1Q_j = G_j \cdots G_1 be the product of the rotations formed in L7, each acting on two consecutive coordinates. Then QjHˉj=(Rj0)Q_j \bar H_j = \begin{pmatrix} R_j \\ 0 \end{pmatrix} with RjR_j upper triangular, Qjβe1=gQ_j \beta e_1 = g, and

min⁡y∥βe1−Hˉjy∥2=∣gj+1∣,\min_y \|\beta e_1 - \bar H_j y\|_2 = |g_{j+1}|,

attained at y=Rj−1g1:jy = R_j^{-1} g_{1:j} when RjR_j is nonsingular.

Proof. Induction on jj. Assume Qj−1Hˉj−1=(Rj−10)Q_{j-1} \bar H_{j-1} = \begin{pmatrix} R_{j-1} \\ 0 \end{pmatrix}. The matrix Hˉj\bar H_j adds a row of zeros (except hj+1,jh_{j+1,j}) and a column jj with nonzeros only in rows 1,…,j+11, \dots, j + 1. The rotations G1,…,Gj−1G_1, \dots, G_{j-1} act on rows 1,…,j1, \dots, j, so they leave hj+1,jh_{j+1,j} alone and turn the first j−1j - 1 columns into (Rj−10)\begin{pmatrix} R_{j-1} \\ 0 \end{pmatrix} padded with a zero row; this is exactly L7 applying the old rotations to column jj. Then GjG_j, with c=hjj/ρc = h_{jj}/\rho and s=hj+1,j/ρs = h_{j+1,j}/\rho, maps the pair (hjj,hj+1,j)(h_{jj}, h_{j+1,j}) to (ρ,0)(\rho, 0) and mixes only rows jj and j+1j + 1, where the first j−1j - 1 columns are zero. So QjHˉjQ_j \bar H_j is upper triangular with a zero last row. Since QjQ_j is orthogonal, ∥βe1−Hˉjy∥2=∥g−(Rj0)y∥2\|\beta e_1 - \bar H_j y\|_2 = \|g - \begin{pmatrix} R_j \\ 0 \end{pmatrix} y\|_2, whose square is ∥g1:j−Rjy∥22+gj+12\|g_{1:j} - R_j y\|_2^2 + g_{j+1}^2. □\square

Lemma 4 (RjR_j is nonsingular). If AA is nonsingular, then Hˉj\bar H_j has full column rank jj for j≤dj \le d, so every ρ\rho in L7 is nonzero.

Proof. AVj=Vj+1HˉjA V_j = V_{j+1} \bar H_j (or VjHjV_j H_j when j=dj = d); the left side has rank jj because AA is nonsingular and VjV_j has independent columns. Hence Hˉj\bar H_j has rank jj, and so does RjR_j, whose diagonal entries are the values ρ\rho. □\square

Theorem 1 (correctness). At the end of a cycle of j≤dj \le d steps, the xx formed in L9 is the unique minimizer of ∥b−Ax∥2\|b - A x\|_2 over x0+Kjx_0 + \mathcal K_j, and its residual norm is ∣gj+1∣|g_{j+1}|. Equivalently ∥rj∥2=min⁡p∈Pj0∥p(A)r0∥2\|r_j\|_2 = \min_{p \in \mathcal P_j^0} \|p(A) r_0\|_2.

Proof. Every x∈x0+Kjx \in x_0 + \mathcal K_j is x0+Vjyx_0 + V_j y for a unique yy (Lemma 1). By Lemmas 2 and 3 the residual is minimized exactly by y=Rj−1g1:jy = R_j^{-1} g_{1:j} (Lemma 4), with value ∣gj+1∣|g_{j+1}|. The polynomial form follows from {r0−Aq(A)r0:deg⁡q≤j−1}={p(A)r0:p∈Pj0}\{r_0 - A q(A) r_0 : \deg q \le j - 1\} = \{p(A) r_0 : p \in \mathcal P_j^0\}. □\square

Corollary (monotonicity). Kj⊆Kj+1\mathcal K_j \subseteq \mathcal K_{j+1}, so within a cycle ∣gj+2∣≤∣gj+1∣|g_{j+2}| \le |g_{j+1}|; across a restart the new cycle starts from the last iterate, whose residual is the old minimum, so the residual norms never increase.

Theorem 2 (termination). If AA is nonsingular, full GMRES (m=nm = n) returns the exact solution after d≤nd \le n steps; every run returns after at most kmax\mathrm{kmax} Arnoldi steps.

Proof. At step dd, hd+1,d=0h_{d+1,d} = 0 (Lemma 1), so L8 leaves the loop. Then Kd\mathcal K_d is AA-invariant and AA restricted to it is nonsingular, so A−1r0∈KdA^{-1} r_0 \in \mathcal K_d and x0+A−1r0=A−1bx_0 + A^{-1} r_0 = A^{-1} b lies in x0+Kdx_0 + \mathcal K_d, with residual 00. By Theorem 1 the iterate formed in L9 attains the minimum, which is 00. For the step limit: each pass of L4 counts one step, the loop and the restart test in L1 stop when the count reaches kmax\mathrm{kmax}, and each cycle performs at least one step, so the number of cycles is at most kmax+1\mathrm{kmax} + 1. ■\blacksquare

Remarks. (i) If AA is singular, Lemma 4 fails and ρ=0\rho = 0 can occur; then AA is singular on Kj\mathcal K_j, the code stops with BREAKDOWN, and the iterate of step j−1j - 1 is returned. (ii) The SPD bound of the page follows from Theorem 1 by choosing pp as the scaled Chebyshev polynomial Tk((λmax⁡+λmin⁡−2λ)/(λmax⁡−λmin⁡))/Tk((λmax⁡+λmin⁡)/(λmax⁡−λmin⁡))T_k((\lambda_{\max} + \lambda_{\min} - 2\lambda)/(\lambda_{\max} - \lambda_{\min})) / T_k((\lambda_{\max} + \lambda_{\min})/(\lambda_{\max} - \lambda_{\min})), whose maximum on [λmin⁡,λmax⁡][\lambda_{\min}, \lambda_{\max}] is at most 2((κ−1)/(κ+1))k2 ((\sqrt\kappa - 1)/(\sqrt\kappa + 1))^k, and using ∥p(A)r0∥2≤max⁡λ∣p(λ)∣∥r0∥2\|p(A) r_0\|_2 \le \max_{\lambda} |p(\lambda)| \|r_0\|_2 for symmetric AA. (iii) The floating-point backward stability of MGS-GMRES is the theorem of Paige, Rozložník and Strakoš (2006); it is quoted, not proved, here.

Back to GMRES