function r8symm_gen_test ( )

%*****************************************************************************80
%
%% r8symm_gen_test() tests r8symm_gen().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    20 February 2012
%
%  Author:
%
%    John Burkardt
%
  n = 10;
  bin_num = 10;
  lambda_dev = 5.0;
  lambda_mean = 10.0;
 
  fprintf ( 1, '\n' );
  fprintf ( 1, 'r8symm_gen_test():\n' );
  fprintf ( 1, '  r8symm_gen() generates an arbitrary size symmetric matrix\n' );
  fprintf ( 1, '  with known eigenvalues and eigenvectors.\n' );

  [ a, q, lambda ] = r8symm_gen ( n, lambda_mean, lambda_dev );
%
%  Get the eigenvalue range.
%
  lambda_min = min ( lambda(1:n) );
  lambda_max = max ( lambda(1:n) );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  LAMBDA_MIN = %g\n', lambda_min );
  fprintf ( 1, '  LAMBDA_MAX = %g\n', lambda_max );
%
%  Bin the eigenvalues.
%
  [ bin, bin_limit ] = r8vec_bin ( n, lambda, bin_num, lambda_min, lambda_max );

  r8bin_print ( bin_num, bin, bin_limit, '  Lambda bins:' );

  if ( false )
    r8mat_print ( n, n, a, '  The matrix A:' );
  end

  if ( false )
    r8mat_print ( n, n, q, '  The eigenvector matrix Q:' );
  end

  aq = a * q;

  for j = 1 : n
    lambda2(j) = norm ( aq(1:n,j) );
  end

  r8vec2_print ( n, lambda, lambda2, '  LAMBDA versus column norms of A*Q:' );

  return
end
