SG++-Doxygen-Documentation
Loading...
Searching...
No Matches
sgpp::datadriven::DBMatOfflinePermutable Class Referenceabstract

#include <DBMatOfflinePermutable.hpp>

Inheritance diagram for sgpp::datadriven::DBMatOfflinePermutable:
sgpp::datadriven::DBMatOffline sgpp::datadriven::DBMatOfflineOrthoAdapt

Public Member Functions

 DBMatOfflinePermutable (const std::string &fileName)
 
virtual void permuteDecomposition (const sgpp::base::GeneralGridConfiguration &baseGridConfig, const sgpp::base::GeneralGridConfiguration &desiredGridConfig)=0
 Applies the permutation and blow-up approach to the decomposition to match the desired grid configuration.
 
void permuteLhsMatrix (const sgpp::base::GeneralGridConfiguration &baseGridConfig, const sgpp::base::GeneralGridConfiguration &desiredGridConfig)
 Applies permutation and blow-up approach to undecomposed left-hand side matrix.
 
- Public Member Functions inherited from sgpp::datadriven::DBMatOffline
virtual void buildMatrix (Grid *grid, const RegularizationConfiguration &regularizationConfig)
 Builds the right hand side matrix with or without the regularization term depending on the type of decomposition.
 
virtual DBMatOfflineclone () const =0
 Interface for the clone idiom.
 
virtual void compute_inverse ()
 
virtual void compute_inverse_parallel (std::shared_ptr< BlacsProcessGrid > processGrid, const ParallelConfiguration &parallelConfig)
 parallel/distributed version of compute_inverse()
 
void compute_L2_refine_vectors (DataMatrix *mat_refine, Grid *grid, size_t newPoints)
 computes vectors of L2 products of grid points for refinement
 
 DBMatOffline (const DBMatOffline &rhs)
 Copy Constructor.
 
 DBMatOffline (const std::string &fileName)
 Constructor Create offline object from serialized offline object.
 
 DBMatOffline (DBMatOffline &&rhs)=default
 Default move constructor.
 
virtual void decomposeMatrix (const RegularizationConfiguration &regularizationConfig, const DensityEstimationConfiguration &densityEstimationConfig)=0
 Decomposes the matrix according to the chosen decomposition type.
 
virtual void decomposeMatrixParallel (RegularizationConfiguration &regularizationConfig, DensityEstimationConfiguration &densityEstimationConfig, std::shared_ptr< BlacsProcessGrid > processGrid, const ParallelConfiguration &parallelConfig)
 The parallel/distributed version of decomposeMatrix(...)
 
DataMatrixDistributedgetDecomposedInverseDistributed ()
 Get a reference to the distributed decomposed matrix, analogously to getDecomposedMatrixDistributed()
 
DataMatrixgetDecomposedMatrix ()
 Get a reference to the decomposed matrix.
 
DataMatrixDistributedgetDecomposedMatrixDistributed ()
 Get a reference to the distributed decomposed matrix.
 
virtual sgpp::datadriven::MatrixDecompositionType getDecompositionType ()=0
 Returns the decomposition type of the DBMatOffline object.
 
