function st_to_ccs_test01 ( )

%*****************************************************************************80
%
%% st_to_ccs_test01() tests st_to_ccs() using a tiny matrix.
%
%  Discussion:
%
%    This test uses a trivial matrix whose full representation is:
%
%          2  3  0  0  0
%          3  0  4  0  6
%      A = 0 -1 -3  2  0
%          0  0  1  0  0
%          0  4  2  0  1
%
%    A (1-based) ST representation, reading in order by rows is:
%
%      I  J   A
%     -- --  --
%      1  1   2
%      1  2   3
%
%      2  1   3
%      2  3   4
%      2  5   6
%
%      3  2  -1
%      3  3  -3
%      3  4   2
%
%      4  3   1
%
%      5  2   4
%      5  3   2
%      5  5   1
%
%    The CCS representation (which goes in order by columns) is
%
%      #   I  JC   A
%     --  --  --  --
%      1   1   1   2
%      2   2       3
%
%      3   1   3   3
%      4   3      -1
%      5   5       4
%
%      6   2   6   4
%      7   3      -3
%      8   4       1
%      9   5       2
%
%     10   3  10   2
%
%     11   2  11   6
%     12   5       1
%
%     13   *  13
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    23 July 2014
%
%  Author:
%
%    John Burkardt
%
  nst = 12;

  ast = [ ...
    2.0,  3.0, ...
    3.0,  4.0,  6.0, ...
   -1.0, -3.0,  2.0, ...
    1.0, ...
    4.0,  2.0,  1.0 ]';
  ist = [ ...
    1, 1, ...
    2, 2, 2, ...
    3, 3, 3, ...
    4, ...
    5, 5, 5 ]';
  jst = [ ...
    1, 2, ...
    1, 3, 5, ...
    2, 3, 4, ...
    3, ...
    2, 3, 5 ]';
  m = 5;
  n = 5;

  fprintf ( 1, '\n' );
  fprintf ( 1, 'st_to_ccs_test01():\n' );
  fprintf ( 1, '  Convert a sparse matrix from ST to CCS format.\n' );
  fprintf ( 1, '  ST:  sparse triplet,    I, J,  A.\n' );
  fprintf ( 1, '  CCs: compressed column, I, CC, A.\n' );

  i_min = min ( ist );
  i_max = max ( ist );
  j_min = min ( jst );
  j_max = max ( jst );
%
%  Print the ST matrix.
%
  title = 'The ST matrix:';
  st_header_print ( i_min, i_max, j_min, j_max, m, n, nst, title );
  st_print ( m, n, nst, ist, jst, ast, title );
%
%  Get the CCS size.
%
  ncc = st_to_ccs_size ( nst, ist, jst );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Number of ST values  = %d\n', nst );
  fprintf ( 1, '  Number of CCS values = %d\n', ncc );
%
%  Create the CCS indices.
%
  [ icc, ccc ] = st_to_ccs_index ( nst, ist, jst, ncc, n );
%
%  Create the CCS values.
%
  acc = st_to_ccs_values ( nst, ist, jst, ast, ncc, n, icc, ccc );
%
%  Print the CCS matrix.
%
  title = 'The CCS matrix:';
  ccs_header_print ( icc, ccc, title );
  ccs_print ( m, n, ncc, icc, ccc, acc, title );

  return
end
