aGrUM  0.20.2
a C++ library for (probabilistic) graphical models
multiDimCompleteProjection.h
Go to the documentation of this file.
1 /**
2  *
3  * Copyright 2005-2020 Pierre-Henri WUILLEMIN(@LIP6) & Christophe GONZALES(@AMU)
4  * info_at_agrum_dot_org
5  *
6  * This library is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this library. If not, see <http://www.gnu.org/licenses/>.
18  *
19  */
20 
21 
22 /**
23  * @file
24  *
25  * @author Christophe GONZALES(@AMU) and Pierre-Henri WUILLEMIN(@LIP6)
26  */
27 
28 #ifndef GUM_MULTI_DIM_COMPLETE_PROJECTION_H
29 #define GUM_MULTI_DIM_COMPLETE_PROJECTION_H
30 
31 #include <agrum/tools/core/set.h>
32 #include <agrum/tools/multidim/instantiation.h>
33 #include <agrum/tools/variables/discreteVariable.h>
34 #include <utility>
35 
36 namespace gum {
37 
38  // clang-format off
39  /** @class MultiDimCompleteProjection
40  * @headerfile multiDimCompleteProjection.h <agrum/tools/multidim/operators/multiDimCompleteProjection.h>
41  * @ingroup multidim_op_group
42  *
43  * @brief A generic class to project efficiently a MultiDim table over all
44  * of its variables
45  */
46  // clang-format on
47  template < typename GUM_SCALAR, template < typename > class TABLE >
49  public:
50  // ========================================================================
51  /// @name Constructors / Destructors
52  // ========================================================================
53  /// @{
54 
55  /// Default constructor
56  MultiDimCompleteProjection(GUM_SCALAR (*proj)(const TABLE< GUM_SCALAR >&,
57  Instantiation*));
58 
59  /// Copy constructor
62 
63  /// Destructor
64  virtual ~MultiDimCompleteProjection();
65 
66  /**
67  * @brief Virtual constructor
68  *
69  * @return a new fresh MultiDimCombinator with the same projection
70  * function.
71  */
73 
74  /// @}
75  // ========================================================================
76  /// @name Accessors/Modifiers
77  // ========================================================================
78  /// @{
79 
80  /// Creates and returns the projection of the table over all of its vars
81  GUM_SCALAR project(const TABLE< GUM_SCALAR >& table,
82  Instantiation* instantiation = 0);
83 
84  /// Changes the function used for projecting TABLES
85  void setProjectFunction(GUM_SCALAR (*proj)(const TABLE< GUM_SCALAR >&,
86  Instantiation*));
87 
88  /// Returns the projection function currently used by the projector
89  GUM_SCALAR(*projectFunction())
90  (const TABLE< GUM_SCALAR >&, Instantiation*);
91 
92  /// @}
93 
94  protected:
95  /// The projection function actually used
96  GUM_SCALAR (*proj_)(const TABLE< GUM_SCALAR >&, Instantiation*);
97 
98  private:
99  /// Forbid copy operators
102  };
103 
104 } /* namespace gum */
105 
106 // always include the template implementation
107 #include <agrum/tools/multidim/utils/operators/multiDimCompleteProjection_tpl.h>
108 
109 #endif /* GUM_MULTI_DIM_COMPLETE_PROJECTION_H */
A generic class to project efficiently a MultiDim table over all of its variables.
virtual MultiDimCompleteProjection< GUM_SCALAR, TABLE > * newFactory() const
Virtual constructor.
MultiDimCompleteProjection< GUM_SCALAR, TABLE > & operator=(const MultiDimCompleteProjection< GUM_SCALAR, TABLE > &)
Forbid copy operators.
INLINE void emplace(Args &&... args)
Definition: set_tpl.h:669
virtual ~MultiDimCompleteProjection()
Destructor.
MultiDimCompleteProjection(const MultiDimCompleteProjection< GUM_SCALAR, TABLE > &)
Copy constructor.
GUM_SCALAR project(const TABLE< GUM_SCALAR > &table, Instantiation *instantiation=0)
Creates and returns the projection of the table over all of its vars.
void setProjectFunction(GUM_SCALAR(*proj)(const TABLE< GUM_SCALAR > &, Instantiation *))
Changes the function used for projecting TABLES.
MultiDimCompleteProjection(GUM_SCALAR(*proj)(const TABLE< GUM_SCALAR > &, Instantiation *))
Default constructor.