Doxygen 1.9.8
Toolkit for Adaptive Stochastic Modeling and Non-Intrusive ApproximatioN: Tasmanian v8.2
 
Loading...
Searching...
No Matches
tsgIndexManipulator.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 __TSG_INDEX_MANIPULATOR_HPP
32#define __TSG_INDEX_MANIPULATOR_HPP
33
34#include "tsgIndexSets.hpp"
36
63namespace TasGrid{
64
70namespace MultiIndexManipulations{
71
79inline MultiIndexSet generateFullTensorSet(std::vector<int> const &num_entries){
80 size_t num_dimensions = num_entries.size();
81 int num_total = 1;
82 for(auto &l : num_entries) num_total *= l;
83 std::vector<int> indexes(Utils::size_mult(num_dimensions, num_total));
84 auto iter = indexes.rbegin();
85 for(int i=num_total-1; i>=0; i--){
86 int t = i;
87 auto l = num_entries.rbegin();
88 // in order to generate indexes in the correct order, the for loop must go backwards
89 for(size_t j = 0; j<num_dimensions; j++){
90 *iter++ = (t % *l);
91 t /= *l++;
92 }
93 }
94 return MultiIndexSet(num_dimensions, std::move(indexes));
95}
96
103inline MultiIndexSet generateLowerMultiIndexSet(size_t num_dimensions, std::function<bool(const std::vector<int> &index)> inside){
104 size_t c = num_dimensions -1;
105 bool is_in = true;
106 std::vector<int> root(num_dimensions, 0);
107 std::vector<int> indexes;
108 while(is_in || (c > 0)){
109 if (is_in){
110 indexes.insert(indexes.end(), root.begin(), root.end());
111 c = num_dimensions-1;
112 root[c]++;
113 }else{
114 std::fill(root.begin() + c, root.end(), 0);
115 root[--c]++;
116 }
117 is_in = inside(root);
118 }
119 return MultiIndexSet(num_dimensions, std::move(indexes));
120}
121
129
141 ProperWeights(size_t num_dimensions, TypeDepth type, std::vector<int> const &weights){
142 contour = OneDimensionalMeta::getControurType(type);
143 if (weights.empty()) linear = std::vector<int>(num_dimensions, 1);
144 if (contour == type_level){ // linear weights only
145 if (!weights.empty()){
146 linear = weights; // simplest type
147 }
148 }else if (contour == type_curved){
149 if (weights.empty()){
150 curved = std::vector<double>(num_dimensions, 0.0); // cannot define default log-correction
151 }else{
152 linear = std::vector<int>(weights.begin(), weights.begin() + num_dimensions);
153 curved = std::vector<double>(num_dimensions);
154 std::transform(weights.begin() + num_dimensions, weights.end(), curved.begin(), [&](int i)->double{ return (double) i; });
155 }
156 }else{ // hyperbolic
157 if (weights.empty()){
158 curved = std::vector<double>(num_dimensions, 1.0);
159 }else{
160 linear = std::vector<int>(num_dimensions, 1); // used only for offset normalization
161 double exponent_normalization = (double) *std::min_element(weights.begin(), weights.end());
162 curved = std::vector<double>(num_dimensions);
163 std::transform(weights.begin(), weights.end(), curved.begin(),
164 [&](int i)->double{ return ((double) i) / exponent_normalization; });
165 }
166 }
167 }
169 bool provenLower() const{
170 if (contour == type_curved)
171 for(size_t i=0; i<linear.size(); i++)
172 if ((double)linear[i] + curved[i] < 0) return false;
173 return true;
174 }
176 int minLinear() const{ return *std::min_element(linear.begin(), linear.end()); }
178 size_t getNumDimensions() const{ return linear.size(); }
179
183 std::vector<int> linear;
185 std::vector<double> curved;
186};
187
200template<typename CacheType, TypeDepth contour, bool isotropic>
201std::vector<std::vector<CacheType>> generateLevelWeightsCache(ProperWeights const &weights, std::function<int(int i)> rule_exactness, int offset){
202 size_t num_dimensions = weights.getNumDimensions();
203 std::vector<std::vector<CacheType>> cache(num_dimensions);
204 std::vector<int> exactness_cache;
205
206 // if we know the sized here, then assign, otherwise dynamically build later
207 if (isotropic){
208 for(auto &vec : cache) vec.reserve((size_t) offset);
209 exactness_cache.resize((size_t) offset);
210 exactness_cache[0] = 0;
211 for(int i=1; i<offset; i++)
212 exactness_cache[i] = 1 + rule_exactness(i - 1);
213 }else{
214 exactness_cache.push_back(0); // exactness always starts from 0
215 }
216
217 for(size_t j=0; j<num_dimensions; j++){
218 int wl = weights.linear[j]; // linear weights
219 double wc = (contour == type_level) ? 0.0 : weights.curved[j]; // curved weights
220
221 size_t i = 0; // keep track of the index
222 CacheType w = (CacheType) ((contour == type_hyperbolic) ? 1 : 0);
223 cache[j].push_back(w); // initial entry
224 do{ // accumulate the cache
225 i++;
226 if (!isotropic && (i >= exactness_cache.size()))
227 exactness_cache.push_back(1 + rule_exactness((int)(i - 1)));
228
229 int e = exactness_cache[i];
230
231 if (contour == type_level){
232 w = (CacheType)(wl * e);
233 }else if (contour == type_curved){
234 w = (CacheType)(wl * e) + (CacheType)(wc * std::log1p((CacheType)e));
235 }else{ // must be hyperbolic
236 w = (CacheType)(pow((CacheType) (1 + e), wc));
237 }
238
239 cache[j].push_back(w);
240 // isotropic mode works until offset, anisotropic mode works until weight reaches the offset
241 }while( (!isotropic && (std::ceil(w) <= (CacheType) offset)) || (isotropic && (i + 1 < (size_t) offset)) );
242 }
243
244 return cache;
245}
246
253template<typename CacheType, TypeDepth contour>
254inline CacheType getIndexWeight(int const index[], std::vector<std::vector<CacheType>> const &cache){
255 CacheType w = (contour == type_hyperbolic) ? 1 : 0;
256 for(size_t j=0; j<cache.size(); j++)
257 if (contour == type_hyperbolic)
258 w *= cache[j][index[j]];
259 else
260 w += cache[j][index[j]];
261 return w;
262}
263
273MultiIndexSet selectTensors(size_t num_dimensions, int offset, TypeDepth type, std::function<int(int i)> rule_exactness,
274 std::vector<int> const &anisotropic_weights, std::vector<int> const &level_limits);
275
283std::vector<int> computeLevels(MultiIndexSet const &mset);
284
292std::vector<int> getMaxIndexes(const MultiIndexSet &mset);
293
303
311MultiIndexSet selectFlaggedChildren(const MultiIndexSet &mset, const std::vector<bool> &flagged, const std::vector<int> &level_limits);
312
323MultiIndexSet generateNestedPoints(const MultiIndexSet &tensors, std::function<int(int)> getNumPoints);
324
334
347void resortIndexes(const MultiIndexSet &iset, std::vector<std::vector<int>> &map, std::vector<std::vector<int>> &lines1d);
348
357template<bool nested>
358std::vector<int> referencePoints(const int levels[], const OneDimensionalWrapper &wrapper, const MultiIndexSet &points){
359 size_t num_dimensions = (size_t) points.getNumDimensions();
360 std::vector<int> num_points(num_dimensions);
361 int num_total = 1; // this will be a subset of all points, no danger of overflow
362 for(size_t j=0; j<num_dimensions; j++) num_points[j] = wrapper.getNumPoints(levels[j]);
363 for(auto n : num_points) num_total *= n;
364
365 std::vector<int> refs(num_total);
366 std::vector<int> p(num_dimensions);
367
368 for(int i=0; i<num_total; i++){
369 int t = i;
370 auto n = num_points.rbegin();
371 for(int j=(int) num_dimensions-1; j>=0; j--){
372 p[j] = (nested) ? t % *n : wrapper.getPointIndex(levels[j], t % *n);
373 t /= *n++;
374 }
375 refs[i] = points.getSlot(p);
376 }
377 return refs;
378}
379
387std::vector<int> computeTensorWeights(MultiIndexSet const &mset);
388
396inline MultiIndexSet createActiveTensors(const MultiIndexSet &mset, const std::vector<int> &weights){
397 size_t num_dimensions = mset.getNumDimensions();
398 size_t nz_weights = 0;
399 for(auto w: weights) if (w != 0) nz_weights++;
400
401 std::vector<int> indexes(nz_weights * num_dimensions);
402 nz_weights = 0;
403 auto iter = indexes.begin();
404 auto iset = mset.begin();
405 for(auto w: weights){
406 if (w != 0){
407 std::copy_n(iset, num_dimensions, iter);
408 std::advance(iter, num_dimensions);
409 }
410 std::advance(iset, num_dimensions);
411 }
412
413 return MultiIndexSet(num_dimensions, std::move(indexes));
414}
415
420inline void computeActiveTensorsWeights(MultiIndexSet const &tensors, MultiIndexSet &active_tensors, std::vector<int> &active_w){
421 std::vector<int> tensors_w = MultiIndexManipulations::computeTensorWeights(tensors);
422 active_tensors = MultiIndexManipulations::createActiveTensors(tensors, tensors_w);
423
424 active_w = std::vector<int>();
425 active_w.reserve(active_tensors.getNumIndexes());
426 for(auto w : tensors_w) if (w != 0) active_w.push_back(w);
427}
428
436MultiIndexSet createPolynomialSpace(const MultiIndexSet &tensors, std::function<int(int)> exactness);
437
450inline bool isLowerComplete(std::vector<int> const &point, MultiIndexSet const &mset, std::vector<int> &scratch){
451 std::copy(point.begin(), point.end(), scratch.begin());
452 for(int &d : scratch){
453 if (d > 0){
454 d--;
455 if (mset.missing(scratch)) return false;
456 d++;
457 }
458 }
459 return true;
460}
461
469inline MultiIndexSet getLargestCompletion(MultiIndexSet const &current, MultiIndexSet const &candidates){
470 if (candidates.empty()) return MultiIndexSet();
471 auto num_dimensions = candidates.getNumDimensions();
472 MultiIndexSet result; // start with an empty set
473 if (current.empty()){
474 if (candidates.missing(std::vector<int>(num_dimensions, 0))){
475 return MultiIndexSet(); // current is empty, 0-th index is the only thing that can be added
476 }else{
477 result = MultiIndexSet(num_dimensions, std::vector<int>(num_dimensions, 0));
478 }
479 }
480
481 std::vector<int> kid(num_dimensions);
482 std::vector<int> scratch(num_dimensions);
483 bool loopon = true;
484 while(loopon){
485 Data2D<int> update(num_dimensions, 0);
486
487 MultiIndexSet total = current;
488 if (!result.empty()) total += result;
489 for(int i=0; i<total.getNumIndexes(); i++){
490 std::copy_n(total.getIndex(i), num_dimensions, kid.begin());
491 for(int &k : kid){
492 k++; // construct the kid in the new direction
493 if (!candidates.missing(kid) && result.missing(kid) && isLowerComplete(kid, total, scratch))
494 update.appendStrip(kid);
495 k--;
496 }
497 }
498
499 loopon = (update.getNumStrips() > 0);
500 if (loopon) result += update;
501 }
502 return result;
503}
504
505
514template<bool limited>
515MultiIndexSet addExclusiveChildren(const MultiIndexSet &tensors, const MultiIndexSet &exclude, const std::vector<int> level_limits){
516 int num_dimensions = (int) tensors.getNumDimensions();
517 Data2D<int> tens(num_dimensions, 0);
518 std::vector<int> scratch(num_dimensions);
519 for(int i=0; i<tensors.getNumIndexes(); i++){ // add the new tensors (so long as they are not included in the initial grid)
520 const int *t = tensors.getIndex(i);
521 std::vector<int> kid(t, t + num_dimensions);
522 auto ilimit = level_limits.begin();
523 for(auto &k : kid){
524 k++;
525 if (exclude.missing(kid) && tensors.missing(kid)){ // if the kid is not to be excluded and if not included in the current set
526 if (isLowerComplete(kid, tensors, scratch)){
527 if (limited){
528 if ((*ilimit == -1) || (k <= *ilimit))
529 tens.appendStrip(kid);
530 ilimit++;
531 }else{
532 tens.appendStrip(kid);
533 }
534 }
535 }
536 k--;
537 }
538 }
539
540 return MultiIndexSet(tens);
541}
542
568template<class IndexList, class RuleLike, class OutputIteratorLike>
569OutputIteratorLike indexesToNodes(IndexList const &list, RuleLike const &rule, OutputIteratorLike nodes){
570 return std::transform(list.begin(), list.end(), nodes, [&](int i)->double{ return rule.getNode(i); });
571}
572
577template<class IteratorLike, class RuleLike, class OutputIteratorLike>
578OutputIteratorLike indexesToNodes(IteratorLike ibegin, size_t num_entries, RuleLike const &rule, OutputIteratorLike nodes){
579 return std::transform(ibegin, ibegin + num_entries, nodes, [&](int i)->double{ return rule.getNode(i); });
580}
581
586template<class IndexList, class RuleLike>
587std::vector<double> getIndexesToNodes(IndexList const &list, RuleLike const &rule){
588 std::vector<double> result(std::distance(list.begin(), list.end()));
589 indexesToNodes(list, rule, result.begin());
590 return result;
591}
592
597template<class IteratorLike, class RuleLike>
598std::vector<double> getIndexesToNodes(IteratorLike ibegin, size_t num_entries, RuleLike const &rule){
599 std::vector<double> result(num_entries);
600 indexesToNodes(ibegin, num_entries, rule, result.begin());
601 return result;
602}
603
612std::vector<int> inferAnisotropicWeights(AccelerationContext const *acceleration, TypeOneDRule rule, TypeDepth depth,
613 MultiIndexSet const &points, std::vector<double> const &coefficients, double tol);
614
615}
616
617}
618
619#endif
Generic 2D data structure divided into contiguous strips of fixed length (similar to a matrix).
Definition tsgIndexSets.hpp:104
void appendStrip(typename std::vector< T >::const_iterator const &x)
Uses std::vector::insert to append the data.
Definition tsgIndexSets.hpp:179
int getNumStrips() const
Returns the number of strips.
Definition tsgIndexSets.hpp:149
Class that stores multi-indexes in sorted (lexicographical) order.
Definition tsgIndexSets.hpp:234
size_t getNumDimensions() const
Returns the number of dimensions.
Definition tsgIndexSets.hpp:263
int getSlot(const int *p) const
Returns the slot containing index p, returns -1 if not found.
bool missing(const std::vector< int > &p) const
Returns true if p is missing from the set, false otherwise.
Definition tsgIndexSets.hpp:291
std::vector< int >::const_iterator begin() const
Returns a const iterator to the beginning of the internal data.
Definition tsgIndexSets.hpp:277
int getNumIndexes() const
Returns the number of indexes.
Definition tsgIndexSets.hpp:265
bool empty() const
Returns true if there are no multi-indexes in the set, false otherwise.
Definition tsgIndexSets.hpp:260
const int * getIndex(int i) const
Returns the i-th index of the set, useful to loop over all indexes or to cross reference with values.
Definition tsgIndexSets.hpp:294
A class to cache one dimensional rules, nodes, weight, meta-data, etc.
Definition tsgOneDimensionalWrapper.hpp:53
int getPointIndex(int level, int j) const
Get the global index of point j on level (used only by non-nested rules).
Definition tsgOneDimensionalWrapper.hpp:281
int getNumPoints(int level) const
Get the number of points for the level, can only query loaded levels.
Definition tsgOneDimensionalWrapper.hpp:279
TypeOneDRule
Used to specify the one dimensional family of rules that induces the sparse grid.
Definition tsgEnumerates.hpp:285
TypeDepth
Used by Global Sequence and Fourier grids, indicates the selection criteria.
Definition tsgEnumerates.hpp:203
@ type_curved
Ignoring the polynomial space, use rules with index .
Definition tsgEnumerates.hpp:213
@ type_level
Ignoring the polynomial space, use rules with index .
Definition tsgEnumerates.hpp:209
@ type_hyperbolic
Ignoring the polynomial space, use rules with index .
Definition tsgEnumerates.hpp:217
MultiIndexSet generateFullTensorSet(std::vector< int > const &num_entries)
Create a full-tensor multi-index set with num_entries in each direction.
Definition tsgIndexManipulator.hpp:79
std::vector< int > computeTensorWeights(MultiIndexSet const &mset)
Computes the weights for the tensor linear combination, mset must be a lower complete set.
Definition tsgIndexManipulator.cpp:545
OutputIteratorLike indexesToNodes(IndexList const &list, RuleLike const &rule, OutputIteratorLike nodes)
Converts int-indexes to double-valued abscissas using the provided rule.
Definition tsgIndexManipulator.hpp:569
MultiIndexSet createActiveTensors(const MultiIndexSet &mset, const std::vector< int > &weights)
Creates a set containing only the entries of mset that have non-zero weights.
Definition tsgIndexManipulator.hpp:396
MultiIndexSet selectFlaggedChildren(const MultiIndexSet &mset, const std::vector< bool > &flagged, const std::vector< int > &level_limits)
Using the flagged map, create a set with the flagged children of mset but only if they obey the level...
Definition tsgIndexManipulator.cpp:336
void resortIndexes(const MultiIndexSet &iset, std::vector< std::vector< int > > &map, std::vector< std::vector< int > > &lines1d)
Creates a map with sorted indexes dimension by dimension.
Definition tsgIndexManipulator.cpp:489
MultiIndexSet getLargestCompletion(MultiIndexSet const &current, MultiIndexSet const &candidates)
Return the largest subset of candidates such that adding it to current will preserve lower completene...
Definition tsgIndexManipulator.hpp:469
MultiIndexSet generateLowerMultiIndexSet(size_t num_dimensions, std::function< bool(const std::vector< int > &index)> inside)
Generate the multi-index with entries satisfying the inside(), assumes that inside() defines a lower-...
Definition tsgIndexManipulator.hpp:103
MultiIndexSet addExclusiveChildren(const MultiIndexSet &tensors, const MultiIndexSet &exclude, const std::vector< int > level_limits)
For a set of tensors create an mset that contain the children of indexes in tensors that are missing ...
Definition tsgIndexManipulator.hpp:515
std::vector< int > inferAnisotropicWeights(AccelerationContext const *acceleration, TypeOneDRule rule, TypeDepth depth, MultiIndexSet const &points, std::vector< double > const &coefficients, double tol)
Overload that returns the result in a vector.
Definition tsgIndexManipulator.cpp:601
std::vector< int > getMaxIndexes(const MultiIndexSet &mset)
Returns a vector with the maximum index in each dimension.
Definition tsgIndexManipulator.cpp:293
std::vector< double > getIndexesToNodes(IndexList const &list, RuleLike const &rule)
Overload that returns the result in a vector.
Definition tsgIndexManipulator.hpp:587
std::vector< int > computeLevels(MultiIndexSet const &mset)
Returns a vector that is the sum of entries of each multi-index in the set.
Definition tsgIndexManipulator.cpp:280
void completeSetToLower(MultiIndexSet &set)
Expand the set with the minimum number of multi-indexes that will result in a lower complete set....
Definition tsgIndexManipulator.cpp:113
std::vector< int > referencePoints(const int levels[], const OneDimensionalWrapper &wrapper, const MultiIndexSet &points)
Find the indexes of all points associated with the tensor with levels within the global points set.
Definition tsgIndexManipulator.hpp:358
void computeActiveTensorsWeights(MultiIndexSet const &tensors, MultiIndexSet &active_tensors, std::vector< int > &active_w)
Uses the computeTensorWeights() and createActiveTensors() to extract the active tensors and the activ...
Definition tsgIndexManipulator.hpp:420
MultiIndexSet generateNonNestedPoints(const MultiIndexSet &tensors, const OneDimensionalWrapper &wrapper)
Converts a set of non-nested active tensors to the actual points, the wrapper gives mapping between l...
Definition tsgIndexManipulator.cpp:457
MultiIndexSet createPolynomialSpace(const MultiIndexSet &tensors, std::function< int(int)> exactness)
For a set of tensors compute the corresponding polynomial space assuming the 1D rules have given exac...
Definition tsgIndexManipulator.cpp:584
MultiIndexSet generateNestedPoints(const MultiIndexSet &tensors, std::function< int(int)> getNumPoints)
Converts a set of nested tensors to the actual points, where each level has getNumPoints() in each di...
Definition tsgIndexManipulator.cpp:416
bool isLowerComplete(std::vector< int > const &point, MultiIndexSet const &mset, std::vector< int > &scratch)
Assuming that mset is lower complete, return true if adding the point will preserve completeness.
Definition tsgIndexManipulator.hpp:450
Data2D< int > computeDAGup(MultiIndexSet const &mset)
Returns a Data2D structure where each strip holds the slot-index of the parents of indexes in mset (f...
Definition tsgIndexManipulator.cpp:317
size_t size_mult(IntA a, IntB b)
Converts two integer-like variables to size_t and returns the product..
Definition tsgUtils.hpp:82
CacheType getIndexWeight(int const index[], std::vector< std::vector< CacheType > > const &cache)
Returns the weight for the multi-index using the cache, assuming level contour.
Definition tsgIndexManipulator.hpp:254
std::vector< std::vector< CacheType > > generateLevelWeightsCache(ProperWeights const &weights, std::function< int(int i)> rule_exactness, int offset)
Generate weights cache for the given parameters.
Definition tsgIndexManipulator.hpp:201
MultiIndexSet selectTensors(size_t num_dimensions, int offset, TypeDepth type, std::function< int(int i)> rule_exactness, std::vector< int > const &anisotropic_weights, std::vector< int > const &level_limits)
Generate a lower complete multi-index set that satisfies the given properties.
Definition tsgIndexManipulator.cpp:240
Encapsulates the Tasmanian Sparse Grid module.
Definition TasmanianSparseGrid.hpp:68
Wrapper class around GPU device ID, acceleration type and GpuEngine.
Definition tsgAcceleratedDataStructures.hpp:576
Holds anisotropic weights in a usable format.
Definition tsgIndexManipulator.hpp:139
std::vector< double > curved
The curved components of the weights type_curved contours; a scaled vector of exponents for type_hype...
Definition tsgIndexManipulator.hpp:185
bool provenLower() const
Return true if the combination of weights and contour is guaranteed to give a lower-complete set.
Definition tsgIndexManipulator.hpp:169
ProperWeights(size_t num_dimensions, TypeDepth type, std::vector< int > const &weights)
Interpret the single vector and form the proper weights, e.g., use defaults, scale hyperbolic weights...
Definition tsgIndexManipulator.hpp:141
TypeDepth contour
Always equal to type_level, type_curved or type_hyperbolic, indicates the general contour and how the...
Definition tsgIndexManipulator.hpp:181
size_t getNumDimensions() const
Return the number of dimensions.
Definition tsgIndexManipulator.hpp:178
std::vector< int > linear
The linear components of the weights for type_level and type_curved contours; a vector of ones for ty...
Definition tsgIndexManipulator.hpp:183
int minLinear() const
Return the smallest linear weight, used for normalization of the offset.
Definition tsgIndexManipulator.hpp:176
Data structures for storing multi-indexes and floating point values.
Cache for one dimensional rules.