Home
        User Manual: TASMANIAN Sparse Grids
         Contents
1.    For a wavelet grid  it returns rule_wavelet     3 20 function getOneDRuleDescription               const char  getOneDRuleDescription   const     Returns a short string description of the one dimensional rule used     13    3 21 function getNumPoints      int getNumPoints   const     Return the total number of abscissas associated with the grid     3 22 function getPoints      void getPoints  double    amp pnts   const   Return the abscissas associated with the grid     pnts on input it is either NULL or a non NULL pointer that would be deleted   on output returns an array of size getNumDimensions   x getNumPoints   of values that rep   resent the abscissas  The first abscissa is located in the first getNumDimensions   number of  entries  the second abscissa is located in the second getNumDimensions   number of entries   and so on     3 23 function getWeights      void getWeights  double    amp weights   const   Return the quadrature weights associated with the abscissas  as in equation  1 1      weights on input it is either NULL or a non NULL pointer that would be deleted   on output it is an array of size getNumPoints   of the quadrature weights associated with the  abscissas  The first weight is associated with the first abscissa returned by getPoints    the  second weight is associated with the second abscissa and so on     14    3 24 function getInterpolantWeights         void getInterpolantWeights  const double x     doublex  amp weights   const     Returns the inte
2.   A 1 Global Grids    AZ Local Polynomials sc oad ERA AREA A oa PES ARAS    A 3 Wavelet Grid    LIST OF FIGURES    vi    LIST OF TABLES    A l Summary of the available quadrature rules  For each rule  we have the enumer   ated type as rule_    followed by the string given to the tasgrid and MATLAB  interfaces  crepas rd br ra A    vii    ABSTRACT    This documents serves to explain the functionality of the Sparse Grid module of the Toolkit for  Adaptive Stochastic Modeling And Non Intrusive Approximation  TASMANIAN   The document  covers the three main components  the libtasmaniansparsegrids library  the tasgrid wrapper and  the MATLAB interface     ACKNOWLEDGEMENTS    The ORNL is operated by UT Battelle  LLC  for the United States Department of Energy under  Contract DE AC05 000R22725     1 Introduction    Sparse Grids is a family of algorithms for constructing multidimensional quadrature and interpo   lation rules from tensor products of one dimensional such rules  8  10  18  19 22   Given a function  f x    R   gt  R  a quadrature rule that integrates f a  over the domain I C R  with respect to the  weight p x  is defined as by the abscissas  2   CT and weights  w   _  CR so that                                  Jona N  gt  wif  ei    1 1     The integration weight p x  is a tensor of one dimensional weight p x    pi 11 p1 x12     pi ta   and the domain T is the tensor of a one dimensional domain         1         I   An interpolation  rule is defined by abscissas  1   Y  
3.   grid that are not yet associated with values of the interpolated function  The matrix file will  have getNumPoints   number of rows and getNumDimensions   number of columns  The  first abscissa will be on the first row  the second on the second row and so on      print write out the same data as in the  outputfile but to the cout stream     4 12 Command   loadvalues      tasgrid  loadvalues  lt optionl gt   lt valuel gt   lt option2 gt   lt value2 gt     Reads a grid from a file and the values of the interpolated function is read from a matrix file   The function values are given to the grid via the loadValues   function and the modified grid is  written back to the same input file      gridfile this is the file with an already created grid  On exit  it will contain the grid with loaded  values      inputfile is a matrix file with getNumNeededPoints   number of rows and getNumOutputs   number  of columns  The first row contains the values of the interpolated function associated with the  first needed abscissa  The second row corresponds to the second abscissa and so on     23    4 13 Command   evaluate      tasgrid  evaluate  lt optionl gt   lt valuel gt   lt option2 gt   lt value2 gt     Reads a grid from a file and a list of points of interest form a matrix file  The interpolant is  evaluated at all the points and the result is written to a matrix file      gridfile this is the file with an already created grid and loaded values      inputfile is a matrix file with points
4.   scissa 1s stored on one row of the matrix     5 5 function tsgRecycleGrid           newp     tsgRecycleGrid  1Grid  depth  order  type  anisotropy      Calls tasgrid with the  recycle command     INPUTS  IGrid is an object created by tsgMakeGrid    depth same as in tsgMakeGrid   and  depth    order same as in tsgMakeGrid   and  order    29    type same as in tsgMakeGrid   and  type  anisotropy same as in tsgMakeGrid   and  anisotropy  transformAB same as in tsgMakeGrid   and  inputfile  OUTPUTS    newp is an optional output MATLAB matrix containing the set of abscissas that are not yet asso   ciated with values from the interpolated function     5 6 function tsgGetQuadrature        weights  points     tsgGetQuadrature  1Grid         Calls tasgrid with the  getquadrature command     INPUTS  IGrid is an object created by tsgMakeGrid    OUTPUTS  weights is a MATLAB matrix containing the quadrature weights associated with the points     ponits is a MATLAB matrix that contains the abscissas associated with the sparse grid  Each ab   scissa 1s stored on one row of the matrix     5 7 function tseGetInterpolationWeights              weights     tsgGetInterpolationWeights  1Grid  points    Calls tasgrid with the  getinterweights command     INPUTS  IGrid is an object created by tsgMakeGrid      points isa MATLAB matrix with dim number of columns and arbitrary number of rows  Each row  represents one point of interest     OUTPUTS    weights isa MATLAB matrix of getNumPoitns   number 
5.  4 for more details     Advanced Build Options    Open the Makefile in an editor and adjust the options     CC specifies the compiler command  The code was written for the GNU C   compiler  GCC    The default command is g    however  that can be changed to force a specific version of the  compiler or even a different compiler     OpenMP is used throughout the code for multicore parallelism  It can be optionally enabled by spec   ifying the COMPILE_OPTIONS    fopenmp or alternatively disabled by removing the op   tions     OPTC specifies standard GCC compiler options  refer to the GCC manual for details     Known Problems    Mac users have reported problems with OpenMP and some versions of GCC  Mac users that want  to use OpenMP should make sure to have the latest available version of GCC  versions 4 7 and  newer tend to resolve most issues     3 LIBTASMANIANSPARSEGRIDS  libtsg     All of the sparse grids functionality is included in the libtsg C   library  Code that interfaces with  the library should include the TasmanianSparseGrid hpp  which introduces the TasGrid namespace  and the definition of the TasmanianSparseGrid class     WARNING  The code performs virtually no sanity check on the validity of input  Wrong input  would most likely result in a crash     3 1 Constructor TasmanianSparseGrid    TasmanianSparseGrid       This is the only class constructor  called by default   makes an empty grid  Before any op   erations can be performed  a grid has to be made with one of
6.  as opposed to the RAM and the  Grid object is the  pointer  Also  the grids are associated by name as opposed to a memory address     e If multiple users are sharing the same temporary folder  then it would be useful if they come  up with a naming convention that prevents two users from using the same grid name  For  example  instead of both users creating a grid named mygrid   the users should name their  grids johngridl and janegridl      e All of the grid data for all of the grids is stored in the same folder  Anyone with access to the  temporary folder has full access to all of the sparse grid data  which is a potential security  issue     e If two users have separate copied of tsgGetPaths    then they can use separate storage folders  without any of the multi user considerations  This is true even if all other files are shared   including the tasgrid executable and libtsg library     34    A Types of One Dimensional Rules    A 1 Global Grids    All global grids use Lagrange polynomial for interpolation  Gauss rules are most suitable for  optimal integration with respect to a given weight  The non Gauss rules are more suitable for  interpolation  However  depending on the structure of f x   it is perfectly possible for a non Gauss  rule to produce a more accurate integral or for a Gauss rule to produce a more accurate interpolant   For more details on the various quadrature rules and their properties see  1 5 7  14  17 24      Clenshaw Curtis    Also known as nested Cheb
7.  matrix    or a matrix of size 2 x 1 with the a and P parameters   See  alpha and  beta option for tasgrid and const double  alpha_beta parameter for libtsg     is either an empty MATLAB matrix    or a matrix of dim rows and 2 columns that contains  the a and b parameters associated with the transformation of the domain  This is the same as   inputfile given to tasgrid with the  makegrid command  See Table A 1 for the various types  of transformation     28    OUTPUTS    IGrid is an object that saves the grid name and some additional parameters  the object is used by  other functions to access the files associated with the grid     ponits is an optional output MATLAB matrix that contains the abscissas associated with the sparse  grid  Each abscissa is stored on one row of the matrix     5 4 function tsgMakeQuadrature        weights  points     tsgMakeQuadrature  dim  oned  depth  order  type   anisotropy  alpha_beta  transformAB      Calls tasgrid with the  makequadrature command  The grid is not written to a file and only  the abscissas and weights are returned  The inputs are the same as tsgMakeGrid    however  no  sGridName and out are needed     INPUTS    Same as tsgMakeGrid   except no sGridName is needed as the grid isn   t stored permanently  and out is assumed to be zero     OUTPUTS  weights is a MATLAB matrix containing the quadrature weights associated with the points     ponits is a MATLAB matrix that contains the abscissas associated with the sparse grid  Each ab 
8.  of interest  The file can have arbitrary number of rows and  getNumDimensions   number of columns  Each row corresponds to one point of interest      outputfile is an optional matrix file that is written on exit  The file contains the values of the inter   polant at the points provided by the  inputfile  The file has the same number of rows and  getNumOutputs   number of columns  Each row contains the values of the interpolant at the  corresponding point of interest      print write out the same data as in the  outputfile but to the cout stream     4 14 Command   integrate         tasgrid  integrate  lt optionl gt   lt valuel gt   lt option2 gt   lt value2 gt     Reads a grid from a file and integrates the interpolant over the domain  The result is written to  a matrix file      gridfile this is the file with an already created grid and loaded values      outputfile is an optional matrix file that is written on exit  The file contains the integrals of the inter   polant over the domain  The file has one row and getNumOutputs   number of columns      print write out the same data as in the  outputfile but to the cout stream     24    4 15 Command   refine      tasgrid  refine  lt optionl gt   lt valuel gt   lt option2 gt   lt value2 gt     Reads a grid from a file and improves the interpolant by adding a new set of abscissas  Refer  to setRefinement   for details      gridfile this is the file with an already created grid and loaded values    tolerance is a positive real numb
9.  the makeGlobalGrid    makeLo   calPolynomialGrid   or make WaveletGrid   functions or alternatively the grid can be read from a  stream file using the read   functions  in order to read a grid  it must first be written to the file with  the write   function   The user can also call getVersion   and getLicense   functions at any time   Calling any other function will result in a Segfault     3 2 Destructor TasmanianSparseGrid        TasmanianSparseGrid       This is the destructor that releases any dynamical memory used by the class  this instance of the  class can no longer be used      3 3 function getVersion    const char   getVersion   const     Returns the version of the library  which is a simple hard coded string     3 4 function getLicense    const charx getlicense   const     Returns a short string indicating the license of the library  This is a simple hard coded string     3 5    function makeGlobalGrid      void makeGlobalGrid  int dimensions        int outputs    int depth    TypeDepth type    TypeOneDRule oned    const int  anisotropic_weights   0   const double xalpha_beta   0                      This function creates a sparse grid induced by one of the global quadrature and interpolation    rules     dimensions    outputs    depth    type    See Appendix A for a full list of the rules  The parameters are described as follows     is a positive integer specifying the dimension of the grid  There is no hard restriction on how  big the dimension can be  however  
10. 2  fejer 2  f   fla de f  f x dx  1 1 f  1   f   0   Yes  Gauss Legendre  rule_gausslegendre  gauss legendre  fo  f a de J  f w dx dd N A No  Gauss Chebyshev type 1  rule_gausschebyshev1  gauss chebyshev 1  fy f x      12  8dx f  f x  b    x  05  x     a  dx    1 1 N A No  Gauss Chebyshev type 2  rule_gausschebyshev2  gauss chebyshev 2  fo  F       2   Fda J  f a   b    x    a     a Fdx  1 1 N A No  Gauss Gegenbauer  rule_gaussgegenbauer  gauss gegenbauer  ie f x  1     2   da f  f x  b    x   a     a edx    1 1 Must specify a No  Gauss Jacobi  rule_gaussjacobi  gauss jacobi  Si FA      1   z   dz f  f     b     x     x     a   dz    1 1 Must specify a  3 No  Gauss Laguerre  rule_gausslaguerre  gauss laguerre  jn   ate  de f   f a   a     ajee 0 0 dar  0  oo  Must specify a No  Gauss Hermite  rule_gausshermite  gauss hermite  JS  fla a e     dx JE fa  a   aJ2e 0 0 dy     oo  00  Must specify a No  Local Polynomials  rule pwpolynomial  local polynomial  Si f x dx f  f x dx     1 1  N A Yes  Local Polynomials with Zero Boundary  rule_pwpolynomial0  local polynomial zero  1 b  J  Fede J   Hoja en f    1    f    0   Yes  Local Wavelets  rule_wavelet  local wavelet  J   fa de J  fade   1 1  N A Yes       Table A 1  Summary of the available quadrature rules  For each rule  we have the enumerated type  as rule_    followed by the string given to the tasgrid and MATLAB interfaces     that at a given depth we can only use a polynomial of the same order  There are two variations of  th
11. C T and basis functions      x     as    N  f x    X cgile    1 2   i 1    where the coefficients c  are chosen so that  N   gt  ola   i l    The coefficients c  can be found by solving a system of linear equations  i e   c  _  are the result  of a linear transformation applied to   f x    _   In general  the conditioning of this linear map is  of consideration  however  a suitable choice of abscissas x  and functions     x  results in a well  conditioned problem  An alternative definition of the interpolant is given by    f a  a  gt  hi x  f  z       i 1    where the functions  h  x    are constructed by applying the dual of the linear transformation  to the vector of basis functions       _   For a specific point 7  the approximation becomes    F 5     gt  hi    f  xi    Ze gif  2     1 3     where g    h  Z  are the interpolation weights     One dimensional integration and interpolation rules can be transformed from a domain I      to ro  where re  is the image of I     under a linear map defined by a and b  For example  if       T       1  1  then an arbitrary interval  a  b  is the image of T   under the linear transformation  b a baa    T q      3    Analogously the integration weight p   1  can be transformed into p x   Extending the result in  multiple dimensions  it is trivial to define a map for every dimension and have    T  co Q T922 Q Q res    and the integration weights  p x    pi xi pi  2      prlta    For a full list of the transformations supported by this co
12. Nu   merische Mathematik  40  1982   pp  407 422  35     15  A  KLIMKE AND B  WOHLMUTH  Algorithm 847  Spinterp  piecewise multilinear hier     archical sparse grid interpolation in matlab  ACM Transactions on Mathematical Software   TOMS   31  2005   pp  561 579  3  38     16  X  MA AND N  ZABARAS  An adaptive hierarchical sparse grid collocation algorithm  for the solution of stochastic differential equations  Journal of Computational Physics  228   2009   pp  3084 3113  3  38     17  R  S  MARTIN AND J  WILKINSON  The implicitql algorithm  Numerische Mathematik  12   1968   pp  377 383  35     18  F  NOBILE  R  TEMPONE  AND C  G  WEBSTER  An anisotropic sparse grid stochastic  collocation method for partial differential equations with random input data  SLAM Journal  on Numerical Analysis  46  2008   pp  2411 2442  2  3 7  8     19  F  NOBILE  R  TEMPONE  AND C  G  WEBSTER  A sparse grid stochastic collocation  method for partial differential equations with random input data  SLAM Journal on Numeri   cal Analysis  46  2008   pp  2309 2345  2  3  7     20  K  PETRAS  Smolyak cubature of given polynomial degree with few nodes for increasing  dimension  Numerische Mathematik  93  2003   pp  729 753  35     21  J  SHEN AND L  L  WANG  Sparse spectral approximations of high dimensional problems  based on hyperbolic cross  SIAM Journal on Numerical Analysis  48  2010   pp  1087 1109   7     22  S  A  SMOLYAK  Quadrature and interpolation formulas for tensor products of certain  
13. ORNL REPORT    Unlimited Release  Printed August 2013    User Manual  TASMANIAN Sparse  Grids    M  Stoyanov    Prepared by  Oak Ridge National Laboratory  One Bethel Valley Road  Oak Ridge  Tennessee 37831    The Oak Ridge National Laboratory is operated by UT Battelle  LLC     for the United States Department of Energy under Contract DE AC05 000R22725   Approved for public release  further dissemination unlimited     oax RIDGE NATIONAL LABORATORY    MANAGED BY UT BATTELLE FOR THE DEPARTMENT OF ENERGY       DOCUMENT AVAILABILITY    Reports produced after January 1  1996  are generally available free via the U S  Department of  Energy  DOE  Information Bridge     Web site http   www osti gov bridge    Reports produced before January 1  1996  may be purchased by members of the public from the  following source     National Technical Information Service   5285 Port Royal Road   Springfield  VA 22161   Oak Ridge  TN 37831   Telephone 703 605 6000  1 800 553 6847    TDD 703 487 4639   Fax 703 605 6900   E mail info ntis gov   Web site http   www ntis gov support ordernowabout htm    Reports are available to DOE employees  DOE contractors  Energy Technology Data Exchange   ETDE  representatives  and International Nuclear Information System  INIS  representatives from  the following source     Office of Scientific and Technical Information  P O  Box 62   Oak Ridge  TN 37831   Telephone 865 576 8401   Fax 865 576 5728   E mail reports osti gov   Web site http   www osti gov contact 
14. PADS Se 24  414 Command  IDEAS castrado eas 24  LIS Command   Tenne or OEE RRS EPR KS PR As WR EROS RNA 25  4 16 Command  IA ic heh Oo ed ea eee nee eae EERU pee eee 25  4 17  Matrix File Forniat   3 scn0  3 6 00 a Bbw ns SH ws op ed BG oo ee 26    gt  MATLAB Interia cionado A 27  314 Tunction USOC AINE  seess on adas sa 27  5 2 functions tsgReadMatrix   and tsgWriteMatrixO       oo ooooooooocooroomooo   28   gt   f  nc  on ts Mako s eie nasasama gise a AS weed ead oa ee gaa 28  54 function tseMakeQuadratite    lt br dees bye eee ed aa 29  5 3 f  nction tseRecycleGidO csc des reges ii desler cae adhe idea 29  30 Rincon e QUISE  recensie oak EE a AAA AR 30  5 7 function tseGetinterpolationWeighis       2 0  6c  ci ees abe dwesa ad ideews 30  5 8 function tseGetNeededP omits  siii A A 31  5 9 Tonction teeLoad Vanies     6640s oo kde AAA SOE 31  5 10 function Se YUCA AA ade RA SOR de ee Hees 31  5 11 function teelntestalet  copii tics iria ad BA hee ees 32  5 12  function tsRenneGid   eseese hressa a ennai hooks aae A Ea iaa 32  5 13  function eer rie  si conse ease eee ke esa ous RA RRA RAR 33  314 function tseDeleteGrid     srs bos ee kok wen A id A EES KEE ean FES 33  3 15 fonction tee DeleteGrid By Namal   lt   65549095 ada 33  5 16 function tse LisiGridshy Name      socorro rogar ta ae ade ob 33  5 17  fanc  on eer Kaine   cias a A A AAA 34  ALE MAA 34  E A 34   Appendix  A Types of One Dimensional Rules      os oss isos ccccccccccccves secs cass sseeeesesssec    35    1v  
15. S EYEE GES a HY ES 13  3 20 function cetOneDRuleDeschiption     s vomita 13  3 21  function CoINUIMPOUNS    puto EE KEE EER ESS ER 14  3 22  ss AS a aa r dhe eee T eee 14  J23 TIRSO CET A Ph a ee KS AR 14  3 24 function getInterpolantWeights   circa rr dde 15  3 25 function getNumNeededPoints      ccoo 15  3 20  function getNeededPoints      RR ERA 15  3 27 function loadNeededPoints             oooooooooooonrrrr morron  ooo s 16  3 26 function evadir a a aaa 16  3 22 TICO IESO   cra a AA ia 16  3 30  TURCO PONES IAS ADS AAA A AA AAA 16  3 31 function setRefinement   e ES 17    iii    E e ee baa a ee tk ha nE REEE RAS EE RER ACERS LARA D ARREARS RTE RE CES 17    4  TASGRID coi a A ARRE wads teen eed seer ieee exe es 18  Od Basie idee so ck oe oh ooh eee OE ea de ese ae cea eee ees 18  4 2  o SIND res 5 2 EG ch E ASA EGS 3 E EERE 18  43  Command  VEO eiere oor ew tee erin detente beeen ew eta es eee  18  AA ACOMMANG  SESE oo ss ey ba eae onset eae eee RE Eee Shee eee 18  4 5  Command  MAKETAS AA SES Rea AA AAA 19  4 6 Command  smakequadrature  lt a 21  47 Command  ICONO renies riter Ses eRe RA ERATOR E EERIE S TI EERE 21  4 8 Command   getg  adrat  re   s ee Ses bes ood e DE E A aa a A a a 22  49 Command DEDOS  si   n cao bh KS ee ken EENE PENE A RS ERNE GREER 22  4 10 Command   getintefrweights  2 osc nel ee haga ve ow ddda AA onsen eos 22  411 Command   cetmeedsdpoints y s s aasre a 23  4 12 Command  Loa dvalues coso rrrrrrrra road Saad 23  413 Command  AA DHA ADS CHRO A DS P
16. a will be on the first row  the second on the  second row and so on     is an optional file  The grid can be saved in this file for future use     is an optional matrix file  however  unlike regular matrix files the entries  must be integers    otherwise the behavior of the code becomes unpredictable  The matrix file must have    dimensions number of rows and only one column  If a global grid is being created  then the  file will specify the anisotropy_weights array given to makeGlobalGrid    If a tensor grid is  being created  then this file will specify the order array given to makeFullTensorGrid       write out the same data as in the  outputfile but to the cout stream     20    4 6    Command   makequadrature      tasgrid  makequadrature  lt optionl gt   lt valuel gt   lt option2 gt   lt value2 gt     This command works the same as  makegrid except for the  outputfile command      outputfile    4 7    is an optional matrix file  At the end of the program  tasgird will write in the file the quadra   ture weights and abscissas associated with the grid  The matrix file will have getNumPoints    number of rows and  dimensions plus one number of columns  The first abscissa will be on  the first row  the second on the second row and so on  On each row  the first column is the  weight and the rest of the columns are the associated abscissa     Command   recycle         tasgrid  recycle  lt optionl gt   lt valuel gt   lt option2 gt   lt value2 gt     This command creates a new gr
17. classes of functions  Dokl  Akad  Nauk SSSR  4  1963   pp  240 243  English translation    2 5  T     23  M  STOYANOV  Hierarchy direction selective approach for locally adaptive sparse grids   Tech  Rep  ORNL TM 2013 384  Oak Ridge National Laboratory  2013  17     24  A  H  STROUD AND D  SECREST  Gaussian quadrature formulas  vol  374  Prentice Hall  Englewood Cliffs  NJ  1966  35     25  W  SWELDENS AND P  SCHRODER  Building your own wavelets at home  in Wavelets in the  Geosciences  Springer  2000  pp  72 107  38     26  G  ZHANG AND M  GUNZBURGER  Error analysis of a stochastic collocation method for  parabolic partial differential equations with random input data  SIAM Journal on Numerical  Analysis  50  2012   pp  1922 1940  3     27  G  ZHANG  M  GUNZBURGER  AND W  ZHAO  A sparse grid method for multi dimensional  backward stochastic differential equaitons  Journal of Computational Mathematics  31   2013   pp  221 248  3    40    v1 0    oax RIDGE NATIONAL LABORATORY    MANAGED BY UT BATTELLE FOR THE DEPARTMENT OF ENERGY    
18. d loadNeededPoints  const double vals       Provides the values of the function to be interpolated evaluated at the corresponding abscissas     vals is an array of size getNumOutputs   x getNumNeededPoints    The first getNumOutputs    entries correspond to the outputs of the interpolated function at the first abscissa point  The  second set of getNumOutputs   entries correspond to the second abscissa and so on     3 28 function evaluate      void evaluate  const double x     double y     const     Finds the value of the interpolant at the provided point x as defined by equation  1 2   The  result is written into y     x an array of size getNumDimensions   that indicate the point where the interpolant should be  evaluated     y an already allocated array of size getNumOutputs    On exit  the entries of y are overwritten  with the values of the interpolant at the point x     3 29 function integrate    void integrate  double y     const   Integrates the interpolant over the domain and returns the result in y     y an already allocated array of size getNumOutputs    On exit  the entries of y are overwritten  with the values of the integral of the interpolant over the domain     3 30 function printStats    void printStats       Prints short description of the sparse grid  The output is written to standard output  i e  cout      16    3 31 function setRefinement         void setRefinement  double tolerance  TypeRefinement criteria       Improves the accuracy of the sparse grid bas
19. de  see Appendix A     The goal of Sparse Grids is to select a subset from all possible tensor product abscissas  x     so that maximum accuracy is achieved for the smallest number of function evaluations   f x        This is usually achieved by balancing the error in different dimensions  For more information on    the properties of sparse grids see  2    4  6  8 10  12  13  15  16  18  19  22  26  27    The TASMANIAN Sparse Grid code implements a number of different quadrature rules and  function basis  The rules are grouped in three categories   e Global Grids  suitable for globally smooth functions  Quadrature is based on a number of  available rules  see Appendix A  and interpolation is based on global Lagrange polynomials     e Local Polynomial Grids  suitable for non smooth functions with locally sharp behavior   Interpolation is based on hierarchical piece wise polynomials with local support and user  specified order  These grids are suitable for local refinement     e Wavelet Grids  are similar to the local polynomials  however  when coupled with local  refinement  often times wavelet grids provide the same accuracy with fewer abscissas     For a given grid the code can perform three tasks     e generate a set of abscissas  x   _  and weights  w     for a quadrature rule of type  1 1      e generate a set of abscissas  x   _  and for the user specified function values A   8 i 1 P i 1  the code can create an interpolant of type  1 2   The interpolant can be evaluated 
20. dimensional quadrature and interpolation rules     4 3 Command   version    Prints the version of the library and executable     4 4 Command   test      tasgrid  test    Performs a series of basic functionality tests  For different grids  different parameters and all  possible quadrature rules  tasgrid will perform a test to make sure that it can integrate or interpolate  appropriate functions to a high degree of precision  The output of the command should be a list of    18    the tests and the Pass or Fail result  A failure of a test in an indication that something went wrong  in the build process or there is a bug in the code     Note that the wavelet tests take a long time and hence they are performed last  Unless one is  interested in using wavelet grids  the wavelet tests can be skipped     4 5 Command   makegrid    tasgrid  makegrid  lt optionl gt   lt valuel gt   lt option2 gt   lt value2 gt     This command creates a new sparse grid  It uses the following options that can be given in any  order      onedim specifies whether to use global  local polynomial or wavelet grids  as well as the underlying  one dimensional quadrature and interpolation rule  The available values for the rules are  summarized in Table A 1    clenshaw curtis creates a global grid with Clenshaw Curtis rule    chebyshev creates a global grid with Chebyshev rule    fejer 2 creates a global grid with Fejer type 2 rule    gauss legendre creates a global grid with Gauss Legendre rule   gauss chebyshe
21. e local polynomial rule that assume zero and non zero boundary  Also note that quadrature rules  based on local polynomials may have abscissas associated with zero weights  For more details on    the local polynomials see  10  15  16     A 3 Wavelet Grid    Same as local polynomials  however  it assumes that order is either 1 or 3  The boundary is not  assumed to be zero and only one type of local refinement is possible  Functionality would be    expanded in the future  For more details on the wavelet grid see  10  13 25     38       REFERENCES     1  M  ABRAMOWITZ AND I  A  STEGUN  Handbook of Mathematical Functions  With Formu   lars  Graphs  and Mathematical Tables  vol  55  Dover Publications  1964  35     2  S  ACHARJEE AND N  ZABARAS  A non intrusive stochastic galerkin approach for model     ing uncertainty propagation in deformation processes  Computers  amp  structures  85  2007    pp  244 254  3     3  N  AGARWAL AND N  R  ALURU  A domain adaptive stochastic collocation approach    for analysis of mems under uncertainties  Journal of Computational Physics  228  2009    pp  7662 7688  3     4  V  BARTHELMANN  E  NOVAK  AND K  RITTER  High dimensional polynomial interpo   lation on sparse grids  Advances in Computational Mathematics  12  2000   pp  273 288   3     5  P  J  DAVIS AND P  RABINOWITZ  Methods of numerical integration  Courier Dover Publi   cations  2007  35     6  M  ELDRED  C  WEBSTER  AND P  CONSTANTINE  Evaluation of non intrusive approaches  for wiene
22. ed on the loaded values of the interpolant  After  calling setRefinement    the needed points are updated and evaluate and integrate will work with  the old interpolant until the new needed values are loaded  If setRefinement   is called twice in  a row without loadNeededValues    then any data from the first call will be cleared and only the  second refinement would persist     tolerance is a positive number with the desired tolerance   criteria is an enumerated type from type_classic type parent first type_direction_selective type_fds   For the three types of local refinement  see  23    Note that the inputs have different meaning depending on the grid   e Global Grid will ignore both parameters and will only increase the accuracy isotropically in  every direction by adding the next levels of the one dimensional rule     e Local Polynomial Grid will compare the relative magnitude of the surpluses c  divided by  the largest provided value f  x   to the tolerance  The algorithm will refine only in the neigh   borhood of the abscissas where the ratio is large for at least one of the outputs  The criteria  defines whether or not all direction should be refined and whether or not the    parents    should  be added before the    children     where the family is described by the hierarchy  23      e Wavelet Grid will compare the surpluses c  to the tolerance and will refine only in the neigh   borhood of the abscissas associated with large surpluses  The criteria is ignored  i e  
23. er Science and Mathematics Division  Oak Ridge National Laboratory  One Bethel Valley Road  P O  Box  2008  MS 6367  Oak Ridge  TN 37831 6164  stoyanovmk ornl  gov      CONTENTS    LIS DOR FIGURES 03d rada vi  LISTOF TABLES uccrerri AA enkdezes vii  ABS TACT 30 ai AA AAA 1  ACKNOWLEDGEMENTS siii Ad 1  1 Introduction    csommsras ea da ea 2  2  COMPUSO uscar a RRA e E acancnan bie 5  3 LIBTASMANIANSPARSEGRIDS  libtsg         cccccccccccccccccccccssssssscces 6  3 1 Constructor Tasmanians parse  0 AAA ORS RRS 6  3 2 Destructor TasmanianSparseGrid   ci ad 6  3 3 function Get Version  eseri ary A AR ad 6  3 4 Tonction cet  Acense   A A A Ad 6  3 5 function makeGlobalGridO                 oooooooooorooooorornooooo   s 7  3 6 function makelLocalPolynomialGnd      cocromicinar oran es 8  3 7 function makeWaveletGrid               oooooooooooorrr nooo 9  3 8 function makeFullTensorGnd   codo dt BS ae 10  3 9 functions recycle FOG  sI ARO de Aaaa AA E Gaa EARE 10  3 10 TURCO  WENE 2  ersi le GES ye AE ee a e A A ee 11  3 11 tunctlon TEO    cir a eS bar da 11  3 12  TURCO WEE  e A a aaa 11  3 13   TUCU read tc id ne RO eee ita 11  3 14 tinction setTranstormAB   or cercei neraet id dees wh at ew eee 12  3 15 function clear TranstormABO  ii Bb AG See ne ee ee due Pace a 12  316 function et TransformABO rd ee eGo a bis la 12  3 17 function getNumDimensions  s osos 2 ucen ce estes apes ey whe ea RA 13  3 18 funcion COIN UIMOUIDUNS    se isa aaae aaa RO 13  3 19 function eee RUSO    A a ew S
24. er that is given to the setRefinement   command    refinement is a string specifying the refinement criteria     classic corresponds to type_classic  parents corresponds to type_parent_first  direction corresponds to type_direction_selective    fds corresponds to type_fds     outputfile is an optional matrix file  At the end of the program  tasgird will write in the file the needed  abscissas  i e  the ones that are not yet associated with values of the interpolated function   The matrix file will have getNumPoints   number of rows and getNumDimensions   number  of columns  The first abscissa will be on the first row  the second on the second row         print write out the same data as in the  outputfile but to the cout stream     4 16 Command   summary      tasgrid  summary  gridfile  lt filename gt        Reads the grid in the provided file and prints short summary about the grid      gridfile this is the file with an already created grid     25    4 17 Matrix File Format    A matrix file is a simple text file that describes a two dimensional array of real numbers  The  file contains two integers on the first line indicating the number of rows and columns  Those are  followed by the actual entries of the matrix one row at a time     The file containing    3 4   1 0 2 0 3 0 4 0  50  OO O g 85 0  9 0 10 0 11 0 12 0       represents the matrix    1 2 3 4  5 6 7 8  9 10 11 12    A matrix file may contain only one row or column  e g     1 2  13 0 14 0       All files used by ta
25. for any  arbitrary x and it can also be integrated over the domain     e generate a set of abscissas  x     and for any arbitrary x it can also generate the interpola   tion weights  h  x   _  for an approximation of type  1 3    In addition  local grids support iterative refinement  where additional abscissas are chosen based  on the provided   f x     _  to improve the approximation of the provided interpolant   The code consists of three main components   e libtasmaniansparsegrids a  for short libtsg  which is a library written in C   that imple     ments the TasmanianSparseGrid class  The class provides an interface for manipulation of  the grid  See Section 3     e tasgrid which is an executable that provides a command line interface to libtsg  The exe   cutable reads and writes data to text files and every command generally reads an instance of  TasmanianSparseGrid class from a text file  calls a function from the class and writes the  modified class back to a text file  See Section 4     e MATLAB Interface  for short tsg m  which is a series of MATLAB functions that call the  executable tasgrid and read the result into MATLAB matrices  See Section 5     2 Compilation    Quick Build  Inside the folder with the source files  type  make    The code doesn   t require any external libraries and uses the simple GNU Make engine  Hence   it will most likely compile just fine     To verify the build you should run    tasgrid  test    and make sure all the test pass  See Section
26. for large dimensions  the number of abscissas associated  with a sparse grid grows fast  i e  the curse of dimensionality  and hence the grid may require  prohibitive amount of memory     is a non negative integer specifying the number of outputs for the function that would be  interpolated  If outputs is zero  then the grid can only generate quadrature and interpolation  weights  i e  problems  1 1  and  1 3   There is no hard restriction on how many outputs  can be handled  however  note that the code requires at least outputs x number of abscissas  storage and hence for large number of outputs memory management may have adverse  effect on performance     is a non negative  or strictly positive  integer that controls the density of abscissa points  For  grids of type_level and type_hyperbolic  depth is strictly positive and it corresponds to the  notion of sparse grid    level     see  18  19 22    For grids of type_basis the depth specifies the  largest total degree polynomial that can be integrated or interpolated exactly  Gauss based  rules imply integration  while non Gauss rules imply interpolation  see Appendix A   There  is no hard restriction on how big depth can be  however  it has direct effect on the number  of abscissas and hence performance and memory requirements     is an enumerated type from type_level type_hyperbolic  type_basis which guides the tensor  selection to balance the precision in different directions         type_level  classical Smolyak Sperse G
27. ghts  lt optionl gt   lt valuel gt   lt option2 gt   lt value2 gt     Reads a grid from a file and a list of points of interest form a matrix file  For each point in  the matrix file  tasgrid computes the corresponding interpolation weights as in equation  1 3   The  result is written to an output matrix file    22     gridfile this is the file with an already created grid and loaded values      inputfile is a matrix file with points of interest  The file can have arbitrary number of rows and  getNumDimensions   number of columns  Each row corresponds to one point of interest      outputfile is an optional matrix file that is written on exit  The file contains the interpolation weights as   sociated with the points provided by the  inputfile  The file has the same number of rows and  getNumPoints   number of columns  Each row contains the interpolation weights associated  with the corresponding point of interest      print write out the same data as in the  outputfile but to the cout stream     4 11 Command   getneededpoints      tasgrid  getneededpoints  lt optionl gt   lt valuel gt   lt option2 gt   lt value2 gt     Reads a grid from a file  extracts the abscissas associated with the grid that are not yet associ   ated with values of the interpolated function  Those abscissas are written to a matrix file      gridfile this is the file with an already created grid      outputfile is an optional matrix file  The program will write in the file the abscissas associated with the
28. html                NOTICE    This report was prepared as an account of work sponsored by an agency  of the United States Government  Neither the United States Government   nor any agency thereof  nor any of their employees  nor any of their con   tractors  subcontractors  or their employees  make any warranty  express  or implied  or assume any legal liability or responsibility for the accuracy   completeness  or usefulness of any information  apparatus  product  or  process disclosed  or represent that its use would not infringe privately  owned rights  Reference herein to any specific commercial product  pro   cess  or service by trade name  trademark  manufacturer  or otherwise   does not necessarily constitute or imply its endorsement  recommenda   tion  or favoring by the United States Government  any agency thereof   or any of their contractors or subcontractors  The views and opinions  expressed herein do not necessarily state or reflect those of the United  States Government  any agency thereof  or any of their contractors              Printed in the United States of America  This report has been reproduced directly from the best available copy        Computer Science and Mathematics Division    USER MANUAL  TASMANIAN SPARSE GRIDS    M  Stoyanov      Date Published  August 2013    Prepared by  OAK RIDGE NATIONAL LABORATORY  Oak Ridge  Tennessee 37831 6283  managed by  UT BATTELLE  LLC  for the  U S  DEPARTMENT OF ENERGY  under contract DE ACOS 000R22725        Comput
29. id   and it specifies the type_level enumerated type   basis calls makeGlobalGrid   and it specifies the type_basis enumerated type     hyperbolic calls makeGlobalGrid   and it specifies the type_hyperbolic enumerated  type   tensor calls makeFullTensorGrid       specifies the order of the local polynomials or wavelets and is used only with local polyno   mial and wavelet grids  For polynomials  the value is    1 for automatically using the max   imum possible order or a non negative integer that restricts the maximum order  Wavelet  grids accept only orders 1 and 3     specifies the    parameter of the one dimensional quadrature rule  The value is a real number  and it is used by gauss gegenbauer  gauss jacobi  gauss hermite and gauss laguerre rules     specifies the 3 parameter of the one dimensional quadrature rule  The value is a real number  and it is used by the gauss jacobi rule     is an optional matrix file that specifies the transformation from the canonical domain to a  custom domain  The matrix file should have dimensions number of rows and 2 columns   The first column is the a parameter and the second column is the b parameter and each row  corresponds to one dimension  For detail on the matrix file format see subsection 4 17     is an optional matrix file  At the end of the program  tasgird will write in the file the abscissas  associated with the grid  The matrix file will have getNumPoints   number of rows and    dimensions number of columns  The first absciss
30. id with most of the parameters taken from an existing grid  specified by the  gridfile option  Furthermore  the command will try to use existing values of  the interpolated function  if they have already been loaded  This command calls one of the recy   cle   Grid   functions  The recycled grid created will use the same number of dimensions and  outputs as well as the same base one dimensional quadrature or interpolation rule  including the  same values for the a and P parameters       gridfile     depth     type     order   inputfile     outputfile     anisotropyfile     print    on input this is the file with an already created grid  On exit the file will be overwritten with  the new grid     same as in  makegrid    if the loaded grid is a global grid  then the value is one of the strings level  basis or hyperbolic  which has the same meaning as in  makegrid  If the grid file contains a tensor grid  then  type  is ignored     same as in  makegrid  same as in  makegrid    is an optional matrix file  At the end of the program  tasgird will write in the file the needed  abscissas  i e  the ones that are not yet associated with values of the interpolated function   The matrix file will have getNumPoints   number of rows and getNumDimensions   number  of columns  The first abscissa will be on the first row  the second on the second row        same as in  makegrid    write out the same data as in the  outputfile but to the cout stream     21    4 8 Command   getquadrature      ta
31. les will be created and  deleted in this folder     27    5 2    functions tsgRead Matrix   and tsgWriteMatrix      Those functions are used internally to read from or write to matrix files  The user shouldn   t call  those functions directly     5 3    function tsgMakeGrid       lGrid  points  tsgMakeGrid  sGridName  dim  out  oned  depth  order  type     anisotropy  alpha_beta  transformAB      Calls tasgrid with the  makegrid command  This function creates an  Grid object that can be  used to refer to the grid by other functions     sGridName    dim  out  oned  depth    order    type    anisotropy    alpha_beta    transformAB    INPUTS    a user provided name that will be appended to all the file names associated with this grid  If  a grid with this name already exists  it will be overwritten and the  Grid object associated  with the old grid will be invalid     the dimension of the grid  same as  dimensions    the number of outputs of the grid  same as  outputs    the one dimensional integration and interpolation rule  same as  onedim   same as  depth     is used by local polynomial and local wavelet grids only  Specifies the order of the polyno   mial  same as  order     is used by global grids only  Specifies the  type option     is either an empty MATLAB matrix    or a matrix of integers with size dim x1 that describe  the anisotropic weights  see  anisotropicfile option for tasgrid and const int  anisotropic_weights  parameter for libtsg      is either an empty MATLAB
32. ll controls the number of abscis   sas  however  it no longer has the same relationship to    levels    or total degree polynomial  order     is either NULL or an array of one or two doubles  The first entry of the array is a and the  second is   and those values are referenced only if the quadrature rule requires them  One  dimensional rules of type rule_gaussgegenbauer  rule_gaussjacobi  rule_gausslaguerre and  rule_gausshermite require an a and in addition rule_gaussjacobi requires p  see Table A 1      function makeLocalPolynomialGrid      void makeLocalPolynomialGrid  int dimensions        int outputs    int depth    int order    TypeOneDRule boundary          Creates a grid based on local hierarchical piece wise polynomial function basis  The main  focus of hierarchical grids is the ability to do local iterative refinement to daptively obtain an  interpolant that clusters abscissa in regions of sharp behavior and puts fewer abscissa in regions  of smooth behavior  Local grids can be used for integration  however  in many cases  this would  result in abscissas associated with zero weights     dimensions    outputs    same as makeGlobalGrid      same as makeGlobalGrid    however  due to the non trivial form of the coefficients c   large  number of outputs comes with bigger computational cost in addition to the larger storage  cost of 2 x outputs x number of abscissas     depth is a positive integer that specifies the initial number of levels for the grid     order is an i
33. nteger bigger than    2  which specifies the largest order of polynomial to be used  For  a one dimensional interpolation rule  a polynomial of order   cannot be used before level  l    1  ie  before depth   l   Thus  if order is larger than depth only lower degree local  polynomials would be used  If order is set to    1  the largest possible order would be selected  automatically    on the fly        boundary is an enumerated type with value either rule pwpolynomial or rule_pwpolynomial0  The  difference is that the latter type assumes that the interpolated function is zero at the boundary     3 7 function makeWaveletGrid         void makeWaveletGrid  int dimensions   int outputs   int depth   int order   1             Creates a grid based on local hierarchical wavelet basis  It is very similar to the local poly   nomial rule  however  local refinement using wavelet functions would sometimes require fewer  function evaluations    dimensions same as in makeGlobalGrid   and makeLocalPolynomialGrid    outputs same as in makeLocalPolynomialGrid      depth same as in makeLocalPolynomialGrid      order an integer equal to either 1 or 3  The wavelet grids use the corresponding order of wavelet  even for grid with depth   1  However  a wavelet grid of a given depth would have more  abscissas than a corresponding local polynomial grid     3 8 function makeFullTensorGrid      void makeFullTensorGrid  int dimensions        int outputs   int order     TypeOneDRule oned    const double 
34. of columns and the same number of rows as  points  The weights contain the interpolation weights associated with each point of interest  in points     30    5 8 function tsgGetNeededPoints        newp     tsgGetNeededPoints  1Grid      Calls tasgrid with the  getneededpoints command     INPUTS  IGrid is an object created by tsgMakeGrid    OUTPUTS    newp is a MATLAB matrix of getNumNeededPoitns   number of rows and out number of columns   Each rows is an abscissa that is not yet associated with a value of the interpolated function     5 9 function tsgLoad Values      tsgLoadValues  1Grid  values      Calls tasgrid with the  loadvalues command     INPUTS  IGrid is an object created by tsgMakeGrid      values isa MATLAB matrix with getNumNeededPoitns   number of rows and out number of columns   Each row represents the values of the function at one point     OUTPUTS    there are no output variables  however  the files associated with the grid are modified     5 10 function tsgEvaluate        result     tsgEvaluate  1Grid  points      Calls tasgrid with the  evaluate option     INPUTS    IGrid is an object created by tsgMakeGrid      31    points isa MATLAB matrix with rows representing points of interest   OUTPUTS    result is a MATLAB matrix with rows representing the values of the interpolant at the point of  interest     5 11 function tsgIntegrate              result     tsgIntegrate  1Grid      Calls tasgrid with the  integrate option     INPUTS  IGrid is an object created b
35. r askey generalized polynomial chaos  in Proceedings of the 10th AIAA Non   Deterministic Approaches Conference  number AIAA 2008 1892  Schaumburg  IL  vol  117   2008  p  189  3     7  S  ELHAY AND J  KAUTSKY  Algorithm 655  Igpack  Fortran subroutines for the weights  of interpolatory quadratures  ACM Transactions on Mathematical Software  TOMS   13   1987   pp  399 415  35     8  T  GERSTNER AND M  GRIEBEL  Numerical integration using sparse grids  Numerical al   gorithms  18  1998   pp  209 232  2  3  7     9          Dimension   adaptive tensor   product quadrature  Computing  71  2003   pp  65 87  3     10  M  GRIEBEL  Adaptive sparse grid multilevel methods for elliptic pdes based on finite differ   ences  Computing  61  1998   pp  151 179  2  3  38     11  M  GRIEBEL AND J  HAMAEKERS  Sparse grids for the schr  dinger equation  M2AN Math   Model  Numer  Anal  41  2007   pp  215 247  7     12  M  GUNZBURGER  C  TRENCHEA  AND C  WEBSTER  A generalized stochastic collocation    approach to constrained optimization for random data identification problems  Tech  Rep   ORNL TM 2012 185  Oak Ridge National Laboratory  2012  3     13  M  GUNZBURGER  C  WEBSTER  AND G  ZHANG  An adaptive wavelet stochastic colloca     tion method for irregular solutions of partial differential equations with random input data   Tech  Rep  ORNL TM 2012 186  Oak Ridge National Laboratory  2012  3  38    39     14  J  KAUTSKY AND S  ELHAY  Calculation of the weights of interpolatory quadratures  
36. rid     10    3 10 function write      void write  std  ofstream    ofs   const     Writes out the grid in text format to the ofstream     3 11 function read      bool read  std  ifstream  amp ifs   const     Reads a grid that has already been written to the stream  The function returns True if the  reading was successful or False if errors with the file format were encountered  The function will  write error information to the standard output stream     3 12 function write      void write  const charx filename   const     Opens a file with filename and calls void write  std   ofstream  amp ofs   const  with the associated  stream  At the end  the file is closed     3 13 function read      bool read  const charx filename       Opens a file with filename and calls bool read  std   ifstream  amp ifs   const  with the associated  stream  At the end  the file is closed     11    3 14 function setTransformAB      void setTransformAB  const double xa   const double xb          By default integration and interpolation are performed on a canonical interval described in  Table A 1  Optionally  the library can transform the canonical interval into a custom one defined  by the a and b parameters for every direction  The transformation is applied as a post processing  step to the abscissas and weights     a is an array of real numbers of size getNumDimensions   that defines the a parameter associ   ated with every dimension     b is an array of real numbers of size getNumDimensions   tha
37. rid selection  The sum of the level indexes over  all of the directions has to be less then depth  18  19 22          type_hyberbolic  hyperbolic cross section  The product of the level indexes over all of  the directions has to be less then depth  8  11 21          type_basis  takes into consideration the accuracy of the one dimensional rule  Any rule  combined with type_basis is guaranteed to integrate or interpolate any polynomial of  total degree no more than depth     oned    anisotropic    alpha_beta    3 6    is an enumerated type from any of the global rules in Table A 1  Those are     rule_clenshawcurtis rule_chebyshev  rule_fejer2 rule_gausslegendre  rule_gausschebyshevl rule_gausschebyshev2  rule_gaussgegenbauer rule_gaussjacobi  rule_gausslaguerre rule_hermite     anisotropic_weights  is either NULL or an array of integers of size dimensions  See  18   for the meaning of the weights  Note that in the literature  the weights are assumed to be real  numbers  The code assumes that the weights are rational numbers and that they add up to  1  thus the anisotropic_weights array contains only the numerators of the rational numbers   This is done so that type_level and type_basis grids can be constructed using only integer  based arithmetic  type_hyperbolic grids still use double precision arithmetic that may be un   stable  1 e  the number of abscissa may be heavily influenced by rounding error   In addition   after introducing anisotropic weights  the value of depth sti
38. rpolantion weight associated with the abscissa and the point defined by x  as in  equation  1 3      x is an array of dimension getNumDimensions   representing the point of interest to evaluate  the interpolant     weights on input it is either NULL or a non NULL pointer that would be deleted   on output returns an array of size getNumPoints   of the interpolation weights associated with  the abscissas  The first weight is associated with the first abscissa returned by getPoints     the second weight is associated with the second abscissa and so on     3 25 function getNumNeededPoints      int getNumNeededPoints   const     Interpolation described in equation  1 2  requires the user to provide the values of the interpo   lated function at the abscissa points  This functions returns the number of abscissas that are still  not associated with function values     3 26 function getNeededPoints      void getNeededPoints  doublex  amp pnts   const     pnts on input it is either NULL or a non NULL pointer that would be deleted   on output returns an array of size getNumDimensions   x getNumNeededPoints   of entries  that represent the abscissas that still need to be associated with function values  The first  abscissa is located in the first getNumDimensions   number of entries  the second abscissa is  located in the second getNumDimensions   number of entries  and so on  If getNumNeeded   Points   returns 0  then pnts is returned NULL     15    3 27 function loadNeededPoints    voi
39. s Legendre  Optimal integration rule for functions on a bounded domain and constant weight     1 i f x dx     A basis type grid is guaranteed to integrate exactly any polynomial of degree no more than the  value of the depth property     Gauss Chebyshev Type 1    Optimal integration rule for functions on a bounded domain and weight p    x     1     x               torai f Foa  ar    A basis type grid is guaranteed to integrate exactly any polynomial of degree no more than the  value of the depth property     Gauss Chebyshev Type 2    Optimal integration rule for functions on a bounded domain and weight p x     1     x   03     1 1    Fome   f FOA  an   1    A basis type grid is guaranteed to integrate exactly any polynomial of degree no more than the  value of the depth property     Gauss Gegenbauer    Generalized Gauss Chebyshev rule  Optimal integration rule for functions on a bounded domain  and weight p    x     1     x           toned f HON  Aar    A basis type grid is guaranteed to integrate exactly any polynomial of degree no more than the  value of the depth property     36    Gauss Jacobi    Generalized Gauss Gegenbauer rule  Optimal integration rule for functions on a bounded domain  and weight p           1     x     1   2       1 1    Fomes   sea  2   0  oar   1  1  A basis type grid is guaranteed to integrate exactly any polynomial of degree no more than the    value of the depth property     Gauss Laguerre    This is the generalized Gauss Laguerre quadrature  Op
40. sgrid  getquadrature  lt optionl gt   lt valuel gt   lt option2 gt   lt value2 gt     Reads a grid from a file  computes the quadrature associated with the grid and writes it to a  matrix file      gridfile this is the file with an already created grid      outputfile is an optional matrix file  The program will write in the file the quadrature weights and  abscissas associated with the grid  The matrix file will have getNumPoints   number of rows  and getNumDimensions   1 number of columns  The first abscissa will be on the first row   the second on the second row and so on  On each row  the first column is the weight and the  rest of the columns are the associated abscissa      print write out the same data as in the  outputfile but to the cout stream     4 9 Command   getpoints      tasgrid  getpoints  lt optionl gt   lt valuel gt   lt option2 gt   lt value2 gt     Reads a grid from a file  extracts the abscissas associated with the grid and writes them out in  a matrix file      gridfile this is the file with an already created grid      outputfile is an optional matrix file  The program will write in the file the abscissas associated with  the grid  The matrix file will have getNumPoints   number of rows and getNumDimensions    number of columns  The first abscissa will be on the first row  the second on the second row  and so on      print write out the same data as in the  outputfile but to the cout stream     4 10 Command   getinterweights         tasgrid  getinterwei
41. sgrid have the above format with the exception of the  gridfile that contains  saved sparse grids and the  anisotropyfile that is a matrix with one column and it should contain  only integers     26    5 MATLAB Interface    The MATLAB interface to tasgrid consists of several functions that call various tasgrid commands  and read and write matrix files  Unlike most MATLAB interfaces  this is code does not use  mex  files  but rather system commands and text files     Before using the interface you must manually edit the tsgGetPath m file     e The MATLAB interface requires that MATLAB is able to call external commands and the  tasgrid executable in particular     e The MATLAB interface also requires access to a folder where the files can be written     e Each grid has a user specified name  that is a string which gets appended at the end of the  file name     e The tsgDeleteGrid    tsgDeleteGridByName   and tsgListGridsByName   allow for cleaning  the files in the temporary folder     e Every function comes with help comments that can be accessed by typing  help tsgFunctionName    e Note that it is recommended to add the folder with the MATLAB interface to your MATLAB  path     5 1 function tsgGetPaths        sFiles  sTasGrid     tsgGetPaths       You must edit the two strings in this file     sTasGrid is a string containing the path to the tasgrid executable  including the name of the exe   cutable      sFiles is the path to a folder where MATLAB has read write permission  Fi
42. t defines the b parameter associ   ated with every dimension     3 15 function clearTransformA B      const charx  clearTransformAB   const     Scales back all abscissas and weights to the canonical interval  Since the transformation is a  post processing step  the clearTransformAB   function simply removes the values set by setTrans   formAB    1 e  the grid is not actually recomputed     3 16 function getTransformAB      void getTransformAB  double   ta   doublex   amp b   const        Returns the transform parameters     a on input it is either a NULL pointer or a non NULL pointer that will be deleted   on output returns a pointer to an array of size getNumDimensions   that contains the values  of the a parameter for every direction     b on input it is either a NULL pointer or a non NULL pointer that will be deleted   on output returns a pointer to an array of size getNumDimensions   that contains the values  of the b parameter for every direction     12    3 17 function getNumDimensions         int getNumDimensions   const     Returns the value of the dimension parameter used by the make    Glid   function call     3 18 function getNumOutputs      int getNumOutputs   const     Returns the value of the outputs parameter used by the make   Glid   function call     3 19 function getOneDRule         TypeOneDRule getOneDRule   const           For a global grid  returns the value of the oned parameter   For a local polynomial grid  returns the value of the boundary parameter  
43. timal integration rule for functions on a  bounded domain and weight p    1    x e           lA ES En   izda    A basis type grid is guaranteed to integrate exactly any polynomial of degree no more than the  value of the depth property     Note  Interpolation with this rule is extremely unstable due to the infinite range of the domain     Gauss Hermite    This is the generalized Gauss Hermite quadrature  Optimal integration rule for functions on a       z      bounded domain and weight p    x     z   e          f tonades f fle lelee ae     A basis type grid is guaranteed to integrate exactly any polynomial of degree no more than the  value of the depth property     Note  Interpolation with this rule is extremely unstable due to the infinite range of the domain     A 2 Local Polynomials    The local polynomial rules are best for interpolation of a function with locally sharp gradients   The domain of interpolation is T4       1  1   Local polynomial grids allow for different types of  local adaptivity  The maximum degree of the polynomials is specified by the order property  Note    37                                                                                                             Canonical Generalized Domain of Canonical Additional Nested  Integral Integral Interpolation Assumptions  Clenshaw Curtis  rule_clenshawcurtis  clenshaw curtis  fo  f   de J  f w dx i N A Yes  Chebyshev  rule_chebyshev  chebyshev  ee f x dx f  f x dx    1 1 N A No  Fejer type 2  rule_fejer
44. tion tsgListGridsByName      tsgListGridsByName       Reads the temp folder and finds all the grids regardless whether or not they are associated with  grid objects     33    5 17 function tsgExample      tsgExample       This function contains sample code that replicated the C   example  This is a demonstration  on the proper way to call the MATLAB functions     5 18 Saving a Grid    You can save the  Grid object just like any other MATLAB object  However  a saved grid has  two components  the  Grid object and the files associated with the grid that are stored in the folder  specified by tsgGetPath    The files in the temporary folder will be persistent until either tsgDelete   Grid   is called or the files are manually deleted  The only exception is that the tsgExample    function will overwrite any grids with names tsgExample2 or tsgExample5  Note that modifying  tsgGetPath   may result in the code not being able to find the needed files and hence the grid object  may be invalidated     5 19 Avoiding Some Problems    e Make sure to call tsgDeleteGrid   as soon as you are done with a grid  this will avoid clutter  in the temporary folder     e If you clear an  Grid object without calling tsgDeleteGrid    i e  you exit MATLAB without  saving   then make sure to use tsgListGridsByName   and tsgDeleteGridByName   to safely  delete the    lost    grids     e Working with the MATLAB interface is very similar to working with dynamical memory   where the data is stored on the disk
45. v 1 creates a global grid with Gauss Chebyshev rule of type 1   gauss chebyshev 2 creates a global grid with Gauss Chebyshev rule of type 2   gauss gegenbauer creates a global grid with Gauss Gegenbauer rule   gauss jacobi creates a global grid with Gauss Jacobi rule    gauss laguerre creates a global grid with Gauss Laguerre rule    gauss hermite creates a global grid with Gauss Hermite rule   local polynomial creates a local polynomial grid    local polynomial zero creates a local polynomial grid with zero boundary   local wavelet creates a wavelet grid      dimensions specifies the dimension of the problem  The value should be a positive integer and it gets  passed directly to make   Grid    see the previous section       outputs specifies the number of outputs of the function that needs to be interpolated  The values  should be a positive integer that gets passed directly to make   Grid    see the previous  section   To set zero outputs  use the  makequadrature command      depth specifies the depth parameter of the make   Grid   function  see the previous section   In  case of a tensor grid and if no anisotropyfile is give  makeFullTensor   will be called with  order array having all entries equal to  depth     19     type     order     alpha     beta     inputfile     outputfile     gridfile     anisotropyfile     print    specifies the selection criteria of the sparse grid and it is used only by global and tensor grids   Available values are    level calls makeGlobalGr
46. wavelet  grids currently only implement type classic refinement      3 32 Examples    The file example cpp in the Examples  folder has sample code that demonstrates proper use of the  TasmanianSparseGrid class  In addition  there is also a Makefile that compiles the example     17    4 TASGRID    The tasgrid executable is a command line interface to libtsg  It provides the ability to create  and manipulate sparse grids  save and load them into files and optionally interface with another  program via text files  For the most part  tasgrid reads a grid from a file  calls one or more of the  functions described in the previous section and then saves the resulting grid  In addition  tasgrid  provides a set of basic functionality tests     4 1 Basic Usage      tasgrid  lt command gt   lt optionl gt   lt valuel gt   lt option2 gt   lt value2 gt     The first input to the executable is the command that specifies the action that needs to be taken   The command is followed by options and values     Every command is associated with a number of options  If other options are provided  then  they are ignored     Tasgrid has some basic error checking and if it encounters and error in the input  tasgrid will  print an error message as well as some help for the input     4 2 Command   h    help    Prints information about the usage of tasgrid  Note that many commands and options have a long  and short name and the help command will list both  In addition it will also list the available one  
47. x alpha_beta   0                Full tensor grids are not sparse grids  however  full tensors share many of the properties of  global grids and hence the capability is included into the code  mostly for testing purposes   Note  that in most situations  full tensor grids would require a much larger number of abscissas to achieve  the same accuracy as than a sparse grid    dimensions same as in makeGlobalGrid      outputs same as in makeGlobalGrid      order an array of non negative integers of size dimensions  The array indicates the level of one  dimensional rule to be used in every direction     oned same as in makeGlobalGrid      alpha_beta same as in makeGlobalGrid      3 9 functions recycle   Grid         void recycleGlobalGrid  int depth    TypeDepth type    const int  anisotropic _weights   0     void recycleLocalPolynomialGrid  int depth                 int order   1                void recycleWaveletGrid  int depth   int order   1                   void recycleFullTensorGrid  int order         The recycle functions recreate a new grid with similar properties  but different number of ab   scissas  and hence different accuracy   The recycle functions modify some of the parameters of  the grids  but keep all the ones that are not specified  i e  dimensions  outputs  oned  boundary    Recycle will also try to use any values of f  x   loaded in the old grid  The code discards values of  f  a   that are associated with abscissas in the old grid but are not part of the new g
48. y tsgMakeGrid    OUTPUTS    result is a MATLAB matrix with one row that represents the integral of the interpolant over the  canonical domain associated with the quadrature rule  i e  oned      5 12 function tsgRefineGrid        newp     tsgRefineGrid  lGrid  tolerance  criteria         Calls tasgrid with the  refine option     INPUTS  IGrid is an object created by tsgMakeGrid    tolerance the tolerance for the refinement  same as  tolerance  criteria the type of refinement  same as  refinement  OUTPUTS    newp is a MATLAB matrix of getNumNeededPoitns   number of rows and out number of columns   Each rows is an abscissa that is not yet associated with a value of the interpolated function     32    5 13 function tsgPrintStats    tsgPrintStats  1Grid      Calls tasgrid with the  summary option     5 14 function tsgDeleteGrid      tsgDeleteGrid  1Grid            Delete all files associated with the grid  The  Grid object is no longer valid for further reference     INPUTS  IGrid is an object created by tsgMakeGrid    OUTPUTS    deletes all the files associated with the grid and the  Grid object is no longer valid     5 15 function tsgDeleteGridByName      tsgDeleteGrid  sGridName         Delete all files associated with the grid with the name sGridName  This function should be  called whenever the  Grid object has been lost  similar to a memory leak      INPUTS  sGridName the name of the grid to be deleted   OUTPUTS    deletes all the files associated with the grid     5 16 func
49. yshev  It uses nested Chebyshev points and integration weights on  T       1 1   The rule is known to produce heavy bias on the main axis  When used with the  basis type  the axis growth is slowed  which is equivalent to  20   A basis type grid is guaranteed  to interpolate exactly any polynomial of degree no more than the depth property  the rule will also  interpolate some higher order polynomials depending on the depth and dimension     Chebyshev    The Chebyshev rule on T4       1  1  with non nested points that grow one point at a level  This  is the only rule where level and basis types grids are identical  A basis type grid is guaranteed to  interpolate exactly any polynomial of degree no more than the depth property     Chebyshev two point growth    The Clenshaw Curtis rule on y       1  1  is split into more levels so that every level adds ex   actly two points to the previous one  A basis type grid is guaranteed to interpolate exactly any  polynomial of degree no more than the depth property     Note  this is not a stable rule and it should be used with great caution     Fejer type 2    The Fejer type 2 rule on I         1  1  that is nested and uses Chebyshev points and weights  Unlike  the Clenshaw Curtis rule  Fejer type 2 assumes that f a  vanishes at the two end points  A basis  type grid is guaranteed to interpolate exactly any polynomial of degree no more than the depth  property  so long as the polynomial vanishes at the boundary of the domain     35    Gaus
    
Download Pdf Manuals
 
 
    
Related Search
    
Related Contents
Descarregar o Manual em formato PDF  NAD C 546BEE    03 Yacht Boy 80, F  基準表(PDF形式:68KB)  Progress Lighting P3945-09 Installation Guide  Whirlpool LE5750XF User's Manual    Copyright © All rights reserved. 
   Failed to retrieve file