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

Class for generating Utility Tables. More...

#include <simpleUTGenerator.h>

Inheritance diagram for gum::SimpleUTGenerator:
Collaboration diagram for gum::SimpleUTGenerator:

Public Member Functions

Constructors / Destructor
 SimpleUTGenerator ()
 Default constructor.
virtual ~SimpleUTGenerator ()
 Destructor.
UT generation methods
virtual void generateUT (const Idx &varId, const Tensor< float > &ut)
 Generates a UT using floats.
virtual void generateUT (const Idx &varId, const Tensor< double > &ut)
 Generates a UT using doubles.

Detailed Description

Class for generating Utility Tables.

This class implements a CPTGenerator UT generation algorithm.

Definition at line 63 of file simpleUTGenerator.h.

Constructor & Destructor Documentation

◆ SimpleUTGenerator()

gum::SimpleUTGenerator::SimpleUTGenerator ( )

Default constructor.

Definition at line 54 of file simpleUTGenerator.cpp.

54 {
55 GUM_CONSTRUCTOR(SimpleUTGenerator);
56 ;
57 }
SimpleUTGenerator()
Default constructor.

References SimpleUTGenerator().

Referenced by SimpleUTGenerator(), and ~SimpleUTGenerator().

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

◆ ~SimpleUTGenerator()

gum::SimpleUTGenerator::~SimpleUTGenerator ( )
virtual

Destructor.

Definition at line 60 of file simpleUTGenerator.cpp.

60 {
61 GUM_DESTRUCTOR(SimpleUTGenerator);
62 ;
63 }

References SimpleUTGenerator().

Here is the call graph for this function:

Member Function Documentation

◆ generateUT() [1/2]

void gum::SimpleUTGenerator::generateUT ( const Idx & varId,
const Tensor< double > & ut )
virtual

Generates a UT using doubles.

Parameters
varIdThe variable id of the UT owner.
utA reference on the UT to fill.

Implements gum::UTGenerator.

Definition at line 80 of file simpleUTGenerator.cpp.

80 {
81 std::vector< double > v;
82
83 for (Size i = 0; i < ut.domainSize(); ++i)
84 v.push_back((double)gum::randomProba() * 1000);
85
86 ut.populate(v);
87 }
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition types.h:74
double randomProba()
Returns a random double between 0 and 1 included (i.e.

References gum::MultiDimDecorator< GUM_SCALAR >::domainSize(), gum::MultiDimDecorator< GUM_SCALAR >::populate(), and gum::randomProba().

Here is the call graph for this function:

◆ generateUT() [2/2]

void gum::SimpleUTGenerator::generateUT ( const Idx & varId,
const Tensor< float > & ut )
virtual

Generates a UT using floats.

Parameters
varIdThe variable id of the UT owner.
utA reference on the UT to fill.

Implements gum::UTGenerator.

Definition at line 68 of file simpleUTGenerator.cpp.

68 {
69 std::vector< float > v;
70
71 for (Size i = 0; i < ut.domainSize(); ++i)
72 v.push_back((float)gum::randomProba() * 1000);
73
74 ut.populate(v);
75 }

References gum::MultiDimDecorator< GUM_SCALAR >::domainSize(), gum::MultiDimDecorator< GUM_SCALAR >::populate(), and gum::randomProba().

Here is the call graph for this function:

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