Algorithm Search⌘K

Proofs: Jacobi method

These are the human proofs of Jacobi method, at full length.

The number of Jacobi sweeps for a diagonally dominant matrix full

This proof shows: sweeps.worst, time.worst.

Exact arithmetic. Assume AA is strictly row diagonally dominant, so q=∥GJ∥∞<1q = \|G_J\|_\infty < 1 (Theorem 3 of the correctness proof), and let 0<ε<10 < \varepsilon < 1.

Claim. After k∗=⌈ln⁡(1/ε)/ln⁡(1/q)⌉k^\ast = \lceil \ln(1/\varepsilon) / \ln(1/q) \rceil sweeps, ∥ek∗∥∞≤ε∥e0∥∞\|e_{k^\ast}\|_\infty \le \varepsilon \|e_0\|_\infty. (If q=0q = 0, one sweep gives e1=0e_1 = 0.)

Proof. By Theorem 3, ∥ek∥∞≤qk∥e0∥∞\|e_k\|_\infty \le q^k \|e_0\|_\infty. For 0<q<10 < q < 1, qk≤εq^k \le \varepsilon is equivalent to kln⁡(1/q)≥ln⁡(1/ε)k \ln(1/q) \ge \ln(1/\varepsilon), which holds for k=k∗k = k^\ast. □\square

Cost per sweep. For each row ii with ziz_i nonzeros (diagonal included), line L3 does zi−1z_i - 1 multiplications and zi−2z_i - 2 additions, line L4 two subtractions and a multiplication, and line L8 a subtraction and a division. That is 2zi+32 z_i + 3 flops, so 2z+3n=O(z)2z + 3n = O(z) per sweep since z≥nz \ge n, plus nn comparisons for the norm in line L5. Each nonzero of AA is read once per sweep. With k∗k^\ast sweeps the time is O(zln⁡(1/ε)/ln⁡(1/q))O(z \ln(1/\varepsilon) / \ln(1/q)). The extra storage is the vectors ss and rr, that is Θ(n)\Theta(n). □\square

■\blacksquare

Convergence and rounding error of the Jacobi method full

This proof shows: correctness, termination.

Notation of the page: A=D+L+UA = D + L + U with aii≠0a_{ii} \ne 0, G=GJ=−D−1(L+U)=I−D−1AG = G_J = -D^{-1}(L + U) = I - D^{-1} A, c=D−1bc = D^{-1} b, q=∥G∥∞q = \|G\|_\infty. Line L8 of the pseudocode computes xk+1=Gxk+cx_{k+1} = G x_k + c, since (bi−si)/aii=ci+(Gxk)i(b_i - s_i)/a_{ii} = c_i + (G x_k)_i.

Lemma 1 (fixed point). Ax=bA x = b if and only if x=Gx+cx = G x + c.

Proof. x=Gx+c  ⟺  Dx=−(L+U)x+b  ⟺  (D+L+U)x=bx = G x + c \iff D x = -(L + U) x + b \iff (D + L + U) x = b. □\square

Theorem 1 (error recursion). If Ax=bA x = b then ek=x−xke_k = x - x_k satisfies ek=Gke0e_k = G^k e_0.

Proof. Subtract xk+1=Gxk+cx_{k+1} = G x_k + c from x=Gx+cx = G x + c: ek+1=Geke_{k+1} = G e_k. Induct on kk. □\square

Theorem 2 (convergence criterion). xk→xx_k \to x for every x0x_0 if and only if ρ(G)<1\rho(G) < 1.

Proof. By Theorem 1, convergence for every x0x_0 means Gkv→0G^k v \to 0 for every vv, that is Gk→0G^k \to 0. If ρ(G)<1\rho(G) < 1, then for any δ>0\delta > 0 there is a norm with ∥G∥≤ρ(G)+δ\|G\| \le \rho(G) + \delta (Horn and Johnson, Lemma 5.6.10); with δ=(1−ρ(G))/2\delta = (1 - \rho(G))/2 this gives ∥Gk∥≤∥G∥k→0\|G^k\| \le \|G\|^k \to 0. If ρ(G)≥1\rho(G) \ge 1, take an eigenpair Gv=λvG v = \lambda v with ∣λ∣≥1|\lambda| \ge 1 and v≠0v \ne 0. If λ\lambda is real, vv can be taken real, and e0=ve_0 = v gives ∥ek∥=∣λ∣k∥v∥↛0\|e_k\| = |\lambda|^k \|v\| \not\to 0. If λ\lambda is not real, v=v1+iv2v = v_1 + i v_2 with v1,v2v_1, v_2 real, and Gkv1,Gkv2G^k v_1, G^k v_2 cannot both tend to 00, since then Gkv=λkvG^k v = \lambda^k v would too. □\square

Theorem 3 (diagonal dominance). If ∑j≠i∣aij∣<∣aii∣\sum_{j \ne i} |a_{ij}| < |a_{ii}| for every ii, then q<1q < 1 and ∥ek∥∞≤qk∥e0∥∞\|e_k\|_\infty \le q^k \|e_0\|_\infty. In particular AA is nonsingular and xk→xx_k \to x.

