function jacobi_test ( )

  fprintf ( 1, '\n' );
  fprintf ( 1, 'jacobi_test()\n' );
  fprintf ( 1, '  Test jacobi()\n' );

  n = 10;
  A = zeros ( n, n );
  for i = 1 : n
    A(i,i) = 2.0;
  end
  for i = 1 : n - 1
    A(i,i+1) = -1.0;
  end
  for i = 2 : n
    A(i,i-1) = -1.0;
  end
  b = zeros ( n, 1 );
  b(n) = n + 1;

  x0 = zeros ( n, 1 );
  delta = 0.0001;
  max_it = 100;

  [ x, iflag, itnum ] = jacobi ( A, b, x0, delta, max_it );

  fprintf ( 1,'\n' );
  fprintf ( 1, '  jacobi() returned iflag = %d\n', iflag );
  fprintf ( 1, '  jacobi() took %d iterations\n', itnum );

  xtrue = 1:n;
  r = A * x - b;

  fprintf ( 1, '\n' );
  fprintf ( 1, '   i      x(i) x_true(i)  A*x-b(i)\n' );
  fprintf ( 1, '\n' );
  for i = 1 : n
    fprintf ( 1, '  %2d  %8.4f  %8.4f  %e\n', i, x(i), xtrue(i), r(i) );
  end

  return
end

