function  AB = GJ(AB)
m = size(AB,1)
n = size(AB,2)-1
p = 1
for j = 1:m%
    %    j
    t = 0;
    while t == 0 & p < n+2
         if AB(j,p) ~= 0
                  t = 1
                  AB(j,p:n+1) = AB(j,p:n+1)/AB(j,p)
                  for k = j+1:m
                   f = AB(k,p)
	               AB(k,p:n+1)=AB(k,p:n+1)-f*AB(j,p:n+1)
                   sprintf('L%d = L%d - %dL%d',k,k,f,j)
                  end
                  for k = 1:j-1
                     f = AB(k,p)
	                 AB(k,p:n+1)=AB(k,p:n+1)-f*AB(j,p:n+1)
                     sprintf('L%d = L%d - %dL%d',k,k,f,j)
                 end
         else
             [maxx,i] = max(abs(AB(j:m,p)));
             if maxx ~= 0
              t = 1
              piv(j) = i + j - 1
              AB([j,piv(j)],p:n+1) = AB([piv(j),j],p:n+1)
              AB(j,p:n+1) = AB(j,p:n+1)/AB(j,p)
               for k = j+1:m
%                    j
%                    m
%                    k
                   f = AB(k,p)
	               AB(k,p:n+1)=Ab(k,p:n+1)-f*AB(j,p:n+1) 
                   sprintf('L%d = L%d - %dL%d',k,k,f,j)
               end
               for k = 1:j-1
                     f = AB(k,p)
	                 AB(k,p:n+1)=Ab(k,p:n+1)-f*AB(j,p:n+1)
                     sprintf('L%d = L%d - %dL%d',k,k,f,j)
               end
             else
                p = p +1
            end
         end
   end
end
