function r8nsymm_gen_test ( )

%*****************************************************************************80
%
%% r8nsymm_gen_test() tests r8nsymm_gen().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    09 March 2018
%
%  Author:
%
%    John Burkardt
%
  n = 5;
  bin_num = 10;
  lambda_dev = 5.0;
  lambda_mean = 10.0;

  fprintf ( 1, '\n' );
  fprintf ( 1, 'r8nsymm_gen_test():\n' );
  fprintf ( 1, '  r8nsymm_gen() generates an arbitrary size nonsymmetric\n' );
  fprintf ( 1, '  matrix with known eigenvalues and eigenvectors.\n' );

  [ A, Q, T ] = r8nsymm_gen ( n, lambda_mean, lambda_dev );

  lambda = diag ( T );
  lambda = sort ( lambda );
%
%  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:' );

  disp ( "" );
  disp ( "  The matrix A:" );
  disp ( A )

  disp ( "" );
  disp ( "  The matrix Q:" );
  disp ( Q )

  disp ( "" );
  disp ( "  The matrix T:" );
  disp ( T )

  disp ( "" );
  disp ( "  The eigenvalues LAMBDA (sorted):" );
  disp ( lambda )

  qtq = Q' * T * Q;

  disp ( '' );
  disp ( '  Q'' * T * Q should equal A' );
  disp ( qtq );

  return
end
