function r8mat = r8rows_to_r8mat ( m, n, r8rows )

%*****************************************************************************80
%
%% R8ROWS_TO_R8MAT converts a row-major vector to an R8MAT.
%
%  Discussion:
%
%    An R8MAT is an MxN array of R8's, in column major order.
%
%    I am frustrated that the FORTRAN standard for initializing an array
%    forces me to enter a table of data by columns, so that I have to
%    transpose the information, which is confusing to me and any reader.
%
%    This function allows me to declare a vector of the right type and length,
%    fill it with data that I can display row-wise, and then have the
%    data copied into a column-major doubly-indexed array.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    10 September 2018
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer M, N, the number of rows and columns.
%
%    real R8ROWS(M*N), the data. stored rowwise
%    in a vector.
%
%  Output:
%
%    real R8MAT(M,N), a copy of the data, stored
%    columnwise in an array.
%
  r8mat = zeros ( m, n );

  k = 0;
  for i = 1 : m
    for j = 1 : n
      k = k + 1;
      r8mat(i,j) = r8rows(k);
    end
  end

  return
end
