function grid_point = gl_abscissa ( dim_num, point_num, grid_index, grid_base )

%*****************************************************************************80
%
%% GL_ABSCISSA sets abscissas for multidimensional 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 X array lists the (complete) Gauss-Legendre abscissas for rules 
%    of order 1, 3, 7, 15, 31, 63 and 127, in order. 
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license. 
%
%  Modified:
%
%    02 October 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), for each
%    point and dimension, the index of the Gauss-Legendre abscissa.
%
%    Input, integer GRID_BASE(DIM_NUM), the order of the 
%    Gauss-Legendre rule being used in each dimension.
%
%    Output, real GRID_POINT(DIM_NUM), the grid points of
%    Gauss-Legendre abscissas.
%
  skip = [ 0, 1, 4, 11, 26, 57, 120, 247 ];
  x = [ ...
       0.0E+00, ...
     - 0.774596669241483377035853079956E+00, ...
       0.0E+00, ...
       0.774596669241483377035853079956E+00, ...
     - 0.949107912342758524526189684048E+00, ...
     - 0.741531185599394439863864773281E+00, ...
     - 0.405845151377397166906606412077E+00, ...
       0.0E+00, ...
       0.405845151377397166906606412077E+00, ...
       0.741531185599394439863864773281E+00, ...
       0.949107912342758524526189684048E+00, ...
      - 0.987992518020485428489565718587E+00, ...
      - 0.937273392400705904307758947710E+00, ...
      - 0.848206583410427216200648320774E+00, ...
      - 0.724417731360170047416186054614E+00, ...
      - 0.570972172608538847537226737254E+00, ...
      - 0.394151347077563369897207370981E+00, ...
      - 0.201194093997434522300628303395E+00, ...
        0.0E+00, ...
        0.201194093997434522300628303395E+00, ...
       0.394151347077563369897207370981E+00, ...
       0.570972172608538847537226737254E+00, ...
       0.724417731360170047416186054614E+00, ...
       0.848206583410427216200648320774E+00, ...
       0.937273392400705904307758947710E+00, ...
       0.987992518020485428489565718587E+00, ...
      -0.99708748181947707454263838179654, ...   
      -0.98468590966515248400211329970113, ...   
      -0.96250392509294966178905249675943, ...   
      -0.93075699789664816495694576311725, ... 
      -0.88976002994827104337419200908023, ... 
      -0.83992032014626734008690453594388, ... 
      -0.78173314841662494040636002019484, ... 
      -0.71577678458685328390597086536649, ...
      -0.64270672292426034618441820323250, ...  
      -0.56324916140714926272094492359516, ...   
      -0.47819378204490248044059403935649, ...  
      -0.38838590160823294306135146128752, ...    
      -0.29471806998170161661790389767170, ... 
      -0.19812119933557062877241299603283, ... 
      -0.99555312152341520325174790118941E-01, ...
       0.00000000000000000000000000000000, ... 
       0.99555312152341520325174790118941E-01, ...
       0.19812119933557062877241299603283, ...   
       0.29471806998170161661790389767170, ...   
       0.38838590160823294306135146128752, ...  
       0.47819378204490248044059403935649, ...   
       0.56324916140714926272094492359516, ...
       0.64270672292426034618441820323250, ... 
       0.71577678458685328390597086536649, ...
       0.78173314841662494040636002019484, ...   
       0.83992032014626734008690453594388, ...    
       0.88976002994827104337419200908023, ...    
       0.93075699789664816495694576311725, ...    
       0.96250392509294966178905249675943, ...    
       0.98468590966515248400211329970113, ...
       0.99708748181947707454263838179654, ...
      -0.99928298402912378050701628988630E+00, ...    
      -0.99622401277797010860209018267357E+00, ...    
      -0.99072854689218946681089469460884E+00, ...    
      -0.98280881059372723486251140727639E+00, ...    
      -0.97248403469757002280196067864927E+00, ...    
      -0.95977944975894192707035416626398E+00, ...    
      -0.94472613404100980296637531962798E+00, ...    
      -0.92736092062184320544703138132518E+00, ...    
      -0.90772630277853155803695313291596E+00, ...    
      -0.88587032850785342629029845731337E+00, ...    
      -0.86184648236412371953961183943106E+00, ...    
      -0.83571355431950284347180776961571E+00, ...    
      -0.80753549577345676005146598636324E+00, ...    
      -0.77738126299037233556333018991104E+00, ...    
      -0.74532464831784741782932166103759E+00, ...    
      -0.71144409958484580785143153770401E+00, ...    
      -0.67582252811498609013110331596954E+00, ...    
      -0.63854710582136538500030695387338E+00, ...    
      -0.59970905187762523573900892686880E+00, ...    
      -0.55940340948628501326769780007005E+00, ...    
      -0.51772881329003324812447758452632E+00, ...    
      -0.47478724799480439992221230985149E+00, ...    
      -0.43068379879511160066208893391863E+00, ...    
      -0.38552639421224789247761502227440E+00, ...    
      -0.33942554197458440246883443159432E+00, ...    
      -0.29249405858625144003615715555067E+00, ...    
      -0.24484679324595336274840459392483E+00, ...    
      -0.19660034679150668455762745706572E+00, ...    
      -0.14787278635787196856983909655297E+00, ...    
      -0.98783356446945279529703669453922E-01, ...
      -0.49452187116159627234233818051808E-01, ...
       0.00000000000000000000000000000000E+00, ...    
       0.49452187116159627234233818051808E-01, ...
       0.98783356446945279529703669453922E-01, ...
       0.14787278635787196856983909655297E+00, ...    
       0.19660034679150668455762745706572E+00, ...    
       0.24484679324595336274840459392483E+00, ...    
       0.29249405858625144003615715555067E+00, ...    
       0.33942554197458440246883443159432E+00, ...    
       0.38552639421224789247761502227440E+00, ...    
       0.43068379879511160066208893391863E+00, ...    
       0.47478724799480439992221230985149E+00, ...    
       0.51772881329003324812447758452632E+00, ...    
       0.55940340948628501326769780007005E+00, ...    
       0.59970905187762523573900892686880E+00, ...    
       0.63854710582136538500030695387338E+00, ...    
       0.67582252811498609013110331596954E+00, ...    
       0.71144409958484580785143153770401E+00, ...    
       0.74532464831784741782932166103759E+00, ...    
       0.77738126299037233556333018991104E+00, ...    
       0.80753549577345676005146598636324E+00, ...    
       0.83571355431950284347180776961571E+00, ...    
       0.86184648236412371953961183943106E+00, ...    
       0.88587032850785342629029845731337E+00, ...    
       0.90772630277853155803695313291596E+00, ...    
       0.92736092062184320544703138132518E+00, ...    
       0.94472613404100980296637531962798E+00, ...    
       0.95977944975894192707035416626398E+00, ...    
       0.97248403469757002280196067864927E+00, ...    
       0.98280881059372723486251140727639E+00, ...    
       0.99072854689218946681089469460884E+00, ...    
       0.99622401277797010860209018267357E+00, ... 
       0.99928298402912378050701628988630E+00, ...
      -0.99982213041530614629963254927125E+00, ...    
      -0.99906293435531189513828920479421E+00, ...    
      -0.99769756618980462107441703193392E+00, ...    
      -0.99572655135202722663543337085008E+00, ...    
      -0.99315104925451714736113079489080E+00, ...    
      -0.98997261459148415760778669967548E+00, ...    
      -0.98619317401693166671043833175407E+00, ...    
      -0.98181502080381411003346312451200E+00, ...    
      -0.97684081234307032681744391886221E+00, ...    
      -0.97127356816152919228894689830512E+00, ...    
      -0.96511666794529212109082507703391E+00, ...    
      -0.95837384942523877114910286998060E+00, ...    
      -0.95104920607788031054790764659636E+00, ...    
      -0.94314718462481482734544963026201E+00, ...    
      -0.93467258232473796857363487794906E+00, ...    
      -0.92563054405623384912746466814259E+00, ...    
      -0.91602655919146580931308861741716E+00, ...    
      -0.90586645826182138280246131760282E+00, ...    
      -0.89515640941708370896904382642451E+00, ...    
      -0.88390291468002656994525794802849E+00, ...    
      -0.87211280599856071141963753428864E+00, ...    
      -0.85979324109774080981203134414483E+00, ...    
      -0.84695169913409759845333931085437E+00, ...    
      -0.83359597615489951437955716480123E+00, ...    
      -0.81973418036507867415511910167470E+00, ...    
      -0.80537472720468021466656079404644E+00, ...    
      -0.79052633423981379994544995252740E+00, ...    
      -0.77519801587020238244496276354566E+00, ...    
      -0.75939907785653667155666366659810E+00, ...    
      -0.74313911167095451292056688997595E+00, ...   
      -0.72642798867407268553569290153270E+00, ...    
      -0.70927585412210456099944463906757E+00, ...    
      -0.69169312100770067015644143286666E+00, ...    
      -0.67369046373825048534668253831602E+00, ...    
      -0.65527881165548263027676505156852E+00, ...    
      -0.63646934240029724134760815684175E+00, ...    
      -0.61727347512685828385763916340822E+00, ...    
      -0.59770286357006522938441201887478E+00, ...    
      -0.57776938897061258000325165713764E+00, ...    
      -0.55748515286193223292186190687872E+00, ...    
      -0.53686246972339756745816636353452E+00, ...    
      -0.51591385950424935727727729906662E+00, ...    
      -0.49465204002278211739494017368636E+00, ...    
      -0.47308991924540524164509989939699E+00, ...    
      -0.45124058745026622733189858020729E+00, ...    
      -0.42911730928019337626254405355418E+00, ...    
      -0.40673351568978256340867288124339E+00, ...    
      -0.38410279579151693577907781452239E+00, ...    
      -0.36123888860586970607092484346723E+00, ...    
      -0.33815567472039850137600027657095E+00, ...    
      -0.31486716786289498148601475374890E+00, ...    
      -0.29138750639370562079451875284568E+00, ...    
      -0.26773094472238862088834352027938E+00, ...    
      -0.24391184465391785797071324453138E+00, ...    
      -0.21994466666968754245452337866940E+00, ...    
      -0.19584396114861085150428162519610E+00, ...    
      -0.17162435953364216500834492248954E+00, ...    
      -0.14730056544908566938932929319807E+00, ...    
      -0.12288734577408297172603365288567E+00, ...    
      -0.98399521677698970751091751509101E-01, ...
      -0.73851959621048545273440409360569E-01, ...
      -0.49259562331926630315379321821927E-01, ...
      -0.24637259757420944614897071846088E-01, ...
       0.00000000000000000000000000000000E+00, ...    
       0.24637259757420944614897071846088E-01, ...
       0.49259562331926630315379321821927E-01, ...
       0.73851959621048545273440409360569E-01, ...
       0.98399521677698970751091751509101E-01, ...
       0.12288734577408297172603365288567E+00, ...    
       0.14730056544908566938932929319807E+00, ...    
       0.17162435953364216500834492248954E+00, ...    
       0.19584396114861085150428162519610E+00, ...    
       0.21994466666968754245452337866940E+00, ...    
       0.24391184465391785797071324453138E+00, ...    
       0.26773094472238862088834352027938E+00, ...    
       0.29138750639370562079451875284568E+00, ...    
       0.31486716786289498148601475374890E+00, ...    
       0.33815567472039850137600027657095E+00, ...    
       0.36123888860586970607092484346723E+00, ...    
       0.38410279579151693577907781452239E+00, ...    
       0.40673351568978256340867288124339E+00, ...    
       0.42911730928019337626254405355418E+00, ...    
       0.45124058745026622733189858020729E+00, ...    
       0.47308991924540524164509989939699E+00, ...    
       0.49465204002278211739494017368636E+00, ...    
       0.51591385950424935727727729906662E+00, ...    
       0.53686246972339756745816636353452E+00, ...    
       0.55748515286193223292186190687872E+00, ...    
       0.57776938897061258000325165713764E+00, ...    
       0.59770286357006522938441201887478E+00, ...    
       0.61727347512685828385763916340822E+00, ...    
       0.63646934240029724134760815684175E+00, ...    
       0.65527881165548263027676505156852E+00, ...    
       0.67369046373825048534668253831602E+00, ...    
       0.69169312100770067015644143286666E+00, ...   
       0.70927585412210456099944463906757E+00, ...    
       0.72642798867407268553569290153270E+00, ...    
       0.74313911167095451292056688997595E+00, ...    
       0.75939907785653667155666366659810E+00, ...    
       0.77519801587020238244496276354566E+00, ...    
       0.79052633423981379994544995252740E+00, ...    
       0.80537472720468021466656079404644E+00, ...    
       0.81973418036507867415511910167470E+00, ...    
       0.83359597615489951437955716480123E+00, ...    
       0.84695169913409759845333931085437E+00, ...    
       0.85979324109774080981203134414483E+00, ...    
       0.87211280599856071141963753428864E+00, ...    
       0.88390291468002656994525794802849E+00, ...    
       0.89515640941708370896904382642451E+00, ...    
       0.90586645826182138280246131760282E+00, ...    
       0.91602655919146580931308861741716E+00, ...    
       0.92563054405623384912746466814259E+00, ...    
       0.93467258232473796857363487794906E+00, ...    
       0.94314718462481482734544963026201E+00, ...    
       0.95104920607788031054790764659636E+00, ...    
       0.95837384942523877114910286998060E+00, ...    
       0.96511666794529212109082507703391E+00, ...    
       0.97127356816152919228894689830512E+00, ...    
       0.97684081234307032681744391886221E+00, ...    
       0.98181502080381411003346312451200E+00, ...    
       0.98619317401693166671043833175407E+00, ...    
       0.98997261459148415760778669967548E+00, ...    
       0.99315104925451714736113079489080E+00, ...    
       0.99572655135202722663543337085008E+00, ...    
       0.99769756618980462107441703193392E+00, ...    
       0.99906293435531189513828920479421E+00, ...    
       0.99982213041530614629963254927125E+00  ...    
  ];

  if ( any ( grid_base(1:dim_num) < 0 ) )
    fprintf ( 1, '\n' );
    fprintf ( 1, 'GL_ABSCISSA - Fatal error!\n' );
    fprintf ( 1, '  Some base values are less than 0.\n' );
    error ( 'GL_ABSCISSA - Fatal error!' );
  end

  if ( any ( 63 < grid_base(1:dim_num) ) )
    fprintf ( 1, '\n' );
    fprintf ( 1, 'GL_ABSCISSA - Fatal error!\n' );
    fprintf ( 1, '  Some base values are greater than 63.\n' );
    error ( 'GL_ABSCISSA - Fatal error!' );
  end

  for point = 1 : point_num
    for dim = 1 : dim_num

      level = i4_log_2 ( grid_base(dim) + 1 );

      pointer = skip(level+1) + ( grid_index(dim,point) + grid_base(dim) + 1 );

      grid_point(dim,point) = x(pointer);

    end
  end

  return
end

