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

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


for i=1:length(n)

  % Generate the problems
  d=rand(n(i),1);
  sd=rand(n(i)-1,1);
 
  % Compute the inverse
  [u,v]=Inv_Sym_trid(sd,d);
  
  % Compute the semiseparable matrix
  S=tril(u'*v);
  S=S+triu(S',1);
  T=diag(d)+diag(sd,-1)+diag(sd,1);
  
  % Output the results
  disp('Problem size:')
  n(i)
  
  disp('Error: norm of S*T-I')
  norm(S*T-eye(n(i)))
  disp('------------------------')
  
end

