Cost of the Kaczmarz method full
This proof shows: time.expected, space.extra, steps.expected, flops.per_sweep.
A is stored by rows (CSR) with z nonzeros, zi in row i, so ∑izi=z.
Setup (line L1). The squared row norms cost 2z flops, and for the randomized order their cumulative sums m more additions. O(z+m) time and m words.
Flops per sweep. In a row step, bi−aiTx costs zi multiplications and zi additions or subtractions, line L6 one multiplication and one division (with ∥ai∥2 precomputed), and line L7 zi multiplications and zi additions. So 4zi+2 flops, and 4z+2m for the m steps of a sweep. The residual at line L8 costs 2z flops for Ax, m subtractions, and 2m for the norm, so a full sweep costs 6z+O(m) flops.
Steps for accuracy ε. By Theorem 5 of the correctness proof, E∥ek∥2≤(1−κ−2)k∥e0∥2≤e−k/κ2∥e0∥2, using 1−t≤e−t. So k=⌈κ2ln(1/ε)⌉ steps give E∥ek∥2≤ε∥e0∥2.
Expected time. A randomized step draws one uniform number and finds the row by binary search in the cumulative sums, O(logm), then costs O(zi+1)⊆O(n) for the row update. With the setup, k steps cost O(z+m+(n+logm)k), which with the k above is O(z+m+(n+logm)κ2log(1/ε)) (the residual test of line L8 is excluded from this count, since the bound concerns the error, not the stopping rule).
Space. The iterate takes n words, the row norms and cumulative sums 2m words, and the residual m words: Θ(m+n) extra space besides A and b. ■
Correctness of the Kaczmarz method full
This proof shows: correctness, termination.
Exact arithmetic throughout. A∈Rm×n has rows aiT, and only rows with ai=0 are used (line L5). One step on row i with relaxation ω maps x to x′=x+ω∥ai∥2bi−aiTxai.
Lemma 1 (projection). For ω=1, aiTx′=bi, and x′ is the point of the hyperplane Hi={y:aiTy=bi} nearest to x.
Proof. aiTx′=aiTx+(bi−aiTx)=bi. For any y∈Hi, x−x′=−∥ai∥2bi−aiTxai is parallel to ai and x′−y is orthogonal to ai (both lie in Hi), so ∥x−y∥2=∥x−x′∥2+∥x′−y∥2≥∥x−x′∥2. □
Theorem 2 (error identity). Let x∗ satisfy aiTx∗=bi, e=x−x∗, e′=x′−x∗ and ρ=bi−aiTx. Then ∥e′∥2=∥e∥2−ω(2−ω)ρ2/∥ai∥2.
Proof. ρ=aiT(x∗−x)=−aiTe, and e′=e+ωρai/∥ai∥2. Expanding, ∥e′∥2=∥e∥2+2ωρaiTe/∥ai∥2+ω2ρ2/∥ai∥2=∥e∥2−2ωρ2/∥ai∥2+ω2ρ2/∥ai∥2. □
So if Ax=b is consistent and 0<ω<2, the distance to every solution is nonincreasing, and strictly decreasing whenever the chosen equation is violated.
Lemma 3 (invariant subspace). Every iterate lies in x0+range(AT).
Proof. Each step adds a multiple of a row ai, which lies in range(AT). □
Let xˉ=A+b+(I−A+A)x0. If Ax=b is consistent, xˉ is a solution, and xˉ−x0=A+(b−Ax0)∈range(AT). Since range(AT)⊥kerA, for any solution y=xˉ+w, w∈kerA, ∥y−x0∥2=∥xˉ−x0∥2+∥w∥2, so xˉ is the solution nearest x0. By Lemma 3, ek=xk−xˉ∈range(AT) for all k.
Theorem 4 (cyclic convergence). If Ax=b is consistent and 0<ω<2, the cyclic iterates converge to xˉ.
Proof. Write one cyclic sweep on the error as e↦Qe with Q=Pm⋯P1, Pi=I−ωaiaiT/∥ai∥2 (identity for zero rows); this holds because bi=aiTxˉ. Each Pi is symmetric with eigenvalues 1 (on ai⊥) and 1−ω∈(−1,1), so ∥Pi∥2≤1, and ∥Piv∥=∥v∥ only if aiTv=0, in which case Piv=v. The space S=range(AT) is invariant under every Pi. Let v∈S with ∥Qv∥=∥v∥. Then every factor preserves the norm, so inductively a1Tv=0, P1v=v, a2Tv=0, and so on: v⊥ai for all i, so v∈S∩S⊥={0}. Hence ∥Qv∥<∥v∥ for every nonzero v in S, and by compactness of the unit sphere of S, q=maxv∈S,∥v∥=1∥Qv∥<1. So ∥esweep s∥≤qs∥e0∥, and the iterates within a sweep are bounded by the norm at the start of the sweep by Theorem 2. □
Theorem 5 (randomized rate, Strohmer and Vershynin). Let Ax=b be consistent, ω=1, and let each step choose row i independently with probability pi=∥ai∥2/∥A∥F2. Then E∥xk−xˉ∥2≤(1−σmin2/∥A∥F2)k∥x0−xˉ∥2, where σmin is the smallest nonzero singular value of A.
Proof. Condition on e=ek. By Theorem 2 with ω=1 and ρ=−aiTe, E[∥ek+1∥2∣e]=∥e∥2−∑ipi(aiTe)2/∥ai∥2=∥e∥2−∥Ae∥2/∥A∥F2. Since e∈range(AT), which is spanned by the right singular vectors of the nonzero singular values, ∥Ae∥2≥σmin2∥e∥2. So E[∥ek+1∥2∣e]≤(1−σmin2/∥A∥F2)∥e∥2; take expectations and induct. □
The factor equals 1−κ−2 with κ=∥A∥F/σmin=∥A∥F∥A+∥2, and it lies in [0,1) because ∥A∥F2=∑jσj2≥σmin2.
Termination. Line L2 runs at most maxit sweeps of m steps each, and each step is a constant number of vector operations, so the procedure halts. It returns "converged" only when line L9 has verified ∥b−Ax∥2≤tol⋅∥b∥2 for the returned x; otherwise it returns "maxit". ■