Doxygen 1.9.1
Toolkit for Adaptive Stochastic Modeling and Non-Intrusive ApproximatioN: Tasmanian v8.2 (development)
tsgEnumerates.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017, Miroslav Stoyanov
3  *
4  * This file is part of
5  * Toolkit for Adaptive Stochastic Modeling And Non-Intrusive ApproximatioN: TASMANIAN
6  *
7  * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
8  *
9  * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
10  *
11  * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
12  * and the following disclaimer in the documentation and/or other materials provided with the distribution.
13  *
14  * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse
15  * or promote products derived from this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
18  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19  * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
20  * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
21  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23  *
24  * UT-BATTELLE, LLC AND THE UNITED STATES GOVERNMENT MAKE NO REPRESENTATIONS AND DISCLAIM ALL WARRANTIES, BOTH EXPRESSED AND IMPLIED.
25  * THERE ARE NO EXPRESS OR IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, OR THAT THE USE OF THE SOFTWARE WILL NOT INFRINGE ANY PATENT,
26  * COPYRIGHT, TRADEMARK, OR OTHER PROPRIETARY RIGHTS, OR THAT THE SOFTWARE WILL ACCOMPLISH THE INTENDED RESULTS OR THAT THE SOFTWARE OR ITS USE WILL NOT RESULT IN INJURY OR DAMAGE.
27  * THE USER ASSUMES RESPONSIBILITY FOR ALL LIABILITIES, PENALTIES, FINES, CLAIMS, CAUSES OF ACTION, AND COSTS AND EXPENSES, CAUSED BY, RESULTING FROM OR ARISING OUT OF,
28  * IN WHOLE OR IN PART THE USE, STORAGE OR DISPOSAL OF THE SOFTWARE.
29  */
30 
31 #ifndef __TASMANIAN_SPARSE_GRID_ENUMERATES_HPP
32 #define __TASMANIAN_SPARSE_GRID_ENUMERATES_HPP
33 
34 // system headers used in many/many places
35 #ifdef _MSC_VER
36 // without this MSVC++ does not accepts keywords such as "not" and "or"
37 #include <iso646.h>
38 #endif
39 
40 #include <algorithm>
41 #include <array>
42 #include <cassert>
43 #include <cmath>
44 #include <complex>
45 #include <cstdint>
46 #include <fstream>
47 #include <iomanip>
48 #include <iostream>
49 #include <limits>
50 #include <map>
51 #include <memory>
52 #include <numeric>
53 #include <stdexcept>
54 #include <string>
55 #include <type_traits>
56 #include <utility>
57 #include <vector>
58 
59 
60 #include "TasmanianConfig.hpp" // contains build options passed down from CMake
61 #include "tsgUtils.hpp" // contains small utilities
62 
85 namespace TasGrid{
86 
94 #ifdef Tasmanian_ENABLE_DPCPP
95  using int_gpu_lapack = std::int64_t;
96 #else
97  using int_gpu_lapack = int;
98 #endif
99 
103 
113 enum TypeIndexRelation{ // internal for IndexSets, unambiguous set comparison
120 };
121 
206 
210 
214 
218 
222 
225 
229 
232 
236 
239 
242 
246 
250 };
251 
254 
360  // Piece-Wise rules
373 };
374 
377 
438 };
439 
564 };
565 
576 
577 }
578 
579 #endif
TypeOneDRule
Used to specify the one dimensional family of rules that induces the sparse grid.
Definition: tsgEnumerates.hpp:285
constexpr TypeAcceleration accel_gpu_rocblas
At the front API, the HIP and CUDA options are equivalent, see TasGrid::TypeAcceleration.
Definition: tsgEnumerates.hpp:575
constexpr TypeAcceleration accel_gpu_hip
At the front API, the HIP and CUDA options are equivalent, see TasGrid::TypeAcceleration.
Definition: tsgEnumerates.hpp:570
TypeAcceleration
Modes of acceleration.
Definition: tsgEnumerates.hpp:551
TypeIndexRelation
Describes the relation between two multi-indexes when compared during sorting.
Definition: tsgEnumerates.hpp:113
TypeDepth
Used by Global Sequence and Fourier grids, indicates the selection criteria.
Definition: tsgEnumerates.hpp:203
TypeRefinement
Refinement strategy for local polynomial and wavelet grids.
Definition: tsgEnumerates.hpp:425
@ rule_minlebesgue
A greedy sequence rule with nodes added to minimize the Lebesgue constant.
Definition: tsgEnumerates.hpp:321
@ rule_gaussgegenbauer
Non-nested rule optimized for integral of the form .
Definition: tsgEnumerates.hpp:343
@ rule_gausshermite
Non-nested rule optimized for integral of the form .
Definition: tsgEnumerates.hpp:355
@ rule_gausslegendre
Non-nested rule but optimized for integration.
Definition: tsgEnumerates.hpp:329
@ rule_fejer2
Similar to rule_clenshawcurtis but with nodes strictly in the interior.
Definition: tsgEnumerates.hpp:293
@ rule_leja
Classic sequence rule, moderate Lebesgue constant growth (empirical result only).
Definition: tsgEnumerates.hpp:299
@ rule_rlejashifteddouble
Same as rule_rlejashifted but doubling the number of nodes per level, which reduced the Lebesgue cons...
Definition: tsgEnumerates.hpp:315
@ rule_gausslaguerreodd
Same as rule_gausslaguerre but using only odd levels, partially mitigates the non-nested issues.
Definition: tsgEnumerates.hpp:353
@ rule_localp
Nested rule with a hierarchy of uniformly distributed nodes and functions with compact support.
Definition: tsgEnumerates.hpp:362
@ rule_chebyshevodd
Same as rule_chebyshev but using only odd levels, partially mitigates the non-nested issues.
Definition: tsgEnumerates.hpp:297
@ rule_minlebesgueodd
Same as rule_minlebesgue but using only odd levels, quadrature is more stable.
Definition: tsgEnumerates.hpp:323
@ rule_gausslegendreodd
Same as rule_gausslegendre but using only odd levels, partially mitigates the non-nested issues.
Definition: tsgEnumerates.hpp:331
@ rule_gausschebyshev1
Non-nested rule optimized for integral of the form .
Definition: tsgEnumerates.hpp:335
@ rule_gausslaguerre
Non-nested rule optimized for integral of the form .
Definition: tsgEnumerates.hpp:351
@ rule_wavelet
Wavelet basis with uniformly distributed nodes (primarily for internal use).
Definition: tsgEnumerates.hpp:370
@ rule_mindelta
A greedy sequence rule with nodes added to minimize the norm of the surplus operator.
Definition: tsgEnumerates.hpp:325
@ rule_gaussgegenbauerodd
Same as rule_gaussgegenbauer but using only odd levels, partially mitigates the non-nested issues.
Definition: tsgEnumerates.hpp:345
@ rule_localpb
Variation of rule_localp focusing nodes on the boundary instead of the interior.
Definition: tsgEnumerates.hpp:368
@ rule_customtabulated
User provided rule, nodes and weights must be provided with a separate file.
Definition: tsgEnumerates.hpp:359
@ rule_gausshermiteodd
Same as rule_gausshermite but using only odd levels, partially mitigates the non-nested issues.
Definition: tsgEnumerates.hpp:357
@ rule_clenshawcurtis
Classic nested rule using Chebyshev nodes with very low Lebesgue constant.
Definition: tsgEnumerates.hpp:289
@ rule_gausschebyshev2odd
Same as rule_gausschebyshev2 but using only odd levels, partially mitigates the non-nested issues.
Definition: tsgEnumerates.hpp:341
@ rule_maxlebesgueodd
Same as rule_maxlebesgue but using only odd levels, quadrature is more stable.
Definition: tsgEnumerates.hpp:319
@ rule_maxlebesgue
A greedy sequence rule with nodes placed at the maximum of the Lebesgue function.
Definition: tsgEnumerates.hpp:317
@ rule_clenshawcurtis0
Same as rule_clenshawcurtis but with modified basis that assumes the model is zero at the boundary.
Definition: tsgEnumerates.hpp:291
@ rule_none
Null rule, should never be used as input (default rule for an empty grid).
Definition: tsgEnumerates.hpp:287
@ rule_chebyshev
Using Chebyshev nodes with very low Lebesgue constant and slow node growth, but non-nested.
Definition: tsgEnumerates.hpp:295
@ rule_gausschebyshev1odd
Same as rule_gausschebyshev1 but using only odd levels, partially mitigates the non-nested issues.
Definition: tsgEnumerates.hpp:337
@ rule_rlejashifted
Similar sequence to rule_rleja but with nodes strictly in the interior.
Definition: tsgEnumerates.hpp:311
@ rule_gausschebyshev2
Non-nested rule optimized for integral of the form .
Definition: tsgEnumerates.hpp:339
@ rule_localp0
Variation of rule_localp assuming the model is zero at the domain boundary.
Definition: tsgEnumerates.hpp:364
@ rule_fourier
Trigonometric basis with uniformly distributed nodes (primarily for internal use).
Definition: tsgEnumerates.hpp:372
@ rule_mindeltaodd
Same as rule_mindelta but using only odd levels, quadrature is more stable.
Definition: tsgEnumerates.hpp:327
@ rule_rlejadouble4
Using rule_rleja nodes but doubling the nodes every 4 levels, reduces the Lebesgue constant.
Definition: tsgEnumerates.hpp:307
@ rule_gaussjacobiodd
Same as rule_gaussjacobi but using only odd levels, partially mitigates the non-nested issues.
Definition: tsgEnumerates.hpp:349
@ rule_lejaodd
Same as rule_leja but using only odd levels, quadrature is more stable.
Definition: tsgEnumerates.hpp:301
@ rule_rlejaodd
Same as rule_rleja but using only odd levels, quadrature is more stable.
Definition: tsgEnumerates.hpp:309
@ rule_rlejadouble2
Using rule_rleja nodes but doubling the nodes every 2 levels, reduces the Lebesgue constant.
Definition: tsgEnumerates.hpp:305
@ rule_rlejashiftedeven
Same as rule_rlejashifted but using only even levels, quadrature is more stable.
Definition: tsgEnumerates.hpp:313
@ rule_gausspatterson
Nested rule that is optimized for integration, probably the best integration rule in more than 2 dime...
Definition: tsgEnumerates.hpp:333
@ rule_rleja
Classic sequence rule based on complex analysis, moderate Lebesgue constant growth (theoretically pro...
Definition: tsgEnumerates.hpp:303
@ rule_semilocalp
Variation of rule_localp using increased support in exchange for higher order basis (better for smoot...
Definition: tsgEnumerates.hpp:366
@ rule_gaussjacobi
Non-nested rule optimized for integral of the form .
Definition: tsgEnumerates.hpp:347
@ accel_cpu_blas
Default (if available), uses both BLAS and LAPACK libraries.
Definition: tsgEnumerates.hpp:555
@ accel_gpu_default
Equivalent to the first available from MAGMA, CUDA, BLAS, or none.
Definition: tsgEnumerates.hpp:557
@ accel_none
Usually the slowest mode, uses only OpenMP multi-threading, but optimized for memory and could be the...
Definition: tsgEnumerates.hpp:553
@ accel_gpu_magma
Same the CUDA option but uses the UTK MAGMA library for the linear algebra operations.
Definition: tsgEnumerates.hpp:563
@ accel_gpu_cublas
Mixed usage of the CPU (OpenMP) and GPU libraries.
Definition: tsgEnumerates.hpp:559
@ accel_gpu_cuda
Similar to the cuBLAS option but also uses a set of Tasmanian custom GPU kernels.
Definition: tsgEnumerates.hpp:561
@ type_abeforeb
Indicates that the first multi-index in the call to compare comes before the second.
Definition: tsgEnumerates.hpp:115
@ type_asameb
Indicates that the two multi-indexes are the same.
Definition: tsgEnumerates.hpp:119
@ type_bbeforea
Indicates that the second multi-index in the call to compare after the second.
Definition: tsgEnumerates.hpp:117
@ type_curved
Ignoring the polynomial space, use rules with index .
Definition: tsgEnumerates.hpp:213
@ type_iptensor
Make a dense tensor grid with interpolation range that includes .
Definition: tsgEnumerates.hpp:245
@ type_qptotal
Total degree polynomial space for quadrature/integration.
Definition: tsgEnumerates.hpp:224
@ type_qpcurved
Curved polynomial space for quadrature/integration.
Definition: tsgEnumerates.hpp:231
@ type_level
Ignoring the polynomial space, use rules with index .
Definition: tsgEnumerates.hpp:209
@ type_qphyperbolic
Hyperbolic cross section polynomial space for quadrature/integration.
Definition: tsgEnumerates.hpp:238
@ type_none
Null type, should never be used for input, indicates an error of some sort.
Definition: tsgEnumerates.hpp:205
@ type_iptotal
Total degree polynomial space for interpolation, i.e., the span of .
Definition: tsgEnumerates.hpp:221
@ type_qptensor
Make a dense tensor grid with quadrature/integration range that includes .
Definition: tsgEnumerates.hpp:249
@ type_hyperbolic
Ignoring the polynomial space, use rules with index .
Definition: tsgEnumerates.hpp:217
@ type_iphyperbolic
Hyperbolic cross section polynomial space for interpolation, i.e., the span of .
Definition: tsgEnumerates.hpp:235
@ type_tensor
Make a dense tensor grid with rules indexed by .
Definition: tsgEnumerates.hpp:241
@ type_ipcurved
Curved polynomial space for interpolation, i.e., the span of .
Definition: tsgEnumerates.hpp:228
@ refine_parents_first
Isotropic refinement adding children only if the parents are already included.
Definition: tsgEnumerates.hpp:429
@ refine_classic
Isotropic refinement using only the children and disregarding missing parents.
Definition: tsgEnumerates.hpp:427
@ refine_direction_selective
Anisotropic refinement using only the children and disregarding missing parents.
Definition: tsgEnumerates.hpp:431
@ refine_fds
Anisotropic refinement adding children only if the parents are already included.
Definition: tsgEnumerates.hpp:433
@ refine_none
Null method, should never be used as input.
Definition: tsgEnumerates.hpp:437
@ refine_stable
Isotropic refinement that ensures the points maintain lower-complete structures.
Definition: tsgEnumerates.hpp:435
Encapsulates the Tasmanian Sparse Grid module.
Definition: TasmanianSparseGrid.hpp:68
int int_gpu_lapack
Defines the integer used by the LAPACK methods, usually int but DPC++ uses int64_t.
Definition: tsgEnumerates.hpp:97
Miscellaneous utility templates used thoughout the code.