function b = r8st_to_r8ge ( m, n, nz_num, row, col, a )

%*****************************************************************************80
%
%% r8st_to_r8ge() converts an r8st matrix to a R8GE matrix.
%
%  Discussion:
%
%    The r8st storage format stores the row, column and value of each nonzero
%    entry of a sparse matrix.
%
%    It is possible that a pair of indices (I,J) may occur more than
%    once.  Presumably, in this case, the intent is that the actual value
%    of A(I,J) is the sum of all such entries.  This is not a good thing
%    to do, but I seem to have come across this in MATLAB.
%
%    The r8st format is used by CSPARSE ("sparse triplet"), SLAP 
%    ("nonsymmetric SLAP triad"), by MATLAB, and by SPARSEKIT ("COO" format).
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    13 February 2004
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer M, N, the number of rows and columns of the matrix.
%
%    integer NZ_NUM, the number of nonzero elements in the matrix.
%
%    integer ROW(NZ_NUM), COL(NZ_NUM), the row and column indices
%    of the nonzero elements.
%
%    real A(NZ_NUM), the nonzero elements of the matrix.
%
%  Output:
%
%    real B(M,N), the R8GE matrix.
%
  b(1:m,1:n) = 0.0;

  for k = 1 :nz_num
    b(row(k),col(k)) = a(k);
  end

  return
end
