SANDIA_SPARSE is a FORTRAN90 library which can be used to compute the points and weights of a Smolyak sparse grid, based on a variety of 1-dimensional quadrature rules.
The sparse grids that can be created may be based on any one of a variety of 1D quadrature rules. However, only isotropic grids are generated, that is, the same 1D quadrature rule is used in each dimension, and the same maximum order is used in each dimension. This is a limitation of this library, and not an inherent limitation of the sparse grid method.
The 1D quadrature rules that can be used to construct sparse grids include:
A major advantage of sparse grids is that they can achieve accuracy that is comparable to a corresponding product rule, while using far fewer points, that is, evaluations of the function that is to be integrated. We will leave aside the issue of comparing accuracy for now, and simply focus on the pattern of point growth.
A sparse grid is essentially a linear combination of lower order product grids. One way point growth is controlled is to only use product grids based on a set of factors that are nested. In other words, the underlying 1D rules are selected so that, when we increase the order of such a rule, all the points of the current rule are included in the new one.
The exact details of how this works depend on the particular 1D rule being used and the nesting behavior it satisfies. We classify the cases as follows:
For CFN rules we have the following relationship between the level (index of the grid) and the 1D order (the number of points in the 1D rule.)
order = 2level + 1
except that for the special case of level=0 we assign
order=1.
For OFN, OWN and ONN rules, the relationship between level and 1D order is:
order = 2level+1 - 1
Thus, as we allow level to grow, the order of the 1D closed and open rules behaves as follows:
| Level | CFN | OFN/OWN/ONN |
|---|---|---|
| 0 | 1 | 1 |
| 1 | 3 | 3 |
| 2 | 5 | 7 |
| 3 | 9 | 15 |
| 4 | 17 | 31 |
| 5 | 33 | 63 |
| 6 | 65 | 127 |
| 7 | 129 | 255 |
| 8 | 257 | 511 |
| 9 | 513 | 1,023 |
| 10 | 1,025 | 2,057 |
When we move to multiple dimensions, the counting becomes more complicated. This is because a multidimensional sparse grid is made up of a logical sum of product grids. A multidimensional sparse grid has a multidimensional level, which is a single number. Each product grid that forms part of this sparse grid has a multidimensional level which is the sum of the 1D levels of its factors. A sparse grid whose multidimensional level is represented by LEVEL includes all product grids whose level ranges LEVEL+1-DIM and LEVEL.
Thus, as one example, if DIM is 2, the sparse grid of level 3, formed from a CFN rule, will be formed from the following product rules.
| level | level 1 | level 2 | order 1 | order 2 | order |
|---|---|---|---|---|---|
| 1 | 0 | 1 | 1 | 3 | 3 |
| 1 | 1 | 0 | 3 | 1 | 3 |
| 2 | 0 | 2 | 1 | 5 | 5 |
| 2 | 1 | 1 | 3 | 3 | 9 |
| 2 | 2 | 0 | 5 | 1 | 5 |
For a CFN sparse grid, here is the pattern of growth in the number of points, as a function of spatial dimension and grid level:
| DIM | 1 | 2 | 3 | 4 | 5 |
|---|---|---|---|---|---|
| Level | |||||
| 0 | 1 | 1 | 1 | 1 | 1 |
| 1 | 3 | 5 | 7 | 9 | 11 |
| 2 | 5 | 13 | 25 | 41 | 61 |
| 3 | 9 | 29 | 69 | 137 | 241 |
| 4 | 17 | 65 | 177 | 401 | 801 |
| 5 | 33 | 145 | 441 | 1,105 | 2,433 |
| 6 | 65 | 321 | 1,073 | 2,929 | 6,993 |
| 7 | 129 | 705 | 2,561 | 7,537 | 19,313 |
| 8 | 257 | 1,537 | 6,017 | 18,945 | 51,713 |
For an OFN sparse grid, here is the pattern of growth in the number of points, as a function of spatial dimension and grid level:
| DIM | 1 | 2 | 3 | 4 | 5 |
|---|---|---|---|---|---|
| Level | |||||
| 0 | 1 | 1 | 1 | 1 | 1 |
| 1 | 3 | 5 | 7 | 9 | 11 |
| 2 | 7 | 17 | 31 | 49 | 71 |
| 3 | 15 | 49 | 111 | 209 | 351 |
| 4 | 31 | 129 | 351 | 769 | 1,471 |
| 5 | 63 | 321 | 1,023 | 2,561 | 5,503 |
| 6 | 127 | 769 | 2,815 | 7,937 | 18,943 |
| 7 | 255 | 1,793 | 7,423 | 23,297 | 61,183 |
| 8 | 511 | 4,097 | 18,943 | 65,537 | 187,903 |
For an OWN sparse grid, here is the pattern of growth in the number of points, as a function of spatial dimension and grid level:
| DIM | 1 | 2 | 3 | 4 | 5 |
|---|---|---|---|---|---|
| Level | |||||
| 0 | 1 | 1 | 1 | 1 | 1 |
| 1 | 3 | 5 | 7 | 9 | 11 |
| 2 | 7 | 21 | 37 | 57 | 81 |
| 3 | 15 | 73 | 159 | 289 | 471 |
| 4 | 31 | 225 | 597 | 1,265 | 2,341 |
| 5 | 63 | 637 | 2,031 | 4,969 | 10,363 |
| 6 | 127 | 1,693 | 6,405 | 17,945 | 41,913 |
| 7 | 255 | 4,289 | 19,023 | 60,577 | 157,583 |
| 8 | 511 | 10,473 | 53,829 | 193,457 | 557,693 |
For an ONN sparse grid, here is the pattern of growth in the number of points, as a function of spatial dimension and grid level:
| DIM | 1 | 2 | 3 | 4 | 5 |
|---|---|---|---|---|---|
| Level | |||||
| 0 | 1 | 1 | 1 | 1 | 1 |
| 1 | 3 | 7 | 10 | 13 | 16 |
| 2 | 7 | 29 | 58 | 95 | 141 |
| 3 | 15 | 95 | 255 | 515 | 906 |
| 4 | 31 | 273 | 945 | 2,309 | 4,746 |
| 5 | 63 | 723 | 3,120 | 9,065 | 21,503 |
| 6 | 127 | 1,813 | 9,484 | 32,259 | 87,358 |
| 7 | 255 | 4,375 | 27,109 | 106,455 | 325,943 |
| 8 | 511 | 10,265 | 73,915 | 330,985 | 1,135,893 |
To integrate a function f(x) over a multidimensional cube [-1,+1]^DIM using a sparse grid based on a Clenshaw Curtis rule, we might use a program something like the following:
dim = 2
level = 3
rule = 1
call levels_index_size ( dim, level, rule, point_num )
allocate ( w(1:point_num) )
allocate ( x(1:dim,1:point_num) )
call sparse_grid ( dim, level, rule, point_num, w, x )
quad = 0.0
do j = 1, point_num
quad = quad + w(j) * f ( x(1:dim,j) )
end do
The code described and made available on this web page is distributed under the GNU LGPL license.
CC_DISPLAY is a MATLAB library which computes and displays Clenshaw Curtis grids in two dimensions, as well as sparse grids formed from sums of Clenshaw Curtis grids.
CLENSHAW_CURTIS is a FORTRAN90 library which can compute Clenshaw Curtis grids in multiple dimensions, as well as sparse grids formed from sums of Clenshaw Curtis grids.
QUADRULE is a FORTRAN90 library which defines quadrature rules for various intervals and weight functions.
SANDIA_RULES is a FORTRAN90 library which generates Gauss quadrature rules of various orders and types.
SANDIA_SPARSE is available in a FORTRAN90 version and a C++ version and a MATLAB version.
SGMGA, a FORTRAN90 library which creates sparse grids based on a mixture of 1D quadrature rules, allowing anisotropic weights for each dimension.
SMOLPACK is a C library which implements Novak and Ritter's method for estimating the integral of a function over a multidimensional hypercube using sparse grids, by Knut Petras.
SPARSE_GRID_CC is a FORTRAN90 library which can define a multidimensional sparse grid based on a 1D Clenshaw Curtis rule.
SPARSE_GRID_CC_DATASET is a FORTRAN90 program which reads user input, creates a multidimensional sparse grid based on a 1D Clenshaw Curtis rule and writes it to three files that define a quadrature rule.
SPARSE_GRID_DISPLAY is a MATLAB program which can display a 2D or 3D sparse grid.
SPINTERP is a MATLAB library which uses a sparse grid to perform multilinear hierarchical interpolation, by Andreas Klimke.
You can go up one level to the FORTRAN90 source codes.