SG++-Doxygen-Documentation
Loading...
Searching...
No Matches
sgpp::datadriven::DBMatOfflineOrthoAdapt Class Reference

#include <DBMatOfflineOrthoAdapt.hpp>

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

Public Member Functions

void buildMatrix (Grid *grid, const RegularizationConfiguration &regularizationConfig) override
 Builds the left hand side matrix without the regularization term.
 
DBMatOfflineclone () const override
 Interface for the clone idiom.
 
void compute_inverse () override
 
void compute_inverse_parallel (std::shared_ptr< BlacsProcessGrid > processGrid, const ParallelConfiguration &parallelConfig) override
 parallel/distributed version of compute_inverse()
 
 DBMatOfflineOrthoAdapt ()
 Constructor Builds DBMatOfflineOrthoAdapt Object from configuration.
 
 DBMatOfflineOrthoAdapt (const std::string &fileName)
 Constructor Builds object from serialized offline object, stored in file.
 
void decomposeMatrix (const RegularizationConfiguration &regularizationConfig, const DensityEstimationConfiguration &densityEstimationConfig) override
 Decomposes and inverts the lhsMatrix of the offline object (lhs + lambda*I)^{-1} = Q * (T + lambda*I)^{-1} * Q^t = Q * T_inv * Q^t.
 
void decomposeMatrixParallel (RegularizationConfiguration &regularizationConfig, DensityEstimationConfiguration &densityEstimationConfig, std::shared_ptr< BlacsProcessGrid > processGrid, const ParallelConfiguration &parallelConfig) override
 The parallel/distributed version of decomposeMatrix(...)
 
sgpp::datadriven::MatrixDecompositionType getDecompositionType () override
 Returns the decomposition type of the DBMatOffline object.
 
sgpp::base::DataMatrixgetQ ()
 
DataMatrixDistributedgetQDistributed ()
 
sgpp::base::DataMatrixgetTinv ()
 
DataMatrixDistributedgetTinvDistributed ()
 
const DataMatrixgetUnmodifiedR () override
 Get the unmodified (without added lambda) system matrix R.
 
const DataMatrixDistributedgetUnmodifiedRDistributed (std::shared_ptr< BlacsProcessGrid > processGrid, const ParallelConfiguration &parallelConfig) override
 Get the unmodified (without added lambda) distributed system matrix R.
 
void hessenberg_decomposition (sgpp::base::DataVector &diag, sgpp::base::DataVector &subdiag)
 Decomposes the lhsMatrix into lhs = Q * T * Q^t and stores the orthogonal matrix Q into the member q_ortho_matrix_.
 
void invert_symmetric_tridiag (sgpp::base::DataVector &diag, sgpp::base::DataVector &subdiag)
 Inverts a symmetric tridiagonal matrix T, which is given in the form of its diagonal and subdiagonal vectors.
 
bool isRefineable () override
 Only Offline objects based on Cholesky decomposition, or orthogonal adaptivity can be refined.
 
void permuteDecomposition (const sgpp::base::GeneralGridConfiguration &baseGridConfig, const sgpp::base::GeneralGridConfiguration &desiredGridConfig) override
 First permutes the rows of the orthogonal matrix Q.
 
void store (const std::string &fileName) override
 Serializes the DBMatOfflineOrthoAdapt object.
 
void syncDistributedDecomposition (std::shared_ptr< BlacsProcessGrid > processGrid, const ParallelConfiguration &parallelConfig) override
 Override to sync Q and Tinv.
 
void updateRegularization (double lambda) override
 Modifies the decomposition to update the regularization parameter lambda.
 
void updateRegularizationParallel (double lambda, std::shared_ptr< BlacsProcessGrid > processGrid, const ParallelConfiguration &parallelConfig) override
 Modifies the parallel decomposition to update the regularization parameter lambda.
 
- Public Member Functions inherited from sgpp::datadriven::DBMatOfflinePermutable
 DBMatOfflinePermutable (const std::string &fileName)
 
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
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.
 
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 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.
 
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 syncDistributedInverse (std::shared_ptr< BlacsProcessGrid > processGrid, const ParallelConfiguration &parallelConfig)
 Synchronizes the inverse matrix.
 
virtual ~DBMatOffline ()=default
 Default virtual destructor.
 

Protected Attributes

bool lhsDistributedSynced = false
 
sgpp::base::DataMatrix q_ortho_matrix_
 
DataMatrixDistributed q_ortho_matrix_distributed_
 
