aGrUM  0.20.3
a C++ library for (probabilistic) graphical models
multiDimPartialInstantiation.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  * @brief Headers of MultiDimPartialInstantiation.
25  *
26  * @author Christophe GONZALES(@AMU) and Pierre-Henri WUILLEMIN(@LIP6)
27  */
28 #ifndef GUM_MULTI_DIM_PARTIAL_INSTANTIATION_H
29 #define GUM_MULTI_DIM_PARTIAL_INSTANTIATION_H
30 
31 #include <agrum/tools/core/set.h>
32 #include <agrum/tools/multidim/implementations/multiDimDecorator.h>
33 #include <agrum/tools/multidim/implementations/multiDimImplementation.h>
34 #include <agrum/tools/multidim/utils/partialInstantiationRegister4MultiDim.h>
35 #include <agrum/tools/variables/discreteVariable.h>
36 #include <utility>
37 
38 namespace gum {
39 
40  /**
41  * @class MultiDimPartialInstantiation
42  * @ingroup multidim_group
43  *
44  * @warning Doxygen does not like spanning command on multiple line, so we
45  * could not configure it with the correct include directive. Use the
46  * following code snippet to include this file.
47  * @code
48  * #include <agrum/tools/multidim/implementations/multiDimPartialInstantiation.h>
49  * @endcode
50  *
51  * @brief A generic class to instantiate a subset of variables of a
52  * multidimensional table.
53  *
54  * @tparam GUM_SCALAR The type of scalars stored in this multidimensional
55  * table.
56  * @tparam Table The class of multidimensional table to use.
57  */
58  template < typename GUM_SCALAR, template < typename > class TABLE >
60  public:
61  // =========================================================================
62  /// @name Constructors, Destructors and Copy
63  // =========================================================================
64  /// @{
65 
66  /**
67  * @brief Default constructor.
68  */
70 
71  /**
72  * @brief Copy constructor.
73  * @param src The MultiDimPartialInstantiation to copy.
74  */
75  MultiDimPartialInstantiation(const MultiDimPartialInstantiation< GUM_SCALAR, TABLE >& src);
76 
77  /**
78  * @brief Class destructor.
79  */
81 
82  /**
83  * @brief Copy operator.
84  * @param src The MultiDimPartialInstantiation to copy.
85  * @return Returns this MultiDimPartialInstantiation.
86  */
89 
90  /// @}
91  // =========================================================================
92  /// @name inherited methdods
93  // =========================================================================
94  /// @{
95 
97 
98  /// @}
99  // =========================================================================
100  /// @name Accessors/Modifiers
101  // =========================================================================
102  /// @{
103 
104  /**
105  * @brief Creates and returns the partial instantiation of the table over a
106  * subset of its variables.
107  *
108  * @warning If inst_vars is precisely equal to the variables of table, the
109  * result is an empty table.
110  *
111  * @param table The table to parially instantiate.
112  * @param inst_vars A mapping between variables and their instantiation.
113  *
114  * @return A new freshly created TABLE which is the result of the
115  * instantiation of a subset of the variables of the TABLE passed in
116  * argument.
117  */
118  TABLE< GUM_SCALAR >* instantiate(const TABLE< GUM_SCALAR >& table,
119  const HashTable< const DiscreteVariable*, Idx >& inst_vars);
120 
121  /**
122  * @brief Creates and returns the partial instantiation of the table over a
123  * subset of its variables.
124  *
125  * @warning If inst_vars is precisely equal to the variables of table, the
126  * result is an empty table.
127  *
128  * @param container Placeholder of the instantiation of table given
129  * inst_vars.
130  * @param table The table to parially instantiate.
131  * @param inst_vars A mapping between variables and their instantiation.
132  */
133  void instantiate(TABLE< GUM_SCALAR >& container,
134  const TABLE< GUM_SCALAR >& table,
135  const HashTable< const DiscreteVariable*, Idx >& inst_vars);
136 
137  /// @}
138  };
139 
140 } /* namespace gum */
141 
142 // always include the template implementation
143 #include <agrum/tools/multidim/implementations/multiDimPartialInstantiation_tpl.h>
144 
145 #endif /* GUM_MULTI_DIM_PARTIAL_INSTANTIATION_H */
virtual ~MultiDimPartialInstantiation()
Class destructor.
MultiDimPartialInstantiation(const MultiDimPartialInstantiation< GUM_SCALAR, TABLE > &src)
Copy constructor.
INLINE void emplace(Args &&... args)
Definition: set_tpl.h:643
MultiDimPartialInstantiation()
Default constructor.
MultiDimPartialInstantiation< GUM_SCALAR, TABLE > & operator=(const MultiDimPartialInstantiation< GUM_SCALAR, TABLE > &src)
Copy operator.
TABLE< GUM_SCALAR > * instantiate(const TABLE< GUM_SCALAR > &table, const HashTable< const DiscreteVariable *, Idx > &inst_vars)
Creates and returns the partial instantiation of the table over a subset of its variables.
void instantiate(TABLE< GUM_SCALAR > &container, const TABLE< GUM_SCALAR > &table, const HashTable< const DiscreteVariable *, Idx > &inst_vars)
Creates and returns the partial instantiation of the table over a subset of its variables.
A generic class to instantiate a subset of variables of a multidimensional table. ...
virtual MultiDimPartialInstantiation< GUM_SCALAR, TABLE > * newFactory() const