function T = r8triangular_upper_gen ( n, lambda_mean, lambda_dev )

%*****************************************************************************80
%
%% r8nsymm_gen() generates a nonsymmetric matrix with a certain eigenstructure.
%
%  Discussion:
%
%    We generate a real nonsymmetric matrix with real eigenvalues,
%    factored as A = Q' * T * Q where Q is orthogonal, 
%    and T is upper triangular.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    04 June 2024
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer N, the order of the matrix.
%
%    real LAMBDA_MEAN, the mean value of the normal
%    distribution
%
%    real LAMBDA_DEV, the standard deviation of the normal
%    distribution.
%
%  Output:
%
%    real T(N,N), the upper triangular Schur matrix.
%
  T = zeros ( n, n );

  for i = 1 : n
    T(i,i:n) = lambda_mean + lambda_dev * randn ( 1, n + 1 - i );
  end

  return
end
