function r83p_fa_test ( )

%*****************************************************************************80
%
%% R83P_FA_TEST tests R83P_FA.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    14 March 2009
%
%  Author:
%
%    John Burkardt
%
  n = 10;

  fprintf ( 1, '\n' );
  fprintf ( 1, 'R83P_FA_TEST\n' );
  fprintf ( 1, '  R83P_FA factors a tridiagonal periodic system\n' );
  fprintf ( 1, '  which then can be solved by R83P_SL.\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Matrix order N = %d\n', n );
%
%  Set the matrix.
%
  a = r83p_random ( n );
%
%  Factor the matrix.
%
  [ a_lu, work2, work3, work4, info ] = r83p_fa ( n, a );

  if ( info ~= 0 )
    fprintf ( 1, '\n' );
    fprintf ( 1, 'R83P_FA_TEST - Fatal error!\n' );
    fprintf ( 1, '  R83P_FA returns INFO = %d\n', info );
    return
  end

  for job = 0 : 1
%
%  Set the desired solution.
%
    x = r8vec_indicator1 ( n );
%
%  Compute the corresponding right hand side.
%
    b = r83p_ml ( n, a_lu, x, job );
%
%  Solve the linear system.
%
    x = r83p_sl ( n, a_lu, b, job, work2, work3, work4 );

    if ( job == 0 )
      r8vec_print ( n, x, '  Solution:' );
    else
      r8vec_print ( n, x, '  Solution to transposed system:' );
    end

  end

  return
end
