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 A stored with z nonzeros.
- L4: the squared norm rTr costs 2n−1 flops (∥b∥2 is computed once).
- L5: Ap costs at most 2z flops (z multiplications, at most z additions); ATp~ the same 2z, as a scatter over the same nonzeros; p~Tq costs 2n−1.
- L6 and L9: two divisions and one inner product r~Tr, 2n+O(1).
- L7, L8, L10: five updates of the form y←y+cw, 2n each, 10n in total.
Sum: 4z+(2n)+(2n)+(2n)+10n+O(1)=4z+16n+O(1) flops, with exactly one product by A and one by AT, so 2 matvecs per step. For k steps plus the initial residual (2z+n) this is O(k(z+n)) time.
Space: the vectors x,r,r~,p,p~,q,q~ are seven arrays of length n, reused across steps, plus O(1) scalars: Θ(n) besides the matrix, for every k. ■
Biorthogonality and finite termination of BiCG full
This proof shows: correctness, termination.
Exact arithmetic. Notation of the page; write ⟨v~,w⟩=v~Tw. Indices refer to the values after the kth pass of L5 to L10, with r0=b−Ax0, p0=r0, p~0=r~0, ρk=r~kTrk, σk=p~kTApk. Assume no breakdown up to step k: ρj=0 and σj=0 for j<k.
The recurrences are, for j≥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, with αj=ρj/σj and βj=ρj+1/ρj, and xj+1=xj+αjpj.
Lemma 1 (invariant). b−Axj=rj for all j.
Proof. True for j=0; and b−Axj+1=rj−αjApj=rj+1. □
Lemma 2 (spaces). rj,pj∈Kj+1(A,r0) and r~j,p~j∈Kj+1(AT,r~0), and xj∈x0+Kj(A,r0).
Proof. Induction from the recurrences: multiplying by A raises the index by one. □
Theorem 1 (biorthogonality). For all i=j with i,j≤k:
(a) r~iTrj=0,(b) p~iTApj=0. Proof. Induction on k. For k=0 there is nothing to prove. Assume (a) and (b) for indices up to k; we show them for pairs involving k+1. By symmetry of the argument (swap the roles of A and AT, primal and shadow), it suffices to show r~iTrk+1=0 and p~iTApk+1=0 for i≤k; the transposed statements r~k+1Tri=0 and p~k+1TApi=(ATp~k+1)Tpi=0 follow in the same way.
Step 1: p~iTrk+1=0 for i≤k. Note p~i=r~i+βi−1p~i−1 is a combination of r~0,…,r~i. For i<k: p~iTrk+1=p~iTrk−αkp~iTApk=0−0, by the induction hypotheses (a) (since p~i is a combination of r~0,…,r~i, i<k) and (b). For i=k: p~kTrk=r~kTrk+βk−1p~k−1Trk=ρk+0, so p~kTrk+1=ρk−αkσk=0 by the choice of αk.
Step 2: (a) for k+1. r~i=p~i−βi−1p~i−1 (with p~−1=0), so r~iTrk+1=0 by Step 1.
Step 3: (b) for k+1. For i≤k, ATp~i=(r~i−r~i+1)/αi, so
p~iTApk+1=p~iTArk+1+βkp~iTApk=αi(r~i−r~i+1)Trk+1+βkp~iTApk. For i<k both terms vanish by (a) for k+1 (Step 2) and (b). For i=k the first term is −r~k+1Trk+1/αk=−ρk+1σk/ρk (using r~kTrk+1=0) and the second is βkσk=ρk+1σk/ρk; they cancel. (αi=0 because ρi=0.) □
Corollary 1 (Petrov-Galerkin). rk⊥Kk(AT,r~0).
Proof. By Lemma 2 and the nonvanishing ρj, r~0,…,r~k−1 are independent (Theorem 1(a) makes the matrix [r~iTrj] diagonal with nonzero diagonal) and lie in Kk(AT,r~0), so they span it; rk is orthogonal to each by Theorem 1(a). □
Theorem 2 (finite termination). If no breakdown occurs, then rk=0 for some k≤n, and then xk=A−1b.
Proof. Suppose r0,…,rn are all nonzero and no breakdown occurs, so ρ0,…,ρn=0. The (n+1)×(n+1) matrix [r~iTrj] is diagonal with nonzero diagonal by Theorem 1(a), hence nonsingular, so r0,…,rn would be n+1 independent vectors in Rn, a contradiction. So rk=0 for some k≤n (the L4 test catches it before any division, since ρ is tested after the residual), and Axk=b by Lemma 1. □
Theorem 3 (the code terminates). The loop L3 runs at most 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 updates. ■