sgpp::base::DataVector t_diag_
 
sgpp::base::DataVector t_subdiag_
 
sgpp::base::DataMatrix t_tridiag_inv_matrix_
 
DataMatrixDistributed t_tridiag_inv_matrix_distributed_
 
- Protected Attributes inherited from sgpp::datadriven::DBMatOffline
bool isConstructed
 
bool isDecomposed
 
DataMatrixDistributed lhsDistributed
 
DataMatrixDistributed lhsDistributedInverse
 
DataMatrix lhsInverse
 
DataMatrix lhsMatrix
 

Additional Inherited Members

- Public Attributes inherited from sgpp::datadriven::DBMatOffline
std::set< std::set< size_t > > interactions
 
- Static Public Attributes inherited from sgpp::datadriven::DBMatOfflinePermutable
static const std::set< MatrixDecompositionTypePermutableDecompositions
 Set that contains all permutable decomposition types.
 
- Protected Member Functions inherited from sgpp::datadriven::DBMatOfflinePermutable
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.
 

Constructor & Destructor Documentation

◆ DBMatOfflineOrthoAdapt() [1/2]

sgpp::datadriven::DBMatOfflineOrthoAdapt::DBMatOfflineOrthoAdapt ( )

Constructor Builds DBMatOfflineOrthoAdapt Object from configuration.

References q_ortho_matrix_, and t_tridiag_inv_matrix_.

◆ DBMatOfflineOrthoAdapt() [2/2]

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

Member Function Documentation

◆ buildMatrix()

void sgpp::datadriven::DBMatOfflineOrthoAdapt::buildMatrix ( Grid grid,
const RegularizationConfiguration regularizationConfig 
)
overridevirtual

Builds the left hand side matrix without the regularization term.

Parameters
gridthe underlying grid
regularizationConfigconfiguaration for the regularization employed

Reimplemented from sgpp::datadriven::DBMatOffline.

References sgpp::datadriven::DBMatOffline::buildMatrix(), grid(), q_ortho_matrix_, sgpp::base::DataMatrix::resizeQuadratic(), and t_tridiag_inv_matrix_.

◆ clone()

DBMatOffline * sgpp::datadriven::DBMatOfflineOrthoAdapt::clone ( ) const
overridevirtual

Interface for the clone idiom.

Returns
a copy of this very object as a pointer to a new DBMatOffline object which is owned by the caller.

Implements sgpp::datadriven::DBMatOffline.

◆ compute_inverse()

◆ compute_inverse_parallel()

◆ decomposeMatrix()

void sgpp::datadriven::DBMatOfflineOrthoAdapt::decomposeMatrix ( const RegularizationConfiguration regularizationConfig,
const DensityEstimationConfiguration densityEstimationConfig 
)
overridevirtual

Decomposes and inverts the lhsMatrix of the offline object (lhs + lambda*I)^{-1} = Q * (T + lambda*I)^{-1} * Q^t = Q * T_inv * Q^t.

The matrix lhsMatrix of the parent object will be altered during the process

Parameters
regularizationConfigthe regularization configuration
densityEstimationConfigthe density estimation configuration

Implements sgpp::datadriven::DBMatOffline.

References sgpp::base::DataVector::copyFrom(), sgpp::base::DataVector::get(), sgpp::base::DataMatrix::get(), sgpp::base::DataMatrix::getNrows(), sgpp::base::DataVector::getSize(), hessenberg_decomposition(), invert_symmetric_tridiag(), sgpp::datadriven::DBMatOffline::isConstructed, sgpp::datadriven::DBMatOffline::isDecomposed, sgpp::datadriven::RegularizationConfiguration::lambda_, sgpp::datadriven::DBMatOffline::lhsMatrix, q_ortho_matrix_, sgpp::base::DataVector::set(), sgpp::base::DataMatrix::set(), t_diag_, t_subdiag_, and t_tridiag_inv_matrix_.

◆ decomposeMatrixParallel()

void sgpp::datadriven::DBMatOfflineOrthoAdapt::decomposeMatrixParallel ( RegularizationConfiguration regularizationConfig,
DensityEstimationConfiguration densityEstimationConfig,
std::shared_ptr< BlacsProcessGrid processGrid,
const ParallelConfiguration parallelConfig 
)
overridevirtual

The parallel/distributed version of decomposeMatrix(...)

Parameters
regularizationConfigthe regularization configuration
densityEstimationConfigthe density estimation configuration
processGridprocess grid to distribute the matrix on
parallelConfig

