ExplicitStorage (continous storage) of a graphical model function data. More...
#include <graphicalmodel_explicit_storage.hxx>
Public Member Functions | |
ExplicitStorage (const GraphicalModelType &gm) | |
~ExplicitStorage () | |
ValueType const * | operator[] (const FactorType &factor) const |
ExplicitStorage (continous storage) of a graphical model function data.
ExplicitStorage stores all instances of all functions into a single continous stride of memory. Given a factor one gets the begin pointer of the corresponding function. The storage of the function is in last coordinate major order.
Usage:
opengm::ExplicitStorage<GmType> storage(gm); typedef GmType::FactorType::ShapeIteratorType ShapeIteratorType; // loop over all factors for(size_t factor=0;factor<gmA.numberOfFactors();++factor){ // "usual" way to iterate over the factors values with coordinates // is with the shapewalker class opengm::ShapeWalker< ShapeIteratorType > walker(gm[factor].shapeBegin(),gm[factor].numberOfVariables()); // get the begin pointer to the storage of the factors function GmType::ValueType const * ptr=storageA[gmA[factor]]; // toy / test loop over all factors values // and compare (expensive) direct access via the factors // and cheap access via pointer for (size_t i = 0; i < gmA[factor].size(); ++i) { OPENGM_TEST_EQUAL(gmA[factor](walker.coordinateTuple().begin()),ptr[i]); ++walker; } }
Definition at line 65 of file graphicalmodel_explicit_storage.hxx.
opengm::ExplicitStorage< GM >::ExplicitStorage | ( | const GraphicalModelType & | gm | ) | [inline] |
Definition at line 79 of file graphicalmodel_explicit_storage.hxx.
opengm::ExplicitStorage< GM >::~ExplicitStorage | ( | ) | [inline] |
Definition at line 113 of file graphicalmodel_explicit_storage.hxx.
ValueType const* opengm::ExplicitStorage< GM >::operator[] | ( | const FactorType & | factor | ) | const [inline] |
Definition at line 117 of file graphicalmodel_explicit_storage.hxx.