function r8ccs_kij_test ( )

%*****************************************************************************80
%
%% r8ccs_kij_test tests r8ccs_kij.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    14 February 2003
%
%  Author:
%
%    John Burkardt
%
  m = 5;
  n = 5;
  nz_num = 12;

  colptr = [ 1, 4, 6, 8, 10, 13 ];
  rowind = [ 1, 2, 4, 1, 2, 3, 5, 4, 5, 1, 2, 5 ];
  test_num = 20;

  fprintf ( 1, '\n' );
  fprintf ( 1, 'r8ccs_kij_test\n' );
  fprintf ( 1, '  r8ccs_kij gets (I,J) from K in an r8ccs matrix.\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Matrix rows M =          %d\n', m );
  fprintf ( 1, '  Matrix columns N =       %d\n', n );
  fprintf ( 1, '  Matrix nonzeros NZ_NUM = %d\n', nz_num );

  i4vec_print ( n+1, colptr, '  The COLPTR vector:' );

  i4vec_print ( nz_num, rowind, '  The ROWIND vector:' );

  a(1:nz_num) = 0.0;
%
%  Initialize the matrix to random values.
%
  a = r8ccs_random ( m, n, nz_num, colptr, rowind );

  r8ccs_print ( m, n, nz_num, colptr, rowind, a, ...
    '  The initial r8ccs matrix:' );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  r8ccs_KIJ locates some K entries.\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '         K         I         J\n' );
  fprintf ( 1, '\n' );

  for ( test = 1 : test_num )
    k = randi ( [ 1, nz_num ], 1 );
    [ i, j ] = r8ccs_kij ( m, n, nz_num, colptr, rowind, k );
    fprintf ( 1, '  %8d  %8d  %8d\n', k, i, j );
  end

  return
end
