aGrUM  0.16.0
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 43 of file simpleUTGenerator.h.

Constructor & Destructor Documentation

◆ SimpleUTGenerator()

gum::SimpleUTGenerator::SimpleUTGenerator ( )

Default constructor.

Definition at line 34 of file simpleUTGenerator.cpp.

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

◆ ~SimpleUTGenerator()

gum::SimpleUTGenerator::~SimpleUTGenerator ( )
virtual

Destructor.

Definition at line 37 of file simpleUTGenerator.cpp.

37 { 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 42 of file simpleUTGenerator.cpp.

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

43  {
44  std::vector< float > v;
45 
46  for (Size i = 0; i < ut.domainSize(); ++i)
47  v.push_back((float)rand() * 1000);
48 
49  ut.populate(v);
50  }
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition: types.h:48
+ 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 55 of file simpleUTGenerator.cpp.

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

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

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