1 #ifndef MULTIINDEXSET_H_
2 #define MULTIINDEXSET_H_
18 class MultiIndexFactory;
21 std::shared_ptr<MultiIndexSet>
operator+=( std::shared_ptr<MultiIndexSet> x,
22 std::shared_ptr<MultiIndexSet> y);
24 std::shared_ptr<MultiIndexSet>
operator+=( std::shared_ptr<MultiIndexSet> x,
25 std::shared_ptr<MultiIndex> y);
72 std::shared_ptr<MultiIndexLimiter> limiterIn = std::make_shared<NoLimiter>());
75 static std::shared_ptr<MultiIndexSet>
CloneExisting(std::shared_ptr<MultiIndexSet>
const& original);
85 virtual void SetLimiter(std::shared_ptr<MultiIndexLimiter>
const& limiterIn);
116 virtual int MultiToIndex(std::shared_ptr<MultiIndex>
const& input)
const;
135 virtual std::shared_ptr<MultiIndex>
const&
at(
int activeIndex){
return IndexToMulti(activeIndex);}
187 virtual void Activate(std::shared_ptr<MultiIndex>
const& multiIndex);
200 virtual int AddActive(std::shared_ptr<MultiIndex>
const& newNode);
210 virtual std::vector<unsigned>
Expand(
unsigned int activeIndex);
220 virtual std::vector<unsigned>
ForciblyExpand(
unsigned int const activeIndex);
230 virtual std::vector<unsigned>
ForciblyActivate(std::shared_ptr<MultiIndex>
const& multiIndex);
242 virtual std::vector<unsigned int>
GetFrontier()
const;
256 virtual std::vector<unsigned int>
GetBackwardNeighbors(std::shared_ptr<MultiIndex>
const& multiIndex)
const;
263 virtual bool IsAdmissible(std::shared_ptr<MultiIndex>
const& multiIndex)
const;
266 virtual bool IsExpandable(
unsigned int activeIndex)
const;
269 virtual bool IsActive(std::shared_ptr<MultiIndex>
const& multiIndex)
const;
275 virtual unsigned int NumForward(
unsigned int activeInd)
const;
287 void ToHDF5(std::string filename, std::string dsetName=
"/multiindices")
const;
320 static std::shared_ptr<MultiIndexSet>
FromHDF5(std::string filename, std::string dsetName=
"/multiiindices");
332 int AddInactive(std::shared_ptr<MultiIndex>
const& newNode);
334 virtual bool IsAdmissible(
unsigned int globalIndex)
const;
335 virtual bool IsActive(
unsigned int globalIndex)
const;
366 int AddMulti(std::shared_ptr<MultiIndex>
const& newMulti);
368 std::map<std::shared_ptr<MultiIndex>,
unsigned int, MultiPtrComp>
multi2global;
A factory class with static methods for generating MultiIndexSets.
A class for holding, sorting, and adapting sets of multiindices.
std::vector< std::shared_ptr< MultiIndex > > allMultis
virtual bool IsActive(std::shared_ptr< MultiIndex > const &multiIndex) const
Return true if the multiIndex is active.
void ForciblyActivate(int localIndex, std::vector< unsigned int > &newInds)
virtual bool IsExpandable(unsigned int activeIndex) const
Return true if one of the forward neighbors of index is admissible but not active.
virtual MultiIndexSet & operator+=(const MultiIndexSet &rhs)
Add another set of multiindices to this one.
virtual std::vector< unsigned > Expand(unsigned int activeIndex)
virtual ~MultiIndexSet()=default
virtual unsigned int Size() const
std::shared_ptr< MultiIndexLimiter > limiter
static std::shared_ptr< MultiIndexSet > FromHDF5(std::string filename, std::string dsetName="/multiiindices")
Loads a multiindex set from an HDF5 file.
static std::shared_ptr< MultiIndexSet > CloneExisting(std::shared_ptr< MultiIndexSet > const &original)
NOTE: does not perform a deep copy of the multiindices themselves, only pointers to the multiindices.
virtual std::vector< std::shared_ptr< MultiIndex > > GetAllMultiIndices() const
virtual int Union(const MultiIndexSet &rhs)
Add all terms in rhs to this instance.
virtual unsigned int NumActiveForward(unsigned int activeInd) const
Returns the number of active forward neighbors.
virtual void SetLimiter(std::shared_ptr< MultiIndexLimiter > const &limiterIn)
virtual unsigned int NumForward(unsigned int activeInd) const
Returns the number of forward neighbors (active or inactive)
std::vector< std::set< int > > inEdges
virtual std::vector< unsigned int > GetStrictFrontier() const
virtual std::vector< unsigned int > GetFrontier() const
Eigen::VectorXi maxOrders
virtual Eigen::VectorXi GetMaxOrders() const
virtual unsigned int GetMultiLength() const
void AddBackwardNeighbors(unsigned int globalIndex, bool addInactive)
std::vector< std::set< int > > outEdges
std::map< std::shared_ptr< MultiIndex >, unsigned int, MultiPtrComp > multi2global
std::vector< int > global2active
virtual std::vector< unsigned > ForciblyActivate(std::shared_ptr< MultiIndex > const &multiIndex)
virtual int MultiToIndex(std::shared_ptr< MultiIndex > const &input) const
virtual void Activate(std::shared_ptr< MultiIndex > const &multiIndex)
void ToHDF5(std::string filename, std::string dsetName="/multiindices") const
Saves the multiindex set to a group in an HDF5 file.
int AddInactive(std::shared_ptr< MultiIndex > const &newNode)
int AddMulti(std::shared_ptr< MultiIndex > const &newMulti)
void AddForwardNeighbors(unsigned int globalIndex, bool addInactive)
virtual bool IsAdmissible(std::shared_ptr< MultiIndex > const &multiIndex) const
Determines whether the input multiIndex is currently admissible.
virtual std::shared_ptr< MultiIndex > const & at(int activeIndex)
virtual std::vector< unsigned > ForciblyExpand(unsigned int const activeIndex)
virtual int AddActive(std::shared_ptr< MultiIndex > const &newNode)
virtual std::shared_ptr< MultiIndex > operator[](int activeIndex)
virtual std::shared_ptr< MultiIndex > const & IndexToMulti(unsigned activeIndex) const
virtual std::vector< std::shared_ptr< MultiIndex > > GetAdmissibleForwardNeighbors(unsigned int activeIndex)
virtual std::vector< unsigned int > GetBackwardNeighbors(unsigned int activeIndex) const
std::vector< unsigned > active2global
virtual std::shared_ptr< MultiIndexLimiter > GetLimiter() const
std::shared_ptr< MultiIndexSet > operator+=(std::shared_ptr< MultiIndexSet > x, std::shared_ptr< MultiIndexSet > y)