close all, clear all

format compact
format long

n = 128;
rng(2);
A = gensmspectr(n);

tol = 1.e-10;
maxiter = 4000;

tic();
[eigs, V, conv1] = mynaiveqr(A, tol, maxiter);
toc()

eigens = sort(eig(A));
eigs1 = sort(eigs);
abserr = norm(eigens - eigs1, inf)

niter1 = length(conv1);
nps1 = 1:niter1;

semilogy(nps1, conv1, 'r.-');
grid on
%hold on
legend('QR iterations')
xlabel('Iteration number');
ylabel('|Delta|');
title('Convergence of QR iteration process');
