%MatrixAprx
%Examines the overlapping residual, for an eigenvector calcultated in a
%smaller modelspace and then projected up onto a larger one.
%This code can fairily easy be altered to compare single float precision
%matrices eigenvectors to eigenvectors of double float precision matrices

t=10.^-(-3:0.5:6);  %tolerance values in the smaller model space
L=length(t);

precH1=0*t;%precision smaller model space
precH2=0*t;%precision larger model space

load 'h06_06.mat'
load 'h06_08.mat'
load 'MAP06_06to08.mat'
h1=h06_06;
h2=h06_08;
map=MAP06_06to08;   %projection matrix

S=0*t;

[e v]=BLKLAN(h1,1,1,200,200,1);
for i=1:L
    [e v]=BLKLAN(h1,1,1,200,t(i),1,v);
    precH1(i)=norm(h1*v-e*v);
    w=map*v;
    precH2(i)=norm(h2*w-e*w);
    display([num2str(100*i/L) '% done'])
end
loglog(precH1,precH2,'+')