function x = r8mat_ldlt_solve ( l, d, b )

%*****************************************************************************80
%
%% r8mat_ldlt_solve solves an LDLT factored linear system A * x = b.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    03 December 2019
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    real L(N,N), D(N,N): the L and D factors.
%
%    real B(N,1), the right hand side.
%
%  Output:
%
%    real X(N,1), the solution of the linear system.
%
  [ n, ~ ] = size ( l );
%
%  Destroy all row vectors!
%
  b = b(:);
%
%  Solve L * z = b.
%
  x = r8mat_l1_solve ( n, l, b );
%
%  Solve D * y = z.
%
  for i = 1 : n
    x(i) = x(i) / d(i,i);
  end
%
%  Solve L' * x = y.
%
  x = r8mat_l1t_solve ( n, l, x );

  return
end
