function A = gensmspectr(n)
%GENSMSPECTR Generate a dense n x n symmetric random matrix
%            with a prescribed eigenspectrum

  Q = orth(rand(n, n)); % orthogonal random n x n matrix
  lambdas = 1:n; % prescribed eigenspectrum
  A = Q'*diag(lambdas)*Q;	
  A = 0.5*(A + A'); % construct a symmetric matrix
end
