Doxygen 1.9.1
Toolkit for Adaptive Stochastic Modeling and Non-Intrusive ApproximatioN: Tasmanian v8.2 (development)
TasGrid::MultiIndexManipulations Namespace Reference

Collection of algorithm to manipulate multi-indexes. More...

Classes

struct  ProperWeights
 Holds anisotropic weights in a usable format. More...
 

Functions

MultiIndexSet generateFullTensorSet (std::vector< int > const &num_entries)
 Create a full-tensor multi-index set with num_entries in each direction. More...
 
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-complete set. . More...
 
void completeSetToLower (MultiIndexSet &set)
 Expand the set with the minimum number of multi-indexes that will result in a lower complete set. . More...
 
template<typename CacheType , TypeDepth contour, bool isotropic>
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. More...
 
template<typename CacheType , TypeDepth contour>
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. More...
 
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. More...
 
std::vector< int > computeLevels (MultiIndexSet const &mset)
 Returns a vector that is the sum of entries of each multi-index in the set. More...
 
std::vector< int > getMaxIndexes (const MultiIndexSet &mset)
 Returns a vector with the maximum index in each dimension. More...
 
Data2D< int > computeDAGup (MultiIndexSet const &mset)
 Returns a Data2D structure where each strip holds the slot-index of the parents of indexes in mset (for each direction), using one-point-growth hierarchy. More...
 
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_limits. More...
 
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 direction. More...
 
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 level and point indexes. More...
 
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. More...
 
template<bool nested>
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. More...
 
std::vector< int > computeTensorWeights (MultiIndexSet const &mset)
 Computes the weights for the tensor linear combination, mset must be a lower complete set. More...
 
MultiIndexSet createActiveTensors (const MultiIndexSet &mset, const std::vector< int > &weights)
 Creates a set containing only the entries of mset that have non-zero weights. More...
 
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 active (non-zero) weights.
 
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 exactness(). More...
 
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. More...
 
MultiIndexSet getLargestCompletion (MultiIndexSet const &current, MultiIndexSet const &candidates)
 Return the largest subset of candidates such that adding it to current will preserve lower completeness. More...
 
template<bool limited>
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 from exclude and obey the level_limits. More...
 
template<class IndexList , class RuleLike , class OutputIteratorLike >
OutputIteratorLike indexesToNodes (IndexList const &list, RuleLike const &rule, OutputIteratorLike nodes)
 Converts int-indexes to double-valued abscissas using the provided rule. More...
 
template<class IteratorLike , class RuleLike , class OutputIteratorLike >
OutputIteratorLike indexesToNodes (IteratorLike ibegin, size_t num_entries, RuleLike const &rule, OutputIteratorLike nodes)
 Overload that uses a begin and a number of entries.
 
template<class IndexList , class RuleLike >
std::vector< double > getIndexesToNodes (IndexList const &list, RuleLike const &rule)
 Overload that returns the result in a vector.
 
template<class IteratorLike , class RuleLike >
std::vector< double > getIndexesToNodes (IteratorLike ibegin, size_t num_entries, RuleLike const &rule)
 Overload that returns the result in a vector.
 
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. More...
 
template<bool use_parents_direction>
void repeatAddIndexes (std::function< bool(const std::vector< int > &index)> inside, std::vector< MultiIndexSet > &level_sets)
 Generate a series of level_sets where each set has the parents/children of the previous one that satisfy the inside() criteria. More...
 
MultiIndexSet unionSets (std::vector< MultiIndexSet > &level_sets)
 Retuns the union of all level_sets, all sets are destroyed in the process. More...
 
MultiIndexSet generateGeneralMultiIndexSet (size_t num_dimensions, std::function< bool(const std::vector< int > &index)> criteria)
 Generate the minimum lower complete multi-index set that includes the indexes satisfying criteria(), assumes criteria() defines a connected set. More...
 
template<bool check_limits>
MultiIndexSet selectLowerSet (ProperWeights const &weights, std::function< int(int i)> rule_exactness, int normalized_offset, std::vector< int > const &level_limits)
 Generate the multi-index of indexes with weighs less than the normalized_offset. More...
 
template<bool check_limits>
MultiIndexSet selectGeneralSet (ProperWeights const &weights, std::function< int(int i)> rule_exactness, int normalized_offset, std::vector< int > const &level_limits)
 Generates the minimum lower complete set that contains all indexes with weights less than normalized_offset. More...
 

Detailed Description

Collection of algorithm to manipulate multi-indexes.

Function Documentation

◆ generateLevelWeightsCache()

template<typename CacheType , TypeDepth contour, bool isotropic>
std::vector<std::vector<CacheType> > TasGrid::MultiIndexManipulations::generateLevelWeightsCache ( ProperWeights const &  weights,
std::function< int(int i)>  rule_exactness,
int  offset 
)

Generate weights cache for the given parameters.

Complexity chosen here in favor of performance and re-usability.

  • isotropic indicates whether to treat the offset as a maximum cache size in each direction (true) of as a cut-off for the weights, i.e., cache until the 1-D weight exceeds the offset.
  • weights.contour must match contour
  • if contour is type_level, then CacheType must be int
  • if contour is type_curved or type_hyperbolic, then CacheType must be double

◆ getIndexWeight()

template<typename CacheType , TypeDepth contour>
CacheType TasGrid::MultiIndexManipulations::getIndexWeight ( int const  index[],
std::vector< std::vector< CacheType >> const &  cache 
)
inline

Returns the weight for the multi-index using the cache, assuming level contour.

◆ selectTensors()

MultiIndexSet TasGrid::MultiIndexManipulations::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.

Using the num_dimensions select all multi-indexes with weight less than the offset. If not empty, anisotropic_weights are used to form the weight and the offset is scaled by the minimum linear weight. Rule exactness is used in place of the raw-index to cover the correct polynomial space, see references in TypeDepth.

◆ selectLowerSet()

template<bool check_limits>
MultiIndexSet TasGrid::MultiIndexManipulations::selectLowerSet ( ProperWeights const &  weights,
std::function< int(int i)>  rule_exactness,
int  normalized_offset,
std::vector< int > const &  level_limits 
)

Generate the multi-index of indexes with weighs less than the normalized_offset.

The weight of an index uses the weights combined with the rule_exactness(). Called only when the set is guaranteed to be lower complete, then the one dimensional weights can be cached prior to running the selection algorithm.

If check_limits is false, then level_limits are ignored for speedup.