MUQ  0.4.3
muq::Utilities::MultiIndexSet Class Reference

A class for holding, sorting, and adapting sets of multiindices. More...

#include <MultiIndexSet.h>

Detailed Description

A class for holding, sorting, and adapting sets of multiindices.

In the context of polynomial expansions, a multiindex defines a single multivariate polynomial. A finite expansion of multivariate polynomials is then defined by a collection of multiindices, one for each term in the expansion. This class is a tool for defining such a multiindex set, relating members within the set (i.e. defining neighbors), and expanding the set.

Let \(\mbox{j}=[j_1,j_2,\dots,j_D]\) be a \(D\)-dimensional multiindex. The backwards neighbors of \(\mbox{j}\) are the multiindices given by multiindices who are only different from \(\mbox{j}\) in one component, and in that component, the difference is -1. For example, \([j_1-1, j_2,\dots,j_D]\) and \([j_1, j_2-1,\dots,j_D]\) are backwards neighbors of \(\mbox{j}\), but \([j_1-1, j_2-1,\dots,j_D]\) and \([j_1, j_2-2,\dots,j_D]\) are not. Forward neighbors are similarly defined, but with +1. Examples of forward neighbors include \([j_1+1, j_2,\dots,j_D]\) and \([j_1, j_2+1,\dots,j_D]\). As far as this class is concerned, multiindices can be in three different categories: active, inactive, and/or admissable. Active multiindices are those that are currently being used to define a polynomial expansion, inactive multiindices are not currently used but are being tracked, and admissable multiindices are inactive multiindices whose backward neighbors are all active.

This class keeps track of both active and admissable multiindices, but only active indices are included in the linear indexing. Nonactive indices are hidden (i.e. not even considered) in all the public members of this class. For example, the GetAllMultiIndices function will return all active multiindices, and the IndexToMulti function will return \(i^\mbox{th}\) active multiindex. Inactive multiindices are used to check admissability and are added to the active set during adaptation.

In general, members of the MultiIndexFactory class should be used to construct MultiIndexSets directly.

Definition at line 65 of file MultiIndexSet.h.

Public Member Functions

 MultiIndexSet (const unsigned dimIn, std::shared_ptr< MultiIndexLimiter > limiterIn=std::make_shared< NoLimiter >())
 
virtual ~MultiIndexSet ()=default
 
virtual void SetLimiter (std::shared_ptr< MultiIndexLimiter > const &limiterIn)
 
virtual std::shared_ptr< MultiIndexLimiterGetLimiter () const
 
virtual std::vector< std::shared_ptr< MultiIndex > > GetAllMultiIndices () const
 
virtual std::shared_ptr< MultiIndex > const & IndexToMulti (unsigned activeIndex) const
 
virtual int MultiToIndex (std::shared_ptr< MultiIndex > const &input) const
 
virtual unsigned int GetMultiLength () const
 
virtual Eigen::VectorXi GetMaxOrders () const
 
virtual std::shared_ptr< MultiIndex > const & at (int activeIndex)
 
virtual std::shared_ptr< MultiIndex > operator[] (int activeIndex)
 
virtual unsigned int Size () const
 
virtual MultiIndexSetoperator+= (const MultiIndexSet &rhs)
 Add another set of multiindices to this one. More...
 
virtual MultiIndexSetoperator+= (std::shared_ptr< MultiIndex > const &rhs)
 Add a single MultiIndex to the set. More...
 
virtual int Union (const MultiIndexSet &rhs)
 Add all terms in rhs to this instance. More...
 
virtual void Activate (std::shared_ptr< MultiIndex > const &multiIndex)
 
virtual int AddActive (std::shared_ptr< MultiIndex > const &newNode)
 
virtual std::vector< unsigned > Expand (unsigned int activeIndex)
 
virtual std::vector< unsigned > ForciblyExpand (unsigned int const activeIndex)
 
virtual std::vector< unsigned > ForciblyActivate (std::shared_ptr< MultiIndex > const &multiIndex)
 
