function nsolgm_test ( )

%*****************************************************************************80
%
%% nsolgm_test() tests nsolgm() on the Chandrasekhar function.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    15 April 2021
%
%  Author:
%
%    John Burkardt
%
  n = 100;

  fprintf ( 1, '\n' );
  fprintf ( 1, 'nsolgm_test():\n' );
  fprintf ( 1, '  nsolgm() solves a system of nonlinear equations\n' );
  fprintf ( 1, '  using an inexact Newton-GMRES iteration.\n' );
  fprintf ( 1, '  Test it on the Chandrasekhar function.\n' );
%
%  Initial estimate.
%
  h(1:n,1) = 1.0;

  atol = 0.000001;
  rtol = 0.000001;
  tol = [ atol, rtol ];

  maxit = 10;
  maxitl = 5;
  etamax = 0.9;
  parms = [ maxit, maxitl, etamax ];

  [ sol, it_hist, ierr ] = nsolgm ( h, @chandrasekhar, tol, parms );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Error flag IERR = %d\n', ierr );

  f = chandrasekhar ( sol );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Residual norm: %f\n', norm ( f ) );

  it_hist

  return
end
