aGrUM  0.20.2
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 70 of file o4DGContext.cpp.

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

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

◆ ~O4DGContext()

gum::O4DGContext::~O4DGContext ( )

Default destructor.

Definition at line 78 of file o4DGContext.cpp.

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

78 { GUM_DESTRUCTOR(O4DGContext); }
O4DGContext(Idx *, Idx)
Default constructor.
Definition: o4DGContext.cpp:70
+ 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 56 of file o4DGContext_inl.h.

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

56  {
59 
60  for (Idx varPos = 0, offset = offsetv__; varPos < nbVar__; varPos++, offset--)
61  if (instNeeded[varPos])
62  key__ += varInstantiation__[varPos] * logPrime__[offset];
63 
64  return key__;
65  }
Idx * varInstantiation__
Vector containing for each retrograde variable its current modality 0 meaning no instantiation done =...
Definition: o4DGContext.h:126
static const Idx offsetv__
Definition: o4DGContext.h:134
static const double logPrime__[]
Table containing the log2 of prime numbers.
Definition: o4DGContext.h:133
static const Idx offset2__
Definition: o4DGContext.h:134
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
NodeId DG2ExploredNode__
DG2 Diagram current explored node.
Definition: o4DGContext.h:122
NodeId DG1ExploredNode__
DG1 Diagram current explored node.
Definition: o4DGContext.h:119
+ 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 71 of file o4DGContext_inl.h.

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

71  {
73  }
O4DGContext(Idx *, Idx)
Default constructor.
Definition: o4DGContext.cpp:70
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 67 of file o4DGContext_inl.h.

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

67  {
69  }
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  {
52  return varInstantiation__[varIndex];
53  }
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: