function sparse_grid_laguerre_test02 ( dim_num, level_max )
 
%*****************************************************************************80
%
%% sparse_grid_laguerre_test02() tests sparse_grid_laguerre_index().
%
%  Discussion:
%
%    The routine computes the indices of the unique points used in a sparse 
%    multidimensional grid whose size is controlled by a parameter LEVEL_MAX.
%
%  Licensing:
%
%    This code is distributed under the MIT license. 
%
%  Modified:
%
%    11 October 2007
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer DIM_NUM, the spatial dimension.
%
%    integer LEVEL_MAX, the level.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'sparse_grid_laguerre_test02():\n' );
  fprintf ( 1, '  SPARSE_GRID_LAGUERRE_INDEX returns abstract indexes for the\n' );
  fprintf ( 1, '  points that make up a Gauss-Laguerre sparse grid.\n' );
  
  level_min = max ( 0, level_max + 1 - dim_num );
  
  fprintf ( 1, '\n' );
  fprintf ( 1, '  LEVEL_MIN = %d\n',level_min );
  fprintf ( 1, '  LEVEL_MAX = %d\n',level_max );
  fprintf ( 1, '  Spatial dimension DIM_NUM = %d\n', dim_num );
 
  point_num = sparse_grid_laguerre_size ( dim_num, level_max );
 
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Number of unique points in the grid = %d\n', point_num );
%
%  Compute the indices.
%
  [ grid_index, grid_base] = sparse_grid_laguerre_index ( dim_num, ...
    level_max, point_num );
%
%  Print the indices.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Grid index/base:\n' );
  fprintf ( 1, '\n' );

  for point = 1 : point_num
    fprintf ( 1, '  %4d', point );
    for dim = 1 : dim_num
      fprintf ( 1, '%6d', grid_index(dim,point) );
    end
    fprintf ( 1, '\n' );
    fprintf ( 1, '      ' );
    for dim = 1 : dim_num
      fprintf ( 1, '%6d', grid_base(dim,point) );
    end
    fprintf ( 1, '\n' );
  end

  return
end
