QR Algorithm Note 1 QR Algorithm is different

  • Slides: 20
Download presentation
QR - Algorithm Note: 1) QR – Algorithm is different from QR-Decomposition 2) a

QR - Algorithm Note: 1) QR – Algorithm is different from QR-Decomposition 2) a procedure to calculate the eigenvalues of a matrix QR Algorithm: (Basic version) for i=1: 50 [Q, R]=qr(A); A=R*Q; end Find QR factorization Multiply in the reverse order DEF: 1 2 3 Characteristic Polynomial (of degree n) The eigenvalues of A are the n roots of its characteristic polynomial The set of these roots is called the spectrum of A and denoted by

Eigenvalues & Eigenvectors DEF: 1 2 3 4 5 6 Characteristic Polynomial (of degree

Eigenvalues & Eigenvectors DEF: 1 2 3 4 5 6 Characteristic Polynomial (of degree n) The eigenvalues of A are the n roots of its characteristic polynomial The set of these roots is called the spectrum of A and denoted by If A is symmetric then all eigenvalues are reals

Eigenvalues & Eigenvectors DEF: the nonzero vectors x that satisfy are called eigenvectors. DEF:

Eigenvalues & Eigenvectors DEF: the nonzero vectors x that satisfy are called eigenvectors. DEF: THM: same eigenvalues

Special Matrices Diagonal Upper bidiagonal Tridiagonal Upper triangular Upper Hessenberg

Special Matrices Diagonal Upper bidiagonal Tridiagonal Upper triangular Upper Hessenberg

Schur Factorization: 1) A and T are similar 2) They have same eigenvalues 3)

Schur Factorization: 1) A and T are similar 2) They have same eigenvalues 3) Eigenvalues of T are the diagonal entries Schur Factorization:

Schur Factorization Compute all eigenvalues of A: Example: >> eig(A)‘ -100. 0111 -10. 0988

Schur Factorization Compute all eigenvalues of A: Example: >> eig(A)‘ -100. 0111 -10. 0988 -0. 8901 IDEA: We need to construct the Schur factorization A 3 = -100. 0111 0. 0010 0. 0000 0. 0010 -10. 0988 0. 0007 0 0. 0007 -0. 8901 QR Algorithm: (Basic version) for i=1: 50 [Q, R]=qr(A); A=R*Q; end A 5 = -100. 0111 0. 0000 -10. 0988 0. 0000 0 0. 0000 -0. 8901

Schur Factorization Compute all eigenvalues of A: All A’s are similar IDEA: We need

Schur Factorization Compute all eigenvalues of A: All A’s are similar IDEA: We need to construct the Schur factorization QR Algorithm: (Basic version) for i=1: 50 [Q, R]=qr(A); A=R*Q; end All A’s have same eigenvalues

Schur Factorization QR-factorization Compute all eigenvalues of A: IDEA: We need to construct the

Schur Factorization QR-factorization Compute all eigenvalues of A: IDEA: We need to construct the Schur factorization

Bad Idea QR-factorization Idea All zeros are destroyed

Bad Idea QR-factorization Idea All zeros are destroyed

Good Idea Bad Idea zeros are not destroyed

Good Idea Bad Idea zeros are not destroyed

Good Idea ? Givens It is not upper triangular Hessenberg

Good Idea ? Givens It is not upper triangular Hessenberg

