Algorithm Search⌘K

Proofs: dqds algorithm

These are the human proofs of dqds algorithm, at full length.

The dqds transform shifts the squared singular values, stays positive below the smallest one, and the algorithm returns them full

This proof shows: correctness, termination.

Notation of the page. BB is n×nn \times n upper bidiagonal with diagonal qk\sqrt{q_k} and superdiagonal ek\sqrt{e_k}, qk≥0q_k \ge 0, ek≥0e_k \ge 0. Its singular values are σ1≥⋯≥σn≥0\sigma_1 \ge \dots \ge \sigma_n \ge 0. SS is the accumulated shift. The arithmetic is exact except in the last section.

Lemma 0 (signs do not matter). The bidiagonal with entries ak,bka_k, b_k and the one with entries ∣ak∣,∣bk∣|a_k|, |b_k| have the same singular values.

Proof. Choose signs sk,tk∈{±1}s_k, t_k \in \{\pm 1\} one after another so that skaktk=∣ak∣s_k a_k t_k = |a_k| and skbktk+1=∣bk∣s_k b_k t_{k+1} = |b_k|. Then diag⁡(s)Bdiag⁡(t)\operatorname{diag}(s) B \operatorname{diag}(t) is the matrix with absolute values, and orthogonal factors keep singular values. □\square

Lemma 1 (the transform). Let ek>0e_k > 0 for all kk and τ∈R\tau \in \mathbb{R}. Suppose lines L4 to L9 run with every q^k≠0\hat q_k \ne 0. Then the output defines B^\hat B with B^TB^=BBT−τI\hat B^T \hat B = B B^T - \tau I.

Proof. BBTBB^T is tridiagonal, with (BBT)kk=qk+ek(BB^T)_{kk} = q_k + e_k (where en=0e_n = 0) and (BBT)k,k+12=qk+1ek(BB^T)_{k,k+1}^2 = q_{k+1} e_k. Also B^TB^\hat B^T \hat B is tridiagonal, with (B^TB^)kk=q^k+e^k−1(\hat B^T \hat B)_{kk} = \hat q_k + \hat e_{k-1} (where e^0=0\hat e_0 = 0) and (B^TB^)k,k+12=q^ke^k(\hat B^T \hat B)_{k,k+1}^2 = \hat q_k \hat e_k. Both off-diagonals are nonnegative, so it is enough to match the diagonals and the squared off-diagonals.

By induction, the dd at the start of iteration kk (with d1=q1−τd_1 = q_1 - \tau) satisfies dk=qk−e^k−1−τd_k = q_k - \hat e_{k-1} - \tau. For k=1k = 1 this is L4. If it holds for kk, then L7 and L8 give

dk+1=dkqk+1q^k−τ=(q^k−ek)qk+1q^k−τ=qk+1−e^k−τ.d_{k+1} = \frac{d_k q_{k+1}}{\hat q_k} - \tau = \frac{(\hat q_k - e_k) q_{k+1}}{\hat q_k} - \tau = q_{k+1} - \hat e_k - \tau.

Hence L6 gives q^k+e^k−1=dk+ek+e^k−1=qk+ek−τ\hat q_k + \hat e_{k-1} = d_k + e_k + \hat e_{k-1} = q_k + e_k - \tau for k<nk < n. L9 gives q^n+e^n−1=qn−τ\hat q_n + \hat e_{n-1} = q_n - \tau. For the off-diagonal, L7 gives q^ke^k=ekqk+1\hat q_k \hat e_k = e_k q_{k+1}. □\square

So σi(B^)2=σi(B)2−τ\sigma_i(\hat B)^2 = \sigma_i(B)^2 - \tau for every ii, because BBTBB^T and BTBB^T B have the same eigenvalues. After the update S←S+τS \leftarrow S + \tau at L10, the multiset {S+σi(B)2}\{S + \sigma_i(B)^2\} is the same as before the transform. It is therefore the multiset of squared singular values of the input matrix.

Lemma 2 (the meaning of dkd_k). Suppose all qj>0q_j > 0 and ej>0e_j > 0, and q^1,…,q^k−1>0\hat q_1, \dots, \hat q_{k-1} > 0. Let BkB_k be the leading k×kk \times k block of BB. Then q^1,…,q^k−1,dk\hat q_1, \dots, \hat q_{k-1}, d_k are the pivots of the Cholesky (LDLTLDL^T) factorization of BkBkT−τIB_k B_k^T - \tau I.

