
%-----------------------------------
  function  Y = nGAUSS(A,F,neq,IB)
%-----------------------------------
%   Solves [A]{Y} = {F}
%   for banded nonsymmetric matices 
%----------------------------------

  Idiag=(IB-1)/2+1;
%-------------------------
% Begin forward elimination
%-------------------------
  for I = 1:(neq-1); 

    Jend=neq;
    if Jend > I+(Idiag-1)
       Jend = I+(Idiag-1);
    end

    for J=(I+1):Jend
      Kc=Idiag-(J-I); 

      FAC=-A(J,Kc)/A(I,Idiag);

      Kbgn=I;
      Kend=Jend;
      for K=Kbgn:Kend
        IKc=Idiag+(K-I);
        JKc=Idiag+(K-J); 
        A(J,JKc)=A(J,JKc)+FAC*A(I,IKc);
      end
      F(J)=F(J)+FAC*F(I);
    end
  end
      
%------------------------ 
% Begin back substitution 
%------------------------ 
  Y(neq)=F(neq)/A(neq,Idiag);
  for Iback=2:neq
    I=neq-Iback+1;
    Jend=neq;
    if Jend > I+(Idiag-1)
       Jend = I+(Idiag-1);
    end
    for J=(I+1):Jend
      Jc = Idiag+(J-I);
      F(I)=F(I)-A(I,Jc)*Y(J); 
    end
    Y(I)=F(I)/A(I,Idiag); 
  end

