MUQ  0.4.3
muq::Utilities::MultiIndexFactory Class Reference

A factory class with static methods for generating MultiIndexSets. More...

#include <MultiIndexFactory.h>

Detailed Description

A factory class with static methods for generating MultiIndexSets.

Functions in this class are static and used to create MultiIndex sets with different structure. If the default behavior of these methods is insufficient to create a multiindex for your application, a custom MultiIndexLimiter can be used to ``filter" the results of one of these methods. @seealso muq::Utilities::MultiIndexLimiter

Definition at line 18 of file MultiIndexFactory.h.

Static Public Member Functions

static std::shared_ptr< MultiIndexSetCreateTotalOrder (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. More...
 
static std::vector< std::shared_ptr< MultiIndexSet > > CreateTriTotalOrder (unsigned int const length, unsigned int const maxOrder, unsigned int const minOrder=0, std::shared_ptr< MultiIndexLimiter > limiter=std::make_shared< NoLimiter >())
 
static std::shared_ptr< MultiIndexSetCreateHyperbolic (unsigned int const length, unsigned int const maxOrder, const double q=0.5, std::shared_ptr< MultiIndexLimiter > limiter=std::make_shared< NoLimiter >())
 Construct a general hyperbolic MultiIndex. More...
 
static std::vector< std::shared_ptr< MultiIndexSet > > CreateTriHyperbolic (unsigned int const length, unsigned int const maxOrder, const double q=0.5, std::shared_ptr< MultiIndexLimiter > limiter=std::make_shared< NoLimiter >())
 
static std::shared_ptr< MultiIndexSetCreateFullTensor (unsigned int const length, unsigned int const order, std::shared_ptr< MultiIndexLimiter > limiter=std::make_shared< NoLimiter >())
 Construct a full tensor product multiindex set. More...
 
static std::shared_ptr< MultiIndexSetCreateFullTensor (const Eigen::RowVectorXi &orders, std::shared_ptr< MultiIndexLimiter > limiter=std::make_shared< NoLimiter >())
 Construct a full tensor product multiindex set with the potential for different orders in each dimension. More...
 
static std::shared_ptr< MultiIndexSetCreateAnisotropic (const Eigen::RowVectorXf &weights, const double epsilon)
 Construct an anisotropic multiindex set based on a priori information on the importance of each dimension. More...
 
static std::shared_ptr< MultiIndex > CreateSingleTerm (int totalDim, int nonzeroDim, int order)
 Creates a single multiindex with one nonzero term. More...
 

Member Function Documentation

◆ CreateAnisotropic()

std::shared_ptr< MultiIndexSet > muq::Utilities::MultiIndexFactory::CreateAnisotropic ( const Eigen::RowVectorXf &  weights,
const double  epsilon 
)
static

Construct an anisotropic multiindex set based on a priori information on the importance of each dimension.

Given a weight vector \( w = (w_i)_{i=1}^d \) with \( w_i \in [0,1] \) and a cutoff threshold \( \epsilon \in (0,1)\), the anisotropic multiindex set contains all d-dimensional multiindices \( \nu = (\nu_i)_{i=1}^d \) for which \( w^\nu := \prod_{i=1}^d w_i^{\nu_i} > \epsilon \). The algorithm is further described as Algorithm 2 in

  • Zech, Jakob. Sparse-grid approximation of high-dimensional parametric PDEs. ETH Zurich, 2018.
Parameters
weightsA vector of weights representing the importance of each dimension.
epsilonCutoff threshold \( \epsilon \in (0,1)\). Multiindices with \( w^\nu > \epsilon \) are excluded from the multiindex set.
Returns
A shared_ptr to an instance of MultiIndexSet

Definition at line 220 of file MultiIndexFactory.cpp.

◆ CreateFullTensor() [1/2]

std::shared_ptr< MultiIndexSet > muq::Utilities::MultiIndexFactory::CreateFullTensor ( const Eigen::RowVectorXi &  orders,
std::shared_ptr< MultiIndexLimiter limiter = std::make_shared<NoLimiter>() 
)
static

Construct a full tensor product multiindex set with the potential for different orders in each dimension.

Like the CreateFullTensor(int,int) function, the output of the this function is a tensor product multiindex set. However, this function allows each dimension of the multiindex to have a different maximum. For example, if [1,2] was passed as the input to this function, the returned multiindex set would include \([0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2] \).

Parameters
[in]ordersA row vector of nonnegative unsigned integers dictating the maximum order in each dimension. Note that the maximum order is inclusive.
Returns
A shared_ptr to a MultiIndexSet containing the tensor product set. Note that the MultiIndexSet does NOT use the same limiter passed to this function.

Definition at line 198 of file MultiIndexFactory.cpp.

◆ CreateFullTensor() [2/2]

std::shared_ptr< MultiIndexSet > muq::Utilities::MultiIndexFactory::CreateFullTensor ( unsigned int const  length,
unsigned int const  order,
std::shared_ptr< MultiIndexLimiter limiter = std::make_shared<NoLimiter>() 
)
static

Construct a full tensor product multiindex set.

The output of this function is a multiindex set containing a full tensor product of the one dimensional orders. For example, a two dimensional set with order 2 would include \( [0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2,1], [2,2]\). Notice that full tensor sets are significantly larger than total order limited sets. In this function, the upper bound on the order is the same for each dimension. For constructing tensor product sets with a different upper bound for each dimension,

See also
CreateFullTensor(const Eigen::RowVectorXi& orders).
Parameters
[in]lengthThe dimension of the multiindex
[in]orderThe upper bound on the order for all dimensions.
Returns
A shared_ptr to a MultiIndexSet containing the tensor product set. Note that the MultiIndexSet does NOT use the same limiter passed to this function.

Definition at line 190 of file MultiIndexFactory.cpp.

Referenced by muq::SamplingAlgorithms::ParallelMIMCMCBox::ParallelMIMCMCBox().

◆ CreateHyperbolic()

shared_ptr< MultiIndexSet > muq::Utilities::MultiIndexFactory::CreateHyperbolic ( unsigned int const  length,
unsigned int const  maxOrder,
const double  q = 0.5,
std::shared_ptr< MultiIndexLimiter limiter = std::make_shared<NoLimiter>() 
)
static

Construct a general hyperbolic MultiIndex.

Following Blatman and Sudret 2011, this function creates a hyperbolic index set. Define the \(q\)-norm of the multindex as

\[ \|\mathbf{j}\|_q = \left(\sum_{d=1}^Dj_d^q\right)^{1/q} \]

where \(D\) is the dimension of the multiindex and \(q\) is a positive scalar. This function creates a set such that \( \|\mathbf{j}\|_q \leq p_U\) for some nonnegative integer \(p_U\). When \(q=1\), we obtain a total order limited set and as \(q\rightarrow\infty\), we would obtain the full tensor set. Notice that in general \(q<1\) to ensure that the resulting set is smaller than the total order set.

Parameters
[in]lengthThe dimension of the multiindex \(\mathbf{j}\).
[in]maxOrderThe upper bound \(p_U\). Notice that this is also an upper bound on the maximum value in the multiindex.
[in]qA scalar defining the norm used. The default value is 0.5.
[in]limiterA shared_ptr to a child of the abstract MultiIndexLimiter class. This input can be used to further restrict what multiIndices are put in the set. However, the default limiter is a NoLimiter, which has no effect.

Definition at line 156 of file MultiIndexFactory.cpp.

References nlohmann::detail::dtoa_impl::e.

◆ CreateSingleTerm()

std::shared_ptr< MultiIndex > MultiIndexFactory::CreateSingleTerm ( int  totalDim,
int  nonzeroDim,
int  order 
)
static

Creates a single multiindex with one nonzero term.

Constructs a MultiIndex of length totalDim that contains a single nonzero element. Component nonzeroDim is set to value of order.

Parameters
[in]totalDimThe length of the MultiIndex (i.e., number of components)
[in]nonzeroDimThe index of the single nonzero component.
[in]orderThe value of the single nonzero component.
Returns
A MultiIndex of the form [0,...,0,order,0,...,0]

Definition at line 265 of file MultiIndexFactory.cpp.

◆ CreateTotalOrder()

shared_ptr< MultiIndexSet > muq::Utilities::MultiIndexFactory::CreateTotalOrder ( unsigned int const  length,
unsigned int const  maxOrder,
unsigned int const  minOrder = 0,
std::shared_ptr< MultiIndexLimiter limiter = std::make_shared<NoLimiter>() 
)
static

Construct a total order limited MultiIndex.

The total order of a multiindex \(\mbox{j}\) is given by the \(\ell_1\) norm \(\|\mathbf{j}\|_1\). This function creates the set of all MultiIndices such that \(p_L \leq \|\mathbf{j}\|_1 \leq p_U\) for two nonnegative integers \(p_L\) and \(p_U\). For example, in two dimensions, setting \(p_L=0\) and \(p_U=3\) would result in a set containing \( [0, 0], [0, 1], [0, 2], [0, 3], [1, 0], [1, 1], [1, 2], [2,0], [2,1], [3,0]\).

Parameters
[in]lengthThe dimension of the multiindex \(\mathbf{j}\).
[in]maxOrderThe upper bound on the total order \(p_U\).
[in]minOrderThe lower bound on the total order \(p_L\). The default value is 0.
[in]limiterA shared_ptr to a child of the abstract MultiIndexLimiter class. This input can be used to further restrict what multiIndices are put in the set. However, the default limiter is a NoLimiter, which has no effect.
Returns
A shared_ptr to a MultiIndexSet containing the total order limited set. Note that the MultiIndexSet does NOT use the same limiter passed to this function.

Definition at line 122 of file MultiIndexFactory.cpp.

◆ CreateTriHyperbolic()

std::vector< std::shared_ptr< MultiIndexSet > > muq::Utilities::MultiIndexFactory::CreateTriHyperbolic ( unsigned int const  length,
unsigned int const  maxOrder,
const double  q = 0.5,
std::shared_ptr< MultiIndexLimiter limiter = std::make_shared<NoLimiter>() 
)
static

Definition at line 176 of file MultiIndexFactory.cpp.

◆ CreateTriTotalOrder()

std::vector< std::shared_ptr< MultiIndexSet > > muq::Utilities::MultiIndexFactory::CreateTriTotalOrder ( unsigned int const  length,
unsigned int const  maxOrder,
unsigned int const  minOrder = 0,
std::shared_ptr< MultiIndexLimiter limiter = std::make_shared<NoLimiter>() 
)
static

Definition at line 142 of file MultiIndexFactory.cpp.

◆ RecursiveHyperbolicFill()

void muq::Utilities::MultiIndexFactory::RecursiveHyperbolicFill ( const double  maxOrderPow,
std::shared_ptr< MultiIndexSet output,
unsigned int const  currDim,
Eigen::RowVectorXi &  base,
const double  q,
std::shared_ptr< MultiIndexLimiter limiter 
)
staticprivate

Definition at line 36 of file MultiIndexFactory.cpp.

◆ RecursiveTensor()

void muq::Utilities::MultiIndexFactory::RecursiveTensor ( const Eigen::RowVectorXi &  orders,
std::shared_ptr< MultiIndexSet output,
unsigned int const  currDim,
Eigen::RowVectorXi &  base,
std::shared_ptr< MultiIndexLimiter limiter,
bool  allInactive 
)
staticprivate

Definition at line 76 of file MultiIndexFactory.cpp.

◆ RecursiveTotalOrderFill()

void muq::Utilities::MultiIndexFactory::RecursiveTotalOrderFill ( unsigned int const  maxOrder,
unsigned int const  minOrder,
std::shared_ptr< MultiIndexSet output,
unsigned int const  currDim,
Eigen::RowVectorXi &  base,
std::shared_ptr< MultiIndexLimiter limiter 
)
staticprivate

Definition at line 7 of file MultiIndexFactory.cpp.


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