function [ nst, ist, jst, ast ] = ccs_to_st ( m, n, ncc, icc, ccc, acc )

%*****************************************************************************80
%
%% ccs_to_st() converts sparse matrix information from CCS to ST format.
%
%  Discussion:
%
%    Only JST actually needs to be computed.  The other three output 
%    quantities are simply copies.  
%    
%  Licensing:
%
%    This code is distributed under the MIT license. 
%
%  Modified:
%
%    23 July 2014
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer M, the number of rows.
%
%    integer N, the number of columns.
%
%    integer NCC, the number of elements.
%
%    integer ICC(NCC), the rows.
%
%    integer CCC(N+1), the compressed columns.
%
%    real ACC(NCC), the values.
%
%  Output:
%
%    integer NST, the number of ST elements.
%
%    integer IST(NST), JST(NST), the ST rows and columns.
%
%    real AST(NST), the ST values.
%
  nst = 0;

  if ( ccc(1) == 0 )

    jlo = 0;
    jhi = n - 1;
  
    for j = jlo : jhi

      klo = ccc(j+1);
      khi = ccc(j+2) - 1;

      for k = klo : khi

        nst = nst + 1;
        ist(nst) = icc(k+1);
        jst(nst) = j;
        ast(nst) = acc(k+1);

      end

    end

  else

    jlo = 1;
    jhi = n;
  
    for j = jlo : jhi

      klo = ccc(j);
      khi = ccc(j+1) - 1;

      for k = klo : khi

        nst = nst + 1;
        ist(nst) = icc(k);
        jst(nst) = j;
        ast(nst) = acc(k);

      end

    end

  end

  return
end
