function a_r8ge = r8ncf_to_r8ge ( m, n, nz_num, rowcol, a )

%*****************************************************************************80
%
%% R8NCF_TO_R8GE converts an R8NCF matrix to R8GE format.
%
%  Discussion:
%
%    The R8NCF storage format stores NZ_NUM, the number of nonzeros, 
%    a real array containing the nonzero values, a 2 by NZ_NUM integer 
%    array storing the row and column of each nonzero entry.
%
%    The R8NCF format is used by NSPCG.  NSPCG requires that the information
%    for the diagonal entries of the matrix must come first.
%
%  Licensing:
%
%    This code is distributed under the MIT license. 
%
%  Modified:
%
%    20 July 2016
%
%  Author:
%
%    John Burkardt
%
%  Parameters:
%
%    Input, integer M, N, the number of rows and columns in
%    the matrix.
%
%    Input, integer NZ_NUM, the number of nonzero entries.
%
%    Input, integer ROWCOL(2,NZ_NUM), the coordinates of 
%    the nonzero entries.
%
%    Input, real A(NZ_NUM), the matrix.
%
%    Output, real A_R8GE(M,N), the R8GE matrix.
%
  a_r8ge = zeros ( m, n );

  for k = 1 : nz_num
    i = rowcol(1,k);
    j = rowcol(2,k);
    a_r8ge(i,j) = a_r8ge(i,j) + a(k);
  end

  return
end
