function invitr_test ( )

%*****************************************************************************80
%
%% invitr_test tests invitr().
%
%  Reference:
%
%    Samuel Conte, Carl de Boor,
%    Elementary Numerical Analysis,
%    Third Edition,
%    SIAM, 2017,
%    ISBN: 978-1-611975-19-2.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'invitr_test:\n' );
  fprintf ( 1, '  Test invitr()\n' );

  n = 5;
  A = rand ( 5, 5 );
  A = A' * A;

  eguess = 1.0;
  vguess = ones ( n, 1 );

  [ evalue, vvalue, iflag ] = invitr ( A, eguess, vguess );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  invitr() returned iflag = %d\n', iflag );
  fprintf ( 1, '  eigenvalue estimate e is %g\n', evalue );
  fprintf ( 1, '  eigenvector estimate v is:\n' );
  fprintf ( 1, '\n' );
  for i = 1 : n
    fprintf ( 1, '  %g\n', vvalue(i) );
  end

  r = A * vvalue - vvalue * evalue;
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Norm of residual A*v-v*e = %g\n', norm ( r ) );

  return
end

