function A = r8crs_to_r8ge ( n, nz, row, col, val )

%*****************************************************************************80
%
%% r8crs_to_r8ge() converts an R8CRS matrix to a R8GE matrix.
%
%  Discussion:
%
%    The R8CRS storage format stores the nonzero entries of row I in 
%    entries ROW(I) through ROW(I+1)-1 of VAL.  
%    COL(J) records the column index of the entry in VAL(J).
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    14 February 2020
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer N: the order of the matrix.
%
%    integer NZ: the number of nonzero elements.
%
%    integer ROW(N+1): the nonzero offdiagonal elements 
%    of row I of A are contained in A(ROW(I)) through A(ROW(I+1)-1).
%
%    integer COL(NZ): the column indices of the nonzero elements of A.
%
%    real VAL(NZ): the nonzero elements of A.
%
%  Output:
%
%    real A(N,N): the R8GE matrix.
%
  A = zeros ( n, n );

  for i = 1 : n
    for j = row(i) : row(i+1)-1
      A(i,col(j)) = val(j);
    end
  end

  return
end
