# toms847

toms847, a MATLAB code which can determine points defining a sparse grid in a multidimensional space, and given specific values at those points, can construct an interpolating function that can be evaluated anywhere. This library is commonly known as spinterp().

The sparse grid is constructed using Smolyak's construction. In fact, a nested series of grids is defined, each a refinement of the previous one, but chosen in such a way that the typical exponential growth in order does not occur. Moreover, because the grids are nested, the procedure produces a hierarchical series of piecewise linear interpolants. The nesting of these interpolants allows the estimation of the interpolation error.

The package includes several choices for the underlying one dimensional rule used to construct the sparse grids. The recommended rule is a Newton Cotes Closed rule, which produces grids of uniformly spaced points in [0,1], including the endpoints, of orders 1, 3, 5, 9, 17, 33, 65, and in general (2^I)+1. Note that the first rule is a special case (it doesn't include the endpoints, and the number of points in the rule is not equal to (2^0)+1!). Also note that the authors denote this rule as the "Clenshaw Curtis" or "CC" rule, although that name is more properly associated with the grid obtained by taking the cosine of the points given by the Newton Cotes Closed rule!

Another 1D rule is denoted by the authors as the "NB" or "no boundary" rule. This is simply a Newton Cotes Open rule which produces grids of uniformly spaced points in [0,1], omitting the endpoints, of orders 1, 3, 7, 15, 31, 63, and in general (2^(I+1))-1.

Another 1D rule is denoted by the authors as the "M" or "maximum norm" rule. This rule is the same as the CC rule, except that it starts with the rule of order 3. This seemingly minor difference forces this rule to use many more points than the other rules in the multidimensional case. The difference is evident in 2 dimensions, and quickly overwhelming even in dimensions as low as 4!

The text of many ACM TOMS algorithms is available online through ACM: https://calgo.acm.org/ or NETLIB: https://www.netlib.org/toms/index.html.

### Author:

Andreas Klimke,
Universitaet Stuttgart,
Stuttgart, Germany.

MULTILINEAR SPARSE GRID INTERPOLATION IN MATLAB

Andreas Klimke,
Universitaet Stuttgart.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

### Languages:

toms847 is available in a MATLAB version.

### Related Data and Programs:

cc_display, a MATLAB code which can compute and display Clenshaw Curtis grids in two dimensions, as well as sparse grids formed from sums of Clenshaw Curtis grids.

clenshaw_curtis_rule, a MATLAB code which can set up a Clenshaw Curtis quadrature grid in multiple dimensions.

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

sparse_grid_hw, a MATLAB code which creates sparse grids based on Gauss-Legendre, Gauss-Hermite, Gauss-Patterson, or a nested variation of Gauss-Hermite rules, by Florian Heiss and Viktor Winschel.

spquad, a MATLAB code 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.

### Reference:

1. Volker Barthelmann, Erich Novak, Klaus Ritter,
High Dimensional Polynomial Interpolation on Sparse Grids,
Volume 12, Number 4, 2000, pages 273-288.
2. Alan Genz,
A Package for Testing Multiple Integration Subroutines,
in Numerical Integration: Recent Developments, Software and Applications,
edited by Patrick Keast, Graeme Fairweather,
Reidel, 1987, pages 337-340,
ISBN: 9027725144,
LC: QA299.3.N38
3. Andreas Klimke, Barbara Wohlmuth,
Algorithm 847: SPINTERP: Piecewise Multilinear Hierarchical Sparse Grid Interpolation in MATLAB,
ACM Transactions on Mathematical Software,
Volume 31, Number 4, December 2005, pages 561-579.
4. Andreas Klimke,
SPINTERP V2.1: Piecewise multilinear hierarchical sparse grid interpolation in MATLAB: Documentation.
5. Andreas Klimke,
SPINTERP V2.1: Examples: Reference Results..
6. Sergey Smolyak,
Quadrature and Interpolation Formulas for Tensor Products of Certain Classes of Functions,
Volume 4, 1963, pages 240-243.

### Source Code:

The following routines are of interest to the user:

• init.m adds the sparse grid directories to the MATLAB path.
• plotgrid.m plots a sparse grid.
• spdim.m computes the number of points in a sparse grid.
• spget.m gets the sparse interpolation parameters.
• spgetseq.m computes the sequence of subgrids that form a sparse grid.
• spgrid.m computes the sparse grid point coordinates.
• spinterp.m computes a piecewise multilinear interpolant using a sparse grid.
• spset.m sets the sparse interpolation parameters.
• spvals.m computes the sparse grid supluses of a given function.

These routines are probably of little direct interest to the user:

• spcpmvalscc.m computes the hierarchical surpluses for the given new level sequences on a CC grid.
• spcpmvalsm.m computes the hierarchical surpluses for the given new level sequences on an M grid.
• spcpmvalsnb.m computes the hierarchical surpluses for the given new level sequences on an NB grid.
• spdimcc.m computes the number of sparse grid points on a CC grid.
• spdimm.m computes the number of sparse grid points on an M grid.
• spevalf.m evaluates the model function at the sparse grid points.
• spgridcc.m computes the sparse grid points for a CC grid.
• spgridm.m computes the sparse grid points for an M grid.
• spgridnb.m computes the sparse grid points for an NB grid.
• spinterpcc.m computes the multilinear interpolant for a CC grid.
• spinterpm.m computes the multilinear interpolant for an M grid.
• spinterpnb.m computes the multilinear interpolant for an NB grid.

Last revised on 01 March 2019.