Algorithm Search⌘K

Proofs: Banded matrix

These are the human proofs of Banded matrix, at full length.

Flop counts for band storage full

This proof shows: flops.worst, time.worst, space.extra, matvec.worst.

Matvec. Row ii has at most p+q+1p + q + 1 stored entries, each costing one multiplication and one addition in line M3. So at most 2n(p+q+1)2 n (p + q + 1) flops. □\square

BandLU. At step kk let mk=min⁡(p,n−k)m_k = \min(p, n - k) and sk=min⁡(q,n−k)s_k = \min(q, n - k). Lines L3 and L4 do mkm_k divisions, and lines L5 to L7 do mkskm_k s_k multiplications and mkskm_k s_k subtractions. The total is ∑k=1nmk(2sk+1)≤np(2q+1)\sum_{k=1}^{n} m_k (2 s_k + 1) \le n p (2q + 1), and for n≥p+qn \ge p + q it is at least (n−p−q)p(2q+1)(n - p - q) p (2q + 1), so it is Θ(npq+np)\Theta(n p q + n p); with the nn pivot tests the time is Θ(npq+n)\Theta(n p q + n). □\square

Pivoted LU. The same count with sk≤min⁡(p+q,n−k)s_k \le \min(p + q, n - k), plus at most pp comparisons and p+q+1p + q + 1 swaps per step: at most np(2(p+q)+1)n p (2(p + q) + 1) flops, O(np(p+q)+n)O(n p (p + q) + n) time. □\square

Space. The array ab has p+q+1p + q + 1 rows of length nn, and 2p+q+12p + q + 1 for the pivoted factorization, plus the nn pivot indices: Θ(n(p+q+1))\Theta(n (p + q + 1)). □\square

■\blacksquare

Band LU keeps the band and is backward stable full

This proof shows: correctness, termination.

Indices are 1-based. AA is n×nn \times n with aij=0a_{ij} = 0 for i−j>pi - j > p or j−i>qj - i > q. A(k)A^{(k)} is the array after step k−1k - 1 of BandLU (A(1)=AA^{(1)} = A). Dense Gaussian elimination without pivoting (GE) computes, at step kk, lik=aik(k)/akk(k)l_{ik} = a^{(k)}_{ik} / a^{(k)}_{kk} for all i>ki > k and aij(k+1)=aij(k)−likakj(k)a^{(k+1)}_{ij} = a^{(k)}_{ij} - l_{ik} a^{(k)}_{kj} for all i,j>ki, j > k.

Lemma 1 (band invariant). For every kk, A(k)A^{(k)} computed by GE satisfies aij(k)=0a^{(k)}_{ij} = 0 whenever i−j>pi - j > p or j−i>qj - i > q.

Proof. Induction on kk; k=1k = 1 is the hypothesis. Suppose it holds for A(k)A^{(k)}, and let i,j>ki, j > k with i−j>pi - j > p. We need aij(k)−likakj(k)=0a^{(k)}_{ij} - l_{ik} a^{(k)}_{kj} = 0. Here aij(k)=0a^{(k)}_{ij} = 0 by the hypothesis. Since j>kj > k, i−k>i−j>pi - k > i - j > p, so aik(k)=0a^{(k)}_{ik} = 0 and lik=0l_{ik} = 0. The case j−i>qj - i > q is symmetric: aij(k)=0a^{(k)}_{ij} = 0 and, since i>ki > k, j−k>j−i>qj - k > j - i > q, so akj(k)=0a^{(k)}_{kj} = 0. Entries with i≤ki \le k or j≤kj \le k do not change at step kk, except the multipliers likl_{ik}, which are zero for i>k+pi > k + p. □\square

Theorem 1 (BandLU equals GE). If all pivots akk(k)a^{(k)}_{kk} are nonzero, BandLU returns the same LL and UU as GE, LL has lower bandwidth pp, UU has upper bandwidth qq, and A=LUA = L U. If some pivot is zero, both fail at the same step.

Proof. At step kk, BandLU computes likl_{ik} for k<i≤min⁡(k+p,n)k < i \le \min(k + p, n) (lines L3 and L4) and updates aija_{ij} for k<i≤min⁡(k+p,n)k < i \le \min(k + p, n), k<j≤min⁡(k+q,n)k < j \le \min(k + q, n) (lines L5 to L7). By Lemma 1 the multipliers that GE computes for i>k+pi > k + p are zero, and the entries akj(k)a^{(k)}_{kj} for j>k+qj > k + q are zero, so every update of GE that BandLU skips subtracts 00. Thus the two arrays agree after each step, by induction, and the pivots agree too. The bandwidths follow from Lemma 1, and A=LUA = L U is the standard property of GE. □\square

