Direct Graphical Models  v.1.7.0
DecodeExact.h
1 // Exact decoding class interface
2 // Written by Sergey G. Kosov in 2012 for Project X
3 #pragma once
4 
5 #include "Decode.h"
6 #include "IGraphPairwise.h"
7 
8 namespace DirectGraphicalModels
9 {
10  // ============================= Exact Decode Class ============================
17  class CDecodeExact : public CDecode
18  {
19  public:
24  DllExport CDecodeExact(IGraphPairwise &graph) : CDecode(graph) {}
25  DllExport virtual ~CDecodeExact(void) {}
26 
32  DllExport virtual vec_byte_t decode(Mat &lossMatrix = EmptyMat) const;
33 
34 
35  protected:
40  IGraphPairwise & getGraphPairwise(void) const { return dynamic_cast<IGraphPairwise &>(CDecode::getGraph()); }
47  void setState(vec_byte_t &state, qword configuration) const;
53  void incState(vec_byte_t &state) const;
59  vec_float_t calculatePotentials(void) const;
60  };
61 }
62 
63 
virtual vec_byte_t decode(Mat &lossMatrix=EmptyMat) const
Exact decoding.
Definition: DecodeExact.cpp:7
CGraph & getGraph(void) const
Returns the reference to the graph.
Definition: Decode.h:66
Exact decoding class.
Definition: DecodeExact.h:17
vec_float_t calculatePotentials(void) const
Calculates potentials for all possible configurations.
Definition: DecodeExact.cpp:58
void incState(vec_byte_t &state) const
Increases the state by one, i.e. switches the state array to the consequent configuration.
Definition: DecodeExact.cpp:49
CDecodeExact(IGraphPairwise &graph)
Constructor.
Definition: DecodeExact.h:24
void setState(vec_byte_t &state, qword configuration) const
Sets the state according to the configuration index configuration.
Definition: DecodeExact.cpp:39
Base abstract class for random model decoding.
Definition: Decode.h:17
Interface class for graphical models.
IGraphPairwise & getGraphPairwise(void) const
Returns the graph.
Definition: DecodeExact.h:40