aGrUM  0.16.0
simpleUTGenerator.cpp
Go to the documentation of this file.
1 
30 
31 namespace gum {
32 
33  // Default constructor.
35 
36  // Destructor.
38 
39  // Generates a UT using floats.
40  // @param varID The variable id of the UT owner.
41  // @param ut A reference on the UT to fill.
43  const Potential< float >& ut) {
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  }
51 
52  // Generates a UT using doubles.
53  // @param varID The variable id of the UT owner.
54  // @param ut A reference on the UT to fill.
56  const Potential< double >& ut) {
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  }
64 
65 } /* namespace gum */
aGrUM&#39;s Potential is a multi-dimensional array with tensor operators.
Definition: potential.h:60
Class for generating Utility Tables.
virtual Size domainSize() const final
Returns the product of the variables domain size.
SimpleUTGenerator()
Default constructor.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Definition: agrum.h:25
virtual void populate(const std::vector< GUM_SCALAR > &v) const final
Automatically fills this MultiDimContainer with the values in v.
virtual void generateUT(const Idx &varId, const Potential< float > &ut)
Generates a UT using floats.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
virtual ~SimpleUTGenerator()
Destructor.
Size Idx
Type for indexes.
Definition: types.h:53
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition: types.h:48