aGrUM  0.16.0
gum::O4DGContext Class Reference

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

#include <agrum/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 __nbVar, and __varInstantiation.

70  :
72  GUM_CONSTRUCTOR(O4DGContext);
73  __varInstantiation = varInst;
74  __nbVar = nbVar;
75  }
NodeId __DG2ExploredNode
DG2 Diagram current explored node.
Definition: o4DGContext.h:122
double __key
The key use to store the context as a key in the hashtable.
Definition: o4DGContext.h:130
O4DGContext(Idx *, Idx)
Default constructor.
Definition: o4DGContext.cpp:70
Idx * __varInstantiation
Vector containing for each retrograde variable its current modality 0 meaning no instantiation done =...
Definition: o4DGContext.h:126
NodeId __DG1ExploredNode
DG1 Diagram current explored node.
Definition: o4DGContext.h:119

◆ ~O4DGContext()

gum::O4DGContext::~O4DGContext ( )

Default destructor.

Definition at line 78 of file o4DGContext.cpp.

78 { GUM_DESTRUCTOR(O4DGContext); }
O4DGContext(Idx *, Idx)
Default constructor.
Definition: o4DGContext.cpp:70

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 __varInstantiation.

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

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 caller 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.

References __DG1ExploredNode, and setDG2Node().

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

86 { return __DG1ExploredNode; }
NodeId __DG1ExploredNode
DG1 Diagram current explored node.
Definition: o4DGContext.h:119
+ Here is the call graph for this function:
+ 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 92 of file o4DGContext.h.

References __DG2ExploredNode, chgVarModality(), key(), and varModality().

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

92 { return __DG2ExploredNode; }
NodeId __DG2ExploredNode
DG2 Diagram current explored node.
Definition: o4DGContext.h:122
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ key()

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

Returns o4DGContext key.

Definition at line 56 of file o4DGContext_inl.h.

References __DG1ExploredNode, __DG2ExploredNode, __key, __logPrime, __nbVar, __offset1, __offset2, __offsetv, and __varInstantiation.

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

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  }
static const Idx __offset1
Definition: o4DGContext.h:134
NodeId __DG2ExploredNode
DG2 Diagram current explored node.
Definition: o4DGContext.h:122
static const double __logPrime[]
Table containing the log2 of prime numbers.
Definition: o4DGContext.h:133
double __key
The key use to store the context as a key in the hashtable.
Definition: o4DGContext.h:130
Idx * __varInstantiation
Vector containing for each retrograde variable its current modality 0 meaning no instantiation done =...
Definition: o4DGContext.h:126
static const Idx __offset2
Definition: o4DGContext.h:134
NodeId __DG1ExploredNode
DG1 Diagram current explored node.
Definition: o4DGContext.h:119
static const Idx __offsetv
Definition: o4DGContext.h:134
+ 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 71 of file o4DGContext_inl.h.

References gum::SmallObjectAllocator::deallocate(), and gum::SmallObjectAllocator::instance().

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::SmallObjectAllocator::allocate(), and gum::SmallObjectAllocator::instance().

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 __DG1ExploredNode.

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

36  {
37  __DG1ExploredNode = exploredNode;
38  }
NodeId __DG1ExploredNode
DG1 Diagram current explored node.
Definition: o4DGContext.h:119
+ 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 41 of file o4DGContext_inl.h.

References __DG2ExploredNode.

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

41  {
42  __DG2ExploredNode = exploredNode;
43  }
NodeId __DG2ExploredNode
DG2 Diagram current explored node.
Definition: o4DGContext.h:122
+ Here is the caller 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 __varInstantiation.

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

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 caller 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.

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

◆ __DG2ExploredNode

NodeId gum::O4DGContext::__DG2ExploredNode
private

DG2 Diagram current explored node.

Definition at line 122 of file o4DGContext.h.

Referenced by 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 130 of file o4DGContext.h.

Referenced by key().

◆ __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.

Referenced by key().

◆ __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.

Referenced by key(), and O4DGContext().

◆ __offset1

const Idx gum::O4DGContext::__offset1 = O4DGContext::__nbLogPrime - 1
staticprivate

Definition at line 134 of file o4DGContext.h.

Referenced by key().

◆ __offset2

const Idx gum::O4DGContext::__offset2 = O4DGContext::__nbLogPrime - 2
staticprivate

Definition at line 134 of file o4DGContext.h.

Referenced by key().

◆ __offsetv

const Idx gum::O4DGContext::__offsetv = O4DGContext::__nbLogPrime - 3
staticprivate

Definition at line 134 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 126 of file o4DGContext.h.

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


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