virtual std::vector< std::shared_ptr< MultiIndex > > GetAdmissibleForwardNeighbors (unsigned int activeIndex)
 
virtual std::vector< unsigned int > GetFrontier () const
 
virtual std::vector< unsigned int > GetStrictFrontier () const
 
virtual std::vector< unsigned int > GetBackwardNeighbors (unsigned int activeIndex) const
 
virtual std::vector< unsigned int > GetBackwardNeighbors (std::shared_ptr< MultiIndex > const &multiIndex) const
 
virtual bool IsAdmissible (std::shared_ptr< MultiIndex > const &multiIndex) const
 Determines whether the input multiIndex is currently admissible. More...
 
virtual bool IsExpandable (unsigned int activeIndex) const
 Return true if one of the forward neighbors of index is admissible but not active. More...
 
virtual bool IsActive (std::shared_ptr< MultiIndex > const &multiIndex) const
 Return true if the multiIndex is active. More...
 
virtual unsigned int NumActiveForward (unsigned int activeInd) const
 Returns the number of active forward neighbors. More...
 
virtual unsigned int NumForward (unsigned int activeInd) const
 Returns the number of forward neighbors (active or inactive) More...
 
void ToHDF5 (std::string filename, std::string dsetName="/multiindices") const
 Saves the multiindex set to a group in an HDF5 file. More...
 
void ToHDF5 (muq::Utilities::H5Object &group, std::string dsetName="multiindices") const
 Saves the multiindex set to an HDF5 group object.
More...
 

Static Public Member Functions

static std::shared_ptr< MultiIndexSetCloneExisting (std::shared_ptr< MultiIndexSet > const &original)
 NOTE: does not perform a deep copy of the multiindices themselves, only pointers to the multiindices. More...
 
static std::shared_ptr< MultiIndexSetFromHDF5 (std::string filename, std::string dsetName="/multiiindices")
 Loads a multiindex set from an HDF5 file.
More...
 
static std::shared_ptr< MultiIndexSetFromHDF5 (muq::Utilities::H5Object &dset)
 Loads the multiindex from an existing HDF5 group.
More...
 

Friends

class MultiIndexFactory
 

Constructor & Destructor Documentation

◆ MultiIndexSet() [1/2]

MultiIndexSet::MultiIndexSet ( const unsigned  dimIn,
std::shared_ptr< MultiIndexLimiter limiterIn = std::make_shared<NoLimiter>() 
)

Definition at line 23 of file MultiIndexSet.cpp.

◆ ~MultiIndexSet()

virtual muq::Utilities::MultiIndexSet::~MultiIndexSet ( )
virtualdefault

Default virtual destructor

◆ MultiIndexSet() [2/2]

muq::Utilities::MultiIndexSet::MultiIndexSet ( )
privatedefault

Member Function Documentation

◆ Activate() [1/2]

void MultiIndexSet::Activate ( int  globalIndex)
protected

◆ Activate() [2/2]

void MultiIndexSet::Activate ( std::shared_ptr< MultiIndex > const &  multiIndex)
virtual

Make the multi-index active. Assumes that the multiIndex input is already admissible, as checked by an assertion. To be admissable (according to this function), the multiIndex must already exist as an inactive member of this set. If that is not the case, use the AddActive function instead.

Parameters
[in]multiIndexA multiindex to make active. Note that an assert will fail if multiIndex is not admissable.

Definition at line 239 of file MultiIndexSet.cpp.

References IsAdmissible(), and multi2global.

Referenced by AddActive(), and Expand().

◆ AddActive()

int MultiIndexSet::AddActive ( std::shared_ptr< MultiIndex > const &  newNode)
virtual

Add the given multiindex to the set and make it active. The functionality of this function is very similar to Activate; however, this function will add the multiIndex if it does not already exist in the set. This function does not check for admissability. Instead, it will add the multiindex to the set and add all neighbors as inactive. Be careful when using this function as it is possible to create a set with active multiindices that are not admisable.

