aGrUM  0.20.3
a C++ library for (probabilistic) graphical models
gum::O4DGContext Class Reference

Class used to manipulate context during Function Graph Operations. More...

#include <agrum/tools/multidim/FunctionGraphUtilities/o4DGContext.h>

+ Collaboration diagram for gum::O4DGContext:

Public Member Functions

Constructors, Destructors.
 O4DGContext (Idx *, Idx)
 Default constructor. More...
 
 ~O4DGContext ()
 Default destructor. More...
 
void * operator new (size_t s)
 Operator new overload to use the SmallObjectAllocator. More...
 
void operator delete (void *p)
 Operator delete overload to use the SmallObjectAllocator. More...
 
Diagrams current nodes setters & getters.
void setDG1Node (const NodeId &)
 Set DG1 diagram current explored Node. More...
 
const NodeIdDG1Node () const
 Get DG1 diagram current explored Node. More...
 
void setDG2Node (const NodeId &)
 Set DG2 diagram current explored Node. More...
 
const NodeIdDG2Node () const
 Get DG2 diagram current explored Node. More...
 
Variables modalities handlers
void chgVarModality (Idx, Idx)
 Changes given variable modality. More...
 
Idx varModality (Idx)
 Changes given variable modality. More...
 
O4DG Handling methods
const doublekey (short int *instNeeded)
 Returns o4DGContext key. More...
 

Detailed Description

Class used to manipulate context during Function Graph Operations.

Definition at line 49 of file o4DGContext.h.

Constructor & Destructor Documentation

◆ O4DGContext()

gum::O4DGContext::O4DGContext ( Idx varInst,
Idx  nbVar 
)

Default constructor.

Definition at line 68 of file o4DGContext.cpp.

References gum::Set< Key, Alloc >::emplace().

68  :
70  GUM_CONSTRUCTOR(O4DGContext);
71  _varInstantiation_ = varInst;
72  _nbVar_ = nbVar;
73  }
NodeId _DG2ExploredNode_
DG2 Diagram current explored node.
Definition: o4DGContext.h:122
O4DGContext(Idx *, Idx)
Default constructor.
Definition: o4DGContext.cpp:68
NodeId _DG1ExploredNode_
DG1 Diagram current explored node.
Definition: o4DGContext.h:119
Idx * _varInstantiation_
Vector containing for each retrograde variable its current modality 0 meaning no instantiation done =...
Definition: o4DGContext.h:126
double _key_
The key use to store the context as a key in the hashtable.
Definition: o4DGContext.h:130
+ Here is the call graph for this function:

◆ ~O4DGContext()

gum::O4DGContext::~O4DGContext ( )

Default destructor.

Definition at line 76 of file o4DGContext.cpp.

References gum::Set< Key, Alloc >::emplace().

76  {
77  GUM_DESTRUCTOR(O4DGContext);
78  ;
79  }
O4DGContext(Idx *, Idx)
Default constructor.
Definition: o4DGContext.cpp:68
+ Here is the call graph for this function:

Member Function Documentation

◆ chgVarModality()

INLINE void gum::O4DGContext::chgVarModality ( Idx  varIndex,
Idx  newModality 
)

Changes given variable modality.

Definition at line 46 of file o4DGContext_inl.h.

References gum::Set< Key, Alloc >::emplace().

46  {
47  _varInstantiation_[varIndex] = newModality;
48  }
Idx * _varInstantiation_
Vector containing for each retrograde variable its current modality 0 meaning no instantiation done =...
Definition: o4DGContext.h:126
+ Here is the call graph for this function:

◆ DG1Node()

const NodeId& gum::O4DGContext::DG1Node ( ) const
inline

Get DG1 diagram current explored Node.

Definition at line 86 of file o4DGContext.h.

86 { return _DG1ExploredNode_; }
NodeId _DG1ExploredNode_
DG1 Diagram current explored node.
Definition: o4DGContext.h:119

