{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# hw6s - CME302 Homework 6 Solutions A.M.B November 8 2009 10...

This preview shows pages 1–2. Sign up to view the full content.

CME302 Homework 6 Solutions A.M.B. November 8, 2009 (TB 28.2c) Let L ( c,r 1 ,r 2 ) be the Givens rotation applied from the left such that in column c element r 2 is made 0 by using element r 1 . To obtain the QR factorization of a symmetric matrix A C m × m , one requires in general m - 1 rotations, where the i th rotation is L ( i,i,i + 1). (a) The resulting R is upper triangular and has nonzero elements in only the diagonal and first two superdiagonals. Q is upper Hessenberg. (b) Let A = QR . First, as A is symmetric and RQ = Q T AQ , RQ is also symmetric. Second, as R is upper triangular and Q is upper Hessenberg, their product is upper Hessenberg. A symmetric upper Hessenberg matrix is tridiagonal. (2) See the file hw6.m in the Materials section of Coursework for the complete Matlab code for this problem. (a) The code for this part follows: function A = tridiag(A) % Tridiagonalize Hermitian A by a unitary similarity transform. n = size(A,1); for(k = 1:n-1) % Construct Householder reflector v = A(k+1:n,k); s = sign(v(1)); if(s == 0) s = 1; end nv = sqrt(v’*v); v(1) = v(1) + s*nv; v = v/sqrt(v’*v); % Apply from the left A(k+1,k) = nv; A(k+2:n,k) = 0; % Structural 0s A(k+1:n,k+1:n) = A(k+1:n,k+1:n) - 2*v*(v’*A(k+1:n,k+1:n)); % Apply from the right A(k,k+1) = nv; A(k,k+2:n) = 0; % Structural 0s A(k+1:n,k+1:n) = A(k+1:n,k+1:n) - 2*(A(k+1:n,k+1:n)*v)*v’; end % Force A to be symmetric. A is already tridiag because we set all the 0 % elements when applying the Householder reflections. A = (A + A’)/2; When applied to A = hilb(4) , the resulting tridiagonal matrix, to three digits 2 4 6 8 10 12 14 16 10 -10 10 -5 T(n,n-1) No shift 1 2 3 4 5 6 7 8 10 -20 10 -10 Iteration T(n,n-1) Wilkinson shift Figure 1: Convergence plots for hilb(4) .

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 3

hw6s - CME302 Homework 6 Solutions A.M.B November 8 2009 10...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online