Parameters
[in]newNodeA multiindex we want to add as an active member of the set.
Returns
An integer specifying the linear index of the now active multiindex.

Definition at line 118 of file MultiIndexSet.cpp.

References Activate(), AddInactive(), and global2active.

Referenced by operator+=(), and Union().

◆ AddBackwardNeighbors()

void MultiIndexSet::AddBackwardNeighbors ( unsigned int  globalIndex,
bool  addInactive 
)
protected

Definition at line 366 of file MultiIndexSet.cpp.

References AddInactive(), allMultis, inEdges, limiter, multi2global, and outEdges.

Referenced by Activate(), and AddMulti().

◆ AddForwardNeighbors()

void MultiIndexSet::AddForwardNeighbors ( unsigned int  globalIndex,
bool  addInactive 
)
protected

Definition at line 249 of file MultiIndexSet.cpp.

References AddInactive(), allMultis, inEdges, limiter, multi2global, and outEdges.

Referenced by Activate(), and AddMulti().

◆ AddInactive()

int MultiIndexSet::AddInactive ( std::shared_ptr< MultiIndex > const &  newNode)
protected

◆ AddMulti()

int MultiIndexSet::AddMulti ( std::shared_ptr< MultiIndex > const &  newMulti)
private

◆ at()

virtual std::shared_ptr<MultiIndex> const& muq::Utilities::MultiIndexSet::at ( int  activeIndex)
inlinevirtual

This function provides access to each of the MultiIndices.

Parameters
[in]activeIndexThe index of the active MultiIndex to return.
Returns
A pointer to the MultiIndex at index outputIndex.

Definition at line 135 of file MultiIndexSet.h.

References IndexToMulti().

◆ CloneExisting()

std::shared_ptr< MultiIndexSet > MultiIndexSet::CloneExisting ( std::shared_ptr< MultiIndexSet > const &  original)
static

NOTE: does not perform a deep copy of the multiindices themselves, only pointers to the multiindices.

Definition at line 57 of file MultiIndexSet.cpp.

◆ Expand()

std::vector< unsigned > MultiIndexSet::Expand ( unsigned int  activeIndex)
virtual

If possible, make the neighbors of this index active, and return any that become active. Do not activate a neighbor that is already part of the family.

Parameters
activeIndexThe linear index of the active multiindex to expand.
Returns
A vector containing the linear index of any multiindices activated because of the expansion.

Definition at line 394 of file MultiIndexSet.cpp.

References Activate(), active2global, global2active, IsActive(), IsAdmissible(), and outEdges.

◆ ForciblyActivate() [1/2]

void muq::Utilities::MultiIndexSet::ForciblyActivate ( int  localIndex,
std::vector< unsigned int > &  newInds 
)
protected

◆ ForciblyActivate() [2/2]

std::vector< unsigned > MultiIndexSet::ForciblyActivate ( std::shared_ptr< MultiIndex > const &  multiIndex)
virtual

Add the given multi-index to the active set regardless of whether it's currently admissible. To keep the whole set admissible, recursively add any backward neighbors necessary. Returns a list of indices of any newly added elements, including itself.

Parameters
multiIndexThe MultiIndex to forcibly add, make active, and make admissable.
Returns
A vector of linear indices indicating all the active MultiIndices added to the set in order to make the given multiIndex admissable.

Definition at line 453 of file MultiIndexSet.cpp.

References AddInactive(), limiter, and multi2global.

Referenced by ForciblyExpand().

◆ ForciblyExpand()

std::vector< unsigned > MultiIndexSet::ForciblyExpand ( unsigned int const  activeIndex)
virtual

Completely expands an index, whether or not it is currently expandable. In order to maintain admissability of the set, it will add backward neighbors needed recursively, and return a list of all the indices it adds.

Parameters
activeIndexThe linear index of the active multiindex to expand.
Returns
A vector containing the linear index of any multiindices activated because of the expansion.

Definition at line 419 of file MultiIndexSet.cpp.

References active2global, ForciblyActivate(), and outEdges.