Proof. BkBkTB_k B_k^T agrees with the leading k×kk \times k block of BBTBB^T, except at (k,k)(k, k), where it has qkq_k instead of qk+ekq_k + e_k. The pivots of a tridiagonal TT satisfy p1=t11p_1 = t_{11} and pj=tjj−tj−1,j2/pj−1p_j = t_{jj} - t_{j-1,j}^2 / p_{j-1}. For BBT−τIBB^T - \tau I this reads pj=qj+ej−τ−qjej−1/pj−1p_j = q_j + e_j - \tau - q_j e_{j-1}/p_{j-1}. By Lemma 1, q^j=dj+ej\hat q_j = d_j + e_j and dj=qj−τ−qjej−1/q^j−1d_j = q_j - \tau - q_j e_{j-1}/\hat q_{j-1}, so pj=q^jp_j = \hat q_j for j<kj < k. The last pivot of BkBkT−τIB_k B_k^T - \tau I uses qkq_k in place of qk+ekq_k + e_k, which gives dkd_k. □\square

Lemma 3 (positivity). Let all qj,ej>0q_j, e_j > 0. The transform runs with every dk>0d_k > 0 if and only if τ<σn2\tau < \sigma_n^2, and then every q^k>0\hat q_k > 0 and e^k>0\hat e_k > 0.

Proof. Suppose first that τ<σn2\tau < \sigma_n^2. BB is upper triangular and nonsingular, so B−1B^{-1} is upper triangular with leading block Bk−1B_k^{-1}. Hence ∥Bk−1∥2≤∥B−1∥2\lVert B_k^{-1}\rVert_2 \le \lVert B^{-1}\rVert_2, that is, σmin⁡(Bk)≥σn\sigma_{\min}(B_k) \ge \sigma_n. Therefore BkBkT−τIB_k B_k^T - \tau I is positive definite for every kk, and its last pivot dkd_k is positive by Lemma 2, by induction on kk. Then q^k=dk+ek>0\hat q_k = d_k + e_k > 0 and e^k=ekqk+1/q^k>0\hat e_k = e_k q_{k+1}/\hat q_k > 0.

Conversely, if every dk>0d_k > 0, then every q^k>0\hat q_k > 0. By Lemma 2 with k=nk = n, these are the Cholesky pivots of BBT−τIBB^T - \tau I, so that matrix is positive definite and τ<σn2\tau < \sigma_n^2. □\square

If τ=σn2\tau = \sigma_n^2 exactly, the same argument gives dk>0d_k > 0 for k<nk < n and dn=0d_n = 0. If some qj=0q_j = 0, then σn=0\sigma_n = 0, line L3 takes τ=0\tau = 0, and the transform runs with dk≥0d_k \ge 0. When q^k=0\hat q_k = 0, then dk=ek=0d_k = e_k = 0, and the code sets e^k=0\hat e_k = 0 and restarts dd at qk+1−τq_{k+1} - \tau. That is the transform applied to the two blocks separately, so Lemma 1 still holds blockwise. The transform therefore keeps all quantities nonnegative.

Lemma 4 (the Newton shift is a lower bound). If all qj>0q_j > 0, the value τ\tau of line L3 satisfies 0<τ≤σn20 < \tau \le \sigma_n^2.

Proof. Let cj=∥B−1ej∥22c_j = \lVert B^{-1} e_j \rVert_2^2, where eje_j is the jj-th unit vector. From B−1B=IB^{-1} B = I, column jj gives qj B−1ej+ej−1 B−1ej−1=ej\sqrt{q_j}\, B^{-1} e_j + \sqrt{e_{j-1}}\, B^{-1} e_{j-1} = e_j. The vector B−1ej−1B^{-1} e_{j-1} is supported on rows 1,…,j−11, \dots, j - 1 and is orthogonal to eje_j. Hence cj=(1+ej−1cj−1)/qjc_j = (1 + e_{j-1} c_{j-1})/q_j and c1=1/q1c_1 = 1/q_1. So ∑jcj=∥B−1∥F2=∑iσi−2≥σn−2\sum_j c_j = \lVert B^{-1}\rVert_F^2 = \sum_i \sigma_i^{-2} \ge \sigma_n^{-2}, and τ=1/∑jcj≤σn2\tau = 1/\sum_j c_j \le \sigma_n^2. This value is also −f(0)/f′(0)-f(0)/f'(0) for f(x)=det⁡(BBT−xI)f(x) = \det(BB^T - xI), which is one Newton step from 00. □\square

