SG++-Doxygen-Documentation
Loading...
Searching...
No Matches
ExampleDatabase.cpp File Reference

Functions

int main (int argc, char **argv)
 This example shows how to initialize a data matrix of offline decompositions (needed for online objects) which enhances the performance since the decomposition usually takes some time.
 

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

This example shows how to initialize a data matrix of offline decompositions (needed for online objects) which enhances the performance since the decomposition usually takes some time.

A database is always initialized upon a json file which contains paths to different matrix decompositions identified by the configuration of the grid, adaptivity and the density estimation itself.

NOTE (Sebastian Kreisel): Use this example with a config that includes a database attribute in the fitter config as well as an explicit dim in the gridConfig. You may for example use config_databaseExample.json.

From datadriven/examplesPipeline: $ ./ExampleDatabase config_databaseExample.json out.txt

writes the database to out.txt.

Get the path for the configuration file and the path for the output of the decomposed matrix.

To retrieve an offline decomposition one must define the setup the offline matrix must match. This is done by defining how the sparse grid is structured, how the sparse grid performs refinement and coarsening (adaptivity). Also regularization and density estimation parameters must be defined to identify a decomposition. This is done by parsing a configuration file which should include all these settings. (gridConfig, adaptivityConfig, regularizationConfig, densityEstimationConfig)

The database has to be initialized. This is done by passing the file to the json database file to the constructor of the DBMatDatabase class.

Before the matrix can be initialized the underlying grid needs to be created

This section shows how to store a decomposition in the database. First however the matrix has to be created and decomposed. This is done using the configuration structures that the database needs to identify a decomposition.

After decomposing the data matrix it can be stored in the database. By passing the configuration structures used to create the matrix the database can identify the decomposition. The last parameter of the putDataMatrix method specified whether an entry with the same configuration will be replaced with a new file path. Note that the database only works on file paths, i.e. strings.

References adaptivityConfig, sgpp::datadriven::DBMatOffline::buildMatrix(), sgpp::datadriven::DBMatOfflineFactory::buildOfflineObject(), sgpp::base::Grid::createLinearGrid(), sgpp::base::Grid::createModLinearGrid(), sgpp::datadriven::DBMatOffline::decomposeMatrix(), sgpp::datadriven::FitterConfiguration::getDatabaseConfig(), sgpp::datadriven::FitterConfiguration::getDensityEstimationConfig(), sgpp::datadriven::FitterConfiguration::getGridConfig(), sgpp::datadriven::FitterConfiguration::getRefinementConfig(), sgpp::datadriven::FitterConfiguration::getRegularizationConfig(), grid(), sgpp::base::Linear, sgpp::base::ModLinear, sgpp::datadriven::DBMatDatabase::putDataMatrix(), sgpp::datadriven::FitterConfigurationDensityEstimation::readParams(), sgpp::base::GridGenerator::regular(), sgpp::datadriven::DBMatOffline::store(), and sgpp::base::factory_exception::what().