◆ FromHDF5() [1/2]

std::shared_ptr< MultiIndexSet > MultiIndexSet::FromHDF5 ( muq::Utilities::H5Object dset)
static

Loads the multiindex from an existing HDF5 group.

This function will read the multiindices in an an HDF5 dataset and construct an instance of the MultiIndexSet class.

Parameters
[in]dsetAn HDF5 dataset containing an \(N\timesD\) matrix of non-negative integers defining the multiindices. Each row is a multiindex.
See also
ToHDF5

Definition at line 532 of file MultiIndexSet.cpp.

References muq::Utilities::H5Object::cols(), dim, muq::Utilities::H5Object::row(), and muq::Utilities::H5Object::rows().

◆ FromHDF5() [2/2]

std::shared_ptr< MultiIndexSet > MultiIndexSet::FromHDF5 ( std::string  filename,
std::string  dsetName = "/multiiindices" 
)
static

Loads a multiindex set from an HDF5 file.

This function works in tandem with the MultiIndexSet::ToHDF5 function. It will read the multiindices in the HDF5 file and return a pointer to a MultiIndexSet object containing those active multiindices. No limiter information is stored in the HDF5 file, so the limiter in the returned MultiIndexSet will be an instance of the NoLimiter class.

Parameters
[in]filenameA string to an HDF5 file. If the file doesn't exist, an exception will be thrown.
[in]dsetNameThe path to the dataset in the HDF5 file containing the multiindices.
Returns
std::shared_ptr<MultiIndexSet>

Definition at line 526 of file MultiIndexSet.cpp.

References muq::Utilities::OpenFile().

◆ GetAdmissibleForwardNeighbors()

std::vector< shared_ptr< MultiIndex > > MultiIndexSet::GetAdmissibleForwardNeighbors ( unsigned int  activeIndex)
virtual

This function returns the admissable forward neighbors of an active multiindex.

Parameters
[in]activeIndexThe linear index of the active multiIndex under consideration.
Returns
A vector of admissible forward neighbors.

Definition at line 276 of file MultiIndexSet.cpp.

References active2global, allMultis, IsAdmissible(), and outEdges.

◆ GetAllMultiIndices()

virtual std::vector<std::shared_ptr<MultiIndex> > muq::Utilities::MultiIndexSet::GetAllMultiIndices ( ) const
inlinevirtual

Get all the active multiindices in this set.

Returns
A vector with shared pointers to all the multi indices in the set.

Definition at line 97 of file MultiIndexSet.h.

References allMultis.

◆ GetBackwardNeighbors() [1/2]

std::vector< unsigned int > MultiIndexSet::GetBackwardNeighbors ( std::shared_ptr< MultiIndex > const &  multiIndex) const
virtual

Returns indices for backward neighbors of an active or inactive multiindex.

Definition at line 332 of file MultiIndexSet.cpp.

References global2active, inEdges, and multi2global.

◆ GetBackwardNeighbors() [2/2]

std::vector< unsigned int > MultiIndexSet::GetBackwardNeighbors ( unsigned int  activeIndex) const
virtual

Returns the indices for the backward neighbors of a currently active multiindex.

Parameters
[in]activeIndexThe linear index of the MultiIndex of interest
Returns
A std::vector containing the linear indices of the backward neighbors.

Definition at line 321 of file MultiIndexSet.cpp.

References active2global, global2active, and inEdges.

◆ GetFrontier()

std::vector< unsigned int > MultiIndexSet::GetFrontier ( ) const
virtual

Here, we define a term on the "frontier" of the multiindex set as one that has at least one inactive admissable forward neighbors. These terms are expandable.

Returns
A vector of active "frontier" indices.

Definition at line 290 of file MultiIndexSet.cpp.

References active2global, and IsExpandable().

◆ GetLimiter()

virtual std::shared_ptr<MultiIndexLimiter> muq::Utilities::MultiIndexSet::GetLimiter ( ) const
inlinevirtual

Returns the limiter used in this MultiIndexSet.

