SG++-Doxygen-Documentation
Loading...
Searching...
No Matches
sgpp::combigrid::HeterogeneousBasis Class Reference

Potentially hetereogeneous basis on full grids, i.e., a dim-dimensional vector of 1D bases of type sgpp::base::Basis. More...

#include <HeterogeneousBasis.hpp>

Public Member Functions

double eval (const LevelVector &level, const IndexVector &index, const base::DataVector &point) const
 Evaluate basis function of given level and index at given point as the tensor product of the 1D bases.
 
const std::vector< base::Basis< level_t, index_t > * > & getBases1d () const
 
size_t getDimension () const
 
 HeterogeneousBasis ()
 Default constructor, corresponds to the zero-dimensional case.
 
 HeterogeneousBasis (const std::vector< base::Basis< level_t, index_t > * > &bases1d, bool isHierarchical=true)
 Constructor.
 
 HeterogeneousBasis (const std::vector< std::unique_ptr< base::Basis< level_t, index_t > > > &bases1d, bool isHierarchical=true)
 Constructor.
 
 HeterogeneousBasis (size_t dim, base::Basis< level_t, index_t > &basis1d, bool isHierarchical=true)
 Constructor for the case in which the same basis should be used for all dimensions.
 
bool isHierarchical () const
 
bool operator!= (const HeterogeneousBasis &other) const
 Inequality operator.
 
bool operator== (const HeterogeneousBasis &other) const
 Equality operator.
 
void setBases1D (const std::vector< base::Basis< level_t, index_t > * > &bases1d)
 
void setIsHierarchical (bool isHierarchical)
 

Static Public Member Functions

static void hierarchizeLevelIndex (level_t &level, index_t &index)
 Hierarchize level/index pair.
 
static void hierarchizeLevelIndex (LevelVector &level, IndexVector &index)
 Hierarchize pair of level/index multi-indices.
 
static void hierarchizeLevelIndex (std::vector< LevelVector > &levels, std::vector< IndexVector > &indices)
 Hierarchize vector of level/index multi-indices.
 

Protected Attributes

std::vector< base::Basis< level_t, index_t > * > bases1d
 vector of pointers to 1D bases (do not delete before this object)
 
bool isHierarchical_
 whether the basis is hierarchical or nodal
 

Detailed Description

Potentially hetereogeneous basis on full grids, i.e., a dim-dimensional vector of 1D bases of type sgpp::base::Basis.

In every dimension, a different basis may be used (or the same basis may be used for all dimensions).

Constructor & Destructor Documentation

◆ HeterogeneousBasis() [1/4]

sgpp::combigrid::HeterogeneousBasis::HeterogeneousBasis ( )
inline

Default constructor, corresponds to the zero-dimensional case.

◆ HeterogeneousBasis() [2/4]

sgpp::combigrid::HeterogeneousBasis::HeterogeneousBasis ( const std::vector< std::unique_ptr< base::Basis< level_t, index_t > > > &  bases1d,
bool  isHierarchical = true 
)
inlineexplicit

Constructor.

Parameters
bases1dvector of unique_ptr to 1D bases (do not destruct before this object)
isHierarchicalwhether the basis is hierarchical or nodal

References bases1d.

◆ HeterogeneousBasis() [3/4]

sgpp::combigrid::HeterogeneousBasis::HeterogeneousBasis ( const std::vector< base::Basis< level_t, index_t > * > &  bases1d,
bool  isHierarchical = true 
)
inlineexplicit

Constructor.

Parameters
bases1dvector of pointers to 1D bases (do not delete before this object)
isHierarchicalwhether the basis is hierarchical or nodal

◆ HeterogeneousBasis() [4/4]

sgpp::combigrid::HeterogeneousBasis::HeterogeneousBasis ( size_t  dim,
base::Basis< level_t, index_t > &  basis1d,
bool  isHierarchical = true 
)
inline

Constructor for the case in which the same basis should be used for all dimensions.

Parameters
dimdimensionality
basis1d1D basis (do not destruct before this object)
isHierarchicalwhether the basis is hierarchical or nodal

Member Function Documentation

◆ eval()

double sgpp::combigrid::HeterogeneousBasis::eval ( const LevelVector level,
const IndexVector index,
const base::DataVector point 
) const
inline

Evaluate basis function of given level and index at given point as the tensor product of the 1D bases.

If the basis is hierarchical, hierarchizeLevelIndex will be called before evaluating the 1D bases.

Parameters
levellevel of the basis function
indexindex of the basis function
pointpoint at which to evaluate the basis function
Returns
value of the basis function at the given point

References bases1d, hierarchizeLevelIndex(), isHierarchical_, and level.

Referenced by python.uq.analysis.asgc.ASGCAnalysis.ASGCAnalysis::estimateDensity(), sgpp::combigrid::OperationEvalFullGrid::eval(), and sgpp::combigrid::OperationEvalFullGrid::multiEval().

