  function P2()
% Checks ou EigsInInterval

% This variable will keep track of the number of times that EigsToLeft is
% called. Overall efficiency depends on its final value.
global nCalls
nCalls = 0;

% Generate a small example...
n = 20;
A = randn(n,n); A = A+A'; T = hess(A);
clc
format long
% Display all the eigenvalues...
eigsMat = sort(eig(T));
disp('All the eigenvalues via eig:')
disp(' ')
disp(eigsMat)
% Pick an interval... 
L = -2;
R = 3;
% Display the eigenvalues in [L,R]...
fprintf('The eigenvalues in [%5.3f,%5.3f] are:\n\n',L,R)
e = EigsInInterval(T,L,R);
disp(e)
% How many calls to EigsToLeft?
fprintf('Number of calls to EigsToLeft = %1d\n\n',nCalls)