% DETUS Calculates the determinant of an upper triangular semiseparable matrix
%       
%    D=DETUS(G,d)
%    Given a sequence of Givens transformations and a vector
%    the function calculates the determinant of the corresponding
%    upper triangular semiseparable matrix
%
%    The givens and the vector have to be stored in the following way
%
%    G= | c(1)  c(2)  c(3) .. .. .. c(n-1) |
%       | s(1)  s(2)  s(3) .. .. .. s(n-1) |
%     
%    d= [d(1) d(2) .. ..  d(n)]
%
%
%    Software of the MaSe - Group
%    mase-at-cs.kuleuven.ac.be
%    Revision Date: 04/05/2004


function determ=DETUS(G,d)
 
% initializing the size of the matrix
  n=length(d);
  
  if n==0
    determ=[];
  elseif n==1
    determ=d(1);
  else
    % as the matrix is upper triangular the determinant is the product of
    % the diagonal elements.
    determ=d(1);
    for i=1:n-1
      determ=determ*d(i+1)*G(1,i);
    end
   end