function a = i4mat_row_swap ( m, n, a, i1, i2 )

%*****************************************************************************80
%
%% I4MAT_ROW_SWAP swaps rows in an I4MAT.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    02 September 2018
%
%  Author:
%
%    John Burkardt
%
%  Parameters:
%
%    Input, integer M, N, the number of rows and columns.
%
%    Input, integer A(M,N), the matrix to be analyzed. 
%
%    Input, integer I1, I2, the indices of the rows.
%    1 <= I1, I2 <= M.
%
%    Output, integer A(M,N), the matrix with swapped rows.
%
  if ( i1 < 1 || m < i1 )
    fprintf ( 1, '\n' );
    fprintf ( 1, 'I4MAT_ROW_SWAP - Fatal error!\n' );
    fprintf ( 1, '  Row index 1 <= I1 <= M required.\n' );
    error ( 'I4MAT_ROW_SWAP - Fatal error!' );
  end

  if ( i2 < 1 || m < i2 )
    fprintf ( 1, '\n' );
    fprintf ( 1, 'I4MAT_ROW_SWAP - Fatal error!\n' );
    fprintf ( 1, '  Row index 1 <= I2 <= M required.\n' );
    error ( 'I4MAT_ROW_SWAP - Fatal error!' );
  end

  temp      = a(i1,1:n);
  a(i1,1:n) = a(i2,1:n);
  a(i2,1:n) = temp;

  return
end