Definition at line 88 of file MultiIndexSet.h.

References limiter.

◆ GetMaxOrders()

virtual Eigen::VectorXi muq::Utilities::MultiIndexSet::GetMaxOrders ( ) const
inlinevirtual

Assume the \(\mathbf{j}^{\mbox{th}}\) multiindex in this set is given by \(\mathbf{j}=[j_1,j_2,\dots,j_D]\). This function returns a vector containing the maximum value of any multiindex in each direction, i.e., a vector \(\mathbf{m}=[m_1,m_2,\dots,m_D]\) where \(m_d = \max_{\mathbf{j}} j_d\).

Returns
The vector \(\mathbf{m}\).

Definition at line 128 of file MultiIndexSet.h.

References maxOrders.

◆ GetMultiLength()

virtual unsigned int muq::Utilities::MultiIndexSet::GetMultiLength ( ) const
inlinevirtual

Get the dimension of the multiindex, i.e. how many components does it have?

Definition at line 119 of file MultiIndexSet.h.

References dim.

Referenced by ToHDF5().

◆ GetStrictFrontier()

std::vector< unsigned int > MultiIndexSet::GetStrictFrontier ( ) const
virtual

We define the strict frontier to be the collection of multiindices, whose forward neighbors are all inactive.

Definition at line 302 of file MultiIndexSet.cpp.

References active2global, IsActive(), and outEdges.

◆ IndexToMulti()

virtual std::shared_ptr<MultiIndex> const& muq::Utilities::MultiIndexSet::IndexToMulti ( unsigned  activeIndex) const
inlinevirtual

Given an index into the set, return the corresponding multiindex as an instance of the MultiIndex set. If all the multiindices were stored in a vector called multiVec, the functionality of this method would be equivalent to multiVec[activeIndex].

Parameters
[in]activeIndexLinear index of interest.
Returns
A shared pointer to a constant instance of the MultiIndex class.

Definition at line 107 of file MultiIndexSet.h.

References active2global, and allMultis.

Referenced by at(), and ToHDF5().

◆ IsActive() [1/2]

bool MultiIndexSet::IsActive ( std::shared_ptr< MultiIndex > const &  multiIndex) const
virtual

Return true if the multiIndex is active.

Definition at line 152 of file MultiIndexSet.cpp.

References multi2global.

Referenced by Expand(), GetStrictFrontier(), IsAdmissible(), IsExpandable(), NumActiveForward(), and SetLimiter().

◆ IsActive() [2/2]

bool MultiIndexSet::IsActive ( unsigned int  globalIndex) const
protectedvirtual

Definition at line 163 of file MultiIndexSet.cpp.

References global2active.

◆ IsAdmissible() [1/2]

bool MultiIndexSet::IsAdmissible ( std::shared_ptr< MultiIndex > const &  multiIndex) const
virtual

Determines whether the input multiIndex is currently admissible.

Definition at line 192 of file MultiIndexSet.cpp.

References multi2global.

Referenced by Activate(), Expand(), GetAdmissibleForwardNeighbors(), and IsExpandable().

◆ IsAdmissible() [2/2]

bool MultiIndexSet::IsAdmissible ( unsigned int  globalIndex) const
protectedvirtual

Definition at line 168 of file MultiIndexSet.cpp.

References allMultis, inEdges, IsActive(), and limiter.

◆ IsExpandable()

bool MultiIndexSet::IsExpandable ( unsigned int  activeIndex) const
virtual

Return true if one of the forward neighbors of index is admissible but not active.

Definition at line 203 of file MultiIndexSet.cpp.

References active2global, IsActive(), IsAdmissible(), and outEdges.

Referenced by GetFrontier().

◆ MultiToIndex()

int MultiIndexSet::MultiToIndex ( std::shared_ptr< MultiIndex > const &  input) const
virtual

Given a multiindex, return the linear index where it is located.

Parameters
[in]inputA shared pointer to an instance of the MultiIndex class.
Returns
If the multiindex was found in this set, a nonnegative value containing the linear index is returned. However, if the set does not contain the multiindex, -1 is returned.

