%BlockSizesEffects
%This test compares the number of matrix multiplications that are used by
%Block Lanczos to aquire a residual norm that for all eigenpairs falls
%below 'tol', against different blocksizes.
%It utilizes random starting blocks and takes a by the user determined number
%of measurements for each block size. From that data it returns the mean
%number of multiplications, and the variance of the data.
%The matrices 'h06_*' belongs to systems of bosons. 

load('h06_08')
A=h06_08;           %the matrix
tol=1;              %residual norm<tol for all eigenpairs
k=10;               %number of desired eigenpairs
sMax=100;           %maximum number of matrix multiplications
measures=1;         %number of measures
p=[1:2 10:12];      %checked block sizes

sMean=p;
sVar=p;
temp=1:measures;

for i=1:length(p);
    for j=1:measures
        [a b temp(j)]= BLKLAN(A,k,p(i),sMax,tol,0);
    end
    display([num2str(100*i/length(p)) '% done']);
    
    sMean(i)=mean(temp);
    sVar(i)=var(temp);
end

plot(p,sMean,p,sMean+sVar,p,sMean-sVar)