aGrUM  0.20.2
a C++ library for (probabilistic) graphical models
multiDimFunctionGraphProjector.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  * @brief Class used to compute the projection of a function graph
25  *
26  * @author Pierre-Henri WUILLEMIN(@LIP6) and Jean-Christophe MAGNAN and Christophe
27  * GONZALES(@AMU)
28  * @author Christophe GONZALES(@AMU) and Pierre-Henri WUILLEMIN(@LIP6)
29  */
30 
31 #ifndef GUM_MULTI_DIM_FUNCTION_GRAPH_PROJECTOR_H
32 #define GUM_MULTI_DIM_FUNCTION_GRAPH_PROJECTOR_H
33 
34 #include <functional>
35 
36 #include <agrum/tools/multidim/implementations/multiDimFunctionGraph.h>
37 #include <agrum/tools/multidim/utils/FunctionGraphUtilities/terminalNodePolicies/ExactTerminalNodePolicy.h>
38 
39 namespace gum {
40 
41  // clang-format off
42  /**
43  * @class MultiDimFunctionGraphProjector
44  * @headerfile multiDimFunctionGraphProjector.h <agrum/tools/multidim/patterns/multiDimFunctionGraphProjector.h>
45  * @ingroup multidim_group
46  *
47  * @brief Class used to perform Function Graph projections
48  */
49  // clang-format on
50  template < typename GUM_SCALAR,
51  template < typename >
52  class FUNCTOR,
53  template < typename > class TerminalNodePolicy
56  public:
57  // ============================================================================
58  /// @name Constructors / Destructors
59  // ============================================================================
60  /// @{
61 
62  /**
63  * @brief Default constructor.
64  */
66  const MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy >* src,
67  const Set< const DiscreteVariable* >& delVars,
68  const GUM_SCALAR neutral);
69 
70  /**
71  * @brief Default destructor.
72  */
74 
75  /// @}
76  // ============================================================================
77  /// @name Main Method
78  // ============================================================================
79  /// @{
80 
81  /**
82  * @brief Computes and builds the Function Graph that is the result of the
83  * Projection.
84  */
86 
87  /// @}
88 
89  private:
90  /// One of the two function graphs used for the Projection
92 
93  /// The list of variables on which the projection is performed
94  const Set< const DiscreteVariable* >& delVars__;
95 
96  /// The resulting function graph
98 
99  /// The function to be performed on the leaves
100  const FUNCTOR< GUM_SCALAR > function__;
101 
102  /// The function to be performed on the leaves
103  const GUM_SCALAR neutral__;
104  };
105 
106 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
107  extern template class MultiDimFunctionGraphProjector< double, std::plus >;
108 #endif
109 
110 } // namespace gum
111 
112 #include <agrum/tools/multidim/utils/FunctionGraphUtilities/operators/multiDimFunctionGraphProjector_tpl.h>
113 
114 #endif // GUM_MULTI_DIM_FUNCTION_GRAPH_PROJECTOR_H
INLINE void emplace(Args &&... args)
Definition: set_tpl.h:669
const FUNCTOR< GUM_SCALAR > function__
The function to be performed on the leaves.
MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy > * project()
Computes and builds the Function Graph that is the result of the Projection.
const GUM_SCALAR neutral__
The function to be performed on the leaves.
MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy > * rd__
The resulting function graph.
MultiDimFunctionGraphProjector(const MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy > *src, const Set< const DiscreteVariable * > &delVars, const GUM_SCALAR neutral)
Default constructor.
const Set< const DiscreteVariable *> & delVars__
The list of variables on which the projection is performed.
Class used to perform Function Graph projections.
const MultiDimFunctionGraph< GUM_SCALAR, TerminalNodePolicy > * src__
One of the two function graphs used for the Projection.