TSG
TASMANIAN Sparse Grid Library
TSG
MATLAB examples and an interface library which
demonstrate the use of the TasmanianSparseGrid (TSG) package,
which implements routines for working with sparse grids,
to efficiently estimate integrals or compute interpolants of
scalar functions of multidimensional arguments.
TSG can create three kinds of rules:

Global grids, for globally smooth functions;

Local polynomial grids, a piecewise polynomial approach
for nonsmooth functions

Wavelet grids, also for nonsmooth functions, but this option
can sometimes achieve better accuracy with fewer points.
TSG is a family of algorithms for constructing multidimensional
quadrature and interpolation rules from tensor products of 1dimensional
versions of such rules.
TSG includes a large variety of 1dimensional rules, which are generally
defined, by default, over the interval [1,+1]. In that case, the
multidimensional quadrature and interpolation rules will be defined over
the hypercube [1,+1]^d, but a simple linear transformation can be
carried out by TSG to redefine the linearly redefine the region.
The onedimensional rules that can be used include:

Chebyshev;

Clenshaw Curtis;

Fejer Type 2;

Gauss Chebyshev Type 1;

Gauss Chebyshev Type 2;

Gauss Gegenbauer;

Gauss Hermite;

Gauss Jacobi;

Gauss Laguerre;

Gauss Legendre;

Local polynomial;

Local polynomial zero;

Local wavelet.
The TasmanianSparseGrid library is available for download from
http://tasmanian.ornl.gov/ .
The MATLAB programs must actually work with the compiled C++ version of
the TasmanianSparseGrid library. They do this by interfacing with a
compiled C++ program called tasg, communicating via the
MATLAB system() command, with data passed by writing and reading
files from a workfile directory whose location is specified by the user.
Licensing:
The computer code and data files made available on this web page
are distributed under
the GNU GPL license.
Languages:
TSG is available in
a C++ version and
a FORTRAN90 version and
a MATLAB version.
Related Programs:
SGMGA,
a MATLAB library which
creates sparse grids based on a mixture of 1D quadrature rules,
allowing anisotropic weights for each dimension.
SPARSE_GRID_CC,
a MATLAB library which
creates sparse grids based on ClenshawCurtis rules.
SPARSE_GRID_HW,
a MATLAB library which
creates sparse grids based on GaussLegendre, GaussHermite,
GaussPatterson, or a nested variation of GaussHermite rules,
by Florian Heiss and Viktor Winschel.
SPINTERP,
a MATLAB library which
carries out piecewise multilinear hierarchical sparse grid interpolation;
an earlier version of this software is ACM TOMS Algorithm 847,
by Andreas Klimke;
SPQUAD,
a MATLAB library which
computes the points and weights of a sparse grid quadrature rule
for an Mdimensional integral,
based on the ClenshawCurtis quadrature rule,
by Greg von Winckel.
TOMS847,
a MATLAB library which
carries out piecewise multilinear hierarchical sparse grid interpolation;
this library is commonly called SPINTERP (version 2.1);
this is ACM TOMS Algorithm 847,
by Andreas Klimke;
Author:
Miroslav Stoyanov, Oak Ridge National Laboratory, mkstoyanov@gmail.com.
References:

Miro Stoyanov,
User Manual: TASMANIAN Sparse Grids,
ORNL Report,
Oak Ridge National Laboratory, August 2013.
Examples and Tests:

tsg_test.m, the calling program;

tsg_test01.m,
estimates an integral in 2D using a ClenshawCurtis sparse grid.

tsg_test02.m,
interpolates a function in 2D using a ClenshawCurtis sparse grid.

tsg_test03.m,
uses a GaussLegendre sparse grid to integrate a function in 2D.

tsg_test04.m,
uses an anisotropic GaussGegenbauer sparse grid for integration.

tsg_test05.m,
interpolates with an adaptive hierarchical locally quadratic basis.

tsg_test06.m,
generates 2D Clenshaw Curtis grids for various levels,
and compares the sizes of "hyperbolic", "level", and "basis"
growth options.

timestamp.m,
prints the YMDHMS date as a timestamp.

tsg_test_output.txt,
the output file.
Source Code:

tsgDeleteGrid.m
clears all data from the workfile directory.

tsgDeleteGridByName.m
clears data associated with a particular grid from the workfile directory.

tsgEvaluate.m
reads a grid from a file, and reads a list of evaluation points from a
matrix file. The interpolant is evaluated at the evaluation points, and
the results are written to a matrix file.

tsgExample.m,
contains five example calculations.

tsgGetInterpolationWeights.m
reads a grid from a file that was created previously, and returns
the interpolation weights.

tsgGetNeededPoints.m
reads a grid from a file and extracts the grid abscissas that are not yet
associated with values of the interpolated function.

tsgGetPaths.m
stores the location of the tsg() executable and the user's TSG workfile directory.

tsgGetPoints.m
reads a grid from a file that was created previously, and returns
the abscissas of the associated quadrature rule.

tsgGetQuadrature.m
reads a grid from a file that was created previously, and computes
the associated quadrature rule.

tsgIntegrate.m
reads a grid from a file and integrates the interpolant over the domain,
returning the value of the integral.

tsgListGridsByName.m
lists the grids for which data is currently stored in the workfile directory.

tsgLoadValues.m
updates a grid from a file that was created previously, by reading the
values of the interpolated function from a matrix file, and adding them
to the grid file.

tsgMakeFilenames.m,
is given the paths defined by tsgGetPaths() and returns the names
of all the files associated with a given grid.

tsgMakeGrid.m
creates information defining a particular grid.

tsgMakeQuadrature.m
returns the abscissas and weights of a particular sparse grid rule.

tsgPlotPoints2D.m
plots a set of 2D points.

tsgPrintStats.m
reads a grid from a file and prints out a short summary of grid
statistics.

tsgReadMatrix.m
an internal routine, used to read matrix files.

tsgRecycleGrid.m
creates a new grid with most of the parameters inherited from
a preexisting grid.

tsgRefineGrid.m
reads a grid from a file and improves the interpolant by adding
a new set of abscissas.

tsgWriteMatrix.m,
an internal routine, used to write matrix files.
You can go up one level to
the MATLAB source codes.
Last revised on 25 February 2014.