function r8mat_is_ldlt_test ( )

%*****************************************************************************80
%
%% r8mat_is_ldlt_test() tests r8mat_is_ldlt().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    13 May 2021
%
%  Author:
%
%    John Burkardt
%
  m = 4;
  n = 4;

  a = [ ...
    1.0,  4.0, 16.0, 64.0; ...
    4.0,  1.0,  4.0, 16.0; ...
   16.0,  4.0,  1.0,  4.0; ...
   64.0, 16.0,  4.0,  1.0 ];

  l = [ ...
    1.0,  0.0,  0.0,  0.0; ...
    4.0,  1.0,  0.0,  0.0; ...
   16.0,  4.0,  1.0,  0.0; ...
   64.0, 16.0,  4.0,  1.0 ];

  d = [ ...
    1.0,   0.0,   0.0,   0.0; ...
    0.0, -15.0,   0.0,   0.0; ...
    0.0,   0.0, -15.0,   0.0; ...
    0.0,   0.0,   0.0, -15.0 ];

  fprintf ( 1, '\n' );
  fprintf ( 1, 'r8mat_is_ldlt_test():\n' );
  fprintf ( 1, '  r8mat_is_ldlt() tests the error in an LDLT factorization\n' );
  fprintf ( 1, '  by looking at\n' );
  fprintf ( 1, '    A - L * D * L''\n' );

  r8mat_print ( m, m, a, '  Matrix A:' );
  r8mat_print ( m, m, l, '  Factor L:' );
  r8mat_print ( m, m, d, '  Factor D:' );

  value = r8mat_is_ldlt ( a, l, d );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Frobenius norm of A-L*D*L'' is %g\n', value );

  fprintf ( 1, '\n' );
  fprintf ( 1, 'r8mat_is_ldlt_test():\n' );
  fprintf ( 1, '  Normal end of execution.\n' );

  return
end