Proof. ∥G∥∞=max⁡i∑j≠i∣aij∣/∣aii∣<1\|G\|_\infty = \max_i \sum_{j \ne i} |a_{ij}| / |a_{ii}| < 1. If Av=0A v = 0, Lemma 1 with b=0b = 0 gives v=Gvv = G v, so ∥v∥∞≤q∥v∥∞\|v\|_\infty \le q \|v\|_\infty and v=0v = 0. Theorem 1 then gives ∥ek∥∞≤∥G∥∞k∥e0∥∞\|e_k\|_\infty \le \|G\|_\infty^k \|e_0\|_\infty. □\square

Theorem 4 (rounding). Assume the floating point model fl(a∘b)=(a∘b)(1+δ)\mathrm{fl}(a \circ b) = (a \circ b)(1 + \delta) with ∣δ∣≤u|\delta| \le u, with no underflow or overflow, and mu<1m u < 1 for m=n+1m = n + 1. Let AA be strictly row diagonally dominant, Ax=bA x = b, and suppose p=q(1+γn+1)<1p = q (1 + \gamma_{n+1}) < 1. Let x^k\hat x_k be the iterates that the pseudocode computes in floating point, with sis_i summed in any order. Then for all k≥0k \ge 0

∥x−x^k∥∞≤pk∥x−x^0∥∞+γn+1(1+2q)1−p∥x∥∞.\|x - \hat x_k\|_\infty \le p^k \|x - \hat x_0\|_\infty + \frac{\gamma_{n+1}(1 + 2q)}{1 - p} \|x\|_\infty .

Proof. Fix kk and ii, and write y=x^ky = \hat x_k. Line L3 computes s^i=∑j≠iaijyj(1+θj)\hat s_i = \sum_{j \ne i} a_{ij} y_j (1 + \theta_j), where 1+θj1 + \theta_j is a product of at most n−1n - 1 factors (1+δ)±1(1 + \delta)^{\pm 1}: one for the multiplication and at most n−2n - 2 for the additions. Line L8 then rounds a subtraction and a division, so

x^k+1,i=bi(1+η0)−∑j≠iaijyj(1+ηj)aii,\hat x_{k+1, i} = \frac{b_i (1 + \eta_0) - \sum_{j \ne i} a_{ij} y_j (1 + \eta_j)}{a_{ii}},

where each 1+ηj1 + \eta_j is a product of at most n+1n + 1 factors (1+δ)±1(1 + \delta)^{\pm 1}. By Higham, Lemma 3.1, ∣ηj∣≤γn+1|\eta_j| \le \gamma_{n+1}. Hence x^k+1=Gy+c+ξk\hat x_{k+1} = G y + c + \xi_k with

∣ξk,i∣≤γn+1(∣ci∣+∑j≠i∣aij∣∣aii∣∣yj∣),∥ξk∥∞≤γn+1(∥c∥∞+q∥y∥∞).|\xi_{k,i}| \le \gamma_{n+1} \Bigl( |c_i| + \sum_{j \ne i} \frac{|a_{ij}|}{|a_{ii}|} |y_j| \Bigr), \qquad \|\xi_k\|_\infty \le \gamma_{n+1} \bigl( \|c\|_\infty + q \|y\|_\infty \bigr).

Since x=Gx+cx = G x + c, the error e^k=x−x^k\hat e_k = x - \hat x_k satisfies e^k+1=Ge^k−ξk\hat e_{k+1} = G \hat e_k - \xi_k. Also c=(I−G)xc = (I - G) x gives ∥c∥∞≤(1+q)∥x∥∞\|c\|_\infty \le (1 + q) \|x\|_\infty, and ∥y∥∞≤∥x∥∞+∥e^k∥∞\|y\|_\infty \le \|x\|_\infty + \|\hat e_k\|_\infty. So

∥e^k+1∥∞≤q∥e^k∥∞+γn+1((1+q)∥x∥∞+q∥x∥∞+q∥e^k∥∞)=p∥e^k∥∞+β,\|\hat e_{k+1}\|_\infty \le q \|\hat e_k\|_\infty + \gamma_{n+1} \bigl( (1 + q) \|x\|_\infty + q \|x\|_\infty + q \|\hat e_k\|_\infty \bigr) = p \|\hat e_k\|_\infty + \beta,

with β=γn+1(1+2q)∥x∥∞\beta = \gamma_{n+1} (1 + 2q) \|x\|_\infty. By induction, ∥e^k∥∞≤pk∥e^0∥∞+β(1+p+⋯+pk−1)≤pk∥e^0∥∞+β/(1−p)\|\hat e_k\|_\infty \le p^k \|\hat e_0\|_\infty + \beta (1 + p + \cdots + p^{k-1}) \le p^k \|\hat e_0\|_\infty + \beta / (1 - p). □\square

Theorem 5 (termination and output). The pseudocode stops after at most kmax⁡+1k_{\max} + 1 executions of lines L2 to L4 and kmax⁡k_{\max} sweeps. If it returns CONVERGED, then the vector rr that it computed for the returned xx in line L4 satisfies ∥r∥∞≤tol⋅∥b∥∞\|r\|_\infty \le \text{tol} \cdot \|b\|_\infty.

Proof. The outer loop runs over k=0,…,kmax⁡k = 0, \ldots, k_{\max}, and line L6 returns at k=kmax⁡k = k_{\max} at the latest. Line L5 is the only place that returns CONVERGED, and it tests exactly this inequality for the current xx, which lines L2 to L4 used. Line L8 changes xx only after the test. □\square

■\blacksquare

Back to Jacobi method