SG++-Doxygen-Documentation
sgpp::datadriven::DBMatOfflineOrthoAdapt Class Reference

#include <DBMatOfflineOrthoAdapt.hpp>

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

Public Member Functions

void buildMatrix (Grid *grid, RegularizationConfiguration &regularizationConfig)
 Builds the left hand side matrix without the regularization term. More...
 
DBMatOfflineclone ()
 Interface for the clone idiom. More...
 
 DBMatOfflineOrthoAdapt ()
 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 (RegularizationConfiguration &regularizationConfig, DensityEstimationConfiguration &densityEstimationConfig)
 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...
 
sgpp::datadriven::MatrixDecompositionType getDecompositionType () override
 Returns the decomposition type of the DBMatOffline object. More...
 
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 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...
 
DataMatrixgetDecomposedMatrix ()
 Get a reference to the decomposed matrix. More...
 
virtual size_t getGridSize ()
 Returns the dimensionality of the quadratic lhs matrix (i.e. More...
 
DataMatrixgetLhsMatrix_ONLY_FOR_TESTING ()
 Allows access to lhs matrix, which is meant ONLY FOR TESTING. 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...
 
virtual ~DBMatOffline ()=default
 Default virtual destructor. More...
 

Protected Attributes

sgpp::base::DataMatrix q_ortho_matrix_
 
sgpp::base::DataMatrix t_tridiag_inv_matrix_
 
- Protected Attributes inherited from sgpp::datadriven::DBMatOffline
bool isConstructed
 
bool isDecomposed
 
DataMatrix lhsMatrix
 

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 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 ( )

Constructor Builds DBMatOfflineOrthoAdapt Object from configuration.

References q_ortho_matrix_, and t_tridiag_inv_matrix_.

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

Member Function Documentation

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

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(), sgpp::base::HashGridStorage::getSize(), sgpp::base::Grid::getStorage(), q_ortho_matrix_, sgpp::base::DataMatrix::resizeQuadratic(), and t_tridiag_inv_matrix_.

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 ( RegularizationConfiguration regularizationConfig,
DensityEstimationConfiguration densityEstimationConfig 
)
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

Parameters
regularizationConfigthe regularization configuration
densityEstimationConfigthe density estimation configuration

Implements sgpp::datadriven::DBMatOffline.

References sgpp::base::DataVector::get(), sgpp::base::DataMatrix::getNrows(), hessenberg_decomposition(), python.statsfileInfo::i, invert_symmetric_tridiag(), sgpp::datadriven::DBMatOffline::isDecomposed, sgpp::datadriven::RegularizationConfiguration::lambda_, sgpp::datadriven::DBMatOffline::lhsMatrix, and sgpp::base::DataVector::set().

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.

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::getNrows(), 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 sgpp::base::DataMatrix::getNcols(), sgpp::base::DataMatrix::getNrows(), sgpp::base::DataVector::getPointer(), sgpp::base::DataVector::getSize(), python.statsfileInfo::i, sgpp::datadriven::DBMatOffline::lhsMatrix, 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 sgpp::datadriven::DBMatOffline::getGridSize(), sgpp::base::DataMatrix::getPointer(), q_ortho_matrix_, sgpp::datadriven::DBMatOffline::store(), and t_tridiag_inv_matrix_.

Member Data Documentation

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: