![]() |
SG++-Doxygen-Documentation
|
Class for iterating over the indices contained in a FullGrid via ranged-based for
loops.
More...
#include <IndexVectorRange.hpp>
Public Member Functions | |
IndexVectorIterator | begin () const |
Returns the beginning of the range, i.e., the IndexVectorIterator that corresponds to the minimum index. | |
IndexVectorIterator | end () const |
Returns the end of the range, i.e., the IndexVectorIterator that corresponds to the maximum index. | |
size_t | find (const IndexVector &index) const |
Finds the given index in the range and returns it position. | |
void | getIndices (std::vector< IndexVector > &indices) const |
Converts this range to a vector of indices, which will contain all indices that are within this range. | |
IndexVectorRange () | |
Default constructor, corresponds to the zero-dimensional case. | |
IndexVectorRange (const FullGrid &grid) | |
Constructor for FullGrid instances. | |
IndexVectorRange (const IndexVector &minIndex, const IndexVector &maxIndex) | |
Constructor for custom-defined minimum and maximum indices. | |
void | setGrid (const FullGrid &grid) |
Sets minimum and maximum index of the range to that of the given FullGrid. | |
Static Public Member Functions | |
static void | getPoints (const FullGrid &grid, base::DataMatrix &points) |
Save all grid points of a FullGrid in a DataMatrix. | |
Protected Attributes | |
size_t | dim |
dimensionality | |
IndexVector | maxIndex |
vector of maximum 1D indices | |
IndexVector | minIndex |
vector of minimum 1D indices | |
IndexVector | numberOfIndexVectors |
number of indices in 1D for all dimensions | |
size_t | totalNumberOfIndexVectors |
total number of indices | |
Class for iterating over the indices contained in a FullGrid via ranged-based for
loops.
This is basically equivalent to NumPy's and MATLAB's meshgrid
function, as it loops over the Cartesian product of the sets of 1D indices.
The order is as follows: \((0, 0, 0, \dotsc, 0)\), \((1, 0, 0, \dotsc, 0)\), ..., \((n_1, 0, 0, \dotsc, 0)\), \((0, 1, 0, \dotsc, 0)\), ..., \((1, 1, 0, \dotsc, 0)\), ..., \((n_1, 1, 0, \dotsc, 0)\), ..., \((n_1, n_2, 0, \dotsc, 0)\), etc. (i.e., like enumerating indices of a matrix in column-major order).
|
inline |
Default constructor, corresponds to the zero-dimensional case.
|
inlineexplicit |
Constructor for FullGrid instances.
grid | full grid |
References grid(), setGrid(), and sgpp::combigrid::FullGrid::TwoToThePowerOfL.
|
inline |
Constructor for custom-defined minimum and maximum indices.
minIndex | vector of minimum 1D indices |
maxIndex | vector of maximum 1D indices |
References dim, maxIndex, minIndex, numberOfIndexVectors, and totalNumberOfIndexVectors.
|
inline |
Returns the beginning of the range, i.e., the IndexVectorIterator that corresponds to the minimum index.
References maxIndex, and minIndex.
Referenced by getIndices().
|
inline |
Returns the end of the range, i.e., the IndexVectorIterator that corresponds to the maximum index.
References maxIndex, minIndex, sgpp::combigrid::IndexVectorIterator::setSequenceNumber(), and totalNumberOfIndexVectors.
Referenced by getIndices().
|
inline |
Finds the given index in the range and returns it position.
Only returns reasonable values if the index is actually in the range.
index | index to find |
References dim, minIndex, and numberOfIndexVectors.
Referenced by sgpp::combigrid::OperationUPFullGrid::apply(), sgpp::combigrid::CombinationGrid::combineSparseGridValues(), sgpp::combigrid::CombinationGrid::combineSparseGridValues(), sgpp::combigrid::CombinationGrid::distributeValuesToFullGrid(), and sgpp::combigrid::CombinationGrid::distributeValuesToFullGrids().
|
inline |
|
inlinestatic |
Save all grid points of a FullGrid in a DataMatrix.
[in] | grid | full grid |
[out] | points | matrix containing the grid points row-by-row after calling |
References dim, grid(), level, sgpp::base::DataMatrix::resize(), totalNumberOfIndexVectors, and sgpp::combigrid::FullGrid::TwoToThePowerOfL.
Referenced by python.data.DataContainer.DataContainer::combine(), python.data.DataContainer.DataContainer::getDataSubsetByIndexList(), python.data.DataContainer.DataContainer::getPointsValues(), and python.data.DataContainer.DataContainer::toString().
|
inline |
Sets minimum and maximum index of the range to that of the given FullGrid.
grid | FullGrid to use |
References dim, grid(), maxIndex, minIndex, numberOfIndexVectors, and totalNumberOfIndexVectors.
Referenced by sgpp::combigrid::OperationUPFullGrid::apply(), sgpp::combigrid::CombinationGrid::combineSparseGridValues(), sgpp::combigrid::CombinationGrid::combineSparseGridValues(), sgpp::combigrid::CombinationGrid::distributeValuesToFullGrids(), IndexVectorRange(), and python.controller.CheckpointController.CheckpointController::setLearner().
|
protected |
dimensionality
Referenced by python.data.DataContainer.DataContainer::__init__(), python.uq.dists.EstimatedDist.EstimatedDist::_convertEvalPoint(), python.uq.dists.SGDEdist.SGDEdist::cdf(), python.uq.dists.KDEDist.KDEDist::cov(), python.uq.dists.SGDEdist.SGDEdist::cov(), find(), python.data.DataContainer.DataContainer::getDataSubsetByIndexList(), python.data.DataContainer.DataContainer::getDim(), python.uq.dists.EstimatedDist.EstimatedDist::getDim(), python.uq.dists.LibAGFDist.LibAGFDist::getDim(), python.uq.dists.NatafDist.NatafDist::getDim(), getPoints(), IndexVectorRange(), python.uq.dists.SGDEdist.SGDEdist::ppf(), python.uq.dists.EstimatedDist.EstimatedDist::rvs(), python.uq.dists.NatafDist.NatafDist::rvs(), python.uq.dists.KDEDist.KDEDist::rvs(), python.uq.dists.SGDEdist.SGDEdist::rvs(), setGrid(), python.uq.operations.natafTransformation.NatafTransformation::trans_X_to_Z(), and python.uq.operations.natafTransformation.NatafTransformation::trans_Z_to_X().
|
protected |
vector of maximum 1D indices
Referenced by begin(), end(), IndexVectorRange(), and setGrid().
|
protected |
vector of minimum 1D indices
Referenced by begin(), end(), find(), IndexVectorRange(), and setGrid().
|
protected |
number of indices in 1D for all dimensions
Referenced by find(), IndexVectorRange(), and setGrid().
|
protected |
total number of indices
Referenced by end(), getPoints(), IndexVectorRange(), and setGrid().