function r8st_ij_to_k_test ( )

%*****************************************************************************80
%
%% r8st_ij_to_k_test() tests r8st_ij_to_k().
%
%  Licensing:
%
%    This code is distributed under the MIT license. 
%
%  Modified:
%
%    22 September 2015
%
%  Author:
%
%    John Burkardt
%
  m = 7;
  n = 5;
  nz_num = 10;
  row = [ 1, 1, 2, 2, 4, 4, 4, 5, 6, 7 ];
  col = [ 2, 5, 1, 5, 1, 2, 3, 4, 4, 1 ];

  fprintf ( 1, '\n' );
  fprintf ( 1, 'r8st_ij_to_k_test():\n' );
  fprintf ( 1, '  r8st_ij_to_k() returns the r8st index of (I,J).\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Matrix rows M =    %d\n', m );
  fprintf ( 1, '  Matrix columns N = %d\n', n );
  fprintf ( 1, '  Matrix nonzeros =  %d\n', nz_num );

  check = r8st_check ( m, n, nz_num, row, col );

  if ( ~ check )
    fprintf ( 1, '\n' );
    fprintf ( 1, 'r8st_check(): Warning!\n' );
    fprintf ( 1, '  The matrix is not in the proper sorted format.\n' );
    return
  end

  fprintf ( 1, '\n' );
  fprintf ( 1, '         I         J         K\n' );
  fprintf ( 1, '\n' );
  for i = 1 : m
    for j = 1 : n
      k = r8st_ij_to_k ( nz_num, row, col, i, j );
      fprintf ( 1, '  %8d  %8d  %8d\n', i, j, k );
    end
  end

  return
end
