SANDIA_SPARSE is a MATLAB library which computes 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 + 1except 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:
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|
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:
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:
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:
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:
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; point_num = levels_index_size ( dim, level, rule ); [ w, x ] = sparse_grid ( dim, level, rule, point_num ); quad = 0.0; for j = 1 : point_num quad = quad + w(j) * f ( x(1:dim,j) ); end
The code described and made available on this web page is distributed under the GNU LGPL license.
SANDIA_SPARSE is available in a C++ version and a FORTRAN90 version and a MATLAB version.
GRID_DISPLAY, a MATLAB library which can display a 2D or 3D grid or sparse grid.
SANDIA_RULES, a MATLAB library which generates Gauss quadrature rules of various orders and types.
SMOLPACK, 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, a MATLAB library which can define a multidimensional sparse grid based on a 1D Clenshaw Curtis rule.
SPARSE_GRID_CC_DATASET, a MATLAB 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.
SPINTERP, a MATLAB library which uses a sparse grid to perform multilinear hierarchical interpolation, by Andreas Klimke.
SPQUAD, a MATLAB library which computes the points and weights of a sparse grid quadrature rule for a multidimensional integral, based on the Clenshaw-Curtis quadrature rule, by Greg von Winckel.
You can go up one level to the MATLAB source codes.