29 - 29. am=4; A=hilb(m); [m,m]=size(A); for k=1:m-2...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
29. a m=4; A=hilb(m); [m,m]=size(A); for k=1:m-2 x=A(k+1:m,k); vk=x; vk(1)=sign(x(1))*norm(x)+x(1); vk=vk/norm(vk); A(k+1:m,k:m)=A(k+1:m,k:m)-2*vk*(vk'*A(k+1:m,k:m)); A(1:m,k+1:m)=A(1:m,k+1:m)-2*(A(1:m,k+1:m)*vk)*vk'; end TB=A(1:m,1:m); for i=1:m for j=1:m if(abs(TB(i,j)<1e-15)) TB(i,j)=0; end end end T=TB; %%========================================================= b % m=4; % A=hilb(m); function [Tnew] = qralg(T) for k=1:1000 [Q,R]=qr(T); T=R*Q; if abs(T(m,m-1))<1e-12 break end end %%========================================================= (c) m=4; A=hilb(m); T=hess(A); % or T=tridiag(A) p=zeros(3,1); s=zeros(3,1); eigen=zeros(m,1); while(abs(T(m,m-1))>1e-12) [Q,R]=qr(T); T=R*Q; p(1)=p(1)+1; end eigen(m)=T(m,m); s(1)=abs(T(m,m-1)); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% T=T(1:m-1,1:m-1); while(abs(T(m-1,m-2))>1e-12) [Q,R]=qr(T); T=R*Q; p(2)=p(2)+1+p(1); end eigen(m-1)=T(m-1,m-1); s(2)=abs(T(m-1,m-2));
Background image of page 1

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

View Full DocumentRight Arrow Icon
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% T=T(1:m-2,1:m-2); while(abs(T(m-2,m-3))>1e-12) [Q,R]=qr(T);
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/28/2011 for the course MATH 510 taught by Professor Sumchow during the Fall '11 term at BYU.

Page1 / 3

29 - 29. am=4; A=hilb(m); [m,m]=size(A); for k=1:m-2...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online