function r8ge_res_test ( )

%*****************************************************************************80
%
%% r8ge_res_test() tests r8ge_res().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    01 February 2016
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'r8ge_res_test():\n' );
  fprintf ( 1, '  r8ge_res() computes b-A*x, where A is an R8GE matrix.\n' );
  fprintf ( 1, '  We check three cases, M<N, M=N, M>N.\n' );

  for i = 1 : 3

    if ( i == 1 )
      m = 3;
      n = 5;
    elseif ( i == 2 )
      m = 5;
      n = 5;
    elseif ( i == 3 )
      m = 5;
      n = 3;
    end

    a = r8ge_random ( m, n );
    x = r8vec_indicator1 ( n );
    b = r8ge_mv ( m, n, a, x );
    r = r8ge_res ( m, n, a, x, b );
    r8vec_print ( m, r, '  Residual A*x-b:' );

  end

  return
end