◆ getBases1d()

const std::vector< base::Basis< level_t, index_t > * > & sgpp::combigrid::HeterogeneousBasis::getBases1d ( ) const
inline

◆ getDimension()

size_t sgpp::combigrid::HeterogeneousBasis::getDimension ( ) const
inline
Returns
dimensionality

References bases1d.

◆ hierarchizeLevelIndex() [1/3]

static void sgpp::combigrid::HeterogeneousBasis::hierarchizeLevelIndex ( level_t &  level,
index_t &  index 
)
inlinestatic

Hierarchize level/index pair.

For every level \(\ell \ge 0\) and index \(i = 0, \dotsc, 2^\ell\), there is a unique level \(0 \le \tilde{\ell} \le \ell\) and index \(\tilde{i} = 0, \dotsc, 2^\tilde{\ell}\) such that

  • \(i 2^{-\ell} =: x_{l,i} = x_{\tilde{l},\tilde{i}} := \tilde{i} 2^{-\tilde{\ell}}\) and
  • \(\tilde{i}\) is odd or \(\tilde{l} = 0\).
Parameters
[in,out]level\(\ell\) before calling, \(\tilde{\ell}\) after calling
[in,out]index\(i\) before calling, \(\tilde{i}\) after calling

References level.

Referenced by sgpp::combigrid::CombinationGrid::combinePoints(), eval(), sgpp::combigrid::OperationPoleHierarchisationGeneral::HierarchisationGeneralSLE::getMatrixEntry(), hierarchizeLevelIndex(), and hierarchizeLevelIndex().

◆ hierarchizeLevelIndex() [2/3]

static void sgpp::combigrid::HeterogeneousBasis::hierarchizeLevelIndex ( LevelVector level,
IndexVector index 
)
inlinestatic

Hierarchize pair of level/index multi-indices.

Applies 1D version to each dimension.

Parameters
[in,out]level\(\vec{\ell}\) before calling, \(\tilde{\vec{\ell}}\) after calling
[in,out]index\(\vec{i}\) before calling, \(\vec{\tilde{i}}\) after calling

References hierarchizeLevelIndex(), and level.

◆ hierarchizeLevelIndex() [3/3]

static void sgpp::combigrid::HeterogeneousBasis::hierarchizeLevelIndex ( std::vector< LevelVector > &  levels,
std::vector< IndexVector > &  indices 
)
inlinestatic

Hierarchize vector of level/index multi-indices.

Applies multi-index version to every entry.

Parameters
[in,out]levelsvector of \(\vec{\ell}\) before calling, vector of \(\tilde{\vec{\ell}}\) after calling
[in,out]indicesvector of \(\vec{i}\) before calling, vector of \(\vec{\tilde{i}}\) after calling

References hierarchizeLevelIndex().

◆ isHierarchical()

bool sgpp::combigrid::HeterogeneousBasis::isHierarchical ( ) const
inline

◆ operator!=()

bool sgpp::combigrid::HeterogeneousBasis::operator!= ( const HeterogeneousBasis other) const
inline

Inequality operator.

Two HeterogeneousBasis instances are equal if they contain the same 1D basis pointers and if the values of isHierarchical are the same.

Parameters
otherother HeterogeneousBasis instance
Returns
whether both instances are inequal

◆ operator==()

bool sgpp::combigrid::HeterogeneousBasis::operator== ( const HeterogeneousBasis other) const
inline

Equality operator.

Two HeterogeneousBasis instances are equal if they contain the same 1D basis pointers and if the values of isHierarchical are the same.

Parameters
otherother HeterogeneousBasis instance
Returns
whether both instances are equal

References bases1d, and isHierarchical_.

◆ setBases1D()

void sgpp::combigrid::HeterogeneousBasis::setBases1D ( const std::vector< base::Basis< level_t, index_t > * > &  bases1d)
inline
Parameters
bases1dvector of pointers to 1D bases (do not delete before this object)

References bases1d.

◆ setIsHierarchical()

void sgpp::combigrid::HeterogeneousBasis::setIsHierarchical ( bool  isHierarchical)
inline
Parameters
isHierarchicalwhether the basis is hierarchical or nodal

References isHierarchical(), and isHierarchical_.

Member Data Documentation

◆ bases1d

std::vector<base::Basis<level_t, index_t>*> sgpp::combigrid::HeterogeneousBasis::bases1d
protected

vector of pointers to 1D bases (do not delete before this object)

Referenced by eval(), getBases1d(), getDimension(), HeterogeneousBasis(), operator==(), and setBases1D().

◆ isHierarchical_

bool sgpp::combigrid::HeterogeneousBasis::isHierarchical_
protected

whether the basis is hierarchical or nodal

Referenced by eval(), isHierarchical(), operator==(), and setIsHierarchical().


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