function test_ldlt ( )

%*****************************************************************************80
%
%% test_ldlt() tests LDLT factors.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    04 December 2019
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'test_ldlt():\n' );
  fprintf ( 1, '  A = a symmetric M x M test matrix\n' );
  fprintf ( 1, '  L is an M by M lower triangular matrix.\n' );
  fprintf ( 1, '  D is an M by M diagonal matrix.\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  ||A|| = Frobenius norm of A.\n' );
  fprintf ( 1, '  ||A-LDLT|| = Frobenius norm of A-L*D*L''.\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Title                    M     N      ' );
  fprintf ( 1, '||A||            ||A-LDLT||\n' );
  fprintf ( 1, '\n' );
%
%  aegerter
%
  title = 'aegerter';
  m = 5;
  n = 5;
  a = aegerter_matrix ( n );
  [ l, d ] = aegerter_ldlt ( n );
  error_frobenius = r8mat_is_ldlt ( a, l, d );
  norm_a_frobenius = norm ( a, 'fro' );
  fprintf ( 1, '  %-20s  %4d  %4d  %14g  %14g\n', ...
    title, m, n, norm_a_frobenius, error_frobenius );
%
%  bodewig
%
  title = 'bodewig';
  m = 4;
  n = 4;
  a = bodewig_matrix ( );
  [ l, d ] = bodewig_ldlt ( );
  error_frobenius = r8mat_is_ldlt ( a, l, d );
  norm_a_frobenius = norm ( a, 'fro' );
  fprintf ( 1, '  %-20s  %4d  %4d  %14g  %14g\n', ...
    title, m, n, norm_a_frobenius, error_frobenius );
%
%  kms
%
  title = 'kms';
  alpha = 2.0;
  m = 4;
  n = 4;
  a = kms_matrix ( alpha, m, n );
  [ l, d ] = kms_ldlt ( alpha, n );
  error_frobenius = r8mat_is_ldlt ( a, l, d );
  norm_a_frobenius = norm ( a, 'fro' );
  fprintf ( 1, '  %-20s  %4d  %4d  %14g  %14g\n', ...
    title, m, n, norm_a_frobenius, error_frobenius );

  return
end
