function r8nsymm_gen_test ( )

%*****************************************************************************80
%
%% R8NSYMM_GEN_TEST tests R8NSYMM_GEN.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    09 March 2018
%
%  Author:
%
%    John Burkardt
%
  n = 100;
  bin_num = 10;
  lambda_dev = 1.0;
  lambda_mean = 1.0;
  seed = 123456789;

  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, ql, qr, lambda, seed ] = r8nsymm_gen ( n, lambda_mean, lambda_dev, seed );
%
%  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, qr, '  The right eigenvector matrix QR:' );
  end

  aqr = a * qr;

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

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

  return
end
