Algorithm Search⌘K

Proofs: Cyclic reduction

These are the human proofs of Cyclic reduction, at full length.

Cost of cyclic reduction full

This proof shows: time.worst, time.best, space.extra, flops.worst, span.worst.

Let the levels have orders N0=nN_0 = n, Nj+1=⌊Nj/2⌋N_{j+1} = \lfloor N_j/2 \rfloor, until NL=1N_L = 1, so L=⌊log⁡2n⌋L = \lfloor \log_2 n \rfloor.

Flops per row. A reduced row with both neighbours costs 22 divisions (α\alpha, γ\gamma), 66 multiplications and 44 additions: 1212 flops. A reduced row without a right neighbour (when NjN_j is even, the last odd row) costs 66. Recovering an even unknown costs 55 flops with two neighbours, 33 with one, and the final 1×11 \times 1 solve costs 11.

Exact count for n=2k−1n = 2^k - 1. Then Nj=2k−j−1N_j = 2^{k-j} - 1 is odd for all jj, so every reduced row has both neighbours. The reduced rows number ∑j≥1Nj=∑i=1k−1(2i−1)=n−k\sum_{j \ge 1} N_j = \sum_{i=1}^{k-1}(2^i - 1) = n - k, costing 12(n−k)12(n - k). The recovered unknowns number ∑j<L(Nj−Nj+1)=n−1\sum_{j < L} (N_j - N_{j+1}) = n - 1; at each of the k−1k - 1 levels two of them are at the ends, so they cost 5(n−1)−4(k−1)5(n - 1) - 4(k - 1). With the final division, the total is 12(n−k)+5(n−1)−4(k−1)+1=17n−16k12(n - k) + 5(n - 1) - 4(k - 1) + 1 = 17 n - 16 k.

General nn. Every row costs at most its two-neighbour price, so the flops are at most 12∑j≥1Nj+5(n−1)+112 \sum_{j \ge 1} N_j + 5(n - 1) + 1. Since ∑j≥1⌊n/2j⌋=n−s(n)\sum_{j \ge 1} \lfloor n/2^j \rfloor = n - s(n), where s(n)≥1s(n) \ge 1 is the number of ones in the binary expansion of nn, this is at most 12(n−1)+5(n−1)+1≤17n12(n - 1) + 5(n - 1) + 1 \le 17 n. Each level has at most 22 end unknowns at 33 flops and at most one reduced row at 66, so at most 4+6=104 + 6 = 10 flops fewer than the full price 12(n−s(n))+5(n−1)+112(n - s(n)) + 5(n - 1) + 1. With s(n)≤log⁡2n+1s(n) \le \log_2 n + 1 and L≤log⁡2nL \le \log_2 n, the count is at least 17n−22log⁡2n−1617 n - 22 \log_2 n - 16, which is 17n−O(log⁡n)17 n - O(\log n). (For n<400n < 400 the tests observe the sharper lower bound 17n−16(⌊log⁡2n⌋+1)17 n - 16(\lfloor \log_2 n \rfloor + 1).)

Time. Each flop is O(1)O(1) work, and the bookkeeping per row is O(1)O(1), so the time is Θ(n)\Theta(n) in every case (every row is touched at least once).

Space. Level j≥1j \ge 1 stores four arrays of length NjN_j, and the back substitution an array of length NjN_j; ∑j≥1Nj<n\sum_{j \ge 1} N_j < n, so the extra storage is at most 5n+O(1)5 n + O(1) numbers plus the copy of the input, Θ(n)\Theta(n).

Span. With one processor per row, the rows of a level in lines L3 to L6 depend only on the previous level, so a level takes O(1)O(1) parallel steps; the same holds for lines L10 to L11. There are 2L+1=Θ(log⁡n)2L + 1 = \Theta(\log n) such phases, and they are sequential since each uses the previous one. So the span is Θ(log⁡n)\Theta(\log n). ■\blacksquare

Correctness of cyclic reduction full

This proof shows: correctness, termination.

Exact arithmetic. A level acts on a tridiagonal system of order N≥2N \ge 2 with rows aixi−1+bixi+cixi+1=dia_i x_{i-1} + b_i x_i + c_i x_{i+1} = d_i, a0=cN−1=0a_0 = c_{N-1} = 0. Let E={0,2,4,…}E = \{0, 2, 4, \ldots\} and O={1,3,5,…}O = \{1, 3, 5, \ldots\} be the even and odd indices below NN.

Lemma 1 (one level is a Schur complement). Suppose bk≠0b_k \ne 0 for every k∈Ek \in E. Write AA in the order (E,O)(E, O) as (DEAEOAOEAOO)\begin{pmatrix} D_E & A_{EO} \\ A_{OE} & A_{OO} \end{pmatrix}. Then DED_E is diagonal, AOOA_{OO} is diagonal, and the Schur complement S=AOO−AOEDE−1AEOS = A_{OO} - A_{OE} D_E^{-1} A_{EO}, with right-hand side dO−AOEDE−1dEd_O - A_{OE} D_E^{-1} d_E, is the tridiagonal system of line L6.

Proof. Two indices of the same parity differ by at least 22, so they are not coupled, and both diagonal blocks are diagonal. Row i∈Oi \in O of AOEA_{OE} has the entries aia_i in column i−1i - 1 and cic_i in column i+1i + 1 (if i+1<Ni + 1 < N). Column j∈Oj \in O of AEOA_{EO} has cj−1c_{j-1} in row j−1j - 1 and aj+1a_{j+1} in row j+1j + 1. So (AOEDE−1AEO)ij(A_{OE} D_E^{-1} A_{EO})_{ij} is a sum over k∈{i−1,i+1}∩{j−1,j+1}k \in \{i - 1, i + 1\} \cap \{j - 1, j + 1\}, which is empty unless ∣i−j∣≤2|i - j| \le 2. For j=ij = i it is aici−1/bi−1+ciai+1/bi+1a_i c_{i-1}/b_{i-1} + c_i a_{i+1}/b_{i+1}, so Sii=bi+αici−1+γiai+1S_{ii} = b_i + \alpha_i c_{i-1} + \gamma_i a_{i+1}. For j=i−2j = i - 2 only k=i−1k = i - 1 contributes, aiai−1/bi−1a_i a_{i-1}/b_{i-1}, so Si,i−2=αiai−1S_{i,i-2} = \alpha_i a_{i-1}; symmetrically Si,i+2=γici+1S_{i,i+2} = \gamma_i c_{i+1}. The right-hand side is di+αidi−1+γidi+1d_i + \alpha_i d_{i-1} + \gamma_i d_{i+1} in the same way. (When i+1=Ni + 1 = N, the terms with i+1i + 1 are absent, as in line L5.) □\square

Theorem 2 (one level is exact). Under the hypothesis of Lemma 1, xx solves Ax=dA x = d if and only if xOx_O solves SxO=dO−AOEDE−1dES x_O = d_O - A_{OE} D_E^{-1} d_E and, for each i∈Ei \in E, xi=(di−aixi−1−cixi+1)/bix_i = (d_i - a_i x_{i-1} - c_i x_{i+1})/b_i.

Proof. The block system is DExE+AEOxO=dED_E x_E + A_{EO} x_O = d_E and AOExE+AOOxO=dOA_{OE} x_E + A_{OO} x_O = d_O. The first gives xE=DE−1(dE−AEOxO)x_E = D_E^{-1}(d_E - A_{EO} x_O), which is line L11, and substituting it into the second gives the reduced system. Conversely these two relations imply both block equations. □\square

Theorem 3 (the algorithm is elimination without pivoting on PAPTP A P^T). Let PP order the indices as the even indices of level 00, then (in original numbering) those eliminated at level 11, and so on, ending with the single index of the last level. The pivots used by the algorithm are, in order, the pivots of Gaussian elimination without pivoting on PAPTP A P^T. Hence the algorithm runs without a zero pivot if and only if all leading principal minors of PAPTP A P^T are nonzero, and then it returns A−1dA^{-1} d.

