function a = dif2_rtr ( n )

%*****************************************************************************80
%
%% DIF2_RTR returns the upper triangular Cholesky factor of the DIF2 matrix.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    04 August 2015
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer N, the order of A.
%
%  Output:
%
%    real A(N,N), the matrix.
%
  a = zeros ( n, n );

  for i = 1 : n
    a(i,i) = sqrt ( i + 1 ) / sqrt ( i );
  end

  for i = 2 : n
    a(i-1,i) = - sqrt ( i - 1 ) / sqrt ( i );
  end

  return
end
