# sparse_grid_gl

sparse_grid_gl, a C++ code which constructs sparse grids based on 1D Gauss-Legendre rules.

Sparse grids are more naturally constructed from a nested family of quadrature rules. Gauss-Legendre rules are not nested, but have higher accuracy. Thus, there is a tradeoff. If we compare two sparse grids of the same "level", one using Gauss-Legendre rules and the other, say, Clenshaw-Curtis rules, then the Gauss-Legendre sparse grid will have higher accuracy...but also a significantly greater number of points. When measuring efficiency, we really need to balance the cost in quadrature points against the accuracy, and so it is not immediately obvious which choice is best!

To slightly complicate matters, Gauss-Legendre rules are very weakly nested, in that the rules of odd order all include the abscissa value X=0.0. A sparse grid constructed from Gauss-Legendre rules will thus have to keep track of this minor point as well.

Here is a table showing the number of points in a sparse grid based on Gauss-Legendre rules, indexed by the spatial dimension, and by the "level", which is simply an index for the family of sparse grids.
DIM:12345
LEVEL_MAX
011111
1357911
2921375781
32373159289471
45322559712652341
51156372031496910363
6241169364051794541913

DIM:678910
LEVEL_MAX
011111
11315171921
2109141177217261
37131023140918792441
43953624593771352518881
519397335595467384931126925

DIM:100
LEVEL_MAX
01
1201
220601

A version of the sparse grid library is available in https://tasmanian.ornl.gov, the TASMANIAN library, available from Oak Ridge National Laboratory.

### Languages:

sparse_grid_gl is available in a C++ version and a Fortran90 version and a MATLAB version.

### Related Data and Programs:

quadrature_rules, a dataset directory which contains quadrature rules; a number of examples of sparse grid quadrature rules are included.

quad_rule, a C++ code which defines quadrature rules for various intervals and weight functions.

sparse_grid_cc, a C++ code which define sparse grids based on 1D Clenshaw Curtis quadrature rules.

sparse_grid_hermite, a C++ code which creates sparse grids based on Gauss-Hermite rules.

sparse_grid_laguerre, a C++ code which creates sparse grids based on Gauss-Laguerre rules.

sparse_grid_mixed, a C++ code which constructs a sparse grid using different rules in each spatial dimension.

### Reference:

1. Volker Barthelmann, Erich Novak, Klaus Ritter,
High Dimensional Polynomial Interpolation on Sparse Grids,
Volume 12, Number 4, 2000, pages 273-288.
2. Thomas Gerstner, Michael Griebel,
Numerical Integration Using Sparse Grids,
Numerical Algorithms,
Volume 18, Number 3-4, 1998, pages 209-232.
3. Albert Nijenhuis, Herbert Wilf,
Combinatorial Algorithms for Computers and Calculators,
Second Edition,
ISBN: 0-12-519260-6,
LC: QA164.N54.
4. Fabio Nobile, Raul Tempone, Clayton Webster,
A Sparse Grid Stochastic Collocation Method for Partial Differential Equations with Random Input Data,
SIAM Journal on Numerical Analysis,
Volume 46, Number 5, 2008, pages 2309-2345.
5. Sergey Smolyak,
Quadrature and Interpolation Formulas for Tensor Products of Certain Classes of Functions,