function [ xmax, ixmax ] = r8row_max ( m, n, x )

%*****************************************************************************80
%
%% r8row_max() returns the maximums of rows of an R8ROW.
%
%  Discussion:
%
%    An R8ROW is an M by N array of R8's, regarded as an array of M rows,
%    each of length N.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    30 September 2006
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer M, N, the number of rows and columns in the array.
%
%    real X(M,N), the R8ROW matrix.
%
%  Output:
%
%    real XMAX(M), the maximums of the rows of X.
%
%    integer IXMAX(M); IXMAX(I) is the column of X in which
%    the maximum for row I occurs.
%
  for i = 1 : m

    ixmax(i) = 1;
    xmax(i) = x(i,1);
    for j = 2 : n
      if ( xmax(i) < x(i,j) )
        ixmax(i) = j;
        xmax(i) = x(i,j);
      end
    end

  end

  return
end
