SG++
sgpp::datadriven::DBMatOfflineOrthoAdapt Class Reference

#include <DBMatOfflineOrthoAdapt.hpp>

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

Public Member Functions

void buildMatrix ()
 Builds the left hand side matrix without the regularization term. More...
 
DBMatOfflineclone ()
 Interface for the clone idiom. More...
 
 DBMatOfflineOrthoAdapt (const sgpp::base::RegularGridConfiguration &gridConfig, const sgpp::base::AdpativityConfiguration &adaptivityConfig, const sgpp::datadriven::RegularizationConfiguration &regularizationConfig, const sgpp::datadriven::DensityEstimationConfiguration &densityEstimationConfig)
 Constructor Builds DBMatOfflineOrthoAdapt Object from configuration. More...
 
 DBMatOfflineOrthoAdapt (const std::string &fileName)
 Constructor Builds object from serialized offline object, stored in file. More...
 
void decomposeMatrix ()
 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. More...
 
size_t & getDimA ()
 
double getLambda ()
 
sgpp::base::DataMatrixgetQ ()
 
sgpp::base::DataMatrixgetTinv ()
 
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_. More...
 
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. More...
 
bool isRefineable () override
 Only Offline objects based on Cholesky decomposition, or orthogonal adaptivity can be refined. More...
 
void store (const std::string &fileName)
 Serializes the DBMatOfflineOrthoAdapt object. More...
 
- Public Member Functions inherited from sgpp::datadriven::DBMatOffline
 DBMatOffline (const sgpp::base::RegularGridConfiguration &gridConfig, const sgpp::base::AdpativityConfiguration &adaptivityConfig, const sgpp::datadriven::RegularizationConfiguration &regularizationConfig, const sgpp::datadriven::DensityEstimationConfiguration &densityEstimationConfig)
 Constructor Build DBMatOffline Object from configuration. More...
 
 DBMatOffline (const std::string &fileName)
 Constructor Create offline object from serialized offline object. More...
 
 DBMatOffline (const DBMatOffline &rhs)
 Copy Constructor. More...
 
 DBMatOffline (DBMatOffline &&rhs)=default
 Default move constructor. More...
 
sgpp::base::AdpativityConfigurationgetAdaptivityConfig ()
 Get a reference to the grid adaptivity configuration object. More...
 
DataMatrixgetDecomposedMatrix ()
 Get a reference to the decomposed matrix. More...
 
sgpp::datadriven::DensityEstimationConfigurationgetDensityEstimationConfig ()
 Get a reference to the matrix decomposition configuration object. More...
 
GridgetGrid ()
 Returns a reference to the sparse grid. More...
 
sgpp::base::RegularGridConfigurationgetGridConfig ()
 Get a reference to the grid configuration object. More...
 
DataMatrixgetLhsMatrix_ONLY_FOR_TESTING ()
 Allows access to lhs matrix, which is meant ONLY FOR TESTING. More...
 
sgpp::datadriven::RegularizationConfigurationgetRegularizationConfig ()
 Get a reference to the grid regularization configuration object. More...
 
DBMatOfflineoperator= (const DBMatOffline &rhs)
 Default copy assign operator. More...
 
DBMatOfflineoperator= (DBMatOffline &&rhs)=default
 Default move assign operator. More...
 
void printMatrix ()
 Prints the matrix onto standard output. More...
 
void setInter (std::vector< std::vector< size_t >> interactions)
 Sets interaction Term. More...
 
virtual ~DBMatOffline ()=default
 Default virtual destructor. More...
 

Protected Attributes

size_t dim_a
 
double lambda
 
sgpp::base::DataMatrix q_ortho_matrix_
 
sgpp::base::DataMatrix t_tridiag_inv_matrix_
 
- Protected Attributes inherited from sgpp::datadriven::DBMatOffline
sgpp::base::AdpativityConfiguration adaptivityConfig
 
sgpp::datadriven::DensityEstimationConfiguration densityEstimationConfig
 
std::unique_ptr< Gridgrid
 An offline object works on a hierarchical basis grid. More...
 
sgpp::base::RegularGridConfiguration gridConfig
 