Proof. Eliminating the first block of PAPTP A P^T, the diagonal block DED_E, by Gaussian elimination uses the pivots bkb_k, k∈Ek \in E, unchanged, since no elimination step touches another row of EE; what remains is exactly the Schur complement SS of Lemma 1. Induct on the levels: the pivots of the next block are the even diagonal entries of SS, and so on, and the last pivot is the 1×11 \times 1 system of line L7. Gaussian elimination without pivoting completes if and only if the leading principal minors are nonzero, since the kk-th pivot is the ratio of the kk-th and (k−1)(k-1)-th minors. By Theorem 2 at every level, the back substitution returns the solution. □\square

In particular, if AA is singular then so is PAPTP A P^T, its last leading minor is det⁡(PAPT)=0\det(P A P^T) = 0, and the algorithm stops with a zero pivot.

Theorem 4 (diagonal dominance improves). If β=β(A)=max⁡i(∣ai∣+∣ci∣)/∣bi∣<1\beta = \beta(A) = \max_i (|a_i| + |c_i|)/|b_i| < 1, then every bk≠0b_k \ne 0 and the reduced matrix satisfies β(S)≤β2\beta(S) \le \beta^2.

Proof. Fix i∈Oi \in O and write p=∣ai∣p = |a_i|, q=∣ci∣q = |c_i|, s=∣ci−1∣/∣bi−1∣s = |c_{i-1}|/|b_{i-1}| and t=∣ai+1∣/∣bi+1∣t = |a_{i+1}|/|b_{i+1}| (with q=t=0q = t = 0 when i+1=Ni + 1 = N). Dominance of rows i−1i - 1 and i+1i + 1 gives ∣ai−1∣/∣bi−1∣≤β−s|a_{i-1}|/|b_{i-1}| \le \beta - s and ∣ci+1∣/∣bi+1∣≤β−t|c_{i+1}|/|b_{i+1}| \le \beta - t. Hence

∣Si,i−2∣+∣Si,i+2∣=p∣ai−1∣∣bi−1∣+q∣ci+1∣∣bi+1∣≤β(p+q)−(ps+qt),|S_{i,i-2}| + |S_{i,i+2}| = p\frac{|a_{i-1}|}{|b_{i-1}|} + q\frac{|c_{i+1}|}{|b_{i+1}|} \le \beta(p + q) - (ps + qt),
∣Sii∣≥∣bi∣−ps−qt.|S_{ii}| \ge |b_i| - ps - qt.

Since p+q≤β∣bi∣p + q \le \beta |b_i|, the first bound is at most β2∣bi∣−(ps+qt)≤β2(∣bi∣−ps−qt)≤β2∣Sii∣\beta^2 |b_i| - (ps + qt) \le \beta^2(|b_i| - ps - qt) \le \beta^2 |S_{ii}|, using β2≤1\beta^2 \le 1. Also ∣Sii∣≥∣bi∣−(p+q)β≥(1−β2)∣bi∣>0|S_{ii}| \ge |b_i| - (p + q)\beta \ge (1 - \beta^2)|b_i| > 0. □\square

Theorem 5 (SPD is preserved). If AA is symmetric positive definite, then PAPTP A P^T is, every Schur complement of a symmetric positive definite matrix is symmetric positive definite, and all pivots are positive. □\square

Termination. Each pass of line L2 maps N≥2N \ge 2 to ⌊N/2⌋\lfloor N/2 \rfloor, with 1≤⌊N/2⌋<N1 \le \lfloor N/2 \rfloor < N, so after ⌊log⁡2n⌋\lfloor \log_2 n \rfloor passes N=1N = 1; the back substitution pops the same number of systems. The algorithm either raises at a zero pivot or returns. ■\blacksquare

Back to Cyclic reduction