![]() |
SG++-Doxygen-Documentation
|
Class for representing a collection of full grids together with one scalar coefficient per full grid. More...
#include <CombinationGrid.hpp>
Public Member Functions | |
CombinationGrid () | |
Default constructor, leaves the list of full grids empty. | |
CombinationGrid (const FullGrid &fullGrid) | |
Constructor for a CombinationGrid consisting of only one FullGrid. | |
CombinationGrid (const std::vector< FullGrid > &fullGrids, const base::DataVector &coefficients) | |
Constructor. | |
void | combinePoints (base::GridStorage &gridStorage) const |
Combine the grid points of all full grids of this combination grid and store the grid points in an existing GridStorage. | |
void | combineSparseGridValues (const base::GridStorage &gridStorage, const std::vector< base::DataMatrix > &values, base::DataMatrix &result) const |
Combine vectors associated to every full grid point using a weighted sum (weighted by the coefficients of the combination grid), i.e., vector version of the other combineSparseGridValues method. | |
void | combineSparseGridValues (const base::GridStorage &gridStorage, const std::vector< base::DataVector > &values, base::DataVector &result) const |
Combine scalars associated to every full grid point using a weighted sum (weighted by the coefficients of the combination grid). | |
void | combineValues (const base::DataMatrix &values, base::DataVector &result) const |
Combine equally-sized vectors (one per full grid) using a weighted sum (weighted by the coefficients of the combination grid). | |
double | combineValues (const base::DataVector &values) const |
Combine scalars (one scalar per full grid) using a weighted sum (weighted by the coefficients of the combination grid). | |
void | distributeValuesToFullGrid (const base::GridStorage &gridStorage, const base::DataVector &values, const FullGrid &fullGrid, base::DataVector &result) const |
Distribute values given on the combined grid to a specific full grid (which should be contained in this combination grid). | |
void | distributeValuesToFullGrids (const base::GridStorage &gridStorage, const base::DataVector &values, std::vector< base::DataVector > &result) const |
Distribute values given on the combined grid to the full grids contained in this combination grid. | |
const base::DataVector & | getCoefficients () const |
size_t | getDimension () const |
const std::vector< FullGrid > & | getFullGrids () const |
void | setFullGridsAndCoefficients (const std::vector< FullGrid > &fullGrids, const base::DataVector &coefficients) |
Static Public Member Functions | |
static CombinationGrid | fromRegularSparse (size_t dim, level_t n, const HeterogeneousBasis &basis, bool hasBoundary=true) |
Factory method to create a CombinationGrid corresponding to the combination technique for a regular sparse grid. | |
static CombinationGrid | fromRegularSparseTruncated (size_t dim, LevelVector truncationLevel, level_t levelSumDistance, const HeterogeneousBasis &basis, bool hasBoundary=true) |
Factory method to create a CombinationGrid corresponding to the truncated combination technique for a regular sparse grid, given a truncation level. | |
static CombinationGrid | fromSubspaces (const std::vector< LevelVector > &subspaceLevels, const HeterogeneousBasis &basis, bool hasBoundary=true) |
Factory method to create a CombinationGrid corresponding to the combination technique for a (potentially dimensionally adaptive) sparse grid specified via its nodal subspaces/full grids. | |
Protected Attributes | |
base::DataVector | coefficients |
vector of coefficients, same size as fullGrids | |
std::vector< FullGrid > | fullGrids |
vector of full grids | |
Class for representing a collection of full grids together with one scalar coefficient per full grid.
sgpp::combigrid::CombinationGrid::CombinationGrid | ( | ) |
Default constructor, leaves the list of full grids empty.
Referenced by fromRegularSparseTruncated(), and fromSubspaces().
sgpp::combigrid::CombinationGrid::CombinationGrid | ( | const std::vector< FullGrid > & | fullGrids, |
const base::DataVector & | coefficients | ||
) |
Constructor.
fullGrids | vector of full grids |
coefficients | vector of coefficients, same size as fullGrids |
|
explicit |
Constructor for a CombinationGrid consisting of only one FullGrid.
fullGrid | the full grid |
void sgpp::combigrid::CombinationGrid::combinePoints | ( | base::GridStorage & | gridStorage | ) | const |
Combine the grid points of all full grids of this combination grid and store the grid points in an existing GridStorage.
[out] | gridStorage | GridStorage in which to save the grid points (will be cleared) |
References fullGrids, getDimension(), sgpp::combigrid::HeterogeneousBasis::hierarchizeLevelIndex(), and level.
void sgpp::combigrid::CombinationGrid::combineSparseGridValues | ( | const base::GridStorage & | gridStorage, |
const std::vector< base::DataMatrix > & | values, | ||
base::DataMatrix & | result | ||
) | const |
Combine vectors associated to every full grid point using a weighted sum (weighted by the coefficients of the combination grid), i.e., vector version of the other combineSparseGridValues
method.
[in] | gridStorage | GridStorage containing the combined grid |
[in] | values | vector of DataMatrix, each DataMatrix corresponds to a full grid and has the same number of columns as the number of grid points of the full grid (every column corresponds to one full grid point, the order of columns is given by IndexVectorRange) |
[out] | result | matrix resulting from the combination, columns have the same order as gridStorage (every column corresponds to one grid point of the combined grid) |
References coefficients, sgpp::combigrid::IndexVectorRange::find(), fullGrids, getDimension(), m, sgpp::base::DataMatrix::resize(), sgpp::base::DataMatrix::setAll(), and sgpp::combigrid::IndexVectorRange::setGrid().
void sgpp::combigrid::CombinationGrid::combineSparseGridValues | ( | const base::GridStorage & | gridStorage, |
const std::vector< base::DataVector > & | values, | ||
base::DataVector & | result | ||
) | const |
Combine scalars associated to every full grid point using a weighted sum (weighted by the coefficients of the combination grid).
Hierarchization is one example: In every full grid, there is a scalar (hierarchical surplus) associated with every grid point. This method combines these grid values to have one value for each point in the combined grid (usually a sparse grid).
[in] | gridStorage | GridStorage containing the combined grid |
[in] | values | vector of DataVector, each DataVector corresponds to a full grid and has the same size as the number of grid points of the full grid (the order of DataVector entries is given by IndexVectorRange) |
[out] | result | vector resulting from the combination, same order as gridStorage |
References coefficients, sgpp::combigrid::IndexVectorRange::find(), fullGrids, getDimension(), sgpp::base::DataVector::setAll(), and sgpp::combigrid::IndexVectorRange::setGrid().
void sgpp::combigrid::CombinationGrid::combineValues | ( | const base::DataMatrix & | values, |
base::DataVector & | result | ||
) | const |
Combine equally-sized vectors (one per full grid) using a weighted sum (weighted by the coefficients of the combination grid).
[in] | values | data matrix, same number of columns as the number of full grids (every column corresponds to one full grid, the order of rows is given by IndexVectorRange) |
[out] | result | vector resulting from the combination |
References coefficients, sgpp::base::DataMatrix::getNrows(), and sgpp::base::DataMatrix::mult().
double sgpp::combigrid::CombinationGrid::combineValues | ( | const base::DataVector & | values | ) | const |
Combine scalars (one scalar per full grid) using a weighted sum (weighted by the coefficients of the combination grid).
values | data vector, same size as the number of full grids |
References coefficients, and sgpp::base::DataVector::dotProduct().
Referenced by sgpp::combigrid::OperationEvalCombinationGrid::eval(), and sgpp::combigrid::OperationEvalCombinationGrid::multiEval().
void sgpp::combigrid::CombinationGrid::distributeValuesToFullGrid | ( | const base::GridStorage & | gridStorage, |
const base::DataVector & | values, | ||
const FullGrid & | fullGrid, | ||
base::DataVector & | result | ||
) | const |
Distribute values given on the combined grid to a specific full grid (which should be contained in this combination grid).
[in] | gridStorage | GridStorage containing the combined grid |
[in] | values | vector of values on the combined grid, same size as gridStorage |
[in] | fullGrid | full grid, should be contained in this combination grid |
[out] | result | vector of values on the full grid, same size as the number of grid points of the full grid (the order is given by IndexVectorRange) |
References sgpp::combigrid::IndexVectorRange::find(), sgpp::combigrid::FullGrid::findGridPointInFullGrid(), getDimension(), sgpp::combigrid::FullGrid::getNumberOfIndexVectors(), and sgpp::base::DataVector::setAll().
void sgpp::combigrid::CombinationGrid::distributeValuesToFullGrids | ( | const base::GridStorage & | gridStorage, |
const base::DataVector & | values, | ||
std::vector< base::DataVector > & | result | ||
) | const |
Distribute values given on the combined grid to the full grids contained in this combination grid.
[in] | gridStorage | GridStorage containing the combined grid |
[in] | values | vector of values on the combined grid, same size as gridStorage |
[out] | result | vector of vectors with values on the full grids, every vector corresponds to one full grid of the combination grid, every vector has the same size as the number of grid points of the respective full grid (the order of DataVector entries is given by IndexVectorRange) |
References sgpp::combigrid::IndexVectorRange::find(), fullGrids, getDimension(), and sgpp::combigrid::IndexVectorRange::setGrid().
|
static |
Factory method to create a CombinationGrid corresponding to the combination technique for a regular sparse grid.
dim | dimensionality |
n | sparse grid level |
basis | basis of the sparse grid (will be the same for all full grids; this can be changed) |
hasBoundary | whether the sparse grid has points on the boundary |
References fromRegularSparseTruncated().
|
static |
Factory method to create a CombinationGrid corresponding to the truncated combination technique for a regular sparse grid, given a truncation level.
dim | dimensionality |
truncationLevel | minimum level for each full component grid |
levelSumDistance | regular level in analogy to fromRegularSparse , the result is a regular sparse grid of level n with each level shifted by truncationLevel |
basis | basis of the sparse grid (will be the same for all full grids; this can be changed) |
hasBoundary | whether the sparse grid has points on the boundary |
References coefficients, CombinationGrid(), fullGrids, sgpp::combigrid::LevelVectorTools::generateDiagonalWithBoundary(), sgpp::combigrid::LevelVectorTools::generateDiagonalWithoutBoundary(), and level.
Referenced by fromRegularSparse().
|
static |
Factory method to create a CombinationGrid corresponding to the combination technique for a (potentially dimensionally adaptive) sparse grid specified via its nodal subspaces/full grids.
Note: You have to specify the levels of all nodal subspaces, i.e., the specified list of subspaces has to be downward closed.
subspaceLevels | vector of subspace levels |
basis | basis of the sparse grid (will be the same for all full grids; this can be changed) |
hasBoundary | whether the sparse grid has points on the boundary |
References coefficients, CombinationGrid(), fullGrids, and sgpp::combigrid::getStandardCoefficientsFromLevelSet().
Referenced by sgpp::combigrid::AdaptiveCombinationGridGenerator::getCombinationGrid().
const base::DataVector & sgpp::combigrid::CombinationGrid::getCoefficients | ( | ) | const |
fullGrids
References coefficients.
size_t sgpp::combigrid::CombinationGrid::getDimension | ( | ) | const |
References fullGrids.
Referenced by combinePoints(), combineSparseGridValues(), combineSparseGridValues(), distributeValuesToFullGrid(), and distributeValuesToFullGrids().
const std::vector< FullGrid > & sgpp::combigrid::CombinationGrid::getFullGrids | ( | ) | const |
References fullGrids.
Referenced by sgpp::combigrid::OperationUPCombinationGrid::apply(), sgpp::combigrid::OperationEvalCombinationGrid::eval(), sgpp::combigrid::AdaptiveCombinationGridGenerator::fromCombinationGrid(), sgpp::combigrid::AdaptiveCombinationGridGenerator::fromCombinationGrid(), and sgpp::combigrid::OperationEvalCombinationGrid::multiEval().
void sgpp::combigrid::CombinationGrid::setFullGridsAndCoefficients | ( | const std::vector< FullGrid > & | fullGrids, |
const base::DataVector & | coefficients | ||
) |
fullGrids | vector of full grids |
coefficients | vector of coefficients, same size as fullGrids |
References coefficients, and fullGrids.
|
protected |
vector of coefficients, same size as fullGrids
Referenced by combineSparseGridValues(), combineSparseGridValues(), combineValues(), combineValues(), fromRegularSparseTruncated(), fromSubspaces(), getCoefficients(), and setFullGridsAndCoefficients().
|
protected |
vector of full grids
Referenced by combinePoints(), combineSparseGridValues(), combineSparseGridValues(), distributeValuesToFullGrids(), fromRegularSparseTruncated(), fromSubspaces(), getDimension(), getFullGrids(), and setFullGridsAndCoefficients().