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

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

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

Collaboration diagram for gum::O4DGContext:

Public Member Functions

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

Private Attributes

NodeId _DG1ExploredNode_
 DG1 Diagram current explored node.
NodeId _DG2ExploredNode_
 DG2 Diagram current explored node.
Idx_varInstantiation_
 Vector containing for each retrograde variable its current modality 0 meaning no instantiation done => there's an offset.
Idx _nbVar_
double _key_
 The key use to store the context as a key in the hashtable.

Static Private Attributes

static const double _logPrime_ []
 Table containing the log2 of prime numbers.
static const Idx _nbLogPrime_ = 140
static const Idx _offsetv_ = O4DGContext::_nbLogPrime_ - 3
static const Idx _offset1_ = O4DGContext::_nbLogPrime_ - 1
static const Idx _offset2_ = O4DGContext::_nbLogPrime_ - 2

Detailed Description

Class used to manipulate context during Function Graph Operations.

Definition at line 70 of file o4DGContext.h.

Constructor & Destructor Documentation

◆ O4DGContext()

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

Default constructor.

Definition at line 98 of file o4DGContext.cpp.

98 :
100 GUM_CONSTRUCTOR(O4DGContext);
101 _varInstantiation_ = varInst;
102 _nbVar_ = nbVar;
103 }
NodeId _DG2ExploredNode_
DG2 Diagram current explored node.
double _key_
The key use to store the context as a key in the hashtable.
Idx * _varInstantiation_
Vector containing for each retrograde variable its current modality 0 meaning no instantiation done =...
NodeId _DG1ExploredNode_
DG1 Diagram current explored node.
O4DGContext(Idx *, Idx)
Default constructor.

References O4DGContext(), _DG1ExploredNode_, _DG2ExploredNode_, _key_, _nbVar_, and _varInstantiation_.

Referenced by O4DGContext(), ~O4DGContext(), and operator delete().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ~O4DGContext()

gum::O4DGContext::~O4DGContext ( )

Default destructor.

Definition at line 106 of file o4DGContext.cpp.

106 {
107 GUM_DESTRUCTOR(O4DGContext);
108 ;
109 }

References O4DGContext().

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 67 of file o4DGContext_inl.h.

67 {
68 _varInstantiation_[varIndex] = newModality;
69 }

References _varInstantiation_.

Referenced by gum::MultiDimFunctionGraphOperator< GUM_SCALAR, FUNCTOR, TerminalNodePolicy >::_compute_(), and gum::Regress< GUM_SCALAR, COMBINEOPERATOR, PROJECTOPERATOR, TerminalNodePolicy >::_compute_().

Here is the caller graph for this function:

◆ DG1Node()

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

Get DG1 diagram current explored Node.

Definition at line 107 of file o4DGContext.h.

107{ return _DG1ExploredNode_; }

References _DG1ExploredNode_.

Referenced by gum::MultiDimFunctionGraphOperator< GUM_SCALAR, FUNCTOR, TerminalNodePolicy >::_compute_(), and gum::Regress< GUM_SCALAR, COMBINEOPERATOR, PROJECTOPERATOR, TerminalNodePolicy >::_compute_().

Here is the caller graph for this function:

◆ DG2Node()

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

Get DG2 diagram current explored Node.

Definition at line 113 of file o4DGContext.h.

113{ return _DG2ExploredNode_; }

References _DG2ExploredNode_.

Referenced by gum::MultiDimFunctionGraphOperator< GUM_SCALAR, FUNCTOR, TerminalNodePolicy >::_compute_(), and gum::Regress< GUM_SCALAR, COMBINEOPERATOR, PROJECTOPERATOR, TerminalNodePolicy >::_compute_().

Here is the caller graph for this function:

◆ key()

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

Returns o4DGContext key.

Definition at line 75 of file o4DGContext_inl.h.

75 {
77
78 for (Idx varPos = 0, offset = _offsetv_; varPos < _nbVar_; varPos++, offset--)
79 if (instNeeded[varPos]) _key_ += _varInstantiation_[varPos] * _logPrime_[offset];
80
81 return _key_;
82 }
static const Idx _offset2_
static const Idx _offset1_
static const double _logPrime_[]
Table containing the log2 of prime numbers.
static const Idx _offsetv_
Size Idx
Type for indexes.
Definition types.h:79

References _DG1ExploredNode_, _DG2ExploredNode_, _key_, _logPrime_, _nbVar_, _offset1_, _offset2_, _offsetv_, and _varInstantiation_.

Referenced by gum::MultiDimFunctionGraphOperator< GUM_SCALAR, FUNCTOR, TerminalNodePolicy >::_compute_(), and gum::Regress< GUM_SCALAR, COMBINEOPERATOR, PROJECTOPERATOR, TerminalNodePolicy >::_compute_().

Here is the caller graph for this function:

◆ operator delete()

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

Operator delete overload to use the SmallObjectAllocator.

Definition at line 88 of file o4DGContext_inl.h.

88 {
90 }
static SmallObjectAllocator & instance()
void deallocate(void *pDeallocatedObject, const size_t &objectSize)
Deallocates an object.

References O4DGContext(), gum::SmallObjectAllocator::deallocate(), and gum::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 84 of file o4DGContext_inl.h.

84 {
86 }
void * allocate(const size_t &objectSize)
Allocates a block.

References gum::SmallObjectAllocator::allocate(), and gum::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 57 of file o4DGContext_inl.h.

57 {
58 _DG1ExploredNode_ = exploredNode;
59 }

References _DG1ExploredNode_.

Referenced by gum::MultiDimFunctionGraphOperator< GUM_SCALAR, FUNCTOR, TerminalNodePolicy >::_compute_(), gum::Regress< GUM_SCALAR, COMBINEOPERATOR, PROJECTOPERATOR, TerminalNodePolicy >::_compute_(), gum::MultiDimFunctionGraphOperator< GUM_SCALAR, FUNCTOR, TerminalNodePolicy >::compute(), and gum::Regress< GUM_SCALAR, COMBINEOPERATOR, PROJECTOPERATOR, TerminalNodePolicy >::compute().

Here is the caller graph for this function:

◆ setDG2Node()

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

Set DG2 diagram current explored Node.

Definition at line 62 of file o4DGContext_inl.h.

62 {
63 _DG2ExploredNode_ = exploredNode;
64 }

References _DG2ExploredNode_.

Referenced by gum::MultiDimFunctionGraphOperator< GUM_SCALAR, FUNCTOR, TerminalNodePolicy >::_compute_(), gum::Regress< GUM_SCALAR, COMBINEOPERATOR, PROJECTOPERATOR, TerminalNodePolicy >::_compute_(), gum::MultiDimFunctionGraphOperator< GUM_SCALAR, FUNCTOR, TerminalNodePolicy >::compute(), and gum::Regress< GUM_SCALAR, COMBINEOPERATOR, PROJECTOPERATOR, TerminalNodePolicy >::compute().

Here is the caller graph for this function:

◆ varModality()

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

Changes given variable modality.

Definition at line 72 of file o4DGContext_inl.h.

72{ return _varInstantiation_[varIndex]; }

References _varInstantiation_.

Referenced by gum::MultiDimFunctionGraphOperator< GUM_SCALAR, FUNCTOR, TerminalNodePolicy >::_compute_(), and gum::Regress< GUM_SCALAR, COMBINEOPERATOR, PROJECTOPERATOR, TerminalNodePolicy >::_compute_().

Here is the caller graph for this function:

Member Data Documentation

◆ _DG1ExploredNode_

NodeId gum::O4DGContext::_DG1ExploredNode_
private

DG1 Diagram current explored node.

Definition at line 141 of file o4DGContext.h.

Referenced by O4DGContext(), DG1Node(), key(), and setDG1Node().

◆ _DG2ExploredNode_

NodeId gum::O4DGContext::_DG2ExploredNode_
private

DG2 Diagram current explored node.

Definition at line 144 of file o4DGContext.h.

Referenced by O4DGContext(), DG2Node(), key(), and setDG2Node().

◆ _key_

double gum::O4DGContext::_key_
private

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

Definition at line 152 of file o4DGContext.h.

Referenced by O4DGContext(), and key().

◆ _logPrime_

