28 #ifndef DOXYGEN_SHOULD_SKIP_THIS 37 template <
typename GUM_SCALAR >
39 MultiDimImplementation< GUM_SCALAR >* (*proj)(
40 const MultiDimImplementation< GUM_SCALAR >&,
41 const Set< const DiscreteVariable* >&)) :
42 ScheduleProjection< GUM_SCALAR >(),
49 template <
typename GUM_SCALAR >
51 const ScheduleProjectionBasic< GUM_SCALAR >& from) :
59 template <
typename GUM_SCALAR >
66 template <
typename GUM_SCALAR >
67 ScheduleProjectionBasic< GUM_SCALAR >*
69 return new ScheduleProjectionBasic< GUM_SCALAR >(*this);
73 template <
typename GUM_SCALAR >
75 const ScheduleMultiDim< GUM_SCALAR >& table,
76 const Set< const DiscreteVariable* >& del_vars,
77 Schedule< GUM_SCALAR >& schedule) {
79 ScheduleProject< GUM_SCALAR > proj(table, del_vars,
_proj);
80 schedule.insert(proj);
86 template <
typename GUM_SCALAR >
87 INLINE ScheduleMultiDim< GUM_SCALAR >
89 const MultiDimImplementation< GUM_SCALAR >& table,
90 const Set< const DiscreteVariable* >& del_vars,
91 Schedule< GUM_SCALAR >& schedule) {
96 template <
typename GUM_SCALAR >
97 template <
template <
typename >
class TABLE >
98 INLINE ScheduleMultiDim< GUM_SCALAR >
100 const TABLE< GUM_SCALAR >& table,
101 const Set< const DiscreteVariable* >& del_vars,
102 Schedule< GUM_SCALAR >& schedule) {
107 template <
typename GUM_SCALAR >
109 MultiDimImplementation< GUM_SCALAR >* (*proj)(
110 const MultiDimImplementation< GUM_SCALAR >&,
111 const Set< const DiscreteVariable* >&)) {
116 template <
typename GUM_SCALAR >
117 INLINE MultiDimImplementation< GUM_SCALAR >* (
119 const MultiDimImplementation< GUM_SCALAR >&,
120 const Set< const DiscreteVariable* >&) {
126 template <
typename GUM_SCALAR >
128 const ScheduleMultiDim< GUM_SCALAR >& table,
129 const Set< const DiscreteVariable* >& del_vars,
130 const Schedule< GUM_SCALAR >& schedule) {
131 const Sequence< const DiscreteVariable* >& vars = table.variablesSequence();
135 for (
const auto var : vars)
136 res *= var->domainSize();
143 template <
typename GUM_SCALAR >
145 const MultiDimImplementation< GUM_SCALAR >& table,
146 const Set< const DiscreteVariable* >& del_vars,
147 const Schedule< GUM_SCALAR >& schedule) {
149 table, del_vars, schedule);
154 template <
typename GUM_SCALAR >
155 template <
template <
typename >
class TABLE >
157 const TABLE< GUM_SCALAR >& table,
158 const Set< const DiscreteVariable* >& del_vars,
159 const Schedule< GUM_SCALAR >& schedule) {
161 table, del_vars, schedule);
165 template <
typename GUM_SCALAR >
167 const ScheduleMultiDim< GUM_SCALAR >& table,
168 const Set< const DiscreteVariable* >& del_vars,
169 const Schedule< GUM_SCALAR >& schedule) {
170 const Sequence< const DiscreteVariable* >& vars = table.variablesSequence();
173 for (
const auto var : vars)
174 if (!del_vars.contains(var)) {
175 if (std::numeric_limits< long >::max() / (long)var->domainSize() < res) {
176 GUM_ERROR(OutOfBounds,
"memory usage out of long int range");
179 res *= long(var->domainSize());
182 return std::pair< long, long >(res, res);
186 template <
typename GUM_SCALAR >
187 INLINE std::pair< long, long >
189 const MultiDimImplementation< GUM_SCALAR >& table,
190 const Set< const DiscreteVariable* >& del_vars,
191 const Schedule< GUM_SCALAR >& schedule) {
193 table, del_vars, schedule);
197 template <
typename GUM_SCALAR >
198 template <
template <
typename >
class TABLE >
199 INLINE std::pair< long, long >
201 const TABLE< GUM_SCALAR >& table,
202 const Set< const DiscreteVariable* >& del_vars,
203 const Schedule< GUM_SCALAR >& schedule) {
205 table, del_vars, schedule);
MultiDimImplementation< GUM_SCALAR > *(* _proj)(const MultiDimImplementation< GUM_SCALAR > &, const Set< const DiscreteVariable * > &)
the projection function actually used
ScheduleProjection()
default constructor
virtual float nbOperations(const ScheduleMultiDim< GUM_SCALAR > &table, const Set< const DiscreteVariable * > &del_vars, const Schedule< GUM_SCALAR > &schedule)
returns a rough estimate of the number of operations that will be performed to compute the projection...
ScheduleProjectionBasic(MultiDimImplementation< GUM_SCALAR > *(*proj)(const MultiDimImplementation< GUM_SCALAR > &, const Set< const DiscreteVariable * > &))
default constructor
gum is the global namespace for all aGrUM entities
virtual ~ScheduleProjectionBasic()
destructor
void setProjectFunction(MultiDimImplementation< GUM_SCALAR > *(*proj)(const MultiDimImplementation< GUM_SCALAR > &, const Set< const DiscreteVariable * > &))
changes the function used for projecting tables
virtual float nbOperations(const ScheduleMultiDim< GUM_SCALAR > &table, const Set< const DiscreteVariable * > &del_vars, const Schedule< GUM_SCALAR > &schedule)=0
returns a rough estimate of the number of operations that will be performed to compute the projection...
ScheduleMultiDim< GUM_SCALAR > project(const ScheduleMultiDim< GUM_SCALAR > &table, const Set< const DiscreteVariable * > &del_vars, Schedule< GUM_SCALAR > &schedule)
creates and returns the projection of the table over a subset of its vars
MultiDimImplementation< GUM_SCALAR > *(*)(const MultiDimImplementation< GUM_SCALAR > &, const Set< const DiscreteVariable *> &) projectFunction()
returns the projection function currently used by the projector
virtual std::pair< long, long > memoryUsage(const ScheduleMultiDim< GUM_SCALAR > &table, const Set< const DiscreteVariable * > &del_vars, const Schedule< GUM_SCALAR > &schedule)=0
returns the memory consumption used during the projection
virtual ScheduleMultiDim< GUM_SCALAR > project(const ScheduleMultiDim< GUM_SCALAR > &table, const Set< const DiscreteVariable * > &del_vars, Schedule< GUM_SCALAR > &schedule)=0
creates and returns the projection of the table over a subset of its vars
a Projection operator class used for scheduling inferences
virtual std::pair< long, long > memoryUsage(const ScheduleMultiDim< GUM_SCALAR > &table, const Set< const DiscreteVariable * > &del_vars, const Schedule< GUM_SCALAR > &schedule)
returns the memory consumption used during the projection
virtual ScheduleProjectionBasic< GUM_SCALAR > * newFactory() const
virtual constructor
#define GUM_ERROR(type, msg)