aGrUM  0.20.3
a C++ library for (probabilistic) graphical models
scheduleDeleteMultiDim.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 /** @file
23  * @brief a MultiDim Delete operator class used for scheduling inferences
24  *
25  * @author Christophe GONZALES(@AMU) and Pierre-Henri WUILLEMIN(@LIP6)
26  */
27 
28 #ifndef GUM_SCHEDULE_DELETE_MULTI_DIM_H
29 #define GUM_SCHEDULE_DELETE_MULTI_DIM_H
30 
31 #include <string>
32 
33 #include <agrum/agrum.h>
34 
35 #include <agrum/tools/core/sequence.h>
36 #include <agrum/tools/graphicalModels/inference/scheduler/scheduleMultiDim.h>
37 #include <agrum/tools/graphicalModels/inference/scheduler/scheduleOperation.h>
38 #include <agrum/tools/multidim/implementations/multiDimImplementation.h>
39 
40 namespace gum {
41 
42  template < typename GUM_SCALAR >
43 
45  public:
46  // ############################################################################
47  /// @name Constructors / Destructors
48  // ############################################################################
49  /// @{
50 
51  /// default constructor
52  /** @warning the table is stored by copy into the ScheduleDeleteMultiDim.
53  * This is actually compulsory for the appropriate use of
54  * ScheduleCombination classes */
55  explicit ScheduleDeleteMultiDim(const ScheduleMultiDim< GUM_SCALAR >& table);
56 
57  /// copy constructor
58  ScheduleDeleteMultiDim(const ScheduleDeleteMultiDim< GUM_SCALAR >&);
59 
60  /// virtual copy constructor: creates a clone of the operation
61  virtual ScheduleDeleteMultiDim< GUM_SCALAR >* newFactory() const;
62 
63  /// destructor
64  virtual ~ScheduleDeleteMultiDim();
65 
66  /// @}
67 
68  // ############################################################################
69  /// @name Operators
70  // ############################################################################
71  /// @{
72 
73  /// copy operator
74  ScheduleDeleteMultiDim< GUM_SCALAR >& operator=(const ScheduleDeleteMultiDim< GUM_SCALAR >&);
75 
76  /// operator ==
77  /** Two operations are identical if and only if they have the same
78  * arguments and their types are identical (combine, project, etc) */
79  bool operator==(const ScheduleOperation< GUM_SCALAR >&) const;
80 
81  /// operator !=
82  /** Two operations are identical if and only if they have the same
83  * arguments and their types are identical (combine, project, etc) */
84  bool operator!=(const ScheduleOperation< GUM_SCALAR >&) const;
85 
86  /// @}
87 
88  // ############################################################################
89  /// @name Accessors/Modifiers
90  // ############################################################################
91  /// @{
92 
93  /// executes the operation
94  void execute();
95 
96  /** @brief returns an estimation of the number of elementary operations
97  * needed to perform the ScheduleOperation */
98  float nbOperations() const;
99 
100  /// returns the memory consumption used during the operation
101  /** Actually, this function does not return a precise account of the memory
102  * used by the ScheduleOperation but a rough estimate based on the sizes
103  * of the tables involved in the operation.
104  * @return a pair of memory consumption: the first one is the maximum
105  * amount of memory used during the operation and the second one is the
106  * amount of memory still used at the end of the function ( the memory used
107  * by
108  * the resulting table ) */
109  std::pair< long, long > memoryUsage() const;
110 
111  /// returns the set of multidims passed in argument to the operation
112  const Sequence< const ScheduleMultiDim< GUM_SCALAR >* >& multiDimArgs() const;
113 
114  /// returns the set of multidims that should be the result of the operation
115  const Sequence< const ScheduleMultiDim< GUM_SCALAR >* >& multiDimResults() const;
116 
117  /// displays the content of the operation
118  std::string toString() const;
119 
120  /// @}
121 
122  private:
123  // the table to delete
125 
126  /// the set of ScheduleMultidims passed in arguments
128  };
129 
130 } /* namespace gum */
131 
132 // always include the template implementation
133 #include <agrum/tools/graphicalModels/inference/scheduler/scheduleDeleteMultiDim_tpl.h>
134 
135 #endif /* GUM_SCHEDULE_DELETE_MULTI_DIM_H */
std::string toString() const
displays the content of the operation
Sequence< const ScheduleMultiDim< GUM_SCALAR > *> * _args_
the set of ScheduleMultidims passed in arguments
INLINE void emplace(Args &&... args)
Definition: set_tpl.h:643
const Sequence< const ScheduleMultiDim< GUM_SCALAR > *> & multiDimResults() const
returns the set of multidims that should be the result of the operation
ScheduleMultiDim< GUM_SCALAR > _table_
std::pair< long, long > memoryUsage() const
returns the memory consumption used during the operation
virtual ~ScheduleDeleteMultiDim()
destructor
ScheduleDeleteMultiDim(const ScheduleMultiDim< GUM_SCALAR > &table)
default constructor
void execute()
executes the operation
float nbOperations() const
returns an estimation of the number of elementary operations needed to perform the ScheduleOperation ...
ScheduleDeleteMultiDim(const ScheduleDeleteMultiDim< GUM_SCALAR > &)
copy constructor
ScheduleDeleteMultiDim< GUM_SCALAR > & operator=(const ScheduleDeleteMultiDim< GUM_SCALAR > &)
copy operator
virtual ScheduleDeleteMultiDim< GUM_SCALAR > * newFactory() const
virtual copy constructor: creates a clone of the operation
const Sequence< const ScheduleMultiDim< GUM_SCALAR > *> & multiDimArgs() const
returns the set of multidims passed in argument to the operation
bool operator==(const ScheduleOperation< GUM_SCALAR > &) const
operator ==
bool operator!=(const ScheduleOperation< GUM_SCALAR > &) const
operator !=