const double gum::O4DGContext::_logPrime_
staticprivate
Initial value:
= {std::log2(2.0), std::log2(3.0), std::log2(5.0), std::log2(7.0), std::log2(11.0),
std::log2(13.0), std::log2(17.0), std::log2(19.0), std::log2(23.0), std::log2(29.0),
std::log2(31.0), std::log2(37.0), std::log2(41.0), std::log2(43.0), std::log2(47.0),
std::log2(53.0), std::log2(59.0), std::log2(61.0), std::log2(67.0), std::log2(71.0),
std::log2(73.0), std::log2(79.0), std::log2(83.0), std::log2(89.0), std::log2(97.0),
std::log2(101.0), std::log2(103.0), std::log2(107.0), std::log2(109.0), std::log2(113.0),
std::log2(127.0), std::log2(131.0), std::log2(137.0), std::log2(139.0), std::log2(149.0),
std::log2(151.0), std::log2(157.0), std::log2(163.0), std::log2(167.0), std::log2(173.0),
std::log2(179.0), std::log2(181.0), std::log2(191.0), std::log2(193.0), std::log2(197.0),
std::log2(199.0), std::log2(211.0), std::log2(223.0), std::log2(227.0), std::log2(229.0),
std::log2(233.0), std::log2(239.0), std::log2(241.0), std::log2(251.0), std::log2(257.0),
std::log2(263.0), std::log2(269.0), std::log2(271.0), std::log2(277.0), std::log2(281.0),
std::log2(283.0), std::log2(293.0), std::log2(307.0), std::log2(311.0), std::log2(313.0),
std::log2(317.0), std::log2(331.0), std::log2(337.0), std::log2(347.0), std::log2(349.0),
std::log2(353.0), std::log2(359.0), std::log2(367.0), std::log2(373.0), std::log2(379.0),
std::log2(383.0), std::log2(389.0), std::log2(397.0), std::log2(401.0), std::log2(409.0),
std::log2(419.0), std::log2(421.0), std::log2(431.0), std::log2(433.0), std::log2(439.0),
std::log2(443.0), std::log2(449.0), std::log2(457.0), std::log2(461.0), std::log2(463.0),
std::log2(467.0), std::log2(479.0), std::log2(487.0), std::log2(491.0), std::log2(499.0),
std::log2(503.0), std::log2(509.0), std::log2(521.0), std::log2(523.0), std::log2(541.0),
std::log2(547.0), std::log2(557.0), std::log2(563.0), std::log2(569.0), std::log2(571.0),
std::log2(577.0), std::log2(587.0), std::log2(593.0), std::log2(599.0), std::log2(601.0),
std::log2(607.0), std::log2(613.0), std::log2(617.0), std::log2(619.0), std::log2(631.0),
std::log2(641.0), std::log2(643.0), std::log2(647.0), std::log2(653.0), std::log2(659.0),
std::log2(661.0), std::log2(673.0), std::log2(677.0), std::log2(683.0), std::log2(691.0),
std::log2(701.0), std::log2(709.0), std::log2(719.0), std::log2(727.0), std::log2(733.0),
std::log2(739.0), std::log2(743.0), std::log2(751.0), std::log2(757.0), std::log2(761.0),
std::log2(769.0), std::log2(773.0), std::log2(787.0), std::log2(797.0), std::log2(809.0)}

Table containing the log2 of prime numbers.

Definition at line 155 of file o4DGContext.h.

Referenced by key().

◆ _nbLogPrime_

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

Definition at line 156 of file o4DGContext.h.

◆ _nbVar_

Idx gum::O4DGContext::_nbVar_
private

Definition at line 149 of file o4DGContext.h.

Referenced by O4DGContext(), and key().

◆ _offset1_

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

Definition at line 156 of file o4DGContext.h.

Referenced by key().

◆ _offset2_

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

Definition at line 156 of file o4DGContext.h.

Referenced by key().

◆ _offsetv_

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

Definition at line 156 of file o4DGContext.h.

Referenced by key().

◆ _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 148 of file o4DGContext.h.

Referenced by O4DGContext(), chgVarModality(), key(), and varModality().


The documentation for this class was generated from the following files:
  • agrum/base/multidim/utils/FunctionGraphUtilities/operators/o4DGContext.h
  • agrum/base/multidim/utils/FunctionGraphUtilities/operators/o4DGContext.cpp
  • agrum/base/multidim/utils/FunctionGraphUtilities/operators/o4DGContext_inl.h