Good Idea QR-Algorithm General matrix A Hessenberg H QR Algorithm: for i=1: 50 [Q,

Good Idea QR-Algorithm General matrix A Hessenberg H QR Algorithm: for i=1: 50 [Q, R]=qr(A); A=R*Q; end PHASE-II PHASE-I QR Algorithm: O(n^3) for i=1: 50 [Q, R]=qr(H); H=R*Q; end O(n^2) 6 n^2 §All H’s are Hessenberg (why? ) §We can upper triangularize H with a sequence of Givens

Idea PHASE-I Reduce H for k=1: n-1 v=house(A(k+1: n, k); A(k+1: n, k: n)=(I-2*v*v’/v’*v)*A(k+1:

Idea PHASE-I Reduce H for k=1: n-1 v=house(A(k+1: n, k); A(k+1: n, k: n)=(I-2*v*v’/v’*v)*A(k+1: n, k: n); A(1: n, k+1: n)=A(1: n, k+1: n)(I-2*v*v’/v*v); end PHASE-II QR Algorithm: for i=1: 50 [Q, R]=qr(H); H=R*Q; end A symmetric If A is symmetric matrix, then H is Hessenberg and symmetric The work reduces to 50% or less

Slow Convergence Example A= 1 4 2 4 >> eig(A)' 11. 1055 -3. 8556

Slow Convergence Example A= 1 4 2 4 >> eig(A)' 11. 1055 -3. 8556 2 5 1 2 3 6 5 1 3. 5736 PHASE-II 4 7 0 0 0. 1765 H 5 = 11. 1328 4. 5792 3. 9941 -0. 0905 -3. 8908 0. 5327 0 -0. 1006 3. 5815 0 0 -0. 0000 -4. 0372 -1. 2342 0. 1765 PHASE-I H= 1. 0000 -5. 0000 -1. 5395 -1. 2767 -6. 0000 8. 5556 0. 1085 3. 6986 0 -5. 9182 -2. 1689 -1. 1428 0 0 -0. 1428 3. 6133 H 20 = 11. 1055 -4. 7403 3. 9060 -4. 0296 -0. 0000 -3. 8526 -0. 6899 1. 2559 0 -0. 0322 3. 5706 0. 1571 0 0 -0. 0000 0. 1765 Any solution for low convergence

Decouple and Deflation Remark: We assume that H is unreduced. If not then we

Decouple and Deflation Remark: We assume that H is unreduced. If not then we have The problem decouples into two smaller problem Remark: Deflation Remark:

QR Algorithm with shift PHASE-II QR Algorithm with shift: A 20 = 11. 1055

QR Algorithm with shift PHASE-II QR Algorithm with shift: A 20 = 11. 1055 -4. 7403 3. 9060 -4. 0296 -0. 0000 -3. 8526 -0. 6899 1. 2559 0 -0. 0322 3. 5706 0. 1571 0 0 -0. 0000 0. 1765 >> eig(A)' 11. 1055 -3. 8556 The theorem says that if we shift an exact eigenvalue, then in exact arithmetic deflation occurs in one step. 3. 5736 0. 1765

QR Algorithm with shift PHASE-II Example: QR Algorithm with shift: H= 1. 0000 -5.

QR Algorithm with shift PHASE-II Example: QR Algorithm with shift: H= 1. 0000 -5. 0000 -1. 5395 -1. 2767 -6. 0000 8. 5556 0. 1085 3. 6986 0 -5. 9182 -2. 1689 -1. 1428 0 0 -0. 1428 3. 6133 H 1 = 3. 3236 -5. 5508 4. 4353 2. 6929 -8. 0984 2. 9128 -6. 1528 -2. 4688 0 -2. 2250 1. 1900 1. 0296 0 0 -0. 0017 3. 5736 >> eig(A)' 11. 1055 -3. 8556 3. 5736 0. 1765 H 2 = 2. 4924 -9. 7341 -2. 5648 2. 3834 -5. 9560 5. 0131 3. 0854 -2. 9507 0 -1. 4702 -0. 0791 0. 0767 deflation 0 0 -0. 0000 3. 5736

QR Algorithm with shift Example: H= 1. 0000 -5. 0000 -1. 5395 -1. 2767

QR Algorithm with shift Example: H= 1. 0000 -5. 0000 -1. 5395 -1. 2767 -6. 0000 8. 5556 0. 1085 3. 6986 0 -5. 9182 -2. 1689 -1. 1428 0 0 -0. 1428 3. 6133 H 1 = 3. 3236 -5. 5508 4. 4353 2. 6929 -8. 0984 2. 9128 -6. 1528 -2. 4688 0 -2. 2250 1. 1900 1. 0296 0 0 -0. 0017 3. 5736 H 2 = 2. 4924 -9. 7341 -2. 5648 2. 3834 -5. 9560 5. 0131 3. 0854 -2. 9507 0 -1. 4702 -0. 0791 0. 0767 0 0 -0. 0000 3. 5736 Theory: quadratic conv Symmetric case : cubic H 3 = 11. 1418 5. 2542 2. 9806 -0. 1409 0. 0453 -1. 4768 0 -0. 1735 -3. 8005 H 4 11. 0926 5. 2199 -3. 2299 -0. 0368 0. 1589 1. 2723 0 -0. 0029 -3. 8649 H 5 = 11. 0798 5. 2490 -3. 2292 -0. 0099 0. 1708 1. 2672 0 -0. 0000 -3. 8640 deflation

Eigenvalues of Symmetric Matrices Schur Factorization: PHASE-I A symmetric T is tridiagonal If A

Eigenvalues of Symmetric Matrices Schur Factorization: PHASE-I A symmetric T is tridiagonal If A is symmetric matrix, then H is Hessenberg and symmetric PHASE-II QR Algorithm: for i=1: 50 [Q, R]=qr(H); H=R*Q; end O(n)

QR Algorithm with wilkinson shift PHASE-II Wilkinson shift: QR Algorithm with shift: A more

QR Algorithm with wilkinson shift PHASE-II Wilkinson shift: QR Algorithm with shift: A more effective choice is to shift by the eigenvalue of Wilkinson has shown that: cubically convergent. That is closer to Can we use this shift to non -symmetric matrix