function test_llt ( )

%*****************************************************************************80
%
%% test_llt() tests LLT factors.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    22 July 2022
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'test_llt():\n' );
  fprintf ( 1, '  A = a test matrix of order M by M\n' );
  fprintf ( 1, '  L is an M by N lower triangular Cholesky factor.\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  |A| = Frobenius norm of A.\n' );
  fprintf ( 1, '  |A-LLT| = Frobenius norm of A-L*L''.\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Title                    M     N      ' );
  fprintf ( 1, '|A|            |A-LLT|\n' );
  fprintf ( 1, '\n' );
%
%  dif2
%
  title = 'dif2';
  m = 5;
  n = 5;
  a = dif2_matrix ( m, n );
  l = dif2_llt ( n );
  error_frobenius = r8mat_is_llt ( m, n, a, l );
  norm_a_frobenius = norm ( a, 'fro' );
  fprintf ( 1, '  %-20s  %4d  %4d  %14g  %14g\n', ...
    title, m, n, norm_a_frobenius, error_frobenius );
%
%  givens
%
  title = 'givens';
  m = 5;
  n = 5;
  a = givens_matrix ( m, n );
  l = givens_llt ( n );
  error_frobenius = r8mat_is_llt ( m, n, a, l );
  norm_a_frobenius = norm ( a, 'fro' );
  fprintf ( 1, '  %-20s  %4d  %4d  %14g  %14g\n', ...
    title, m, n, norm_a_frobenius, error_frobenius );
%
%  hilbert
%
  title = 'hilbert';
  m = 5;
  n = 5;
  a = hilbert_matrix ( m, n );
  l = hilbert_llt ( n );
  error_frobenius = r8mat_is_llt ( m, n, a, l );
  norm_a_frobenius = norm ( a, 'fro' );
  fprintf ( 1, '  %-20s  %4d  %4d  %14g  %14g\n', ...
    title, m, n, norm_a_frobenius, error_frobenius );
%
%  kershaw
%
  title = 'kershaw';
  m = 4;
  n = 4;
  a = kershaw_matrix ( );
  l = kershaw_llt ( );
  error_frobenius = r8mat_is_llt ( m, n, a, l );
  norm_a_frobenius = norm ( a, 'fro' );
  fprintf ( 1, '  %-20s  %4d  %4d  %14g  %14g\n', ...
    title, m, n, norm_a_frobenius, error_frobenius );
%
%  lehmer
%
  title = 'lehmer';
  m = 5;
  n = 5;
  a = lehmer_matrix ( n, n );
  l = lehmer_llt ( n );
  error_frobenius = r8mat_is_llt ( m, n, a, l );
  norm_a_frobenius = norm ( a, 'fro' );
  fprintf ( 1, '  %-20s  %4d  %4d  %14g  %14g\n', ...
    title, m, n, norm_a_frobenius, error_frobenius );
%
%  minij
%
  title = 'minij';
  m = 5;
  n = 5;
  a = minij_matrix ( n, n );
  l = minij_llt ( n );
  error_frobenius = r8mat_is_llt ( m, n, a, l );
  norm_a_frobenius = norm ( a, 'fro' );
  fprintf ( 1, '  %-20s  %4d  %4d  %14g  %14g\n', ...
    title, m, n, norm_a_frobenius, error_frobenius );
%
%  moler1
%
  title = 'moler1';
  m = 5;
  n = 5;
  r8_lo = -5.0;
  r8_hi = +5.0;
  key = 123456789;
  rng ( key );
  alpha = r8_lo + ( r8_hi - r8_lo ) * rand ( 1, 1 );
  a = moler1_matrix ( alpha, m, n );
  l = moler1_llt ( alpha, n );
  error_frobenius = r8mat_is_llt ( m, n, a, l );
  norm_a_frobenius = norm ( a, 'fro' );
  fprintf ( 1, '  %-20s  %4d  %4d  %14g  %14g\n', ...
    title, m, n, norm_a_frobenius, error_frobenius );
%
%  moler3
%
  title = 'moler3';
  m = 5;
  n = 5;
  a = moler3_matrix ( m, n );
  l = moler3_llt ( n );
  error_frobenius = r8mat_is_llt ( m, n, a, l );
  norm_a_frobenius = norm ( a, 'fro' );
  fprintf ( 1, '  %-20s  %4d  %4d  %14g  %14g\n', ...
    title, m, n, norm_a_frobenius, error_frobenius );
%
%  oto
%
  title = 'oto';
  m = 5;
  n = 5;
  a = oto_matrix ( m, n );
  l = oto_llt ( n );
  error_frobenius = r8mat_is_llt ( m, n, a, l );
  norm_a_frobenius = norm ( a, 'fro' );
  fprintf ( 1, '  %-20s  %4d  %4d  %14g  %14g\n', ...
    title, m, n, norm_a_frobenius, error_frobenius );
%
%  pascal2
%
  title = 'pascal2';
  m = 5;
  n = 5;
  a = pascal2_matrix ( n );
  l = pascal2_llt ( n );
  error_frobenius = r8mat_is_llt ( m, n, a, l );
  norm_a_frobenius = norm ( a, 'fro' );
  fprintf ( 1, '  %-20s  %4d  %4d  %14g  %14g\n', ...
    title, m, n, norm_a_frobenius, error_frobenius );
%
%  wilk05
%
  title = 'wilk05';
  m = 5;
  n = 5;
  a = wilk05_matrix ( );
  l = wilk05_llt ( );
  error_frobenius = r8mat_is_llt ( m, n, a, l );
  norm_a_frobenius = norm ( a, 'fro' );
  fprintf ( 1, '  %-20s  %4d  %4d  %14g  %14g\n', ...
    title, m, n, norm_a_frobenius, error_frobenius );
%
%  wilson
%
  title = 'wilson';
  m = 4;
  n = 4;
  a = wilson_matrix ( );
  l = wilson_llt ( );
  error_frobenius = r8mat_is_llt ( m, n, a, l );
  norm_a_frobenius = norm ( a, 'fro' );
  fprintf ( 1, '  %-20s  %4d  %4d  %14g  %14g\n', ...
    title, m, n, norm_a_frobenius, error_frobenius );

  return
end
