aGrUM  0.20.3
a C++ library for (probabilistic) graphical models
exactPolicy.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 Classes used to practice approximation on value
25  *
26  * @author Pierre-Henri WUILLEMIN(@LIP6) & Jean-Christophe Magnan
27  *
28  */
29 #ifndef GUM_EXACT_POLICY_H
30 #define GUM_EXACT_POLICY_H
31 #include <agrum/agrum.h>
32 
33 #include <agrum/tools/core/approximations/approximationPolicy.h>
34 
35 namespace gum {
36 
37  /**
38  * @class ExactPolicy
39  * @headerfile exactPolicy.h <agrum/tools/core/approximations/exactPolicy.h>
40  * @brief Class implementing exact approximation policy (meaning a value is
41  * approximate to itself).
42  * @ingroup approximationpolicy_group
43  *
44  * @tparam GUM_SCALAR The type used for computations.
45  */
46  template < typename GUM_SCALAR >
47  class ExactPolicy: public virtual ApproximationPolicy< GUM_SCALAR > {
48  public:
49  // ===========================================================================
50  /// @name Constructors / Destructors
51  // ===========================================================================
52  /// @{
53 
54  /**
55  * Default constructor.
56  */
57  ExactPolicy();
58 
59  /// @}
60 
61  // ===========================================================================
62  /// @name Accessors/Modifiers
63  // ===========================================================================
64  /// @{
65 
66  /**
67  * @brief Convert value to approximation representation.
68  * @param value The converted value.
69  * @return The value approximation representation.
70  */
71  INLINE GUM_SCALAR fromExact(const GUM_SCALAR& value) const;
72 
73  /**
74  * @brief Combine using addition with the given gum::ApproximationPolicy.
75  * @param ap The policy to combine with.
76  */
77  void combineAdd(const ApproximationPolicy< GUM_SCALAR >* ap);
78 
79  /**
80  * @brief Combine using substraction with the given
81  * gum::ApproximationPolicy.
82  * @param ap The policy to combine with.
83  */
84  void combineSub(const ApproximationPolicy< GUM_SCALAR >* ap);
85 
86  /**
87  * @brief Combine using multiplication with the given
88  * gum::ApproximationPolicy.
89  * @param ap The policy to combine with.
90  */
91  void combineMult(const ApproximationPolicy< GUM_SCALAR >* ap);
92 
93  /**
94  * @brief Combine using division with the given gum::ApproximationPolicy.
95  * @param ap The policy to combine with.
96  */
97  void combineDiv(const ApproximationPolicy< GUM_SCALAR >* ap);
98 
99  /**
100  * @brief Combine using max with the given gum::ApproximationPolicy.
101  * @param ap The policy to combine with.
102  */
103  void combineMax(const ApproximationPolicy< GUM_SCALAR >* ap);
104 
105  /**
106  * @brief Combine using min with the given gum::ApproximationPolicy.
107  * @param ap The policy to combine with.
108  */
109  void combineMin(const ApproximationPolicy< GUM_SCALAR >* ap);
110 
111  /// @}
112  };
113 } // namespace gum
114 
115 
116 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
117 extern template class gum::ExactPolicy< double >;
118 #endif
119 
120 
121 // Always include inlined implementation of template class
122 #include <agrum/tools/core/approximations/exactPolicy_tpl.h>
123 
124 #endif /* GUM_EXACT_POLICY_H */
void combineMult(const ApproximationPolicy< GUM_SCALAR > *ap)
Combine using multiplication with the given gum::ApproximationPolicy.
INLINE void emplace(Args &&... args)
Definition: set_tpl.h:643
void combineMax(const ApproximationPolicy< GUM_SCALAR > *ap)
Combine using max with the given gum::ApproximationPolicy.
void combineMin(const ApproximationPolicy< GUM_SCALAR > *ap)
Combine using min with the given gum::ApproximationPolicy.
INLINE GUM_SCALAR fromExact(const GUM_SCALAR &value) const
Convert value to approximation representation.
void combineDiv(const ApproximationPolicy< GUM_SCALAR > *ap)
Combine using division with the given gum::ApproximationPolicy.
void combineAdd(const ApproximationPolicy< GUM_SCALAR > *ap)
Combine using addition with the given gum::ApproximationPolicy.
void combineSub(const ApproximationPolicy< GUM_SCALAR > *ap)
Combine using substraction with the given gum::ApproximationPolicy.
ExactPolicy()
Default constructor.