aGrUM 3.1.1
a C++ library for (probabilistic) graphical models
gum::ConcreteLeaf< AttributeSelection, isScalar > Class Template Referencefinal

<agrum/FMDP/learning/datastructure/leaves/concreteLeaf.h> More...

#include <concreteLeaf.h>

Inheritance diagram for gum::ConcreteLeaf< AttributeSelection, isScalar >:
Collaboration diagram for gum::ConcreteLeaf< AttributeSelection, isScalar >:

Public Member Functions

double effectif (Idx moda) const override
 Gaves the leaf effectif for given modality.
double total () const override
Idx nbModa () const override
std::string toString () override
virtual bool contains (NodeId testedId) const
 Returns true if abstractleaf has leaf in it.
NodeId id ()
Constructor & destructor.
 ConcreteLeaf (NodeId leafId, NodeDatabase< AttributeSelection, isScalar > *n1, const Sequence< ValueType > *valueDomain)
 Default constructor.
 ~ConcreteLeaf () override
 Default destructor.
void * operator new (size_t s)
 Allocators and Deallocators redefinition.
void operator delete (void *p)
 Default constructor.

Private Types

using ValueType = typename ValueSelect< isScalar, double, Idx >::type

Private Member Functions

double _effectif_ (Idx moda, Int2Type< true >) const
double _effectif_ (Idx moda, Int2Type< false >) const
Idx _nbModa_ (Int2Type< true >) const
Idx _nbModa_ (Int2Type< false >) const

Private Attributes

NodeDatabase< AttributeSelection, isScalar > * _n1_
const Sequence< ValueType > * _valueDomain_
NodeId _leafId_

Detailed Description

template<TESTNAME AttributeSelection, bool isScalar>
class gum::ConcreteLeaf< AttributeSelection, isScalar >

<agrum/FMDP/learning/datastructure/leaves/concreteLeaf.h>

A concrete leaf

Definition at line 74 of file concreteLeaf.h.

Member Typedef Documentation

◆ ValueType

template<TESTNAME AttributeSelection, bool isScalar>
using gum::ConcreteLeaf< AttributeSelection, isScalar >::ValueType = typename ValueSelect< isScalar, double, Idx >::type
private

Definition at line 75 of file concreteLeaf.h.

Constructor & Destructor Documentation

◆ ConcreteLeaf()

template<TESTNAME AttributeSelection, bool isScalar>
gum::ConcreteLeaf< AttributeSelection, isScalar >::ConcreteLeaf ( NodeId leafId,
NodeDatabase< AttributeSelection, isScalar > * n1,
const Sequence< ValueType > * valueDomain )

Default constructor.

Definition at line 49 of file concreteLeaf_tpl.h.

52 :
55 }
AbstractLeaf(NodeId leafId)
Default constructor.
<agrum/FMDP/learning/datastructure/leaves/concreteLeaf.h>
const Sequence< ValueType > * _valueDomain_
NodeDatabase< AttributeSelection, isScalar > * _n1_
ConcreteLeaf(NodeId leafId, NodeDatabase< AttributeSelection, isScalar > *n1, const Sequence< ValueType > *valueDomain)
Default constructor.

References gum::AbstractLeaf::AbstractLeaf(), ConcreteLeaf(), _n1_, and _valueDomain_.

Referenced by ConcreteLeaf(), ~ConcreteLeaf(), operator delete(), and operator new().

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

◆ ~ConcreteLeaf()

template<TESTNAME AttributeSelection, bool isScalar>
gum::ConcreteLeaf< AttributeSelection, isScalar >::~ConcreteLeaf ( )
override

Default destructor.

Definition at line 58 of file concreteLeaf_tpl.h.

58 {
60 ;
61 }

References ConcreteLeaf().

Here is the call graph for this function:

Member Function Documentation

◆ _effectif_() [1/2]

template<TESTNAME AttributeSelection, bool isScalar>
double gum::ConcreteLeaf< AttributeSelection, isScalar >::_effectif_ ( Idx moda,
Int2Type< false >  ) const
private

Definition at line 85 of file concreteLeaf_tpl.h.

86 {
87 return (double)_n1_->effectif(moda);
88 }

References _n1_.

◆ _effectif_() [2/2]

template<TESTNAME AttributeSelection, bool isScalar>
double gum::ConcreteLeaf< AttributeSelection, isScalar >::_effectif_ ( Idx moda,
Int2Type< true >  ) const
private

Definition at line 79 of file concreteLeaf_tpl.h.

80 {
81 return (double)_n1_->effectif(Idx(_valueDomain_->atPos(moda)));
82 }
Size Idx
Type for indexes.
Definition types.h:79

References _n1_, and _valueDomain_.

Referenced by effectif().

Here is the caller graph for this function:

◆ _nbModa_() [1/2]

