aGrUM  0.14.2
multiDimProjection.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  ***************************************************************************/
25 #ifndef GUM_MULTI_DIM_PROJECTION_H
26 #define GUM_MULTI_DIM_PROJECTION_H
27 
28 #include <utility>
29 
30 #include <agrum/core/sequence.h>
31 #include <agrum/core/set.h>
33 
34 namespace gum {
35 
36  // clang-format off
84  // clang-format on
85  template < typename GUM_SCALAR, template < typename > class TABLE >
87  public:
88  // ========================================================================
90  // ========================================================================
92 
94  MultiDimProjection(TABLE< GUM_SCALAR >* (*proj)(
95  const TABLE< GUM_SCALAR >&, const Set< const DiscreteVariable* >&));
96 
99 
101  virtual ~MultiDimProjection();
102 
110 
112  // ========================================================================
114  // ========================================================================
116 
128  TABLE< GUM_SCALAR >* project(const TABLE< GUM_SCALAR >& table,
129  const Set< const DiscreteVariable* >& del_vars);
130 
131  void project(TABLE< GUM_SCALAR >& container,
132  const TABLE< GUM_SCALAR >& table,
133  const Set< const TABLE< GUM_SCALAR >* >& del_vars);
134 
136  void setProjectFunction(TABLE< GUM_SCALAR >* (*proj)(
137  const TABLE< GUM_SCALAR >&, const Set< const DiscreteVariable* >&));
138 
140  TABLE< GUM_SCALAR >* (*projectFunction())(
141  const TABLE< GUM_SCALAR >&, const Set< const DiscreteVariable* >&);
142 
147  float nbOperations(const TABLE< GUM_SCALAR >& table,
148  const Set< const DiscreteVariable* >& del_vars) const;
149 
155  const Set< const DiscreteVariable* >& del_vars) const;
156 
169  std::pair< long, long >
170  memoryUsage(const TABLE< GUM_SCALAR >& table,
171  const Set< const DiscreteVariable* >& del_vars) const;
172 
185  std::pair< long, long >
187  const Set< const DiscreteVariable* >& del_vars) const;
188 
190 
191  protected:
193  TABLE< GUM_SCALAR >* (*_proj)(const TABLE< GUM_SCALAR >&,
195 
196  private:
200  };
201 
202 } /* namespace gum */
203 
204 // always include the template implementation
206 
207 #endif /* GUM_MULTI_DIM_PROJECTION_H */
TABLE< GUM_SCALAR > *(*)(const TABLE< GUM_SCALAR > &, const Set< const DiscreteVariable *> &) projectFunction()
Returns the projection function currently used by the projector.
Base class for discrete random variable.
Header file of gum::Sequence, a class for storing (ordered) sequences of objects. ...
Sets of elements (i.e.
The generic class for storing (ordered) sequences of objects.
Definition: sequence.h:1019
MultiDimProjection(TABLE< GUM_SCALAR > *(*proj)(const TABLE< GUM_SCALAR > &, const Set< const DiscreteVariable * > &))
Default constructor.
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
A generic interface to project efficiently a MultiDim table over a subset of its variables.
std::pair< long, long > memoryUsage(const TABLE< GUM_SCALAR > &table, const Set< const DiscreteVariable * > &del_vars) const
Returns the memory consumption used during the projection.
virtual MultiDimProjection< GUM_SCALAR, TABLE > * newFactory() const
virtual constructor
virtual ~MultiDimProjection()
Destructor.
MultiDimProjection< GUM_SCALAR, TABLE > & operator=(const MultiDimProjection< GUM_SCALAR, TABLE > &)
Forbid copy operators.
float nbOperations(const TABLE< GUM_SCALAR > &table, const Set< const DiscreteVariable * > &del_vars) const
returns a rough estimate of the number of operations that will be performed to compute the projection...
A generic class to project efficiently a MultiDim table over a subset of its variables.
void setProjectFunction(TABLE< GUM_SCALAR > *(*proj)(const TABLE< GUM_SCALAR > &, const Set< const DiscreteVariable * > &))
Changes the function used for projecting TABLES.
TABLE< GUM_SCALAR > * project(const TABLE< GUM_SCALAR > &table, const Set< const DiscreteVariable * > &del_vars)
Creates and returns the projection of the table over a subset of its vars.