aGrUM  0.14.2
multiDimCombinationDefault.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005 by Pierre-Henri WUILLEMIN et Christophe GONZALES *
3  * {prenom.nom}_at_lip6.fr *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
26 #ifndef GUM_MULTI_DIM_COMBINATION_DEFAULT_H
27 #define GUM_MULTI_DIM_COMBINATION_DEFAULT_H
28 
29 #include <agrum/core/sequence.h>
32 
33 namespace gum {
34 
35  // clang-format off
97  // clang-format on
98  template < typename GUM_SCALAR, template < typename > class TABLE >
100  : public MultiDimCombination< GUM_SCALAR, TABLE > {
101  public:
102  // ========================================================================
104  // ========================================================================
106 
114  MultiDimCombinationDefault(TABLE< GUM_SCALAR >* (*combine)(
115  const TABLE< GUM_SCALAR >&, const TABLE< GUM_SCALAR >&));
116 
120 
122  virtual ~MultiDimCombinationDefault();
123 
131 
133  // ========================================================================
135  // ========================================================================
137 
148  virtual TABLE< GUM_SCALAR >*
149  combine(const Set< const TABLE< GUM_SCALAR >* >& set);
150  virtual void combine(TABLE< GUM_SCALAR >& container,
151  const Set< const TABLE< GUM_SCALAR >* >& set);
152 
154  virtual void setCombineFunction(TABLE< GUM_SCALAR >* (*combine)(
155  const TABLE< GUM_SCALAR >&, const TABLE< GUM_SCALAR >&));
156 
158  virtual TABLE< GUM_SCALAR >* (*combineFunction())(const TABLE< GUM_SCALAR >&,
159  const TABLE< GUM_SCALAR >&);
160 
165  virtual float nbOperations(const Set< const TABLE< GUM_SCALAR >* >& set) const;
166  virtual float nbOperations(
167  const Set< const Sequence< const DiscreteVariable* >* >& set) const;
168 
180  virtual std::pair< long, long >
181  memoryUsage(const Set< const TABLE< GUM_SCALAR >* >& set) const;
182  virtual std::pair< long, long > memoryUsage(
183  const Set< const Sequence< const DiscreteVariable* >* >& set) const;
184 
186 
187  protected:
189  TABLE< GUM_SCALAR >* (*_combine)(const TABLE< GUM_SCALAR >& t1,
190  const TABLE< GUM_SCALAR >& t2);
191 
197  const Sequence< const DiscreteVariable* >& seq2) const;
198  };
199 
200 } /* namespace gum */
201 
202 // always include the template implementation
204 
205 #endif /* GUM_MULTI_DIM_COMBINATION_DEFAULT_H */
A class to combine efficiently several MultiDim tablesMultiDimCombinationDefault is a class designed ...
A generic class to combine efficiently several MultiDim tables.
Base class for discrete random variable.
Header file of gum::Sequence, a class for storing (ordered) sequences of objects. ...
virtual std::pair< long, long > memoryUsage(const Set< const TABLE< GUM_SCALAR > * > &set) const
Returns the additional memory consumption used during the combination.
The generic class for storing (ordered) sequences of objects.
Definition: sequence.h:1019
virtual TABLE< GUM_SCALAR > *(*)(const TABLE< GUM_SCALAR > &, const TABLE< GUM_SCALAR > &) combineFunction()
Returns the combination function currently used by the combinator.
virtual void setCombineFunction(TABLE< GUM_SCALAR > *(*combine)(const TABLE< GUM_SCALAR > &, const TABLE< GUM_SCALAR > &))
Changes the function used for combining two TABLES.
gum is the global namespace for all aGrUM entities
Definition: agrum.h:25
Representation of a setA Set is a structure that contains arbitrary elements.
Definition: set.h:162
virtual float nbOperations(const Set< const TABLE< GUM_SCALAR > * > &set) const
returns a rough estimate of the number of operations that will be performed to compute the combinatio...
Size _combinedSize(const Sequence< const DiscreteVariable * > &seq1, const Sequence< const DiscreteVariable * > &seq2) const
returns the domain size of the Cartesian product of the union of all the variables in seq1 and seq2...
virtual MultiDimCombinationDefault< GUM_SCALAR, TABLE > * newFactory() const
virtual constructor
A generic interface to combine efficiently several MultiDim tables.
MultiDimCombinationDefault(TABLE< GUM_SCALAR > *(*combine)(const TABLE< GUM_SCALAR > &, const TABLE< GUM_SCALAR > &))
Default constructor.
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition: types.h:45
virtual ~MultiDimCombinationDefault()
Destructor.
virtual TABLE< GUM_SCALAR > * combine(const Set< const TABLE< GUM_SCALAR > * > &set)
Creates and returns the result of the combination of the tables within set.