Applied Numerical Linear Algebra. Lecture 14
Total Page:16
File Type:pdf, Size:1020Kb
Algorithms for the Symmetric Eigenproblem: Divide-and-Conquer Algorithms for the Symmetric Eigenproblem: Bisection and Inverse Iteration Algorithms for the Symmetric Eigenproblem: Jacobi’s Method Algorithms for the Singular Value Decomposition(SVD) Applied Numerical Linear Algebra. Lecture 14. 1/54 Algorithms for the Symmetric Eigenproblem: Divide-and-Conquer Algorithms for the Symmetric Eigenproblem: Bisection and Inverse Iteration Algorithms for the Symmetric Eigenproblem: Jacobi’s Method Algorithms for the Singular Value Decomposition(SVD) 5.3.3. Divide-and-Conquer This method is the fastest now available if you want all eigenvalues and eigenvectors of a tridiagonal matrix whose dimension is larger than about 25. (The exact threshold depends on the computer.) It is quite subtle to implement in a numerically stable way. Indeed, although this method was first introduced in 1981 [J. J. M. Cuppen. A divide and conquer method for the symmetric tridiagonal eigenproblem. Numer. Math., 36:177-195, 1981], the ”right” implementation was not discovered until 1992 [M. Gu and S. Eisenstat. A stable algorithm for the rank-1 modification of the symmetric eigenproblem. Computer Science Dept. Report YALEU/DCS/RR-916, Yale University, September 1992;M. Gu and S. C. Eisenstat. A divide-and-conquer algorithm for the symmetric tridiagonal eigenproblem. SIAM J. Matrix Anal Appl, 16:172-191, 1995]). 2/54 Algorithms for the Symmetric Eigenproblem: Divide-and-Conquer Algorithms for the Symmetric Eigenproblem: Bisection and Inverse Iteration Algorithms for the Symmetric Eigenproblem: Jacobi’s Method Algorithms for the Singular Value Decomposition(SVD) a1 b1 0 ... ... 0 b1 a2 b2 0 ... 0 ... ... ... ... ... ... ... am 1 bm 1 ... ... 0 − − 0 bm 1 am bm 0 0 T = − 0 0 b a b 0 m m+1 m+1 0 0 0 b ... ... m+1 ... ... ... ... ... ... 0 0 0 ... ... bn 1 − 00 0 0 bn 1 an − 3/54 Algorithms for the Symmetric Eigenproblem: Divide-and-Conquer Algorithms for the Symmetric Eigenproblem: Bisection and Inverse Iteration Algorithms for the Symmetric Eigenproblem: Jacobi’s Method Algorithms for the Singular Value Decomposition(SVD) a1 b1 0 ... ... 0 b1 a2 b2 0 ... 0 ... ... ... ... ... ... ... am 1 bm 1 ... ... 0 ... ... − − 0 bm 1 am bm 0 0 0 ...bm bm... T = − − + 0 0 0 a b b 0 ...b b ... m+1 − m m+1 m m 0 0 0 b ... ... ... ... m+1 ... ... ... ... ... ... 0 0 0 ... ... bn 1 − 00 0 0 bn 1 an − 0 ... 0 T1 0...0 1 = + bm 0...0 1 1 0....0 0...0 T2 · 1 · 0 .... 0 4/54 Algorithms for the Symmetric Eigenproblem: Divide-and-Conquer Algorithms for the Symmetric Eigenproblem: Bisection and Inverse Iteration Algorithms for the Symmetric Eigenproblem: Jacobi’s Method Algorithms for the Singular Value Decomposition(SVD) Assume that we have eigendecomposition of T1, T2 such that T T T1 = Q1Λ1Q1 and T2 = Q2Λ2Q2 . Then we can write that T T1 0...0 T Q1Λ1Q1 0...0 T T = + bmv v = T + bmv v 0...0 T2 · 0...0 Q2Λ2Q · 2 T Q1 0...0 Λ1 0...0 T Q1 0...0 = + bmu u T 0...0 Q2 · 0...0 Λ2 · · 0...0 Q2 Let define the diagonal matrix Λ 0...0 D = 1 0...0 Λ 2 We observe that the eigenvalues of T are the same as of D + b u uT = D + ρu uT . m · · 5/54 Algorithms for the Symmetric Eigenproblem: Divide-and-Conquer Algorithms for the Symmetric Eigenproblem: Bisection and Inverse Iteration Algorithms for the Symmetric Eigenproblem: Jacobi’s Method Algorithms for the Singular Value Decomposition(SVD) 1. We want to find eigenvalues of D + b u uT = D + ρu uT m · · 2. We assume that diagonal elements of D are sorted such that d ... d and D + λI is nonsingular 1 ≥ ≥ n 3. To find eigenvalues we compute the characteristic polynomial D + ρu uT λI noting that · T − 1 T D + ρu u λI =(D λI )(I + ρ(D λI )− u u ) · − − − · By assumption (2) we have det(D λI ) = 0 and thus − 6 1 T det(I + ρ(D λI )− u u )=0. − · 6/54 Algorithms for the Symmetric Eigenproblem: Divide-and-Conquer Algorithms for the Symmetric Eigenproblem: Bisection and Inverse Iteration Algorithms for the Symmetric Eigenproblem: Jacobi’s Method Algorithms for the Singular Value Decomposition(SVD) LEMMA 5.1. If x and y are vectors, det(I + xy T )=1+ y T x. Thus, using this lemma we can get that 2 1 T T 1 n ui det(I + ρ(D λI )− u u )=1+ u ρ(D λI )− u =1+ ρ = i=1 di λ f (λ). − · − − We see that eigenvalues of T are roots of the secular equationPf (λ)=0. The secular equation can be solved using Newton’s method with starting point (di , di+1). T 1 LEMMA 5.2. If α is an eigenvalue of D + ρuu , then (D αI )− u is its eigenvector. Since D αI is diagonal, this costs O(n) flops− to compute. − 7/54 Algorithms for the Symmetric Eigenproblem: Divide-and-Conquer Algorithms for the Symmetric Eigenproblem: Bisection and Inverse Iteration Algorithms for the Symmetric Eigenproblem: Jacobi’s Method Algorithms for the Singular Value Decomposition(SVD) ALGORITHM 5.2. Finding eigenvalues and eigenvectors of a symmetric tridiagonal matrix using divide-and-conquer: proc dc eig (T , Q, Λ) ..... from input T compute outputs Q and Λ where T = QΛQT if T is 1-by-1 return Q = 1, Λ= T else T 0 form T = 1 + b υυT 0 T m 2 call dc eig (T1, Q1, Λ1) call dc eig (T2, Q2, Λ2) T form D + ρuu from Λ1, Λ2, Q1, Q2 find eigenvalues Λ and eigenvectors Q′ of D + ρuuT Q 0 form Q = 1 Q′ = eigenvectors of T 0 Q2 · return Q and Λ end if 8/54 Algorithms for the Symmetric Eigenproblem: Divide-and-Conquer Algorithms for the Symmetric Eigenproblem: Bisection and Inverse Iteration Algorithms for the Symmetric Eigenproblem: Jacobi’s Method Algorithms for the Singular Value Decomposition(SVD) Computing the Eigenvectors Stably Lemma 5.2 provides formula for the computing of eigenvectors. This formula is not stable in the case when two eigenvalues are close to each other. Let αi ,αi+1 are close to each other. Then (D α )−1u and (D α )−1u are inaccurate and far − i − i+1 from orthogonal. An alternative formula was found which is based on the L¨owner’s theorem. 9/54 Algorithms for the Symmetric Eigenproblem: Divide-and-Conquer Algorithms for the Symmetric Eigenproblem: Bisection and Inverse Iteration Algorithms for the Symmetric Eigenproblem: Jacobi’s Method Algorithms for the Singular Value Decomposition(SVD) THEOREM 5.10. (L¨owner). Let D = diag(d1,..., dn) be diagonal with dn <...< d1. Let αn <...<α1 be given, satisfying the interlacing property d <α < < d <α < d <α < < d <α . n n ··· i+1 i+1 i i ··· 1 1 Then there is a vectoru ˆ such that the αi are the exact eigenvalues of Dˆ D +u ˆuˆT . The entries ofu ˆ are given by ≡ n 1/2 j=1(αj di ) uˆi = n − . | | " j=1,j=i (dj di )# Q 6 − Q 10/54 Algorithms for the Symmetric Eigenproblem: Divide-and-Conquer Algorithms for the Symmetric Eigenproblem: Bisection and Inverse Iteration Algorithms for the Symmetric Eigenproblem: Jacobi’s Method Algorithms for the Singular Value Decomposition(SVD) Proof. The characteristic polynomial of Dˆ can be written both as ˆ n ˆ T det(D λI )= j=1(αj λ) and as det(D λI ) = det(D +u ˆuˆ λI )= − 1 T − − 1 T − det(D(I + D− uˆuˆ ) λI ) = det((D λI )(I +(D λI )− uˆuˆ )) or Q − − − n n 2 uˆj det(Dˆ λI ) = (dj λ) 1+ − − · dj λ Yj=1 Xj=1 − n n 2 uˆj = (dj λ) 1+ − · dj λ j=1 j = 1 − Y X j = i 6 n 2 + (dj λ) uˆi . − · j = 1 Y j = i 6 11/54 Algorithms for the Symmetric Eigenproblem: Divide-and-Conquer Algorithms for the Symmetric Eigenproblem: Bisection and Inverse Iteration Algorithms for the Symmetric Eigenproblem: Jacobi’s Method Algorithms for the Singular Value Decomposition(SVD) Setting λ = d in the above eq. and in det(Dˆ λI )= n (α λ), i − j=1 j − equating both expressions for det(Dˆ λI ) yield − Q n n (α d ) =u ˆ2 (d d ) j − i i · j − i Yj=1 j Y= 1 j = i 6 or n 2 j=1(αj di ) uˆi = n − . j=1,j=i (dj di ) Q 6 − Using the interlacing property,Q we can show that the fraction on the right is positive, so we can take its square root to get the desired expression for uˆi . 12/54 Algorithms for the Symmetric Eigenproblem: Divide-and-Conquer Algorithms for the Symmetric Eigenproblem: Bisection and Inverse Iteration Algorithms for the Symmetric Eigenproblem: Jacobi’s Method Algorithms for the Singular Value Decomposition(SVD) Here is the stable algorithm for computing the eigenvalues and eigenvectors (where we assume for simplicity of presentation that ρ = 1). ALGORITHM 5.3. Compute the eigenvalues and eigenvectors of D + uuT . u2 Solve the secular equation 1+ n i = 0 to get the eigenvalues i=1 di λ α of D + uuT − i P Use L¨owner’s theorem to compute uˆ so that the αi are ”exact” eigenvalues of D +u ˆuˆT . Use Lemma 5.2 to compute the eigenvectors of Dˆ = D +u ˆuˆT . 13/54 Algorithms for the Symmetric Eigenproblem: Divide-and-Conquer Algorithms for the Symmetric Eigenproblem: Bisection and Inverse Iteration Algorithms for the Symmetric Eigenproblem: Jacobi’s Method Algorithms for the Singular Value Decomposition(SVD) 5.3.4. Bisection and Inverse Iteration The Bisection algorithm exploits Sylvester’s inertia theorem (Theorem 5.3) to find only those k eigenvalues that one wants, at cost O(nk).