Definition at line 83 of file MultiIndexSet.cpp.

References global2active, and multi2global.

◆ NumActiveForward()

unsigned int MultiIndexSet::NumActiveForward ( unsigned int  activeInd) const
virtual

Returns the number of active forward neighbors.

Definition at line 347 of file MultiIndexSet.cpp.

References active2global, IsActive(), and outEdges.

◆ NumForward()

unsigned int MultiIndexSet::NumForward ( unsigned int  activeInd) const
virtual

Returns the number of forward neighbors (active or inactive)

Definition at line 360 of file MultiIndexSet.cpp.

References active2global, and outEdges.

◆ operator+=() [1/2]

MultiIndexSet & MultiIndexSet::operator+= ( const MultiIndexSet rhs)
virtual

Add another set of multiindices to this one.

Any basis functions in the rhs MultiIndexSet that are not equivalent to basis functions in this instance are added.

Parameters
[in]rhsAnother MultiIndex set to add to this one
Returns
A reference to this MultiIndex set, which now contains the union of this set and rhs.

Definition at line 472 of file MultiIndexSet.cpp.

References Union().

◆ operator+=() [2/2]

MultiIndexSet & MultiIndexSet::operator+= ( std::shared_ptr< MultiIndex > const &  rhs)
virtual

Add a single MultiIndex to the set.

This functions checks to see if the input basis function is already in the set and if the input function is unique, it is added to the set.

Parameters
[in]rhsA shared_ptr to the MultiIndex we want to add to the set.
Returns
A reference to this MultiIndex set, which may now contain the new MultiIndex in rhs.

Definition at line 497 of file MultiIndexSet.cpp.

References AddActive().

◆ operator[]()

virtual std::shared_ptr<MultiIndex> muq::Utilities::MultiIndexSet::operator[] ( int  activeIndex)
inlinevirtual

This function provides access to each of the MultiIndices without any bounds checking on the vector.

Parameters
[in]outputIndexThe index of the active MultiIndex we want to return.
Returns
A pointer to the MultiIndex at index outputIndex.

Definition at line 142 of file MultiIndexSet.h.

References active2global, and allMultis.

◆ SetLimiter()

void MultiIndexSet::SetLimiter ( std::shared_ptr< MultiIndexLimiter > const &  limiterIn)
virtual

Set the limiter of this MultiIndexSet. This function will check to make sure that all currently active nodes are still feasible with the new limiter. If this is not the case, an assert will be thrown.

Parameters
[in]limiterInA shared pointer to the new limiter.

Definition at line 30 of file MultiIndexSet.cpp.

References allMultis, inEdges, IsActive(), limiter, and outEdges.

◆ Size()

virtual unsigned int muq::Utilities::MultiIndexSet::Size ( ) const
inlinevirtual

Get the number of active MultiIndices in this set.

Returns
An unsigned integer with the number of active MultiIndices in the set.

Definition at line 148 of file MultiIndexSet.h.

References active2global.

Referenced by ToHDF5(), and Union().

◆ ToHDF5() [1/2]

void MultiIndexSet::ToHDF5 ( muq::Utilities::H5Object group,
std::string  dsetName = "multiindices" 
) const

Saves the multiindex set to an HDF5 group object.

This function will create (or replace) a dataset in an HDF5 file containing the active multiindices in this set. Note that all information about the multiindex limiter will be lost when saving. The dataset will be an \(N\times D\) matrix of integers, where \(N\) is the number of active multiindices in this set and \(D\) is the length of each multiindex.

Typical Usage:

