Algorithm Search⌘K

Proofs: Biconjugate gradient method

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

Cost per step of BiCG full

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

Count flops for one pass of L4 to L10, with AA stored with zz nonzeros.

  • L4: the squared norm rTrr^T r costs 2n−12 n - 1 flops (∥b∥2\|b\|_2 is computed once).
  • L5: ApA p costs at most 2z2 z flops (zz multiplications, at most zz additions); ATp~A^T \tilde p the same 2z2 z, as a scatter over the same nonzeros; p~Tq\tilde p^T q costs 2n−12 n - 1.
  • L6 and L9: two divisions and one inner product r~Tr\tilde r^T r, 2n+O(1)2 n + O(1).
  • L7, L8, L10: five updates of the form y←y+cwy \leftarrow y + c w, 2n2 n each, 10n10 n in total.

Sum: 4z+(2n)+(2n)+(2n)+10n+O(1)=4z+16n+O(1)4 z + (2n) + (2n) + (2n) + 10 n + O(1) = 4 z + 16 n + O(1) flops, with exactly one product by AA and one by ATA^T, so 2 matvecs per step. For kk steps plus the initial residual (2z+n2 z + n) this is O(k(z+n))O(k (z + n)) time.

Space: the vectors x,r,r~,p,p~,q,q~x, r, \tilde r, p, \tilde p, q, \tilde q are seven arrays of length nn, reused across steps, plus O(1)O(1) scalars: Θ(n)\Theta(n) besides the matrix, for every kk. ■\blacksquare

Biorthogonality and finite termination of BiCG full

This proof shows: correctness, termination.

Exact arithmetic. Notation of the page; write ⟨v~,w⟩=v~Tw\langle \tilde v, w \rangle = \tilde v^T w. Indices refer to the values after the kkth pass of L5 to L10, with r0=b−Ax0r_0 = b - A x_0, p0=r0p_0 = r_0, p~0=r~0\tilde p_0 = \tilde r_0, ρk=r~kTrk\rho_k = \tilde r_k^T r_k, σk=p~kTApk\sigma_k = \tilde p_k^T A p_k. Assume no breakdown up to step kk: ρj≠0\rho_j \ne 0 and σj≠0\sigma_j \ne 0 for j<kj < k.

The recurrences are, for j≥0j \ge 0,

rj+1=rj−αjApj,r~j+1=r~j−αjATp~j,pj+1=rj+1+βjpj,p~j+1=r~j+1+βjp~j,r_{j+1} = r_j - \alpha_j A p_j, \quad \tilde r_{j+1} = \tilde r_j - \alpha_j A^T \tilde p_j, \quad p_{j+1} = r_{j+1} + \beta_j p_j, \quad \tilde p_{j+1} = \tilde r_{j+1} + \beta_j \tilde p_j,

with αj=ρj/σj\alpha_j = \rho_j / \sigma_j and βj=ρj+1/ρj\beta_j = \rho_{j+1} / \rho_j, and xj+1=xj+αjpjx_{j+1} = x_j + \alpha_j p_j.

Lemma 1 (invariant). b−Axj=rjb - A x_j = r_j for all jj.

Proof. True for j=0j = 0; and b−Axj+1=rj−αjApj=rj+1b - A x_{j+1} = r_j - \alpha_j A p_j = r_{j+1}. □\square

Lemma 2 (spaces). rj,pj∈Kj+1(A,r0)r_j, p_j \in \mathcal K_{j+1}(A, r_0) and r~j,p~j∈Kj+1(AT,r~0)\tilde r_j, \tilde p_j \in \mathcal K_{j+1}(A^T, \tilde r_0), and xj∈x0+Kj(A,r0)x_j \in x_0 + \mathcal K_j(A, r_0).

Proof. Induction from the recurrences: multiplying by AA raises the index by one. □\square

Theorem 1 (biorthogonality). For all i≠ji \ne j with i,j≤ki, j \le k:

(a) r~iTrj=0,(b) p~iTApj=0.\text{(a)} \ \tilde r_i^T r_j = 0, \qquad \text{(b)} \ \tilde p_i^T A p_j = 0.

Proof. Induction on kk. For k=0k = 0 there is nothing to prove. Assume (a) and (b) for indices up to kk; we show them for pairs involving k+1k + 1. By symmetry of the argument (swap the roles of AA and ATA^T, primal and shadow), it suffices to show r~iTrk+1=0\tilde r_i^T r_{k+1} = 0 and p~iTApk+1=0\tilde p_i^T A p_{k+1} = 0 for i≤ki \le k; the transposed statements r~k+1Tri=0\tilde r_{k+1}^T r_i = 0 and p~k+1TApi=(ATp~k+1)Tpi=0\tilde p_{k+1}^T A p_i = (A^T \tilde p_{k+1})^T p_i = 0 follow in the same way.

