function r83_cr_fa_test ( )

%*****************************************************************************80
%
%% r83_cr_fa_test() tests r83_cr_fa().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    30 August 2015
%
%  Author:
%
%    John Burkardt
%
  n = 5;
  debug = 0;

  fprintf ( 1, '\n' );
  fprintf ( 1, 'R83_CR_FA_TEST\n' );
  fprintf ( 1, '  R83_CR_FA factors a real tridiagonal matrix;\n' );
  fprintf ( 1, '  Once the matrix has been factored, we can call\n' );
  fprintf ( 1, '  R83_CR_SL to solve a linear system.\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Matrix order N = %d\n', n );
  fprintf ( 1, '  Demonstrate multiple system solution method.\n' );
  fprintf ( 1, '\n' );
%
%  Set the matrix values.
%
  a = r83_dif2 ( n, n );
%
%  Print the matrix.
%
  r83_print ( n, n, a, '  System matrix A:' );
%
%  Factor the matrix once.
%
  a_cr = r83_cr_fa ( n, a );
%
%  Print the factor information.
%
  if ( debug )
    r83_print ( n, 2*n+1, a_cr, '  Cyclic reduction factor information:' );
  end 

  for j = 1 : 2

    fprintf ( 1, '\n' );
    fprintf ( 1, '  Solve linear system number #%d\n', j );

    if ( j == 1 ) 
      b(1:n-1) = 0.0;
      b(n) = n + 1;
    else
      b(1) = 1.0;
      b(2:n-1) = 0.0;
      b(n) = 1.0;
    end
%
%  Solve the linear system.
%
    x = r83_cr_sl ( n, a_cr, b );

    r8vec_print ( n, x, '  Solution:' );

  end

  return
end

