function r83s_jac_sl_test ( )

%*****************************************************************************80
%
%% R83S_JAC_SL_TEST tests R83S_JAC_SL.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    05 September 2015
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'R83S_JAC_SL_TEST\n' );
  fprintf ( 1, '  R83S_JAC_SL applies Jacobi iteration with an R83S matrix\n' );
  fprintf ( 1, '  to solve a linear system A*x=b.\n' );
%
%  Set A to the second difference matrix.
%
  n = 10;

  a = r83s_dif2 ( n, n );
%
%  Choose a random solution.
%
  seed = 123456789;
  [ x1, seed ] = r8vec_uniform_01 ( n, seed );
%
%  Compute the corresponding right hand side.
%
  b = r83s_mv ( n, n, a, x1 );
%
%  Call the Jacobi routine.
%
  x2 = ones ( n, 1 );
  it_max = 100;
  x3 = r83s_jac_sl ( n, a, b, x2, it_max );
%
%  Compute the residual.
%
  r = r83s_res ( n, n, a, x3, b );
  r_norm = norm ( r(1:n) );
%
%  Compute the error.
%
  x1 = x1(:);
  x3 = x3(:);
  e_norm = norm ( x1 - x3 );
%
%  Report.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Number of variables N = %d\n', n );
  fprintf ( 1, '  Norm of residual ||Ax-b|| = %g\n', r_norm );
  fprintf ( 1, '  Norm of error ||x1-x2|| = %g\n', e_norm );

  return
end
