% cd c:\working@PC\tex\Beijing2009\MATLAB
%
% This is an example of extended Jacobi-Divison method for computing the smallest
% eigenvalue of a symmetric.
%
% RCL 7/23/2009

n=1000;
A=diag(1:n)+.5*diag(ones(n-1,1),1)+.5*diag(ones(n-1,1),-1);
A(1,n)=0.5; A(n,1)=0.5;

tau=n+1; Anrm=n+1;

neig=5; tol=1.0e-10; U=[]; ks=[]; mus=[]; 
for j=1:neig,
    v0=ones(n,1);
    [mu,x,k,resd]=eJD(A,U,tau,Anrm,v0,tol);
    U=[U x]; ks=[ks;k]; mus=[mus; mu];
    semilogy(resd);
    aa=axis;
    text(0.5*(aa(1)+aa(2)),0.5*(aa(3)+aa(4)),strcat('j=',num2str(j)),'FontSize',20);
    pause
end