std::shared_ptr<MultiIndexSet> mset = MultiIndexFactory::CreateTotalOrder(2,5);
// Save to HDF5
mset->ToHDF5(fout, "/SomeGroup/multis");
// Load from HDF5
std::shared_ptr<MultiIndexSet> mset2 = MultiIndexSet::FromHDF5(fout["/SomeGroup/multis"]);
static std::shared_ptr< MultiIndexSet > CreateTotalOrder(unsigned int const length, unsigned int const maxOrder, unsigned int const minOrder=0, std::shared_ptr< MultiIndexLimiter > limiter=std::make_shared< NoLimiter >())
Construct a total order limited MultiIndex.
static std::shared_ptr< MultiIndexSet > FromHDF5(std::string filename, std::string dsetName="/multiiindices")
Loads a multiindex set from an HDF5 file.
H5Object OpenFile(std::string const &filename)
Open an HDF5 file and return the root object.
Definition: H5Object.cpp:321
Parameters
[in]groupAn HDF5 object for the group where the dataset should be created.
[in]dsetNameA string containing the name of a new dataset to create inside the group.

Definition at line 511 of file MultiIndexSet.cpp.

References muq::Utilities::H5Object::CreateDataset(), dim, GetMultiLength(), IndexToMulti(), muq::Utilities::H5Object::row(), and Size().

◆ ToHDF5() [2/2]

void MultiIndexSet::ToHDF5 ( std::string  filename,
std::string  dsetName = "/multiindices" 
) const

Saves the multiindex set to a group in an HDF5 file.

This function will create (or replace) a dataset in an HDF5 file containing the active multiindices in this set. Note that all information about the multiindex limiter will be lost when saving. The dataset defaults to "/multiindices" and will contain an \(N\times D\) matrix of integers, where \(N\) is the number of active multiindices in this set and \(D\) is the length of each multiindex.

Parameters
[in]filenameA string to the HDF5 file that this multiindexset should be stored in. If the file doesn't exist, it will be created.
[in]dsetNameThe path to the dataset in the HDF5 file where the multiindices will be stored. If the datset already exists, it will be replaced. Defaults to "/multiindices".

Definition at line 504 of file MultiIndexSet.cpp.

References muq::Utilities::OpenFile().

◆ Union()

int MultiIndexSet::Union ( const MultiIndexSet rhs)
virtual

Add all terms in rhs to this instance.

This function adds all unique MultiIndices from the rhs into this MultiIndexSet. In the event that a multiindex is active in one set, but not the other, the union will set that multiindex to be active.

Parameters
[in]rhsThe MultiIndex set we want to add to this instance.
Returns
The number of unique terms from rhs that were added to this set.

Definition at line 478 of file MultiIndexSet.cpp.

References AddActive(), AddInactive(), allMultis, global2active, limiter, and Size().

Referenced by operator+=().

Friends And Related Function Documentation

◆ MultiIndexFactory

friend class MultiIndexFactory
friend

Definition at line 67 of file MultiIndexSet.h.

Member Data Documentation

◆ active2global

std::vector<unsigned> muq::Utilities::MultiIndexSet::active2global
protected

◆ allMultis

std::vector<std::shared_ptr<MultiIndex> > muq::Utilities::MultiIndexSet::allMultis
protected

◆ dim

unsigned int muq::Utilities::MultiIndexSet::dim
protected

Definition at line 356 of file MultiIndexSet.h.

Referenced by FromHDF5(), GetMultiLength(), and ToHDF5().

◆ global2active

std::vector<int> muq::Utilities::MultiIndexSet::global2active
protected

◆ inEdges

std::vector<std::set<int> > muq::Utilities::MultiIndexSet::inEdges
protected

◆ limiter

std::shared_ptr<MultiIndexLimiter> muq::Utilities::MultiIndexSet::limiter
protected

◆ maxOrders

Eigen::VectorXi muq::Utilities::MultiIndexSet::maxOrders
protected

Definition at line 353 of file MultiIndexSet.h.

Referenced by Activate(), and GetMaxOrders().

◆ multi2global

std::map<std::shared_ptr<MultiIndex>, unsigned int, MultiPtrComp> muq::Utilities::MultiIndexSet::multi2global
private

◆ outEdges

std::vector<std::set<int> > muq::Utilities::MultiIndexSet::outEdges
protected

The documentation for this class was generated from the following files: