aGrUM  0.21.0
a C++ library for (probabilistic) graphical models
multiDimCompleteProjection.h
Go to the documentation of this file.
1 /**
2  *
3  * Copyright (c) 2005-2021 by 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 >&, Instantiation*));
57 
58  /// Copy constructor
60 
61  /// Destructor
62  virtual ~MultiDimCompleteProjection();
63 
64  /**
65  * @brief Virtual constructor
66  *
67  * @return a new fresh MultiDimCombinator with the same projection
68  * function.
69  */
71 
72  /// @}
73  // ========================================================================
74  /// @name Accessors/Modifiers
75  // ========================================================================
76  /// @{
77 
78  /// Creates and returns the projection of the table over all of its vars
79  GUM_SCALAR project(const TABLE< GUM_SCALAR >& table, Instantiation* instantiation = 0);
80 
81  /// Changes the function used for projecting TABLES
82  void setProjectFunction(GUM_SCALAR (*proj)(const TABLE< GUM_SCALAR >&, Instantiation*));
83 
84  /// Returns the projection function currently used by the projector
85  GUM_SCALAR(*projectFunction())
86  (const TABLE< GUM_SCALAR >&, Instantiation*);
87 
88  /// @}
89 
90  protected:
91  /// The projection function actually used
92  GUM_SCALAR (*proj_)(const TABLE< GUM_SCALAR >&, Instantiation*);
93 
94  private:
95  /// Forbid copy operators
98  };
99 
100 } /* namespace gum */
101 
102 // always include the template implementation
103 #include <agrum/tools/multidim/utils/operators/multiDimCompleteProjection_tpl.h>
104 
105 #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:643
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.