Iterative Methods for the Eigenvalue Problem
Total Page:16
File Type:pdf, Size:1020Kb
15/11/2013 Iterative methods for eigenvalue problem Project Report Group members: Radharaman Roy, Mouktik Chattopadhyay Necessity of an Iterative Method for Eigenvalues:In general, any method for computing eigenvalues necessarily involves an infinite number of steps. This is because finding eigenvalues of an n × n matrix is equivalent to finding the roots of its characteristic polynomial of degree n and Computing coefficients of characteristic polynomial requires computation of the determinant, however, the problem of finding the roots of a polynomial can be very ill-conditioned and for n > 4 such roots cannot be found (By Abel's theorem), in general, in a finite number of steps. In other words, we must consider iterative methods producing, at step k, an approximated eigenvector xk associated with an approximated eigenvalue λk that converge to the desired eigenvector x and eigenvalue λ as the number of iterations becomes larger. Here we present some iterative methods called the Schur factorization, QR method, power method, Bisection method, Jacobi's method, and Divide and conquer method. Jacobi eigenvalue algorithm: Jacobi eigenvalue algorithm is an iterative method for calculation of the eigenvalues and eigenvectors of a symmetric matrix. ••Givens rotation: A Givens rotation is represented by a matrix of the form 01 ··· 0 ··· 0 ··· 01 B. C B. C B C B0 ··· c · · · −s ··· 0C B C B. C G(i; j; θ) =B. C B C B0 ··· s ··· c ··· 0C B C B. C @. A 0 ··· 0 ··· 0 ··· 1 where c = cos θ, s = sin θ appear intersection of i th and j th rows and columns. That is the non zero elements of Givens matrix is given by gkk = 1 for k6=i; j gii=c gjj=-s gij = s for i > j. • Description of Jacobi algorithm: S0 = GT SG where G be a Givens rotation matrix & S be a symmetric matrix then S0 is also a symmetric matrix. S0 has entries 0 0 2 2 Sij = Sji = (c − s )Sij + sc(Sii − Sjj); 0 0 Sik = Ski = cSik − sSjk for k6=i,j 0 0 Sjk = Skj = sSik + cSjk for k6=j,i 0 2 2 Sii = c Sii − 2scSij + s Sjj; 0 2 2 Sjj = s Sii + 2scSij + c Sjj; ;where c = cos θ ; s = sin θ, G is orthogonal,S and S0 have the same Frobenious norm , however we can 0 0 choose θ s.t Sij = 0, in which case S has a large sum of squares on the diagonal. 0 1 Sij = (cos 2θ)SiJ + 2 (sin 2θ)(Sii − Sjj) Set this equal to 0 ; tan 2θ = 2Sij . Sjj −Sii The Jacobi eigenvalue method repeatedly performs rotation until the matrix becomes almost diagonal. Then the diagonal elements are approximations of the eigenvalues of S. • Convergence of Jacobi's method: Let od(A)is the root-sum-of-squares of the (upper) off diagonal entries of A, so A is diagonal if and only if od(A) = 0. Our goal is to make od(A) approach 0 quickly. The next lemma tells us that od(A) decreases monotonically with every Jacobi rotation. { Lemma: Let A0 be the matrix after calling Jacobi-Rotation (A, j, k)for any j,k. Then od2(A0) = 2 2 od (A) − ajk. Proof: Here A0 = A except in rows and columns j and k. Write 2 1 2 od (A)= 2 ×sum of square of all off diagonal elements of A except ajk + ajk 2 0 02 0 2 02 0 and similarly od (A ) = S + ajk = S , since ajk = 0 after calling Jacobi- Rotation(A,j,k). Since 2 02 k X kF = k QX kF and k X kF = k XQ kF for any X and any orthogonal Q, we can show S = S . 2 0 2 2 Thus od (A ) = od (A)- ajk as desired. 0 p 1 { Theorem: After one Jacobi's rotation in the classical Jacobi's algorithm, we have od(A ) ≤ (1 − N ), n(n−1) where N = 2 =the no. of sub-per diagonal entries of A. After k Jacobi rotation od(.) is no more k 1 2 than (1 − N ) od(A). 2 0 2 2 ( n(n−1) 2 Proof: od (A ) = od (A) − ajk, where ajk is the largest off diagonal entry. Thus od A) ≤ 2 ajk. 2 2 1 2 So od (A) − ajk ≤ (1 − N )od (A). So the classical Jacobi's algorithm converges at least linearly with the error (measured by od(A)) p 1 decreasing by a factor at least (1 − N ) at time. It eventually converges quadratically. • Algorithm: This method determines the eigenvalues and eigenvectors of a real symmetric matrix A, by converting A into a diagonal matrix by similarity transformation. { Step 1. Read the symmetric matrix A. { Step 2. Initialize D = A and S = I, a unit matrix. { Step 3. Find the largest off-diagonal element (in magnitude) from D = [dij] and let it be dij . { Step 4.Find the rotational angle . If dii = djj then π π if dij > 0 then θ = 4 else θ = − 4 endif; else ! θ = 1 tan1 2dij ; 2 dii−djj endif; { Step 5. Compute the matrix S1 = [spq] Set spq = 0 for all p; q = 1; 2; :::; n skk = 1, k = 1; 2; :::; n and sii = sjj = cos , sij = sin , sji = sin. T { Step 6. Find D = S1 DS1 and S = SS1; { Step 7. Repeat steps 3 to 6 until D becomes diagonal. { Step 8. Diagonal elements of D are the eigenvalues and the columns of S are the corresponding eigenvectors. • Program: This program finds all the eigenvalues and the corresponding eigenvectors of a real symmetric matrix. Assume that the given matrix is real symmetric. #include < stdio:h > #include < math:h > void main() f int n,i,j,p,q,flag; float a[10][10],d[10][10],s[10][10],s1[10][10],s1t[10][10]; float temp[10][10],theta,zero=1e-4,max,pi=3.141592654; printf("Enter the size of the matrix "); scanf("%d",&n); printf("Enter the elements row wise "); for(i = 1; i <= n; i + +) for(j = 1; j <= n; j + +) scanf("%f"; &a[i][j]); printf("The given matrix is"); for(i = 1; i <= n; i + +) f for(j = 1; j <= n; j + +) printf("%8:5f"; a[i][j]); printf("nn"); g printf("nn"); for(i = 1; i <= n; i + +) for(j = 1; j <= n; j + +) f d[i][j]=a[i][j]; s[i][j]=0; g for(i = 1; i <= n; i + +) s[i][i]=1; do f flag=0; i=1; j=2; max=fabs(d[1][2]); for(p = 1; p <= n; p + +) for(q = 1; q <= n; q + +) f if(p!=q) if(max < fabs(d[p][q])) f max=fabs(d[p][q]); i=p; j=q; g g if(d[i][i]==d[j][j]) f if(d[i][j] > 0) theta=pi/4; else theta=-pi/4; g else f theta=0.5*atan(2*d[i][j]/(d[i][i]-d[j][j])); g for(p = 1; p <= n; p + +) for(q = 1; q <= n; q + +) s1[p][q]=0; s1t[p][q]=0; for(p = 1; p <= n; p + +) s1[p][p]=1; s1t[p][p]=1; s1[i][i]=cos(theta); s1[j][j]=s1[i][i]; s1[j][i]=sin(theta); s1[i][j]=-s1[j][i]; s1t[i][i]=s1[i][i]; s1t[j][j]=s1[j][j]; s1t[i][j]=s1[j][i]; s1t[j][i]=s1[i][j]; for(i = 1; i <= n; i + +) for(j = 1; j <= n; j + +)f temp[i][j]=0; for(p = 1; p <= n; p + +) temp[i][j]+=s1t[i][p]*d[p][j]; g for(i = 1; i <= n; i + +) for(j = 1; j <= n; j + +) f d[i][j]=0; for(p = 1; p <= n; p + +) d[i][j]+=temp[i][p]*s1[p][j]; g for(i = 1; i <= n; i + +) for(j = 1; j <= n; j + +) f temp[i][j]=0; for(p = 1; p <= n; p + +) temp[i][j]+=s[i][p]*s1[p][j]; g for(i = 1; i <= n; i + +) for(j = 1; j <= n; j + +) s[i][j]=temp[i][j]; for(i = 1; i <= n; i + +) for(j = 1; j <= n; j + +) f if(i!=j) if(fabs(d[i][j] > zero)) flag=1; g g while(flag==1); printf("The eigenvalues are nn"); for(i = 1; i <= n; i + +) printf("%8.5f ",d[i][i]); printf("nnThe corresponding eigenvectors are nn"); for(j = 1; j <= n; j + +) f for(i = 1; i < n; i + +) printf("% 8.5f,",s[i][j]); printf("%8.5fnn",s[n][j]) g g Divide and conquer method eigenvalue algorithm: This method we can use for symmetric tridiagonal matrix. • Divide: The divide part of the divide conquer algorithm from the realization that a tridiagonal matrix is almost block diagonal. ! T A T = 1 .where A and B be a matrix whose elements are 0 except (n; 1)th element of A and (1; n)th B T2 element of B and these elements are a. The size of sub-matrix T1 is n × n and then T2 is (m − n) × (m − n) 0 ! ! T1 0 a a T = 0 + 0 T2 a a 0 0 The only difference between T1 and T1 is that the lower right entry in T1 has been replaced with tnn - a and 0 similarly in T 2 . t t t t t • Conquer: First define z = (q1; q2) where q1 is the last row of Q1 and q2 is the first row of Q2 then ! ! ! t ! Q1 D1 t Q1 T = + azz t ) Q2 D2 Q2 Now we have to find the eigenvalues of a diagonal matrix plus a rank one correction .