31 #ifndef DOXYGEN_SHOULD_SKIP_THIS 40 template <
typename GUM_SCALAR >
42 MultiDimImplementation< GUM_SCALAR >* (*proj)(
43 const MultiDimImplementation< GUM_SCALAR >&,
44 const Set< const DiscreteVariable* >&)) :
45 ScheduleProjection< GUM_SCALAR >(),
52 template <
typename GUM_SCALAR >
54 const ScheduleProjectionBasic< GUM_SCALAR >& from) :
62 template <
typename GUM_SCALAR >
69 template <
typename GUM_SCALAR >
70 ScheduleProjectionBasic< GUM_SCALAR >*
72 return new ScheduleProjectionBasic< GUM_SCALAR >(*this);
76 template <
typename GUM_SCALAR >
78 const ScheduleMultiDim< GUM_SCALAR >& table,
79 const Set< const DiscreteVariable* >& del_vars,
80 Schedule< GUM_SCALAR >& schedule) {
82 ScheduleProject< GUM_SCALAR > proj(table, del_vars,
_proj);
83 schedule.insert(proj);
89 template <
typename GUM_SCALAR >
90 INLINE ScheduleMultiDim< GUM_SCALAR >
92 const MultiDimImplementation< GUM_SCALAR >& table,
93 const Set< const DiscreteVariable* >& del_vars,
94 Schedule< GUM_SCALAR >& schedule) {
99 template <
typename GUM_SCALAR >
100 template <
template <
typename >
class TABLE >
101 INLINE ScheduleMultiDim< GUM_SCALAR >
103 const TABLE< GUM_SCALAR >& table,
104 const Set< const DiscreteVariable* >& del_vars,
105 Schedule< GUM_SCALAR >& schedule) {
110 template <
typename GUM_SCALAR >
112 MultiDimImplementation< GUM_SCALAR >* (*proj)(
113 const MultiDimImplementation< GUM_SCALAR >&,
114 const Set< const DiscreteVariable* >&)) {
119 template <
typename GUM_SCALAR >
120 INLINE MultiDimImplementation< GUM_SCALAR >* (
122 const MultiDimImplementation< GUM_SCALAR >&,
123 const Set< const DiscreteVariable* >&) {
129 template <
typename GUM_SCALAR >
131 const ScheduleMultiDim< GUM_SCALAR >& table,
132 const Set< const DiscreteVariable* >& del_vars,
133 const Schedule< GUM_SCALAR >& schedule) {
134 const Sequence< const DiscreteVariable* >& vars = table.variablesSequence();
138 for (
const auto var : vars)
139 res *= var->domainSize();
146 template <
typename GUM_SCALAR >
148 const MultiDimImplementation< GUM_SCALAR >& table,
149 const Set< const DiscreteVariable* >& del_vars,
150 const Schedule< GUM_SCALAR >& schedule) {
152 table, del_vars, schedule);
157 template <
typename GUM_SCALAR >
158 template <
template <
typename >
class TABLE >
160 const TABLE< GUM_SCALAR >& table,
161 const Set< const DiscreteVariable* >& del_vars,
162 const Schedule< GUM_SCALAR >& schedule) {
164 table, del_vars, schedule);
168 template <
typename GUM_SCALAR >
170 const ScheduleMultiDim< GUM_SCALAR >& table,
171 const Set< const DiscreteVariable* >& del_vars,
172 const Schedule< GUM_SCALAR >& schedule) {
173 const Sequence< const DiscreteVariable* >& vars = table.variablesSequence();
176 for (
const auto var : vars)
177 if (!del_vars.contains(var)) {
178 if (std::numeric_limits< long >::max() / (long)var->domainSize() < res) {
179 GUM_ERROR(OutOfBounds,
"memory usage out of long int range");
182 res *= long(var->domainSize());
185 return std::pair< long, long >(res, res);
189 template <
typename GUM_SCALAR >
190 INLINE std::pair< long, long >
192 const MultiDimImplementation< GUM_SCALAR >& table,
193 const Set< const DiscreteVariable* >& del_vars,
194 const Schedule< GUM_SCALAR >& schedule) {
196 table, del_vars, schedule);
200 template <
typename GUM_SCALAR >
201 template <
template <
typename >
class TABLE >
202 INLINE std::pair< long, long >
204 const TABLE< GUM_SCALAR >& table,
205 const Set< const DiscreteVariable* >& del_vars,
206 const Schedule< GUM_SCALAR >& schedule) {
208 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
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
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
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
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)