function [ a, ql, qr, lambda ] = r8nsymm_gen ( n, lambda_mean, lambda_dev )

%*****************************************************************************80
%
%% r8nsymm_gen() generates a nonsymmetric matrix with a certain eigenstructure.
%
%  Discussion:
%
%    An R8NSYMM is a real nonsymmetric matrix stored using full storage, and
%    using R8 arithmetic.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    09 March 2018
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer N, the order of the matrix.
%
%    real LAMBDA_MEAN, the mean value of the normal
%    distribution from which the eigenvalues will be chosen.
%
%    real LAMBDA_DEV, the standard deviation of the normal
%    distribution from which the eigenvalues will be chosen.
%
%  Output:
%
%    real A(N,N), the test matrix.
%
%    real QL(N,N), the left eigenvector matrix.
%
%    real QR(N,N), the right eigenvector matrix.
%
%    real LAMBDA(N), the eigenvalue vector.
%
 
%
%  Choose the eigenvalues LAMBDA.
%
  lambda = lambda_mean + lambda_dev * randn ( n, 1 );
%
%  Get random orthogonal matrices QL and QR.
%
  ql = r8mat_orth_uniform ( n );
  qr = r8mat_orth_uniform ( n );
%
%  Set A = QL * Lambda*I * QR'.
%
  a = ql * diag ( lambda ) * qr';

  return
end