◆ DG2Node()

const NodeId& gum::O4DGContext::DG2Node ( ) const
inline

Get DG2 diagram current explored Node.

Definition at line 92 of file o4DGContext.h.

92 { return _DG2ExploredNode_; }
NodeId _DG2ExploredNode_
DG2 Diagram current explored node.
Definition: o4DGContext.h:122

◆ key()

INLINE const double & gum::O4DGContext::key ( short int *  instNeeded)

Returns o4DGContext key.

Definition at line 54 of file o4DGContext_inl.h.

References gum::Set< Key, Alloc >::emplace().

54  {
56 
57  for (Idx varPos = 0, offset = _offsetv_; varPos < _nbVar_; varPos++, offset--)
58  if (instNeeded[varPos]) _key_ += _varInstantiation_[varPos] * _logPrime_[offset];
59 
60  return _key_;
61  }
NodeId _DG2ExploredNode_
DG2 Diagram current explored node.
Definition: o4DGContext.h:122
static const Idx _offsetv_
Definition: o4DGContext.h:134
NodeId _DG1ExploredNode_
DG1 Diagram current explored node.
Definition: o4DGContext.h:119
Idx * _varInstantiation_
Vector containing for each retrograde variable its current modality 0 meaning no instantiation done =...
Definition: o4DGContext.h:126
static const double _logPrime_[]
Table containing the log2 of prime numbers.
Definition: o4DGContext.h:133
static const Idx _offset1_
Definition: o4DGContext.h:134
double _key_
The key use to store the context as a key in the hashtable.
Definition: o4DGContext.h:130
static const Idx _offset2_
Definition: o4DGContext.h:134
+ Here is the call graph for this function:

◆ operator delete()

INLINE void gum::O4DGContext::operator delete ( void *  p)

Operator delete overload to use the SmallObjectAllocator.

Definition at line 67 of file o4DGContext_inl.h.

References gum::Set< Key, Alloc >::emplace().

67  {
69  }
O4DGContext(Idx *, Idx)
Default constructor.
Definition: o4DGContext.cpp:68
void deallocate(void *pDeallocatedObject, const size_t &objectSize)
Deallocates an object.
static SmallObjectAllocator & instance()
+ Here is the call graph for this function:

◆ operator new()

INLINE void * gum::O4DGContext::operator new ( size_t  s)

Operator new overload to use the SmallObjectAllocator.

Definition at line 63 of file o4DGContext_inl.h.

References gum::Set< Key, Alloc >::emplace().

63  {
65  }
void * allocate(const size_t &objectSize)
Allocates a block.
static SmallObjectAllocator & instance()
+ Here is the call graph for this function:

◆ setDG1Node()

INLINE void gum::O4DGContext::setDG1Node ( const NodeId exploredNode)

Set DG1 diagram current explored Node.

Definition at line 36 of file o4DGContext_inl.h.

References gum::Set< Key, Alloc >::emplace().

36  {
37  _DG1ExploredNode_ = exploredNode;
38  }
NodeId _DG1ExploredNode_
DG1 Diagram current explored node.
Definition: o4DGContext.h:119
+ Here is the call graph for this function:

◆ setDG2Node()

INLINE void gum::O4DGContext::setDG2Node ( const NodeId exploredNode)

Set DG2 diagram current explored Node.

Definition at line 41 of file o4DGContext_inl.h.

References gum::Set< Key, Alloc >::emplace().

41  {
42  _DG2ExploredNode_ = exploredNode;
43  }
NodeId _DG2ExploredNode_
DG2 Diagram current explored node.
Definition: o4DGContext.h:122
+ Here is the call graph for this function:

◆ varModality()

INLINE Idx gum::O4DGContext::varModality ( Idx  varIndex)

Changes given variable modality.

Definition at line 51 of file o4DGContext_inl.h.

References gum::Set< Key, Alloc >::emplace().

