aGrUM  0.20.3
a C++ library for (probabilistic) graphical models
projections4MultiDim.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 Efficient functionals for projecting multiDimensional tables
25  *
26  * @author Christophe GONZALES(@AMU) and Pierre-Henri WUILLEMIN(@LIP6)
27  */
28 
29 #ifndef GUM_PROJECTIONS_4_MULTI_DIM_H
30 #define GUM_PROJECTIONS_4_MULTI_DIM_H
31 
32 #include <agrum/tools/core/set.h>
33 #include <agrum/tools/multidim/implementations/multiDimArray.h>
34 #include <agrum/tools/multidim/implementations/multiDimFunctionGraph.h>
35 #include <agrum/tools/multidim/implementations/multiDimImplementation.h>
36 
37 namespace gum {
38 
39  // ==========================================================================
40  /// @name Project Max for MultiDim
41  // ==========================================================================
42  /// @{
43 
44  /**
45  * @brief a specialized function for projecting a multiDimArray using a Max
46  * operator
47  * @ingroup multidim_op_group
48  *
49  * The function projects a table over the subset of its variables NOT IN the
50  * set of variables del_vars. For instance, if table is a MultiDimArray
51  * defined over A,B,C,D and if del_vars = {A,C}, then the function returns a
52  * table over B,D defined as Max_{A,C} table (A,B,C,D). @return function
53  * ProjectMaxMultiDimArrays allocates on the heap the new T multiDimArray and
54  * returns it
55  *
56  * @warning In practice, do not use this function but rather
57  * operator/function projectMax on MultiDimImplementation. This operator will
58  * take care to select this function if it is appropriate for your
59  * projection.
60  */
61  template < typename GUM_SCALAR >
64  const Set< const DiscreteVariable* >& del_vars);
65 
66  /**
67  * @brief a specialized function for projecting a multiDimArray using a Max
68  * operator
69  * @ingroup multidim_op_group
70  *
71  * The function projects a table over the subset of its variables NOT IN the
72  * set of variables del_vars. For instance, if table is a MultiDimArray
73  * defined over A,B,C,D and if del_vars = {A,C}, then the function returns a
74  * table over B,D defined as Max_{A,C} table (A,B,C,D). @return function
75  * ProjectMaxMultiDimArrays allocates on the heap the new T multiDimArray and
76  * returns it
77  *
78  * @warning In practice, do not use this function but rather
79  * operator/function projectMax on MultiDimImplementation. This operator will
80  * take care to select this function if it is appropriate for your
81  * projection.
82  */
83  template < typename GUM_SCALAR >
86  const Set< const DiscreteVariable* >& del_vars);
87 
88  /**
89  * @brief a specialized function for projecting a multiDimArray using a Max
90  * operator
91  * @ingroup multidim_op_group
92  *
93  * The function projects a table over the subset of its variables NOT IN the
94  * set of variables del_vars. For instance, if table is a MultiDimArray
95  * defined over A,B,C,D and if del_vars = {A,C}, then the function returns a
96  * table over B,D defined as Max_{A,C} table (A,B,C,D). @return function
97  * ProjectMaxMultiDimArrays allocates on the heap the new T multiDimArray and
98  * returns it
99  *
100  * @warning In practice, do not use this function but rather
101  * operator/function projectMax on MultiDimImplementation. This operator will
102  * take care to select this function if it is appropriate for your
103  * projection.
104  */
105  template < typename GUM_SCALAR >
108  const Set< const DiscreteVariable* >& del_vars);
109 
110  /**
111  * @brief a specialized function for projecting a multiDimArray using a Max
112  * operator
113  * @ingroup multidim_op_group
114  *
115  * The function projects a table over the subset of its variables NOT IN the
116  * set of variables del_vars. For instance, if table is a MultiDimArray
117  * defined over A,B,C,D and if del_vars = {A,C}, then the function returns a
118  * table over B,D defined as Max_{A,C} table (A,B,C,D). @return function
119  * ProjectMaxMultiDimArrays allocates on the heap the new T multiDimArray and
120  * returns it
121  *
122  * @warning In practice, do not use this function but rather
123  * operator/function projectMax on MultiDimImplementation. This operator will
124  * take care to select this function if it is appropriate for your
125  * projection.
126  */
127  template < typename GUM_SCALAR >
130  const Set< const DiscreteVariable* >& del_vars);
131 
132  // @}
133  // ==========================================================================
134  /// @name Project Min for MultiDim
135  // ==========================================================================
136  /// @{
137 
138  /**
139  * @brief a specialized function for projecting a multiDimArray using a Min
140  * operator
141  *
142  * The function projects a table over the subset of its variables NOT IN the
143  * set of variables del_vars. For instance, if table is a MultiDimArray
144  * defined over A,B,C,D and if del_vars = {A,C}, then the function returns a
145  * table over B,D defined as Min_{A,C} table (A,B,C,D).
146  *
147  * @return function ProjectMaxMultiDimArrays allocates on the heap the new T
148  * multiDimArray and returns it
149  *
150  * @warning In practice, do not use this function but rather
151  * operator/function projectMin on MultiDimImplementation. This operator will
152  * take care to select this function if it is appropriate for your
153  * projection.
154  */
155  template < typename GUM_SCALAR >
158  const Set< const DiscreteVariable* >& del_vars);
159 
160  /**
161  * @brief a specialized function for projecting a multiDimArray using a Min
162  * operator
163  *
164  * The function projects a table over the subset of its variables NOT IN the
165  * set of variables del_vars. For instance, if table is a MultiDimArray
166  * defined over A,B,C,D and if del_vars = {A,C}, then the function returns a
167  * table over B,D defined as Min_{A,C} table (A,B,C,D).
168  *
169  * @return function ProjectMaxMultiDimArrays allocates on the heap the new T
170  * multiDimArray and returns it
171  *
172  * @warning In practice, do not use this function but rather
173  * operator/function projectMin on MultiDimImplementation. This operator will
174  * take care to select this function if it is appropriate for your
175  * projection.
176  */
177  template < typename GUM_SCALAR >
180  const Set< const DiscreteVariable* >& del_vars);
181 
182  /**
183  * @brief a specialized function for projecting a multiDimArray using a Min
184  * operator
185  *
186  * The function projects a table over the subset of its variables NOT IN the
187  * set of variables del_vars. For instance, if table is a MultiDimArray
188  * defined over A,B,C,D and if del_vars = {A,C}, then the function returns a
189  * table over B,D defined as Min_{A,C} table (A,B,C,D).
190  *
191  * @return function ProjectMaxMultiDimArrays allocates on the heap the new T
192  * multiDimArray and returns it
193  *
194  * @warning In practice, do not use this function but rather
195  * operator/function projectMin on MultiDimImplementation. This operator will
196  * take care to select this function if it is appropriate for your
197  * projection.
198  */
199  template < typename GUM_SCALAR >
202  const Set< const DiscreteVariable* >& del_vars);
203 
204  /**
205  * @brief a specialized function for projecting a multiDimArray using a Min
206  * operator
207  *
208  * The function projects a table over the subset of its variables NOT IN the
209  * set of variables del_vars. For instance, if table is a MultiDimArray
210  * defined over A,B,C,D and if del_vars = {A,C}, then the function returns a
211  * table over B,D defined as Min_{A,C} table (A,B,C,D).
212  *
213  * @return function ProjectMaxMultiDimArrays allocates on the heap the new T
214  * multiDimArray and returns it
215  *
216  * @warning In practice, do not use this function but rather
217  * operator/function projectMin on MultiDimImplementation. This operator will
218  * take care to select this function if it is appropriate for your
219  * projection.
220  */
221  template < typename GUM_SCALAR >
224  const Set< const DiscreteVariable* >& del_vars);
225 
226  // @}
227  // ==========================================================================
228  /// @name Project Sum for MultiDim
229  // ==========================================================================
230  /// @{
231 
232  /**
233  * @brief a specialized function for projecting a multiDimArray using a
234  * summation
235  *
236  * The function projects a table over the subset of its variables NOT IN the
237  * set of variables del_vars. For instance, if table is a MultiDimArray
238  * defined over A,B,C,D and if del_vars = {A,C}, then the function returns a
239  * table over B,D defined as Sum_{A,C} table (A,B,C,D).
240  *
241  * @return function ProjectMaxMultiDimArrays allocates on the heap the new T
242  * multiDimArray and returns it
243  *
244  * @warning In practice, do not use this function but rather
245  * operator/function projectSum on MultiDimImplementation. This operator will
246  * take care to select this function if it is appropriate for your
247  * projection.
248  */
249  template < typename GUM_SCALAR >
252  const Set< const DiscreteVariable* >& del_vars);
253 
254  /**
255  * @brief a specialized function for projecting a multiDimArray using a
256  * summation
257  *
258  * The function projects a table over the subset of its variables NOT IN the
259  * set of variables del_vars. For instance, if table is a MultiDimArray
260  * defined over A,B,C,D and if del_vars = {A,C}, then the function returns a
261  * table over B,D defined as Sum_{A,C} table (A,B,C,D).
262  *
263  * @return function ProjectMaxMultiDimArrays allocates on the heap the new T
264  * multiDimArray and returns it
265  *
266  * @warning In practice, do not use this function but rather
267  * operator/function projectSum on MultiDimImplementation. This operator will
268  * take care to select this function if it is appropriate for your
269  * projection.
270  */
271  template < typename GUM_SCALAR >
274  const Set< const DiscreteVariable* >& del_vars);
275 
276  /**
277  * @brief a specialized function for projecting a multiDimArray using a
278  * summation
279  *
280  * The function projects a table over the subset of its variables NOT IN the
281  * set of variables del_vars. For instance, if table is a MultiDimArray
282  * defined over A,B,C,D and if del_vars = {A,C}, then the function returns a
283  * table over B,D defined as Sum_{A,C} table (A,B,C,D).
284  *
285  * @return function ProjectMaxMultiDimArrays allocates on the heap the new T
286  * multiDimArray and returns it
287  *
288  * @warning In practice, do not use this function but rather
289  * operator/function projectSum on MultiDimImplementation. This operator will
290  * take care to select this function if it is appropriate for your
291  * projection.
292  */
293  template < typename GUM_SCALAR >
296  const Set< const DiscreteVariable* >& del_vars);
297 
298  /**
299  * @brief a specialized function for projecting a multiDimArray using a
300  * summation
301  *
302  * The function projects a table over the subset of its variables NOT IN the
303  * set of variables del_vars. For instance, if table is a MultiDimArray
304  * defined over A,B,C,D and if del_vars = {A,C}, then the function returns a
305  * table over B,D defined as Sum_{A,C} table (A,B,C,D).
306  *
307  * @return function ProjectMaxMultiDimArrays allocates on the heap the new T
308  * multiDimArray and returns it
309  *
310  * @warning In practice, do not use this function but rather
311  * operator/function projectSum on MultiDimImplementation. This operator will
312  * take care to select this function if it is appropriate for your
313  * projection.
314  */
315  template < typename GUM_SCALAR >
318  const Set< const DiscreteVariable* >& del_vars);
319 
320  // @}
321  // ==========================================================================
322  /// @name Project Product for MultiDim
323  // ==========================================================================
324  /// @{
325 
326  /**
327  * @brief a specialized function for projecting a multiDimArray using
328  * products
329  *
330  * The function projects a table over the subset of its variables NOT IN the
331  * set of variables del_vars. For instance, if table is a MultiDimArray
332  * defined over A,B,C,D and if del_vars = {A,C}, then the function returns a
333  * table over B,D defined as Prod_{A,C} table (A,B,C,D).
334  *
335  * @return function ProjectMaxMultiDimArrays allocates on the heap the new T
336  * multiDimArray and returns it
337  *
338  * @warning In practice, do not use this function but rather
339  * operator/function projectProduct on MultiDimImplementation. This operator
340  * will take care to select this function if it is appropriate for your
341  * projection.
342  */
343  template < typename GUM_SCALAR >
346  const Set< const DiscreteVariable* >& del_vars);
347 
348  /**
349  * @brief a specialized function for projecting a multiDimArray using
350  * products
351  *
352  * The function projects a table over the subset of its variables NOT IN the
353  * set of variables del_vars. For instance, if table is a MultiDimArray
354  * defined over A,B,C,D and if del_vars = {A,C}, then the function returns a
355  * table over B,D defined as Prod_{A,C} table (A,B,C,D).
356  *
357  * @return function ProjectMaxMultiDimArrays allocates on the heap the new T
358  * multiDimArray and returns it
359  *
360  * @warning In practice, do not use this function but rather
361  * operator/function projectProduct on MultiDimImplementation. This operator
362  * will take care to select this function if it is appropriate for your
363  * projection.
364  */
365  template < typename GUM_SCALAR >
368  const Set< const DiscreteVariable* >& del_vars);
369 
370  /**
371  * @brief a specialized function for projecting a multiDimArray using
372  * products
373  *
374  * The function projects a table over the subset of its variables NOT IN the
375  * set of variables del_vars. For instance, if table is a MultiDimArray
376  * defined over A,B,C,D and if del_vars = {A,C}, then the function returns a
377  * table over B,D defined as Prod_{A,C} table (A,B,C,D).
378  *
379  * @return function ProjectMaxMultiDimArrays allocates on the heap the new T
380  * multiDimArray and returns it
381  *
382  * @warning In practice, do not use this function but rather
383  * operator/function projectProduct on MultiDimImplementation. This operator
384  * will take care to select this function if it is appropriate for your
385  * projection.
386  */
387  template < typename GUM_SCALAR >
390  const Set< const DiscreteVariable* >& del_vars);
391 
392  /**
393  * @brief a specialized function for projecting a multiDimArray using
394  * products
395  *
396  * The function projects a table over the subset of its variables NOT IN the
397  * set of variables del_vars. For instance, if table is a MultiDimArray
398  * defined over A,B,C,D and if del_vars = {A,C}, then the function returns a
399  * table over B,D defined as Prod_{A,C} table (A,B,C,D).
400  *
401  * @return function ProjectMaxMultiDimArrays allocates on the heap the new T
402  * multiDimArray and returns it
403  *
404  * @warning In practice, do not use this function but rather
405  * operator/function projectProduct on MultiDimImplementation. This operator
406  * will take care to select this function if it is appropriate for your
407  * projection.
408  */
409  template < typename GUM_SCALAR >
412  const Set< const DiscreteVariable* >& del_vars);
413 
414  // @}
415  // ==========================================================================
416  /// @name Project Function for MultiDim
417  // ==========================================================================
418  /// @{
419 
420  /**
421  * @brief a specialized function for functionally projecting a multiDimArray
422  *
423  * The function produces a tensorial functional combination of t1 and t2,
424  * that is, if t1 and t2 are multiDimArrays over variables A,B,C,D and D,B,E
425  * respectively, function combine2MultiDimArrays will return a multiDimArray
426  * T defined as T[A,B,C,D,E] = f ( t1[A,B,C,D],t2[D,B,E] ) for all A,B,C,D,E.
427  *
428  * @return function combine2MultiDimArrays allocates on the heap the new T
429  * multiDimArray and returns it.
430  */
431  template < typename GUM_SCALAR >
433  const MultiDimArray< GUM_SCALAR >* t2,
434  const GUM_SCALAR (*f)(const GUM_SCALAR&,
435  const GUM_SCALAR&));
436 
437  /**
438  * @brief a specialized function for functionally projecting a multiDimArray
439  *
440  * The function produces a tensorial functional combination of t1 and t2,
441  * that is, if t1 and t2 are multiDimArrays over variables A,B,C,D and D,B,E
442  * respectively, function combine2MultiDimArrays will return a multiDimArray
443  * T defined as T[A,B,C,D,E] = f ( t1[A,B,C,D],t2[D,B,E] ) for all A,B,C,D,E.
444  *
445  * @return function combine2MultiDimArrays allocates on the heap the new T
446  * multiDimArray and returns it.
447  */
448  template < typename GUM_SCALAR >
452  const GUM_SCALAR (*f)(const GUM_SCALAR&, const GUM_SCALAR&));
453 
454  // @}
455  // ==========================================================================
456  /// @name Projectors For Function Graphs
457  // ==========================================================================
458  /// @{
459 
460  /**
461  * @brief a specialized function for projecting a multiDimFunctionGraph using
462  * a Max operator
463  *
464  * The function projects a table over the subset of its variables NOT IN the
465  * set of variables del_vars. For instance, if table is a
466  * MultiDimFunctionGraph defined over A,B,C,D and if del_vars = {A,C}, then
467  * the function returns a table over B,D defined as Max_{A,C} table
468  * (A,B,C,D).
469  *
470  * @return function ProjectMaxMultiDimFunctionGraph allocates on the heap the
471  * new T multiDimFunctionGraph and returns it
472  *
473  * @warning In practice, do not use this function but rather
474  * operator/function projectMax on MultiDimImplementation. This operator will
475  * take care to select this function if it is appropriate for your
476  * projection.
477  */
478  template < typename GUM_SCALAR >
481  const Set< const DiscreteVariable* >& del_vars);
482 
483  /**
484  * @brief a specialized function for projecting a multiDimFunctionGraph using
485  * a Max operator
486  *
487  * The function projects a table over the subset of its variables NOT IN the
488  * set of variables del_vars. For instance, if table is a
489  * MultiDimFunctionGraph defined over A,B,C,D and if del_vars = {A,C}, then
490  * the function returns a table over B,D defined as Max_{A,C} table
491  * (A,B,C,D).
492  *
493  * @return function ProjectMaxMultiDimFunctionGraph allocates on the heap the
494  * new T multiDimFunctionGraph and returns it
495  *
496  * @warning In practice, do not use this function but rather
497  * operator/function projectMax on MultiDimImplementation. This operator will
498  * take care to select this function if it is appropriate for your
499  * projection.
500  */
501  template < typename GUM_SCALAR >
504  const Set< const DiscreteVariable* >& del_vars);
505 
506 
507  /**
508  * @brief a specialized function for projecting a multiDimFunctionGraph
509  * using a Min operator
510  *
511  * The function projects a table over the subset of its variables NOT IN the
512  * set of variables del_vars. For instance, if table is a
513  * MultiDimFunctionGraph defined over A,B,C,D and if del_vars = {A,C}, then
514  * the function returns a table over B,D defined as Min_{A,C} table
515  * (A,B,C,D).
516  *
517  * @return function ProjectMaxMultiDimFunctionGraphs allocates on the heap
518  * the new T multiDimFunctionGraph and returns it
519  *
520  * @warning In practice, do not use this function but rather
521  * operator/function projectMin on MultiDimImplementation. This operator will
522  * take care to select this function if it is appropriate for your
523  * projection.
524  */
525  template < typename GUM_SCALAR >
528  const Set< const DiscreteVariable* >& del_vars);
529 
530  /**
531  * @brief a specialized function for projecting a multiDimFunctionGraph
532  * using a Min operator
533  *
534  * The function projects a table over the subset of its variables NOT IN the
535  * set of variables del_vars. For instance, if table is a
536  * MultiDimFunctionGraph defined over A,B,C,D and if del_vars = {A,C}, then
537  * the function returns a table over B,D defined as Min_{A,C} table
538  * (A,B,C,D).
539  *
540  * @return function ProjectMaxMultiDimFunctionGraphs allocates on the heap
541  * the new T multiDimFunctionGraph and returns it
542  *
543  * @warning In practice, do not use this function but rather
544  * operator/function projectMin on MultiDimImplementation. This operator will
545  * take care to select this function if it is appropriate for your
546  * projection.
547  */
548  template < typename GUM_SCALAR >
551  const Set< const DiscreteVariable* >& del_vars);
552 
553 
554  /**
555  * @brief a specialized function for projecting a multiDimFunctionGraph using
556  * a summation
557  *
558  * The function projects a table over the subset of its variables NOT IN the
559  * set of variables del_vars. For instance, if table is a
560  * MultiDimFunctionGraph defined over A,B,C,D and if del_vars = {A,C}, then
561  * the function returns a table over B,D defined as Sum_{A,C} table
562  * (A,B,C,D).
563  *
564  * @return function ProjectMaxMultiDimFunctionGraphs allocates on the heap
565  * the new T multiDimFunctionGraph and returns it
566  *
567  * @warning In practice, do not use this function but rather
568  * operator/function projectSum on MultiDimImplementation. This operator will
569  * take care to select this function if it is appropriate for your
570  * projection.
571  */
572  template < typename GUM_SCALAR >
575  const Set< const DiscreteVariable* >& del_vars);
576 
577  /**
578  * @brief a specialized function for projecting a multiDimFunctionGraph using
579  * a summation
580  *
581  * The function projects a table over the subset of its variables NOT IN the
582  * set of variables del_vars. For instance, if table is a
583  * MultiDimFunctionGraph defined over A,B,C,D and if del_vars = {A,C}, then
584  * the function returns a table over B,D defined as Sum_{A,C} table
585  * (A,B,C,D).
586  *
587  * @return function ProjectMaxMultiDimFunctionGraphs allocates on the heap
588  * the new T multiDimFunctionGraph and returns it
589  *
590  * @warning In practice, do not use this function but rather
591  * operator/function projectSum on MultiDimImplementation. This operator will
592  * take care to select this function if it is appropriate for your
593  * projection.
594  */
595  template < typename GUM_SCALAR >
598  const Set< const DiscreteVariable* >& del_vars);
599 
600 
601  /**
602  * @brief a specialized function for projecting a multiDimFunctionGraph using
603  * products
604  *
605  * The function projects a table over the subset of its variables NOT IN the
606  * set of variables del_vars. For instance, if table is a
607  * MultiDimFunctionGraph defined over A,B,C,D and if del_vars = {A,C}, then
608  * the function returns a table over B,D defined as Prod_{A,C} table
609  * (A,B,C,D).
610  *
611  * @return function ProjectMaxMultiDimFunctionGraphs allocates on the heap
612  * the new T multiDimFunctionGraph and returns it
613  *
614  * @warning In practice, do not use this function but rather
615  * operator/function projectProduct on MultiDimImplementation. This operator
616  * will take care to select this function if it is appropriate for your
617  * projection.
618  */
619  template < typename GUM_SCALAR >
622  const Set< const DiscreteVariable* >& del_vars);
623 
624  /**
625  * @brief a specialized function for projecting a multiDimFunctionGraph using
626  * products
627  *
628  * The function projects a table over the subset of its variables NOT IN the
629  * set of variables del_vars. For instance, if table is a
630  * MultiDimFunctionGraph defined over A,B,C,D and if del_vars = {A,C}, then
631  * the function returns a table over B,D defined as Prod_{A,C} table
632  * (A,B,C,D).
633  *
634  * @return function ProjectMaxMultiDimFunctionGraphs allocates on the heap
635  * the new T multiDimFunctionGraph and returns it
636  *
637  * @warning In practice, do not use this function but rather
638  * operator/function projectProduct on MultiDimImplementation. This operator
639  * will take care to select this function if it is appropriate for your
640  * projection.
641  */
642  template < typename GUM_SCALAR >
645  const Set< const DiscreteVariable* >& del_vars);
646 
647  /// @}
648 
649  /// The function to be used to project a MultiDimImplementation using a Max
650  template < typename GUM_SCALAR >
653  const Set< const DiscreteVariable* >& del_vars);
654 
655  /// The function to be used to project a MultiDimImplementation using a Min
656  template < typename GUM_SCALAR >
659  const Set< const DiscreteVariable* >& del_vars);
660 
661  /// The function to be used to project a MultiDimImplementation using a Sum
662  template < typename GUM_SCALAR >
665  const Set< const DiscreteVariable* >& del_vars);
666 
667  /// The function to be used to project a MultiDimImplementation using a
668  /// Product
669  template < typename GUM_SCALAR >
672  const Set< const DiscreteVariable* >& del_vars);
673 
674 
675  // ==========================================================================
676  // DO NOT FORGET TO REGISTER YOUR PROJECTION FUNCTIONS AT THE END OF FILE
677  // projections4MultiDim_tpl.h
678  // ==========================================================================
679 
680  /**
681  * @brief the function used to register all the projection operators on
682  * multidimImplementations over non-pointers types.
683  */
684  template < typename GUM_SCALAR >
686 
687  /**
688  * @brief the function used to register all the projections on
689  * multidimImplementations over pointers types.
690  */
691  template < typename GUM_SCALAR >
693 
694  /**
695  * @brief a class used to register projections over non-pointers types
696  *
697  * This class is of course completely redundant with function
698  * projections4MultiDimInit. Its aim is to enable specialization of function
699  * projections4MultiDimInit for pointer types: C++ allows partial
700  * specialization of templated classes (e.g., create different
701  * implementations for C<T> and C<T*>) but it does not allows partial
702  * specialization for functions. Hence, by creating a class the primary
703  * purpose of which is to run function projections4MultiDimInit, we allow
704  * this partial specialization. This is most effective to produce different
705  * codes for pointer types and non-pointer types.
706  */
707  template < typename GUM_SCALAR >
709  void init() { projections4MultiDimInit< GUM_SCALAR >(); };
710  };
711 
712  /**
713  * @brief a class used to register projections over pointers types
714  *
715  * This class is of course completely redundant with function
716  * pointerProjections4MultiDimInit. Its aim is to enable different
717  * implementations of the projections for multidims depending in whether
718  * these multidim contain pointers or not. Actually, C++ allows partial
719  * specialization of templated classes (e.g., create different
720  * implementations for C<T> and C<T*>) but it does not allows partial
721  * specialization for functions. Hence, by creating a class the primary
722  * purpose of which is to run function projections4MultiDimInit or
723  * pointerProjections4MultiDimInit, we allow this partial specialization to
724  * obtain.
725  */
726  template < typename GUM_SCALAR >
727  struct Projections4MultiDimInitialize< GUM_SCALAR* > {
728  void init() { pointerProjections4MultiDimInit< GUM_SCALAR >(); };
729  };
730 
731 } /* namespace gum */
732 
733 // always include the templatized implementations
734 #include <agrum/tools/multidim/utils/operators/projections4MultiDim_tpl.h>
735 
736 #endif /* GUM_PROJECTIONS_4_MULTI_DIM_H */
MultiDimImplementation< GUM_SCALAR > * projectMaxMultiDimArray(const MultiDimImplementation< GUM_SCALAR > *table, const Set< const DiscreteVariable * > &del_vars)
a specialized function for projecting a multiDimArray using a Max operatorThe function projects a tab...
a class used to register projections over non-pointers types
MultiDimImplementation< GUM_SCALAR > * projectProductMultiDimArray(const MultiDimImplementation< GUM_SCALAR > *table, const Set< const DiscreteVariable * > &del_vars)
a specialized function for projecting a multiDimArray using products
MultiDimImplementation< GUM_SCALAR > * projectMax(const MultiDimImplementation< GUM_SCALAR > &table, const Set< const DiscreteVariable * > &del_vars)
The function to be used to project a MultiDimImplementation using a Max.
MultiDimImplementation< GUM_SCALAR *> * projectSumMultiDimArray4Pointers(const MultiDimImplementation< GUM_SCALAR * > *table, const Set< const DiscreteVariable * > &del_vars)
a specialized function for projecting a multiDimArray using a summation
MultiDimImplementation< GUM_SCALAR > * projectMin(const MultiDimImplementation< GUM_SCALAR > &table, const Set< const DiscreteVariable * > &del_vars)
The function to be used to project a MultiDimImplementation using a Min.
MultiDimImplementation< GUM_SCALAR > * projectProduct(const MultiDimImplementation< GUM_SCALAR > &table, const Set< const DiscreteVariable * > &del_vars)
The function to be used to project a MultiDimImplementation using a Product.
MultiDimImplementation< GUM_SCALAR *> * projectMinMultiDimArray4Pointers(const MultiDimImplementation< GUM_SCALAR * > *table, const Set< const DiscreteVariable * > &del_vars)
a specialized function for projecting a multiDimArray using a Min operator
INLINE void emplace(Args &&... args)
Definition: set_tpl.h:643
MultiDimImplementation< GUM_SCALAR > * combine2MultiDimArrays(const MultiDimImplementation< GUM_SCALAR > *t1, const MultiDimImplementation< GUM_SCALAR > *t2, const GUM_SCALAR(*f)(const GUM_SCALAR &, const GUM_SCALAR &))
a specialized function for functionally projecting a multiDimArray
void projections4MultiDimInit()
the function used to register all the projection operators on multidimImplementations over non-pointe...
MultiDimImplementation< GUM_SCALAR > * projectMaxMultiDimFunctionGraph(const MultiDimImplementation< GUM_SCALAR > *table, const Set< const DiscreteVariable * > &del_vars)
a specialized function for projecting a multiDimFunctionGraph using a Max operator ...
MultiDimArray< GUM_SCALAR > * ProjectFuncMultiDimArray(const MultiDimArray< GUM_SCALAR > *t1, const MultiDimArray< GUM_SCALAR > *t2, const GUM_SCALAR(*f)(const GUM_SCALAR &, const GUM_SCALAR &))
a specialized function for functionally projecting a multiDimArray
MultiDimImplementation< GUM_SCALAR > * projectMinMultiDimFunctionGraph(const MultiDimImplementation< GUM_SCALAR > *table, const Set< const DiscreteVariable * > &del_vars)
a specialized function for projecting a multiDimFunctionGraph using a Min operator ...
MultiDimImplementation< GUM_SCALAR > * projectMinMultiDimArray(const MultiDimImplementation< GUM_SCALAR > *table, const Set< const DiscreteVariable * > &del_vars)
a specialized function for projecting a multiDimArray using a Min operator
MultiDimImplementation< GUM_SCALAR > * projectSum(const MultiDimImplementation< GUM_SCALAR > &table, const Set< const DiscreteVariable * > &del_vars)
The function to be used to project a MultiDimImplementation using a Sum.
MultiDimImplementation< GUM_SCALAR > * projectSumMultiDimFunctionGraph(const MultiDimImplementation< GUM_SCALAR > *table, const Set< const DiscreteVariable * > &del_vars)
a specialized function for projecting a multiDimFunctionGraph using a summation
MultiDimImplementation< GUM_SCALAR > * projectProductMultiDimFunctionGraph(const MultiDimImplementation< GUM_SCALAR > *table, const Set< const DiscreteVariable * > &del_vars)
a specialized function for projecting a multiDimFunctionGraph using products
void pointerProjections4MultiDimInit()
the function used to register all the projections on multidimImplementations over pointers types...
MultiDimImplementation< GUM_SCALAR > * projectSumMultiDimArray(const MultiDimImplementation< GUM_SCALAR > *table, const Set< const DiscreteVariable * > &del_vars)
a specialized function for projecting a multiDimArray using a summation
MultiDimImplementation< GUM_SCALAR *> * projectProductMultiDimArray4Pointers(const MultiDimImplementation< GUM_SCALAR * > *table, const Set< const DiscreteVariable * > &del_vars)
a specialized function for projecting a multiDimArray using products
MultiDimImplementation< GUM_SCALAR *> * projectMaxMultiDimArray4Pointers(const MultiDimImplementation< GUM_SCALAR * > *table, const Set< const DiscreteVariable * > &del_vars)
a specialized function for projecting a multiDimArray using a Max operatorThe function projects a tab...