Reimplemented from sgpp::datadriven::DBMatOffline.

References sgpp::datadriven::ParallelConfiguration::columnBlockSize_, sgpp::base::DataVector::copyFrom(), sgpp::datadriven::DataMatrixDistributed::fromSharedData(), sgpp::base::DataVector::get(), sgpp::base::DataMatrix::get(), sgpp::datadriven::DataMatrixDistributed::get(), sgpp::datadriven::DataMatrixDistributed::getColumnBlockSize(), sgpp::datadriven::DataMatrixDistributed::getDescriptor(), sgpp::datadriven::DataMatrixDistributed::getGlobalCols(), sgpp::datadriven::DataMatrixDistributed::getGlobalRows(), sgpp::datadriven::DataMatrixDistributed::getLocalPointer(), sgpp::base::DataMatrix::getNrows(), sgpp::base::DataMatrix::getPointer(), sgpp::base::DataVector::getPointer(), sgpp::datadriven::DataMatrixDistributed::getProcessGrid(), sgpp::datadriven::DataMatrixDistributed::getRowBlockSize(), sgpp::base::DataVector::getSize(), invert_symmetric_tridiag(), sgpp::datadriven::DBMatOffline::isConstructed, sgpp::datadriven::DBMatOffline::isDecomposed, sgpp::datadriven::RegularizationConfiguration::lambda_, sgpp::datadriven::DBMatOffline::lhsDistributed, lhsDistributedSynced, sgpp::datadriven::DBMatOffline::lhsMatrix, q_ortho_matrix_, q_ortho_matrix_distributed_, sgpp::datadriven::ParallelConfiguration::rowBlockSize_, sgpp::base::DataVector::set(), sgpp::base::DataMatrix::set(), sgpp::datadriven::DataMatrixDistributed::set(), sgpp::base::DataMatrix::setAll(), t_diag_, t_subdiag_, t_tridiag_inv_matrix_, t_tridiag_inv_matrix_distributed_, and sgpp::datadriven::DataMatrixDistributed::transpose().

◆ getDecompositionType()

sgpp::datadriven::MatrixDecompositionType sgpp::datadriven::DBMatOfflineOrthoAdapt::getDecompositionType ( )
overridevirtual

Returns the decomposition type of the DBMatOffline object.

Returns
the type of matrix decomposition

Implements sgpp::datadriven::DBMatOffline.

References sgpp::datadriven::OrthoAdapt.

◆ getQ()

◆ getQDistributed()

DataMatrixDistributed & sgpp::datadriven::DBMatOfflineOrthoAdapt::getQDistributed ( )
inline

◆ getTinv()

◆ getTinvDistributed()

DataMatrixDistributed & sgpp::datadriven::DBMatOfflineOrthoAdapt::getTinvDistributed ( )
inline

◆ getUnmodifiedR()

const DataMatrix & sgpp::datadriven::DBMatOfflineOrthoAdapt::getUnmodifiedR ( )
overridevirtual

Get the unmodified (without added lambda) system matrix R.

Returns
Matrix R

Implements sgpp::datadriven::DBMatOffline.

References sgpp::datadriven::DBMatOffline::lhsMatrix.

◆ getUnmodifiedRDistributed()

const DataMatrixDistributed & sgpp::datadriven::DBMatOfflineOrthoAdapt::getUnmodifiedRDistributed ( std::shared_ptr< BlacsProcessGrid processGrid,
const ParallelConfiguration parallelConfig 
)
overridevirtual

◆ hessenberg_decomposition()

void sgpp::datadriven::DBMatOfflineOrthoAdapt::hessenberg_decomposition ( sgpp::base::DataVector diag,
sgpp::base::DataVector subdiag 
)

Decomposes the lhsMatrix into lhs = Q * T * Q^t and stores the orthogonal matrix Q into the member q_ortho_matrix_.

The information to reconstruct T is written into diag and subdiag

Parameters
diagDiagonal entries of T
subdiagSub- and superdiagonal entries of T (symmetric)

References sgpp::base::DataMatrix::copyFrom(), sgpp::base::DataMatrix::getNcols(), sgpp::base::DataMatrix::getNrows(), sgpp::base::DataMatrix::getPointer(), sgpp::base::DataVector::getPointer(), sgpp::datadriven::DBMatOffline::lhsMatrix, and q_ortho_matrix_.

Referenced by decomposeMatrix().

◆ invert_symmetric_tridiag()

