function [ nz_num, rowcol, a ] = r8st_to_r8ncf ( m, n, nz_num, row, col, a )

%*****************************************************************************80
%
%% r8st_to_r8ncf() converts a r8st matrix to an R8NCF matrix.
%
%  Discussion:
%
%    The r8st and R8NCF formats are essentially identical, except that
%    r8st keeps separate ROW and COLUMN vectors, while R8NCF uses a single
%    ROWCOL array.  Therefore, the input values NZ_NUM and A used in
%    the r8st representation can be regarded as part of the output
%    values used for the R8NCF representation.
%
%    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).
%
%    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:
%
%    02 August 2006
%
%  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:
%
%    integer NZ_NUM, the number of nonzero elements in the DNCF matrix.
%
%    integer ROWCOL(2,NZ_NUM), the row and column indices
%    of the nonzero elements.
%
%    real A(NZ_NUM), the nonzero elements of the DNCF matrix.
%
  rowcol(1,1:nz_num) = row(1:nz_num);
  rowcol(2,1:nz_num) = col(1:nz_num);

  return
end