template<TESTNAME AttributeSelection, bool isScalar>
Idx gum::ConcreteLeaf< AttributeSelection, isScalar >::_nbModa_ ( Int2Type< false > ) const
private

Definition at line 106 of file concreteLeaf_tpl.h.

106 {
107 return _n1_->valueDomain();
108 }

References _n1_.

◆ _nbModa_() [2/2]

template<TESTNAME AttributeSelection, bool isScalar>
Idx gum::ConcreteLeaf< AttributeSelection, isScalar >::_nbModa_ ( Int2Type< true > ) const
private

Definition at line 101 of file concreteLeaf_tpl.h.

101 {
102 return _valueDomain_->size();
103 }

References _valueDomain_.

Referenced by nbModa().

Here is the caller graph for this function:

◆ contains()

INLINE bool gum::AbstractLeaf::contains ( NodeId testedId) const
virtualinherited

Returns true if abstractleaf has leaf in it.

Reimplemented in gum::ComposedLeaf.

Definition at line 65 of file abstractLeaf_inl.h.

65{ return _leafId_ == testedId; }

References _leafId_.

Referenced by gum::ComposedLeaf::contains(), and gum::LeafAggregator::update().

Here is the caller graph for this function:

◆ effectif()

template<TESTNAME AttributeSelection, bool isScalar>
double gum::ConcreteLeaf< AttributeSelection, isScalar >::effectif ( Idx moda) const
overridevirtual

Gaves the leaf effectif for given modality.

Implements gum::AbstractLeaf.

Definition at line 74 of file concreteLeaf_tpl.h.

74 {
76 }
double _effectif_(Idx moda, Int2Type< true >) const

References _effectif_().

Here is the call graph for this function:

◆ id()

INLINE NodeId gum::AbstractLeaf::id ( )
inherited

Definition at line 67 of file abstractLeaf_inl.h.

67{ return _leafId_; }

References _leafId_.

Referenced by gum::LeafAggregator::updateLeaf().

Here is the caller graph for this function:

◆ nbModa()

template<TESTNAME AttributeSelection, bool isScalar>
Idx gum::ConcreteLeaf< AttributeSelection, isScalar >::nbModa ( ) const
overridevirtual

Implements gum::AbstractLeaf.

Definition at line 96 of file concreteLeaf_tpl.h.

96 {
98 }
Idx _nbModa_(Int2Type< true >) const

References _nbModa_().

Here is the call graph for this function:

◆ operator delete()

template<TESTNAME AttributeSelection, bool isScalar>
void gum::ConcreteLeaf< AttributeSelection, isScalar >::operator delete ( void * p)

Default constructor.

Definition at line 69 of file concreteLeaf_tpl.h.

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

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

Here is the call graph for this function:

◆ operator new()

template<TESTNAME AttributeSelection, bool isScalar>
void * gum::ConcreteLeaf< AttributeSelection, isScalar >::operator new ( size_t s)

Allocators and Deallocators redefinition.

Definition at line 64 of file concreteLeaf_tpl.h.

64 {
66 }
void * allocate(const size_t &objectSize)
Allocates a block.

References ConcreteLeaf(), gum::SmallObjectAllocator::allocate(), and gum::SmallObjectAllocator::instance().

Here is the call graph for this function:

◆ toString()

template<TESTNAME AttributeSelection, bool isScalar>
std::string gum::ConcreteLeaf< AttributeSelection, isScalar >::toString ( )
overridevirtual

Implements gum::AbstractLeaf.

Definition at line 111 of file concreteLeaf_tpl.h.

111 {
112 return std::format("{{ Id : {}}}", this->id());
113 }

◆ total()

template<TESTNAME AttributeSelection, bool isScalar>
double gum::ConcreteLeaf< AttributeSelection, isScalar >::total ( ) const
overridevirtual

Implements gum::AbstractLeaf.

Definition at line 91 of file concreteLeaf_tpl.h.

91 {
92 return double(_n1_->nbObservation());
93 }

References _n1_.

Member Data Documentation

◆ _leafId_

NodeId gum::AbstractLeaf::_leafId_
privateinherited

Definition at line 116 of file abstractLeaf.h.

Referenced by AbstractLeaf(), contains(), and id().

◆ _n1_

template<TESTNAME AttributeSelection, bool isScalar>
NodeDatabase< AttributeSelection, isScalar >* gum::ConcreteLeaf< AttributeSelection, isScalar >::_n1_
private

Definition at line 128 of file concreteLeaf.h.

Referenced by ConcreteLeaf(), _effectif_(), _effectif_(), _nbModa_(), and total().

◆ _valueDomain_

template<TESTNAME AttributeSelection, bool isScalar>
const Sequence< ValueType >* gum::ConcreteLeaf< AttributeSelection, isScalar >::_valueDomain_
private

Definition at line 129 of file concreteLeaf.h.

Referenced by ConcreteLeaf(), _effectif_(), and _nbModa_().


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