aGrUM  0.14.2
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. More...
 
virtual ~SimpleUTGenerator ()
 Destructor. More...
 
UT generation methods
virtual void generateUT (const Idx &varId, const Potential< float > &ut)
 Generates a UT using floats. More...
 
virtual void generateUT (const Idx &varId, const Potential< double > &ut)
 Generates a UT using doubles. More...
 

Detailed Description

Class for generating Utility Tables.

This class implements a CPTGenerator UT generation algorithm.

Definition at line 40 of file simpleUTGenerator.h.

Constructor & Destructor Documentation

◆ SimpleUTGenerator()

gum::SimpleUTGenerator::SimpleUTGenerator ( )

Default constructor.

Definition at line 31 of file simpleUTGenerator.cpp.

31 { GUM_CONSTRUCTOR(SimpleUTGenerator); }
SimpleUTGenerator()
Default constructor.

◆ ~SimpleUTGenerator()

gum::SimpleUTGenerator::~SimpleUTGenerator ( )
virtual

Destructor.

Definition at line 34 of file simpleUTGenerator.cpp.

34 { GUM_DESTRUCTOR(SimpleUTGenerator); }
SimpleUTGenerator()
Default constructor.

Member Function Documentation

◆ generateUT() [1/2]

void gum::SimpleUTGenerator::generateUT ( const Idx varId,
const Potential< 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 39 of file simpleUTGenerator.cpp.

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

40  {
41  std::vector< float > v;
42 
43  for (Size i = 0; i < ut.domainSize(); ++i)
44  v.push_back((float)rand() * 1000);
45 
46  ut.populate(v);
47  }
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition: types.h:45
+ Here is the call graph for this function:

◆ generateUT() [2/2]

void gum::SimpleUTGenerator::generateUT ( const Idx varId,
const Potential< 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 52 of file simpleUTGenerator.cpp.

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

53  {
54  std::vector< double > v;
55 
56  for (Size i = 0; i < ut.domainSize(); ++i)
57  v.push_back((double)rand() * 1000);
58 
59  ut.populate(v);
60  }
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition: types.h:45
+ Here is the call graph for this function:

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