% checking how dense the skew shift spectrum is
%
% The operator is
%
% hbar Delta + 2 cos(2 pi alpha n^2)
%
% on [-L, L] with L = 10 * 2^m, where m is taken
% from mvec, which ranges from 3 to 7 below.
%
% The code can be improved by using faster algorithms
% to find the iegenvalues, as e.g. provided by
% LAPACK.
%
% Usage is simply by runnning
% SkewSpecDense
% in matlab.
%
tic
alpha = sqrt(2) - 1;
hbar = 1;
maxvec = [];
mvec = 3:7;
for m=mvec
L = 10*2^m;
u = ones(2*L,1) .* hbar; % off-diagonal entries of the matrix
d = 2*cos(2 * pi * ([-L:L]'.^2)*alpha); % diagonal entries of the operator
schroe = diag(d) + diag(u,1) + diag(u,-1);
schroe = sparse(schroe);
ew = eig(schroe);
ew = sort(ew);
bandiff = abs(ew(2:end)-ew(1:end-1));
maxban = 2.5*max(bandiff);
fprintf('m = %d \t L = %d \t Max %f\n', m, L, maxban);
end
toc