Theorem 2 (pivoting). With partial pivoting over rows kk to min⁡(k+p,n)\min(k + p, n), the computed UU has uij=0u_{ij} = 0 for j−i>p+qj - i > p + q, and the nonzero multipliers of step kk lie in rows k+1k + 1 to min⁡(k+p,n)\min(k + p, n).

Proof. Claim: before step kk, every row i≥ki \ge k of the working array has its nonzeros in columns at most max⁡(i+q,k−1+p+q)\max(i + q, k - 1 + p + q). Also all rows i>k−1+pi > k - 1 + p are untouched original rows with no nonzero in column k−1k - 1 or before, since no elimination step k′<kk' < k reached them (i>k′+pi > k' + p). At step kk the candidate rows are k≤r≤min⁡(k+p,n)k \le r \le \min(k + p, n), all with nonzeros in columns at most max⁡(r+q,k−1+p+q)≤k+p+q\max(r + q, k - 1 + p + q) \le k + p + q. After the swap and the update, rows k+1k + 1 to k+pk + p have nonzeros in columns at most k+p+qk + p + q, which preserves the claim for step k+1k + 1, and the pivot row kk, which becomes row kk of UU, has nonzeros in columns at most k+p+qk + p + q. Rows below k+pk + p are untouched and have no nonzero in column kk, so the multipliers of step kk are in rows k+1k + 1 to min⁡(k+p,n)\min(k + p, n). □\square

Theorem 3 (backward error). In the floating point model, with no underflow or overflow and wu<1w u < 1, w=min⁡(p,q)+1w = \min(p, q) + 1, if BandLU runs to completion then L^U^=A+ΔA\hat L \hat U = A + \Delta A with ∣ΔA∣≤γw∣L^∣∣U^∣|\Delta A| \le \gamma_w |\hat L| |\hat U|.

Proof. The value finally stored at (i,j)(i, j) is obtained from aija_{ij} by subtracting the products l^iku^kj\hat l_{ik} \hat u_{kj} for max⁡(1,i−p,j−q)≤k<min⁡(i,j)\max(1, i - p, j - q) \le k < \min(i, j), in increasing order of kk, and then, if i>ji > j, dividing by u^jj\hat u_{jj}. The number mm of products is at most min⁡(i,j)−max⁡(i−p,j−q)≤min⁡(p,q)\min(i, j) - \max(i - p, j - q) \le \min(p, q): if i≤ji \le j it is at most i−(j−q)≤qi - (j - q) \le q and at most i−(i−p)=pi - (i - p) = p; the case i>ji > j is the same with the roles exchanged. Higham, Lemma 8.4, applied to y=(c−∑k=1makbk)/bm+1y = (c - \sum_{k=1}^{m} a_k b_k)/b_{m+1} (with bm+1=1b_{m+1} = 1 when i≤ji \le j) gives ∣aij−∑k≤min⁡(i,j)l^iku^kj∣≤γm+1∑k≤min⁡(i,j)∣l^ik∣∣u^kj∣|a_{ij} - \sum_{k \le \min(i,j)} \hat l_{ik} \hat u_{kj}| \le \gamma_{m+1} \sum_{k \le \min(i, j)} |\hat l_{ik}| |\hat u_{kj}|, with l^ii=1\hat l_{ii} = 1. Since γm+1≤γw\gamma_{m+1} \le \gamma_w, this is the claim entrywise. □\square

Theorem 4 (termination). BandLU stops after nn steps or at the first zero pivot; lu_pivoted stops after nn steps or when column kk has no nonzero candidate, which happens only if AA is singular.

Proof. All loops have fixed bounds. If at step kk all of akk(k),…,amin⁡(k+p,n),k(k)a^{(k)}_{kk}, \ldots, a^{(k)}_{\min(k+p, n), k} are zero, then by Theorem 2 column kk of the working array is zero in rows kk to nn. The working array is MAM A with MM nonsingular (a product of permutations and unit lower triangular matrices), and its leading kk columns have rank at most k−1k - 1, so AA is singular. □\square

■\blacksquare

Back to Banded matrix