51 { return _varInstantiation_[varIndex]; }
Idx * _varInstantiation_
Vector containing for each retrograde variable its current modality 0 meaning no instantiation done =...
Definition: o4DGContext.h:126
+ Here is the call graph for this function:

Member Data Documentation

◆ _DG1ExploredNode_

NodeId gum::O4DGContext::_DG1ExploredNode_
private

DG1 Diagram current explored node.

Definition at line 119 of file o4DGContext.h.

◆ _DG2ExploredNode_

NodeId gum::O4DGContext::_DG2ExploredNode_
private

DG2 Diagram current explored node.

Definition at line 122 of file o4DGContext.h.

◆ _key_

double gum::O4DGContext::_key_
private

The key use to store the context as a key in the hashtable.

Definition at line 130 of file o4DGContext.h.

◆ _logPrime_

const double gum::O4DGContext::_logPrime_
staticprivate
Initial value:
= {log2(2), log2(3), log2(5), log2(7), log2(11), log2(13), log2(17), log2(19),
log2(23), log2(29), log2(31), log2(37), log2(41), log2(43), log2(47), log2(53),
log2(59), log2(61), log2(67), log2(71), log2(73), log2(79), log2(83), log2(89),
log2(97), log2(101), log2(103), log2(107), log2(109), log2(113), log2(127), log2(131),
log2(137), log2(139), log2(149), log2(151), log2(157), log2(163), log2(167), log2(173),
log2(179), log2(181), log2(191), log2(193), log2(197), log2(199), log2(211), log2(223),
log2(227), log2(229), log2(233), log2(239), log2(241), log2(251), log2(257), log2(263),
log2(269), log2(271), log2(277), log2(281), log2(283), log2(293), log2(307), log2(311),
log2(313), log2(317), log2(331), log2(337), log2(347), log2(349), log2(353), log2(359),
log2(367), log2(373), log2(379), log2(383), log2(389), log2(397), log2(401), log2(409),
log2(419), log2(421), log2(431), log2(433), log2(439), log2(443), log2(449), log2(457),
log2(461), log2(463), log2(467), log2(479), log2(487), log2(491), log2(499), log2(503),
log2(509), log2(521), log2(523), log2(541), log2(547), log2(557), log2(563), log2(569),
log2(571), log2(577), log2(587), log2(593), log2(599), log2(601), log2(607), log2(613),
log2(617), log2(619), log2(631), log2(641), log2(643), log2(647), log2(653), log2(659),
log2(661), log2(673), log2(677), log2(683), log2(691), log2(701), log2(709), log2(719),
log2(727), log2(733), log2(739), log2(743), log2(751), log2(757), log2(761), log2(769),
log2(773), log2(787), log2(797), log2(809)}

Table containing the log2 of prime numbers.

Definition at line 133 of file o4DGContext.h.

◆ _nbLogPrime_

const Idx gum::O4DGContext::_nbLogPrime_ = 140
staticprivate

Definition at line 134 of file o4DGContext.h.

◆ _nbVar_

Idx gum::O4DGContext::_nbVar_
private

Definition at line 127 of file o4DGContext.h.

◆ _offset1_

const Idx gum::O4DGContext::_offset1_ = O4DGContext::_nbLogPrime_ - 1
staticprivate

Definition at line 134 of file o4DGContext.h.

◆ _offset2_

const Idx gum::O4DGContext::_offset2_ = O4DGContext::_nbLogPrime_ - 2
staticprivate

Definition at line 134 of file o4DGContext.h.

◆ _offsetv_

const Idx gum::O4DGContext::_offsetv_ = O4DGContext::_nbLogPrime_ - 3
staticprivate

Definition at line 134 of file o4DGContext.h.

◆ _varInstantiation_

Idx* gum::O4DGContext::_varInstantiation_
private

Vector containing for each retrograde variable its current modality 0 meaning no instantiation done => there's an offset.

Definition at line 126 of file o4DGContext.h.


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