function r8mat_ldlt_solve_test ( )

%*****************************************************************************80
%
%% r8mat_ldlt_solve_test tests r8mat_ldlt_solve.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    03 December 2019
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'r8mat_ldlt_solve_test\n' );
  fprintf ( 1, '  r8mat_ldlt_solve solves a linear system\n' );
  fprintf ( 1, '  associated with a symmetric matrix A\n' );
  fprintf ( 1, '  that has been LDLT factored.\n' );

  n = 5;
  a = zeros ( n, n );
  for i = 1 : n
    for j = 1 : n
      a(i,j) = 1.0 / ( i + j - 1 );
    end
  end

  r8mat_print ( n, n, a, '  Matrix to be factored:' );
%
%  Compute the LDLT factors.
%
  [ l, d ] = r8mat_ldlt_factor ( a );
  r8mat_print ( n, n, l, '  L factor:' );
  r8mat_print ( n, n, d, '  D factor:' );
  a2(1:n,1:n) = l * d * l';
  r8mat_print ( n, n, a2, '  Product L * D * L'':' );
%
%  Solve a linear system.
%
  x = ( 1 : n )';
  b = a * x;
  r8vec_print ( n, b, '  Right hand side:' );
  x = r8mat_ldlt_solve ( l, d, b );

  r8vec_print ( n, x, '  Computed solution:' );

  return
end