By Lemmas 3 and 4, in exact arithmetic the test at L8 fails only when τ=σn2\tau = \sigma_n^2 exactly. In that case dn=0≥0d_n = 0 \ge 0 and the transform is accepted.

Lemma 5 (deflation). Suppose en−1≤u2(S+qn)e_{n-1} \le u^2 (S + q_n) at L2. Recording S+qnS + q_n and continuing with the leading (n−1)×(n−1)(n-1) \times (n-1) block changes each eigenvalue of BBT+SIBB^T + SI by at most (u+u2)(S+qn)(u + u^2)(S + q_n).

Proof. Write M=BBT+SIM = BB^T + SI. The matrix M′M' is block diagonal, with the leading block Bn−1Bn−1T+SIB_{n-1} B_{n-1}^T + SI and the trailing entry S+qnS + q_n. Then M−M′M - M' has only three nonzero entries: en−1e_{n-1} at (n−1,n−1)(n-1, n-1) and β=qnen−1\beta = \sqrt{q_n e_{n-1}} at (n−1,n)(n-1, n) and (n,n−1)(n, n-1). Its 2-norm is at most en−1+βe_{n-1} + \beta. Since qn≤S+qnq_n \le S + q_n, we have β≤u(S+qn)\beta \le u (S + q_n), and en−1≤u2(S+qn)e_{n-1} \le u^2 (S + q_n). Weyl's inequality bounds each eigenvalue change by ∥M−M′∥2\lVert M - M'\rVert_2. □\square

Since S≥0S \ge 0 and every eigenvalue of MM is at least SS, the bound is of the order of uu times the deflated value. That makes it relative for that value. For the remaining values it is at most (u+u2)(u + u^2) times their own size, plus (u+u2)qn(u + u^2) q_n. When en−1=0e_{n-1} = 0, the deflation is exact.

Theorem (correctness and termination). In exact arithmetic, the values returned at L11 are the singular values of the input, provided the loop ends without the step cap. The loop always ends, after at most n+60nn + 60n passes.

Proof. By Lemma 0, the squared variables represent the input. Each accepted transform keeps the multiset {S+σi(B)2}\{S + \sigma_i(B)^2\} (Lemma 1, with Lemma 3 and the remarks for the degenerate cases). An exact deflation with en−1=0e_{n-1} = 0 splits MM into two blocks. The recorded S+qnS + q_n is the eigenvalue of the trailing 1×11 \times 1 block, and the rest is carried by the leading block. When n=1n = 1, the value is S+q1S + q_1. L11 returns their square roots, sorted. For termination, each pass of L2 either lowers nn, which can happen at most nn times, or performs a transform. Transforms are counted and capped at 60n60n, after which the code raises an error. □\square

Convergence (cited, not proved here). With τ=0\tau = 0, the qd recurrences give ek(t)→0e_k^{(t)} \to 0 like (σk+1/σk)2t(\sigma_{k+1}/\sigma_k)^{2t} (Rutishauser 1954; Fernando and Parlett 1994). Aishima, Matsuo, Murota and Sugihara (2008) proved global convergence of dqds under a class of shift strategies, together with its asymptotic rate. The bound of 60n60n transforms is a safety cap. In the tests, about 9 transforms per value were used.

Floating point (cited). Fernando and Parlett (1994) proved that the computed dqds transform is mixed stable in the relative sense. Make relative changes of a few ulps to each qkq_k and eke_k, apply the exact transform, and change each output entry by a few ulps; the result is the computed (q^,e^)(\hat q, \hat e). Demmel and Kahan (1990) proved that relative changes of size at most η\eta in the 2n−12n - 1 entries of a bidiagonal matrix change each singular value by a factor between (1+η)−(2n−1)(1 + \eta)^{-(2n-1)} and (1+η)2n−1(1 + \eta)^{2n-1}. Combining the two results bounds the relative error in each σi\sigma_i by O(nu)O(n u) per transform, whatever the ratio σi/σ1\sigma_i / \sigma_1.

Back to dqds algorithm