% Collect results from lanso and plot
% check orthogonality of v basis and compare to wjps
figure(1)
vn=normc(triu(v'*v-eye(j)));
semilogy([vn ; wjps]');
title('Orthogonality of basis, actual and estimates');
figure(2)
t=diag(alpha)+diag(beta(2:j),1)+diag(beta(2:j),-1);
resv=normc(A*v-v*t)/anorm;
semilogy(resv(1:j-1));
title('Residuals');
nevc=length(lmb);
res=A*xv-xv*diag(lmb);
rn=normc(res)/anorm;
xort=normc(xv'*xv-eye(nevc));
ress=[(1:nevc)' lmb rn' xort'];
fprintf('  k lambda_k                resid     orth  \n')
fprintf('%3.0f %20.14e %8.2e %8.2e \n',ress.');
% Compute all Ritz values and plot actual and estimated residuals
figure(3)
hold off
xs=v*s;
resns=normc(A*xs-xs*d)/anorm;
orts=normc(xs'*xs-eye(j));
semilogy(diag(d),[resns;bndv/anorm;orts],'o');
hold on;
semilogy([min(diag(d)) max(diag(d))],[tolconv tolconv])
title('All Ritz values act residual, estimated res, orthog')
