function grid_point = gl_abscissa ( dim_num, point_num, grid_index )

%*****************************************************************************80
%
%% GL_ABSCISSA sets abscissas for "nested" Gauss-Legendre quadrature.
%
%  Discussion:
%
%    The "nesting" as it occurs for Gauss-Legendre sparse grids simply
%    involves the use of a specified set of permissible orders for the
%    rule.
%
%    The XTAB array lists the Gauss-Legendre abscissas for rules of order
%    1, 3, 5, 9, 17, 33 and 65, in order.  
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    18 April 2007
%
%  Author:
%
%    John Burkardt
%
%  Parameters:
%
%    Input, integer DIM_NUM, the spatial dimension.
%
%    Input, integer POINT_NUM, the number of points.
%
%    Input, integer GRID_INDEX(DIM_NUM,POINT_NUM), indices that
%    indicate the Gauss-Legendre abscissa to be used for each component
%    of each point.  Each index should be between 1 and 133, indicating
%    a particular abscissa.
%
%    Output, real GRID_POINT(DIM_NUM), the grid points of
%    Gauss-Legendre abscissas.
%
  xtab = [ &
       0.0, ...
     - 0.774596669241483377035853079956, ...
       0.0, ...
       0.774596669241483377035853079956, ...
     - 0.906179845938663992797626878299, ...
     - 0.538469310105683091036314420700, ...
       0.0, ...
       0.538469310105683091036314420700, ...
       0.906179845938663992797626878299, ...
     - 0.968160239507626089835576202904, ...
     - 0.836031107326635794299429788070, ...
     - 0.613371432700590397308702039341, ...
     - 0.324253423403808929038538014643, ...
       0.0, ...
       0.324253423403808929038538014643, ...
       0.613371432700590397308702039341, ...
       0.836031107326635794299429788070, ...
       0.968160239507626089835576202904, ...
     - 0.990575475314417335675434019941, ...
     - 0.950675521768767761222716957896, ...
     - 0.880239153726985902122955694488, ...
     - 0.781514003896801406925230055520, ...
     - 0.657671159216690765850302216643, ...
     - 0.512690537086476967886246568630, ...
     - 0.351231763453876315297185517095, ...
     - 0.178484181495847855850677493654, ...
       0.0, ...
       0.178484181495847855850677493654, ...
       0.351231763453876315297185517095, ...
       0.512690537086476967886246568630, ...
       0.657671159216690765850302216643, ...
       0.781514003896801406925230055520, ...
       0.880239153726985902122955694488, ...
       0.950675521768767761222716957896, ...
       0.990575475314417335675434019941, ...
      -0.9974246942464552, ...
      -0.9864557262306425, ...
      -0.9668229096899927, ...
      -0.9386943726111684, ...
      -0.9023167677434336, ...
      -0.8580096526765041, ...
      -0.8061623562741665, ...
      -0.7472304964495622, ...
      -0.6817319599697428, ...
      -0.6102423458363790, ...
      -0.5333899047863476, ...
      -0.4518500172724507, ...
      -0.3663392577480734, ...
      -0.2776090971524970, ...
      -0.1864392988279916, ...
      -0.09363106585473338, ...
       0.0, ...
       0.09363106585473338, ...
       0.1864392988279916, ...
       0.2776090971524970, ...
       0.3663392577480734, ...
       0.4518500172724507, ...
       0.5333899047863476, ...
       0.6102423458363790, ...
       0.6817319599697428, ...
       0.7472304964495622, ...
       0.8061623562741665, ...
       0.8580096526765041, ...
       0.9023167677434336, ...
       0.9386943726111684, ...
       0.9668229096899927, ...
       0.9864557262306425, ...
       0.9974246942464552, ...
      -0.9993260970754129, ...
      -0.9964509480618492, ...
      -0.9912852761768016, ...
      -0.9838398121870350, ...
      -0.9741315398335512, ...
      -0.9621827547180553, ...
      -0.9480209281684076, ...
      -0.9316786282287494, ...
      -0.9131934405428462, ...
      -0.8926078805047389, ...
      -0.8699692949264071, ...
      -0.8453297528999303, ...
      -0.8187459259226514, ...
      -0.7902789574921218, ...
      -0.7599943224419998, ...
      -0.7279616763294247, ...
      -0.6942546952139916, ...
      -0.6589509061936252, ...
      -0.6221315090854003, ...
      -0.5838811896604873, ...
      -0.5442879248622271, ...
      -0.5034427804550069, ...
      -0.4614397015691450, ...
      -0.4183752966234090, ...
      -0.3743486151220660, ...
      -0.3294609198374864, ...
      -0.2838154539022487, ...
      -0.2375172033464168, ...
      -0.1906726556261428, ...
      -0.1433895546989752, ...
      -0.9577665320919751E-01, ...
      -0.4794346235317186E-01, ...
       0.0, ...
       0.4794346235317186E-01, ...
       0.9577665320919751E-01, ...
       0.1433895546989752, ...
       0.1906726556261428, ...
       0.2375172033464168, ...
       0.2838154539022487, ...
       0.3294609198374864, ...
       0.3743486151220660, ...
       0.4183752966234090, ...
       0.4614397015691450, ...
       0.5034427804550069, ...
       0.5442879248622271, ...
       0.5838811896604873, ...
       0.6221315090854003, ...
       0.6589509061936252, ...
       0.6942546952139916, ...
       0.7279616763294247, ...
       0.7599943224419998, ...
       0.7902789574921218, ...
       0.8187459259226514, ...
       0.8453297528999303, ...
       0.8699692949264071, ...
       0.8926078805047389, ...
       0.9131934405428462, ...
       0.9316786282287494, ...
       0.9480209281684076, ...
       0.9621827547180553, ...
       0.9741315398335512, ...
       0.9838398121870350, ...
       0.9912852761768016, ...
       0.9964509480618492, ...
       0.9993260970754129 ];

  if ( any ( grid_index(1:dim_num,1:point_num) < 1 ) )
    fprintf ( 1, '\n' );
    fprintf ( 1, 'GL_ABSCISSA - Fatal error!\n' );
    fprintf ( 1, '  Some index values are less than 1.\n' );
    error ( 'GL_ABSCISSA - Fatal error!' );
  elseif ( any ( 127 < grid_index(1:dim_num,1:point_num) ) )
    fprintf ( 1, '\n' );
    fprintf ( 1, 'GL_ABSCISSA - Fatal error!\n' );
    fprintf ( 1, '  Some index values are greater than 127.\n' );
    error ( 'GL_ABSCISSA - Fatal error!' );
  end

  for dim = 1 : dim_num
    grid_point(dim,1:point_num) = xtab ( grid_index(dim,1:point_num) )
  end

  return
end
