function [ a, q, lambda ] = r8symm_gen ( n, lambda_mean, lambda_dev )

%*****************************************************************************80
%
%% r8symm_gen() generates a symmetric matrix with a certain eigenstructure.
%
%  Discussion:
%
%    An R8SYMM is a real symmetric matrix stored using full storage, and
%    using R8 arithmetic.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    21 February 2012
%
%  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 Q(N,N), the eigenvector matrix.
%
%    real LAMBDA(N), the eigenvalue vector.
%
 
%
%  Choose the eigenvalues LAMBDA.
%
  lambda = lambda_mean + lambda_dev * randn ( n, 1 );
%
%  Get a random orthogonal matrix Q.
%
  q = r8mat_orth_uniform ( n );
%
%  Set A = Q * Lambda*I * Q'.
%
  a = q * diag ( lambda ) * q';

  return
end
