function r8mat_cholesky_factor_test ( )

%*****************************************************************************80
%
%% R8MAT_CHOLESKY_FACTOR_TEST tests R8MAT_CHOLESKY_FACTOR.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    28 August 2016
%
%  Author:
%
%    John Burkardt
%
  n = 5;

  fprintf ( 1, '\n' );
  fprintf ( 1, 'R8MAT_CHOLESKY_FACTOR_TEST\n' );
  fprintf ( 1, '  R8MAT_CHOLESKY_FACTOR determines the\n' );
  fprintf ( 1, '  lower triangular Cholesky factorization\n' );
  fprintf ( 1, '  of a positive definite symmetric matrix,\n' );

  for i = 1 : n
    for j = 1 : n
      if ( i == j )
        a(i,j) = 2.0;
      elseif ( abs ( i - j ) == 1 )
        a(i,j) = -1.0;
      else
        a(i,j) = 0.0;
      end
    end
  end

  r8mat_print ( n, n, a, '  Matrix to be factored:' );
%
%  Compute a Cholesky factor.
%
  l = r8mat_cholesky_factor ( n, a );
  r8mat_print ( n, n, l, '  Cholesky factor L:' );
  d(1:n,1:n) = l(1:n,1:n) * l(1:n,1:n)';
  r8mat_print ( n, n, d, '  Product L * L'':' );

  return
end