bool isConstructed
 
bool isDecomposed
 
DataMatrix lhsMatrix
 
sgpp::datadriven::RegularizationConfiguration regularizationConfig
 

Additional Inherited Members

- Public Attributes inherited from sgpp::datadriven::DBMatOffline
std::vector< std::vector< size_t > > interactions
 
- Protected Member Functions inherited from sgpp::datadriven::DBMatOffline
 DBMatOffline ()
 
void InitializeGrid ()
 Build the initial sparse grid. More...
 
void parseConfig (const std::string &fileName, sgpp::base::RegularGridConfiguration &gridConfig, sgpp::base::AdpativityConfiguration &adaptivityConfig, sgpp::datadriven::RegularizationConfiguration &regularizationConfig, sgpp::datadriven::DensityEstimationConfiguration &densityEstimationConfig) const
 Read the configuration from a serialized DBMatOffline object. More...
 
void parseInter (const std::string &fileName, std::vector< std::vector< size_t >> &interactions) const
 Read the Interactionsterms from a serialized DBMatOfflibe object. More...
 

Constructor & Destructor Documentation

sgpp::datadriven::DBMatOfflineOrthoAdapt::DBMatOfflineOrthoAdapt ( const sgpp::base::RegularGridConfiguration gridConfig,
const sgpp::base::AdpativityConfiguration adaptivityConfig,
const sgpp::datadriven::RegularizationConfiguration regularizationConfig,
const sgpp::datadriven::DensityEstimationConfiguration densityEstimationConfig 
)
explicit

Constructor Builds DBMatOfflineOrthoAdapt Object from configuration.

Parameters
gridConfigThe configuration of the grid
adaptivityConfigThe configuration of the grid adaptivity
regularizationConfigThe configuration of the grid regularization
densityEstimationConfigThe configuration of the matrix decomposition

References dim_a, lambda, sgpp::datadriven::RegularizationConfiguration::lambda_, q_ortho_matrix_, and t_tridiag_inv_matrix_.

Member Function Documentation

void sgpp::datadriven::DBMatOfflineOrthoAdapt::buildMatrix ( )
virtual
DBMatOffline * sgpp::datadriven::DBMatOfflineOrthoAdapt::clone ( )
virtual

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.

void sgpp::datadriven::DBMatOfflineOrthoAdapt::decomposeMatrix ( )
virtual

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

Implements sgpp::datadriven::DBMatOffline.

References dim_a, sgpp::base::DataVector::get(), hessenberg_decomposition(), invert_symmetric_tridiag(), sgpp::datadriven::DBMatOffline::isDecomposed, lambda, and sgpp::base::DataVector::set().

size_t& sgpp::datadriven::DBMatOfflineOrthoAdapt::getDimA ( )
inline
double sgpp::datadriven::DBMatOfflineOrthoAdapt::getLambda ( )
inline

References lambda.

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 dim_a, sgpp::base::DataVector::getPointer(), sgpp::base::DataMatrix::getPointer(), sgpp::datadriven::DBMatOffline::lhsMatrix, and q_ortho_matrix_.

Referenced by decomposeMatrix().

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 dim_a, sgpp::base::DataMatrix::getNcols(), sgpp::base::DataMatrix::getNrows(), sgpp::base::DataVector::getPointer(), sgpp::base::DataVector::getSize(), sgpp::base::DataMatrix::set(), and t_tridiag_inv_matrix_.

Referenced by decomposeMatrix().

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.

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

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 dim_a, sgpp::base::DataMatrix::getPointer(), q_ortho_matrix_, sgpp::datadriven::DBMatOffline::store(), and t_tridiag_inv_matrix_.

Member Data Documentation

size_t sgpp::datadriven::DBMatOfflineOrthoAdapt::dim_a
protected
double sgpp::datadriven::DBMatOfflineOrthoAdapt::lambda
protected
sgpp::base::DataMatrix sgpp::datadriven::DBMatOfflineOrthoAdapt::q_ortho_matrix_
protected
sgpp::base::DataMatrix sgpp::datadriven::DBMatOfflineOrthoAdapt::t_tridiag_inv_matrix_
protected

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