Step 1: p~iTrk+1=0\tilde p_i^T r_{k+1} = 0 for i≤ki \le k. Note p~i=r~i+βi−1p~i−1\tilde p_i = \tilde r_i + \beta_{i-1} \tilde p_{i-1} is a combination of r~0,…,r~i\tilde r_0, \dots, \tilde r_i. For i<ki < k: p~iTrk+1=p~iTrk−αkp~iTApk=0−0\tilde p_i^T r_{k+1} = \tilde p_i^T r_k - \alpha_k \tilde p_i^T A p_k = 0 - 0, by the induction hypotheses (a) (since p~i\tilde p_i is a combination of r~0,…,r~i\tilde r_0, \dots, \tilde r_i, i<ki < k) and (b). For i=ki = k: p~kTrk=r~kTrk+βk−1p~k−1Trk=ρk+0\tilde p_k^T r_k = \tilde r_k^T r_k + \beta_{k-1} \tilde p_{k-1}^T r_k = \rho_k + 0, so p~kTrk+1=ρk−αkσk=0\tilde p_k^T r_{k+1} = \rho_k - \alpha_k \sigma_k = 0 by the choice of αk\alpha_k.

Step 2: (a) for k+1k + 1. r~i=p~i−βi−1p~i−1\tilde r_i = \tilde p_i - \beta_{i-1} \tilde p_{i-1} (with p~−1=0\tilde p_{-1} = 0), so r~iTrk+1=0\tilde r_i^T r_{k+1} = 0 by Step 1.

Step 3: (b) for k+1k + 1. For i≤ki \le k, ATp~i=(r~i−r~i+1)/αiA^T \tilde p_i = (\tilde r_i - \tilde r_{i+1}) / \alpha_i, so

p~iTApk+1=p~iTArk+1+βkp~iTApk=(r~i−r~i+1)Trk+1αi+βkp~iTApk.\tilde p_i^T A p_{k+1} = \tilde p_i^T A r_{k+1} + \beta_k \tilde p_i^T A p_k = \frac{(\tilde r_i - \tilde r_{i+1})^T r_{k+1}}{\alpha_i} + \beta_k \tilde p_i^T A p_k.

For i<ki < k both terms vanish by (a) for k+1k + 1 (Step 2) and (b). For i=ki = k the first term is −r~k+1Trk+1/αk=−ρk+1σk/ρk-\tilde r_{k+1}^T r_{k+1} / \alpha_k = -\rho_{k+1} \sigma_k / \rho_k (using r~kTrk+1=0\tilde r_k^T r_{k+1} = 0) and the second is βkσk=ρk+1σk/ρk\beta_k \sigma_k = \rho_{k+1} \sigma_k / \rho_k; they cancel. (αi≠0\alpha_i \ne 0 because ρi≠0\rho_i \ne 0.) □\square

Corollary 1 (Petrov-Galerkin). rk⊥Kk(AT,r~0)r_k \perp \mathcal K_k(A^T, \tilde r_0).

Proof. By Lemma 2 and the nonvanishing ρj\rho_j, r~0,…,r~k−1\tilde r_0, \dots, \tilde r_{k-1} are independent (Theorem 1(a) makes the matrix [r~iTrj][\tilde r_i^T r_j] diagonal with nonzero diagonal) and lie in Kk(AT,r~0)\mathcal K_k(A^T, \tilde r_0), so they span it; rkr_k is orthogonal to each by Theorem 1(a). □\square

Theorem 2 (finite termination). If no breakdown occurs, then rk=0r_k = 0 for some k≤nk \le n, and then xk=A−1bx_k = A^{-1} b.

Proof. Suppose r0,…,rnr_0, \dots, r_n are all nonzero and no breakdown occurs, so ρ0,…,ρn≠0\rho_0, \dots, \rho_n \ne 0. The (n+1)×(n+1)(n+1) \times (n+1) matrix [r~iTrj][\tilde r_i^T r_j] is diagonal with nonzero diagonal by Theorem 1(a), hence nonsingular, so r0,…,rnr_0, \dots, r_n would be n+1n + 1 independent vectors in Rn\mathbb{R}^n, a contradiction. So rk=0r_k = 0 for some k≤nk \le n (the L4 test catches it before any division, since ρ\rho is tested after the residual), and Axk=bA x_k = b by Lemma 1. □\square

Theorem 3 (the code terminates). The loop L3 runs at most kmax+1\mathrm{kmax} + 1 times; each pass either returns in L4 or L5 or completes. So the code always returns, with CONVERGED, a breakdown flag, or NOT-CONVERGED after kmax\mathrm{kmax} updates. ■\blacksquare

Back to Biconjugate gradient method