function x = seidel ( A, xold, b )
%
% function x = seidel ( A, xold, b )
%
%  Discussion:
%
%    SEIDEL carries out one step of Gauss-Seidel iteration, seeking
%    to solve the system A * x = b.
%
%  Modified:
%
%    03 April 2000
%
%  Author:
%
%    John Burkardt
%
%  Parameters:
%
%    Input, real A(N,N), the matrix of the linear system.
%
%    Input, real XOLD(N), an esimate for the solution.
%
%    Input, real B(N), the right hand side of the linear system.
%
%    Output, real X(N), the improved estimate of the solution.
%
[ n, n ] = size ( A );

x = xold;

for i = 1 : n

  sum = 0.0;
  for j = 1 : n
    if ( j ~= i ) 
      sum = sum + A(i,j) * x(j);
    end 
  end

  x(i) = ( b(i) - sum ) / A(i,i);

end
