% In this file we will test for few sizes the routine
% Inv_Unsym_Trid

n=[1,2,3,5,10,100]; % An array of the problem sizes


for i=1:length(n)
  % Generate the tridiagonal matrix
  a=rand(n(i),1);
  b=rand(n(i)-1,1);
  c=rand(n(i)-1,1); 
  
  % Compute the generators of the inverse
  [u,v,p,q]=Inv_Unsym_Trid(b,a,c);
 
  % Check if the result is satisfactory
  T=diag(a)+diag(b,-1)+diag(c,1);
  S = tril(u.'*v)+triu(p.'*q,1);
  
  
  disp('Problem size:')
  n(i)
  
  disp('Error: norm of S*T-I')
  norm(S*T-eye(n(i)))
  disp('------------------------')
  
end

