function A = lr(A)
%*** get size of Matrix
n = size(A,1);

for k=1:n-1
  for j = k+1 : n 
    %*** compute entries l_{j,k} and store in A
    if A(k,k)==0
      disp('Es existiert keine LR-Zerlegung!');
      return;
    end
    A(j,k) = A(j,k)/A(k,k); 
    %*** update other entries of j-th row
    for i = k+1 : n 
      A(j,i) = A(j,i) - A(j,k)*A(k,i); 
    end 
  end 
end 