function eigs_symmetric_test ( )

%*****************************************************************************80
%
%% eigs_symmetric_test() tests eigs() on a symmetric matrix.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    04 June 2024
%
%  Author:
%
%    John Burkardt
%
  n = 5;
  lambda_dev = 5.0;
  lambda_mean = 10.0;
 
  fprintf ( 1, '\n' );
  fprintf ( 1, 'eigs_symmetric_test():\n' );
  fprintf ( 1, '  Test eigs() on a real symmetric matrix.\n' );
%
%  Generate a real symmetric test matrix with known eigenvalues and eigenvectors.
%
  [ A, Q, lambda ] = r8symm_gen ( n, lambda_mean, lambda_dev );
%
%  Print the matrix.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Real symmetric test matrix A:\n' );
  disp ( A )

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Eigenvectors Q:\n' );
  disp ( Q )

  lambda = sort ( lambda );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Eigenvalues lambda:\n' );
  disp ( lambda )
%
%  Call eigs.
%
  [ Q2, lambda2 ] = eigs ( A, n );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Computed eigenvectors Q2:\n' );
  disp ( Q2 )

  lambda2 = diag ( lambda2 );
  lambda2 = sort ( lambda2 );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Computed eigenvalues lambda2:\n' );
  disp ( lambda2 )
%
%  Errors.
%
  lambda_error = norm ( lambda - lambda2 );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Norm of eigenvalue error = %g\n', lambda_error );

  return
end