virtual size_t getGridSize ()
 Returns the dimensionality of the quadratic lhs matrix (i.e.
 
DataMatrixgetInverseMatrix ()
 Get a reference to the inverse matrix.
 
DataMatrixgetLhsMatrix_ONLY_FOR_TESTING ()
 Allows access to lhs matrix, which is meant ONLY FOR TESTING.
 
virtual const DataMatrixgetUnmodifiedR ()=0
 Get the unmodified (without added lambda) system matrix R.
 
virtual const DataMatrixDistributedgetUnmodifiedRDistributed (std::shared_ptr< BlacsProcessGrid > processGrid, const ParallelConfiguration &parallelConfig)=0
 Get the distributed version of the unmodified (without added lambda) system matrix R.
 
virtual bool isRefineable ()=0
 Only Offline objects based on Cholesky decomposition, or orthogonal adaptivity can be refined.
 
DBMatOfflineoperator= (const DBMatOffline &rhs)
 Default copy assign operator.
 
DBMatOfflineoperator= (DBMatOffline &&rhs)=default
 Default move assign operator.
 
void printMatrix ()
 Prints the matrix onto standard output.
 
virtual void store (const std::string &fileName)
 Serialize the DBMatOffline Object.
 
virtual void syncDistributedDecomposition (std::shared_ptr< BlacsProcessGrid > processGrid, const ParallelConfiguration &parallelConfig)
 Synchronizes the decomposed matrix.
 
virtual void syncDistributedInverse (std::shared_ptr< BlacsProcessGrid > processGrid, const ParallelConfiguration &parallelConfig)
 Synchronizes the inverse matrix.
 
virtual void updateRegularization (double lambda)=0
 Modifies the decomposition to update the regularization parameter lambda.
 
virtual void updateRegularizationParallel (double lambda, std::shared_ptr< BlacsProcessGrid > processGrid, const ParallelConfiguration &parallelConfig)=0
 Modifies the parallel decomposition to update the regularization parameter lambda.
 
virtual ~DBMatOffline ()=default
 Default virtual destructor.
 

Static Public Attributes

static const std::set< MatrixDecompositionTypePermutableDecompositions
 Set that contains all permutable decomposition types.
 

Protected Member Functions

std::vector< size_t > applyPermutation (std::vector< size_t > vector, std::vector< size_t > permutation)
 Applies a permutation stored in an array to a vector.
 
std::vector< size_t > computePermutation (std::vector< size_t > baseLevel, std::vector< size_t > desiredLevel)
 Computes a permutation to transfer the desired level vector into the base level vector.
 
 DBMatOfflinePermutable ()
 
void dimensionBlowUp (const sgpp::base::GeneralGridConfiguration &baseGridConfig, const sgpp::base::GeneralGridConfiguration &desiredGridConfig, sgpp::base::DataMatrix &baseMatrix, bool matrixIsInverse=false)
 In place application of the blow-up method to a base system matrix.
 
size_t getMatrixIndexForPoint (std::vector< size_t > level, std::vector< size_t > index, std::vector< size_t > gridLevel, const std::vector< size_t > &preComputations)
 Implementation of the inverse numbering function.
 
void permuteMatrix (const sgpp::base::GeneralGridConfiguration &baseGridConfig, const sgpp::base::GeneralGridConfiguration &desiredGridConfig, const sgpp::base::DataMatrix &baseMatrix, sgpp::base::DataMatrix &permutedMatrix, bool permuteRowsOrColumns)
 Permutes a given sytem matrix with corresponding grid config baseGridConfig to the system matrix corresponding to desiredGridConfig.
 
std::vector< size_t > preComputeMatrixIndexForPoint (std::vector< size_t > level)
 Precomputation of the factors for the mapping from level and index vectors to matrix.
 
- Protected Member Functions inherited from sgpp::datadriven::DBMatOffline
 DBMatOffline ()
 
void parseInter (const std::string &fileName, std::set< std::set< size_t > > &interactions) const
 Read the Interactionsterms from a serialized DBMatOfflibe object.
 

Additional Inherited Members

- Public Attributes inherited from sgpp::datadriven::DBMatOffline
std::set< std::set< size_t > > interactions
 
- Protected Attributes inherited from sgpp::datadriven::DBMatOffline
bool isConstructed
 
bool isDecomposed
 
DataMatrixDistributed lhsDistributed
 
DataMatrixDistributed lhsDistributedInverse
 
DataMatrix lhsInverse
 
DataMatrix lhsMatrix
 

Constructor & Destructor Documentation

◆ DBMatOfflinePermutable() [1/2]

sgpp::datadriven::DBMatOfflinePermutable::DBMatOfflinePermutable ( const std::string &  fileName)
explicit

◆ DBMatOfflinePermutable() [2/2]

sgpp::datadriven::DBMatOfflinePermutable::DBMatOfflinePermutable ( )
protected

Member Function Documentation

◆ applyPermutation()

std::vector< size_t > sgpp::datadriven::DBMatOfflinePermutable::applyPermutation ( std::vector< size_t >  vector,
std::vector< size_t >  permutation 
)
inlineprotected

Applies a permutation stored in an array to a vector.

Parameters
vectorThe vector that is to be permuted.
permutationThe permutation stored in an array.
Returns
std::vector<size_t>

Referenced by permuteMatrix().

◆ computePermutation()

std::vector< size_t > sgpp::datadriven::DBMatOfflinePermutable::computePermutation ( std::vector< size_t >  baseLevel,
std::vector< size_t >  desiredLevel 
)
protected

Computes a permutation to transfer the desired level vector into the base level vector.

Parameters
baseLevelLevel vector of the base object's grid.
desiredLevelLevel vector of the desired object's grid.
Returns
std::vector<size_t>

Referenced by permuteMatrix().

◆ dimensionBlowUp()

void sgpp::datadriven::DBMatOfflinePermutable::dimensionBlowUp ( const sgpp::base::GeneralGridConfiguration baseGridConfig,
const sgpp::base::GeneralGridConfiguration desiredGridConfig,
sgpp::base::DataMatrix baseMatrix,
bool  matrixIsInverse = false 
)
protected

In place application of the blow-up method to a base system matrix.

It can be specified wheter the base matrix is inverse or not. For inverse matrices, the inverse blow-up factor is multiplied.

Parameters
baseGridConfigGrid configuration of the base object
desiredGridConfigGrid configuration of the desired object
baseMatrixBase system matrix
matrixIsInverseFlag to specify whether the base matrix is inverse. Set to true if the matrix is inverse. Set to false by default.

References sgpp::base::GeneralGridConfiguration::dim_, sgpp::base::Linear, sgpp::base::DataMatrix::mult(), and sgpp::base::GeneralGridConfiguration::type_.

Referenced by sgpp::datadriven::DBMatOfflineOrthoAdapt::permuteDecomposition(), and permuteLhsMatrix().

◆ getMatrixIndexForPoint()

size_t sgpp::datadriven::DBMatOfflinePermutable::getMatrixIndexForPoint ( std::vector< size_t >  level,
std::vector< size_t >  index,
std::vector< size_t >  gridLevel,
const std::vector< size_t > &  preComputations 
)
protected

Implementation of the inverse numbering function.

Maps a point given by its level and index vector to it's corresponding matrix index in the system matrix corresponding to the grid with level vector gridLevel.

Parameters
levelLevel vector of the point
indexIndex vector of the point
gridLevelLevel vector of the grid
preComputationsPrecomputed factors
Returns
size_t

References level.

Referenced by permuteMatrix().

◆ permuteDecomposition()

virtual void sgpp::datadriven::DBMatOfflinePermutable::permuteDecomposition ( const sgpp::base::GeneralGridConfiguration baseGridConfig,
const sgpp::base::GeneralGridConfiguration desiredGridConfig 
)
pure virtual

Applies the permutation and blow-up approach to the decomposition to match the desired grid configuration.

Parameters
baseGridConfigGrid configuration of the current state of the offline object.
desiredGridConfigGrid configuration of the desired offline object.

Implemented in sgpp::datadriven::DBMatOfflineOrthoAdapt.

Referenced by sgpp::datadriven::DBMatPermutationFactory::getPermutedObject().

◆ permuteLhsMatrix()

void sgpp::datadriven::DBMatOfflinePermutable::permuteLhsMatrix ( const sgpp::base::GeneralGridConfiguration baseGridConfig,
const sgpp::base::GeneralGridConfiguration desiredGridConfig 
)

Applies permutation and blow-up approach to undecomposed left-hand side matrix.

Meant to be used for testing primarily.

Parameters
baseGridConfig
desiredGridConfig

References dimensionBlowUp(), sgpp::datadriven::DBMatOffline::lhsMatrix, and permuteMatrix().

◆ permuteMatrix()

void sgpp::datadriven::DBMatOfflinePermutable::permuteMatrix ( const sgpp::base::GeneralGridConfiguration baseGridConfig,
const sgpp::base::GeneralGridConfiguration desiredGridConfig,
const sgpp::base::DataMatrix baseMatrix,
sgpp::base::DataMatrix permutedMatrix,
bool  permuteRowsOrColumns 
)
protected

Permutes a given sytem matrix with corresponding grid config baseGridConfig to the system matrix corresponding to desiredGridConfig.

It can be specified whether rows or columns are permuted.

Parameters
baseGridConfigGrid configuration of the base object
desiredGridConfigGrid configuration of the desired object
baseMatrixBase system matrix
permutedMatrixMatrix to return the system matrix of the desired object
permuteRowsOrColumnsFlag to specify wheter rows or columns are permuted. For row permutation set to true, for columns permutation set to false.

References applyPermutation(), computePermutation(), sgpp::datadriven::PermutationUtil::deleteOnesFromLevelVec(), sgpp::base::DataMatrix::getColumn(), getMatrixIndexForPoint(), sgpp::base::DataMatrix::getNcols(), sgpp::base::DataMatrix::getNrows(), sgpp::base::DataMatrix::getRow(), level, sgpp::base::GeneralGridConfiguration::levelVector_, preComputeMatrixIndexForPoint(), sgpp::base::DataMatrix::setColumn(), and sgpp::base::DataMatrix::setRow().

Referenced by sgpp::datadriven::DBMatOfflineOrthoAdapt::permuteDecomposition(), and permuteLhsMatrix().

◆ preComputeMatrixIndexForPoint()

std::vector< size_t > sgpp::datadriven::DBMatOfflinePermutable::preComputeMatrixIndexForPoint ( std::vector< size_t >  level)
protected

Precomputation of the factors for the mapping from level and index vectors to matrix.

indices.

Parameters
levelLevel vector of the base grid.
Returns
std::vector<size_t>

References level.

Referenced by permuteMatrix().

Member Data Documentation

◆ PermutableDecompositions

const std::set< MatrixDecompositionType > sgpp::datadriven::DBMatOfflinePermutable::PermutableDecompositions
static
Initial value:

Set that contains all permutable decomposition types.

If the approach is implemented for a new decomposition, it has to be added to this set. The set is used to check whether the permutaion and blow-up approach is applicable for a configured decomposition type.

Referenced by sgpp::datadriven::ModelFittingDensityEstimationOnOff::fit(), and sgpp::datadriven::ModelFittingDensityEstimationCombi::ModelFittingDensityEstimationCombi().


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