Doxygen 1.9.1
Toolkit for Adaptive Stochastic Modeling and Non-Intrusive ApproximatioN: Tasmanian v8.2 (development)
tsgIndexManipulator.hpp File Reference

Algorithms for manipulating sets of multi-indexes. More...

Include dependency graph for tsgIndexManipulator.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  TasGrid::MultiIndexManipulations::ProperWeights
 Holds anisotropic weights in a usable format. More...
 

Namespaces

 TasGrid
 Encapsulates the Tasmanian Sparse Grid module.
 
 TasGrid::MultiIndexManipulations
 Collection of algorithm to manipulate multi-indexes.
 

Functions

MultiIndexSet TasGrid::MultiIndexManipulations::generateFullTensorSet (std::vector< int > const &num_entries)
 Create a full-tensor multi-index set with num_entries in each direction. More...
 
MultiIndexSet TasGrid::MultiIndexManipulations::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 TasGrid::MultiIndexManipulations::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 > > TasGrid::MultiIndexManipulations::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 TasGrid::MultiIndexManipulations::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 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. More...
 
std::vector< int > TasGrid::MultiIndexManipulations::computeLevels (MultiIndexSet const &mset)
 Returns a vector that is the sum of entries of each multi-index in the set. More...
 
std::vector< int > TasGrid::MultiIndexManipulations::getMaxIndexes (const MultiIndexSet &mset)
 Returns a vector with the maximum index in each dimension. More...
 
Data2D< int > TasGrid::MultiIndexManipulations::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 TasGrid::MultiIndexManipulations::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 TasGrid::MultiIndexManipulations::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 TasGrid::MultiIndexManipulations::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 TasGrid::MultiIndexManipulations::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 > TasGrid::MultiIndexManipulations::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 > TasGrid::MultiIndexManipulations::computeTensorWeights (MultiIndexSet const &mset)
 Computes the weights for the tensor linear combination, mset must be a lower complete set. More...
 
MultiIndexSet TasGrid::MultiIndexManipulations::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 TasGrid::MultiIndexManipulations::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 TasGrid::MultiIndexManipulations::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 TasGrid::MultiIndexManipulations::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 TasGrid::MultiIndexManipulations::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 TasGrid::MultiIndexManipulations::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 TasGrid::MultiIndexManipulations::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 TasGrid::MultiIndexManipulations::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 > TasGrid::MultiIndexManipulations::getIndexesToNodes (IndexList const &list, RuleLike const &rule)
 Overload that returns the result in a vector.
 
template<class IteratorLike , class RuleLike >
std::vector< double > TasGrid::MultiIndexManipulations::getIndexesToNodes (IteratorLike ibegin, size_t num_entries, RuleLike const &rule)
 Overload that returns the result in a vector.
 
std::vector< int > TasGrid::MultiIndexManipulations::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...
 

Detailed Description

Algorithms for manipulating sets of multi-indexes.

Author
Miroslav Stoyanov

A series of templates, lambda, and regular functions that allow the manipulation of multi-indexes and sets of multi-indexes.