function [u,k] = Richardson(A,b,u0,omega,maxIters,prec)

% [V,D] = eig(full(A));
% n = length(b);
% x = 0:1/(n-1):1

u = u0;
r = b-A*u;
initNorm = norm(r);

% coeff = abs(V'*r)
% plot(x,r);
% hold on

for k=1:maxIters
    u = u + omega*r;    
    r = b-A*u;    
    
%     coeff_prev = coeff;
%     coeff= abs(V'*r);
%     coeff./coeff_prev
%     plot(x,r)
%     pause
    
    if norm(r)/initNorm < prec
        break;
    end
end


