% Aufgabe 27
clear all

A = gallery('poisson',20); % try different sizes
n = size(A,1);
disp(['Size of A: ', num2str(n)])

q1 = rand(n,1);
q1 = q1/norm(q1);
% ... first Lanczos step
%     compute alpha(1), beta(1) 

% Compute Eigenvalues of T_1


k = 2;
tic
while % ... 
  % Lanczos iteration
  q0 = q1; % q1 is q_k, q0 is q_{k-1}
  
  
end
disp(['Time for Lanczos: ', num2str(toc)])



figure(1)
tic
ew = eig(A);
disp(['Time for eig:    ', num2str(toc)])

plot([1,k],[max(ew), max(ew)],'k--')
hold on 
plot([1,k],[min(ew), min(ew)],'r--')
plot(1:k,e_max,'-o',1:k,e_min,'-o')
hold off
 
figure(2)
semilogy(1:k,abs(max(ew)-e_max),'--b', 1:k,abs(min(ew)-e_min),'-r')