void sgpp::datadriven::DBMatOfflineOrthoAdapt::invert_symmetric_tridiag ( sgpp::base::DataVector diag,
sgpp::base::DataVector subdiag 
)

Inverts a symmetric tridiagonal matrix T, which is given in the form of its diagonal and subdiagonal vectors.

When finished, diag and subdiag no longer hold their initial values.

Parameters
diagDiagonal entries of T
subdiagSub- and superdiagonal entries of T (symmetric)

References sgpp::base::DataMatrix::getNcols(), sgpp::base::DataMatrix::getNrows(), sgpp::base::DataVector::getPointer(), sgpp::base::DataVector::getSize(), sgpp::datadriven::DBMatOffline::lhsMatrix, sgpp::base::DataMatrix::set(), and t_tridiag_inv_matrix_.

Referenced by decomposeMatrix(), decomposeMatrixParallel(), updateRegularization(), and updateRegularizationParallel().

◆ isRefineable()

bool sgpp::datadriven::DBMatOfflineOrthoAdapt::isRefineable ( )
overridevirtual

Only Offline objects based on Cholesky decomposition, or orthogonal adaptivity can be refined.

Returns
true if object can be refined, else false;

Implements sgpp::datadriven::DBMatOffline.

◆ permuteDecomposition()

void sgpp::datadriven::DBMatOfflineOrthoAdapt::permuteDecomposition ( const sgpp::base::GeneralGridConfiguration baseGridConfig,
const sgpp::base::GeneralGridConfiguration desiredGridConfig 
)
overridevirtual

First permutes the rows of the orthogonal matrix Q.

I.e. Q' T (Q')^T = (PQ) T (PQ)^T where P is the permutation matrix obtained from the permutation approach. In the second step, the dimension blow-up factor is multiplied to T^{-1}.

Parameters
baseGridConfigGrid configuration of the base object
desiredGridConfigGrid configuration of the desired object

Implements sgpp::datadriven::DBMatOfflinePermutable.

References sgpp::datadriven::PermutationUtil::deleteOnesFromLevelVec(), sgpp::datadriven::DBMatOfflinePermutable::dimensionBlowUp(), sgpp::base::DataMatrix::getNrows(), sgpp::base::GeneralGridConfiguration::levelVector_, sgpp::datadriven::DBMatOfflinePermutable::permuteMatrix(), q_ortho_matrix_, and t_tridiag_inv_matrix_.

◆ store()

void sgpp::datadriven::DBMatOfflineOrthoAdapt::store ( const std::string &  fileName)
overridevirtual

Serializes the DBMatOfflineOrthoAdapt object.

q_ortho_matrix_ and t_inv_tridiag_ are stored into the specified file, which is the explicit representation of the decomposition needed for the online phase

Parameters
fileNamepath where to store the file

Reimplemented from sgpp::datadriven::DBMatOffline.

References fileName, sgpp::datadriven::DBMatOffline::getGridSize(), sgpp::base::DataMatrix::getPointer(), q_ortho_matrix_, sgpp::datadriven::DBMatOffline::store(), and t_tridiag_inv_matrix_.

◆ syncDistributedDecomposition()

◆ updateRegularization()

void sgpp::datadriven::DBMatOfflineOrthoAdapt::updateRegularization ( double  lambda)
overridevirtual

◆ updateRegularizationParallel()

void sgpp::datadriven::DBMatOfflineOrthoAdapt::updateRegularizationParallel ( double  lambda,
std::shared_ptr< BlacsProcessGrid processGrid,
const ParallelConfiguration parallelConfig 
)
overridevirtual

Member Data Documentation

◆ lhsDistributedSynced

bool sgpp::datadriven::DBMatOfflineOrthoAdapt::lhsDistributedSynced = false
protected

◆ q_ortho_matrix_

◆ q_ortho_matrix_distributed_

DataMatrixDistributed sgpp::datadriven::DBMatOfflineOrthoAdapt::q_ortho_matrix_distributed_
protected

◆ t_diag_

sgpp::base::DataVector sgpp::datadriven::DBMatOfflineOrthoAdapt::t_diag_
protected

◆ t_subdiag_

sgpp::base::DataVector sgpp::datadriven::DBMatOfflineOrthoAdapt::t_subdiag_
protected

◆ t_tridiag_inv_matrix_

◆ t_tridiag_inv_matrix_distributed_

DataMatrixDistributed sgpp::datadriven::DBMatOfflineOrthoAdapt::t_tridiag_inv_matrix_distributed_
protected

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