aGrUM  0.20.2
a C++ library for (probabilistic) graphical models
operators4MultiDim.h
Go to the documentation of this file.
1 /**
2  *
3  * Copyright 2005-2020 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 combining multiDims
25  *
26  * @author Christophe GONZALES(@AMU) and Pierre-Henri WUILLEMIN(@LIP6)
27  */
28 
29 #ifndef GUM_OPERATORS_4_MULTI_DIM_H
30 #define GUM_OPERATORS_4_MULTI_DIM_H
31 
32 #include <agrum/tools/core/timer.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 Add MultiDims
41  // ==========================================================================
42  /// @{
43 
44  /**
45  * @brief a specialized function for summing two multiDimArrays
46  * @ingroup multidim_op_group
47  *
48  * The function produces a tensorial addition of t1 and t2, that is, if t1
49  * and t2 are multiDimArrays over variables A,B,C,D and D,B,E respectively,
50  * function add2MultiDimArrays will return a multiDimArray T defined as
51  * T[A,B,C,D,E] = t1[A,B,C,D] + t2[D,B,E] for all A,B,C,D,E.
52  *
53  * @return function add2MultiDimArrays allocates on the heap the new T
54  * multiDimArray and returns it
55  *
56  * @warning In practice, do not use this function but rather operator+ on
57  * multiDimImplementations. This operator will take care to select this
58  * function if it is appropriate for your addition.
59  */
60  template < typename T >
62  const MultiDimArray< T >* t2);
63 
64  /**
65  * @brief a specialized function for summing two multiDimArrays
66  * @ingroup multidim_op_group
67  *
68  * The function produces a tensorial addition of t1 and t2, that is, if t1
69  * and t2 are multiDimArrays over variables A,B,C,D and D,B,E respectively,
70  * function add2MultiDimArrays will return a multiDimArray T defined as
71  * T[A,B,C,D,E] = t1[A,B,C,D] + t2[D,B,E] for all A,B,C,D,E.
72  *
73  * @return function add2MultiDimArrays allocates on the heap the new T
74  * multiDimArray and returns it
75  *
76  * @warning In practice, do not use this function but rather operator+ on
77  * multiDimImplementations. This operator will take care to select this
78  * function if it is appropriate for your addition.
79  */
80  template < typename T >
83  const MultiDimImplementation< T >* t2);
84 
85  /**
86  * @brief a specialized function for summing two multiDimArrays
87  * @ingroup multidim_op_group
88  *
89  * The function produces a tensorial addition of t1 and t2, that is, if t1
90  * and t2 are multiDimArrays over variables A,B,C,D and D,B,E respectively,
91  * function add2MultiDimArrays will return a multiDimArray T defined as
92  * T[A,B,C,D,E] = t1[A,B,C,D] + t2[D,B,E] for all A,B,C,D,E.
93  *
94  * @return function add2MultiDimArrays allocates on the heap the new T
95  * multiDimArray and returns it
96  *
97  * @warning In practice, do not use this function but rather operator+ on
98  * multiDimImplementations. This operator will take care to select this
99  * function if it is appropriate for your addition.
100  */
101  template < typename T >
103  const MultiDimArray< T* >* t2);
104 
105  /**
106  * @brief a specialized function for summing two multiDimArrays
107  * @ingroup multidim_op_group
108  *
109  * The function produces a tensorial addition of t1 and t2, that is, if t1
110  * and t2 are multiDimArrays over variables A,B,C,D and D,B,E respectively,
111  * function add2MultiDimArrays will return a multiDimArray T defined as
112  * T[A,B,C,D,E] = t1[A,B,C,D] + t2[D,B,E] for all A,B,C,D,E.
113  *
114  * @return function add2MultiDimArrays allocates on the heap the new T
115  * multiDimArray and returns it
116  *
117  * @warning In practice, do not use this function but rather operator+ on
118  * multiDimImplementations. This operator will take care to select this
119  * function if it is appropriate for your addition.
120  */
121  template < typename T >
124  const MultiDimImplementation< T* >* t2);
125 
126  /**
127  * @brief a specialized function for summing two multiDimArrays
128  * @ingroup multidim_op_group
129  *
130  * The function produces a tensorial addition of t1 and t2, that is, if t1
131  * and t2 are multiDimArrays over variables A,B,C,D and D,B,E respectively,
132  * function add2MultiDimArrays will return a multiDimArray T defined as
133  * T[A,B,C,D,E] = t1[A,B,C,D] + t2[D,B,E] for all A,B,C,D,E.
134  *
135  * @return function add2MultiDimArrays allocates on the heap the new T
136  * multiDimArray and returns it
137  *
138  * @warning In practice, do not use this function but rather operator+ on
139  * multiDimImplementations. This operator will take care to select this
140  * function if it is appropriate for your addition.
141  */
142  template < typename T >
145  const MultiDimFunctionGraph< T >* t2);
146 
147  /**
148  * @brief a specialized function for summing two multiDimArrays
149  * @ingroup multidim_op_group
150  *
151  * The function produces a tensorial addition of t1 and t2, that is, if t1
152  * and t2 are multiDimArrays over variables A,B,C,D and D,B,E respectively,
153  * function add2MultiDimArrays will return a multiDimArray T defined as
154  * T[A,B,C,D,E] = t1[A,B,C,D] + t2[D,B,E] for all A,B,C,D,E.
155  *
156  * @return function add2MultiDimArrays allocates on the heap the new T
157  * multiDimArray and returns it
158  *
159  * @warning In practice, do not use this function but rather operator+ on
160  * multiDimImplementations. This operator will take care to select this
161  * function if it is appropriate for your addition.
162  */
163  template < typename T >
166  const MultiDimImplementation< T >* t2);
167 
168  /// @}
169  // ==========================================================================
170  /// @name Substract MultiDims
171  // ==========================================================================
172  /// @{
173 
174  /**
175  * @brief a specialized function for subtracting two multiDimArrays
176  * @ingroup multidim_op_group
177  *
178  * The function produces a tensorial subtraction of t2 from t1, that is, if
179  * t1 and t2 are multiDimArrays over variables A,B,C,D and D,B,E
180  * respectively, function subtract2MultiDimArrays will return a multiDimArray
181  * T defined as T[A,B,C,D,E] = t1[A,B,C,D] - t2[D,B,E] for all A,B,C,D,E.
182  *
183  * @return function subtract2MultiDimArrays allocates on the heap the new T
184  * multiDimArray and returns it
185  *
186  * @warning In practice, do not use this function but rather operator- on
187  * multiDimImplementations. This operator will take care to select this
188  * function if it is appropriate for your subtraction.
189  */
190  template < typename T >
192  const MultiDimArray< T >* t2);
193 
194  /**
195  * @brief a specialized function for subtracting two multiDimArrays
196  * @ingroup multidim_op_group
197  *
198  * The function produces a tensorial subtraction of t2 from t1, that is, if
199  * t1 and t2 are multiDimArrays over variables A,B,C,D and D,B,E
200  * respectively, function subtract2MultiDimArrays will return a multiDimArray
201  * T defined as T[A,B,C,D,E] = t1[A,B,C,D] - t2[D,B,E] for all A,B,C,D,E.
202  *
203  * @return function subtract2MultiDimArrays allocates on the heap the new T
204  * multiDimArray and returns it
205  *
206  * @warning In practice, do not use this function but rather operator- on
207  * multiDimImplementations. This operator will take care to select this
208  * function if it is appropriate for your subtraction.
209  */
210  template < typename T >
213  const MultiDimImplementation< T >* t2);
214 
215  /**
216  * @brief a specialized function for subtracting two multiDimArrays
217  * @ingroup multidim_op_group
218  *
219  * The function produces a tensorial subtraction of t2 from t1, that is, if
220  * t1 and t2 are multiDimArrays over variables A,B,C,D and D,B,E
221  * respectively, function subtract2MultiDimArrays will return a multiDimArray
222  * T defined as T[A,B,C,D,E] = t1[A,B,C,D] - t2[D,B,E] for all A,B,C,D,E.
223  *
224  * @return function subtract2MultiDimArrays allocates on the heap the new T
225  * multiDimArray and returns it
226  *
227  * @warning In practice, do not use this function but rather operator- on
228  * multiDimImplementations. This operator will take care to select this
229  * function if it is appropriate for your subtraction.
230  */
231  template < typename T >
232  MultiDimArray< T* >*
234  const MultiDimArray< T* >* t2);
235 
236  /**
237  * @brief a specialized function for subtracting two multiDimArrays
238  * @ingroup multidim_op_group
239  *
240  * The function produces a tensorial subtraction of t2 from t1, that is, if
241  * t1 and t2 are multiDimArrays over variables A,B,C,D and D,B,E
242  * respectively, function subtract2MultiDimArrays will return a multiDimArray
243  * T defined as T[A,B,C,D,E] = t1[A,B,C,D] - t2[D,B,E] for all A,B,C,D,E.
244  *
245  * @return function subtract2MultiDimArrays allocates on the heap the new T
246  * multiDimArray and returns it
247  *
248  * @warning In practice, do not use this function but rather operator- on
249  * multiDimImplementations. This operator will take care to select this
250  * function if it is appropriate for your subtraction.
251  */
252  template < typename T >
255  const MultiDimImplementation< T* >* t2);
256 
257  /**
258  * @brief a specialized function for subtracting two multiDimArrays
259  * @ingroup multidim_op_group
260  *
261  * The function produces a tensorial subtraction of t2 from t1, that is, if
262  * t1 and t2 are multiDimArrays over variables A,B,C,D and D,B,E
263  * respectively, function subtract2MultiDimArrays will return a multiDimArray
264  * T defined as T[A,B,C,D,E] = t1[A,B,C,D] - t2[D,B,E] for all A,B,C,D,E.
265  *
266  * @return function subtract2MultiDimArrays allocates on the heap the new T
267  * multiDimArray and returns it
268  *
269  * @warning In practice, do not use this function but rather operator- on
270  * multiDimImplementations. This operator will take care to select this
271  * function if it is appropriate for your subtraction.
272  */
273  template < typename T >
276  const MultiDimFunctionGraph< T >* t2);
277 
278  /**
279  * @brief a specialized function for subtracting two multiDimArrays
280  * @ingroup multidim_op_group
281  *
282  * The function produces a tensorial subtraction of t2 from t1, that is, if
283  * t1 and t2 are multiDimArrays over variables A,B,C,D and D,B,E
284  * respectively, function subtract2MultiDimArrays will return a multiDimArray
285  * T defined as T[A,B,C,D,E] = t1[A,B,C,D] - t2[D,B,E] for all A,B,C,D,E.
286  *
287  * @return function subtract2MultiDimArrays allocates on the heap the new T
288  * multiDimArray and returns it
289  *
290  * @warning In practice, do not use this function but rather operator- on
291  * multiDimImplementations. This operator will take care to select this
292  * function if it is appropriate for your subtraction.
293  */
294  template < typename T >
297  const MultiDimImplementation< T >* t2);
298 
299  /// @}
300  // ==========================================================================
301  /// @name Multiply MultiDims
302  // ==========================================================================
303  /// @{
304 
305  /**
306  * @brief a specialized function for multiplying two multiDimArrays
307  * @ingroup multidim_op_group
308  *
309  * The function produces a tensorial product of t2 from t1, that is, if t1
310  * and t2 are multiDimArrays over variables A,B,C,D and D,B,E respectively,
311  * function multiply2MultiDimArrays will return a multiDimArray T defined as
312  * T[A,B,C,D,E] = t1[A,B,C,D] * t2[D,B,E] for all A,B,C,D,E.
313  *
314  * @return function multiply2MultiDimArrays allocates on the heap the new T
315  * multiDimArray and returns it
316  *
317  * @warning In practice, do not use this function but rather operator* on
318  * multiDimImplementations. This operator will take care to select this
319  * function if it is appropriate for your multiplication.
320  */
321  template < typename T >
323  const MultiDimArray< T >* t2);
324 
325  /**
326  * @brief a specialized function for multiplying two multiDimArrays
327  * @ingroup multidim_op_group
328  *
329  * The function produces a tensorial product of t2 from t1, that is, if t1
330  * and t2 are multiDimArrays over variables A,B,C,D and D,B,E respectively,
331  * function multiply2MultiDimArrays will return a multiDimArray T defined as
332  * T[A,B,C,D,E] = t1[A,B,C,D] * t2[D,B,E] for all A,B,C,D,E.
333  *
334  * @return function multiply2MultiDimArrays allocates on the heap the new T
335  * multiDimArray and returns it
336  *
337  * @warning In practice, do not use this function but rather operator* on
338  * multiDimImplementations. This operator will take care to select this
339  * function if it is appropriate for your multiplication.
340  */
341  template < typename T >
344  const MultiDimImplementation< T >* t2);
345 
346  /**
347  * @brief a specialized function for multiplying two multiDimArrays
348  * @ingroup multidim_op_group
349  *
350  * The function produces a tensorial product of t2 from t1, that is, if t1
351  * and t2 are multiDimArrays over variables A,B,C,D and D,B,E respectively,
352  * function multiply2MultiDimArrays will return a multiDimArray T defined as
353  * T[A,B,C,D,E] = t1[A,B,C,D] * t2[D,B,E] for all A,B,C,D,E.
354  *
355  * @return function multiply2MultiDimArrays allocates on the heap the new T
356  * multiDimArray and returns it
357  *
358  * @warning In practice, do not use this function but rather operator* on
359  * multiDimImplementations. This operator will take care to select this
360  * function if it is appropriate for your multiplication.
361  */
362  template < typename T >
363  MultiDimArray< T* >*
365  const MultiDimArray< T* >* t2);
366 
367  /**
368  * @brief a specialized function for multiplying two multiDimArrays
369  * @ingroup multidim_op_group
370  *
371  * The function produces a tensorial product of t2 from t1, that is, if t1
372  * and t2 are multiDimArrays over variables A,B,C,D and D,B,E respectively,
373  * function multiply2MultiDimArrays will return a multiDimArray T defined as
374  * T[A,B,C,D,E] = t1[A,B,C,D] * t2[D,B,E] for all A,B,C,D,E.
375  *
376  * @return function multiply2MultiDimArrays allocates on the heap the new T
377  * multiDimArray and returns it
378  *
379  * @warning In practice, do not use this function but rather operator* on
380  * multiDimImplementations. This operator will take care to select this
381  * function if it is appropriate for your multiplication.
382  */
383  template < typename T >
386  const MultiDimImplementation< T* >* t2);
387 
388  /**
389  * @brief a specialized function for multiplying two multiDimArrays
390  * @ingroup multidim_op_group
391  *
392  * The function produces a tensorial product of t2 from t1, that is, if t1
393  * and t2 are multiDimArrays over variables A,B,C,D and D,B,E respectively,
394  * function multiply2MultiDimArrays will return a multiDimArray T defined as
395  * T[A,B,C,D,E] = t1[A,B,C,D] * t2[D,B,E] for all A,B,C,D,E.
396  *
397  * @return function multiply2MultiDimArrays allocates on the heap the new T
398  * multiDimArray and returns it
399  *
400  * @warning In practice, do not use this function but rather operator* on
401  * multiDimImplementations. This operator will take care to select this
402  * function if it is appropriate for your multiplication.
403  */
404  template < typename T >
407  const MultiDimFunctionGraph< T >* t2);
408 
409  /**
410  * @brief a specialized function for multiplying two multiDimArrays
411  * @ingroup multidim_op_group
412  *
413  * The function produces a tensorial product of t2 from t1, that is, if t1
414  * and t2 are multiDimArrays over variables A,B,C,D and D,B,E respectively,
415  * function multiply2MultiDimArrays will return a multiDimArray T defined as
416  * T[A,B,C,D,E] = t1[A,B,C,D] * t2[D,B,E] for all A,B,C,D,E.
417  *
418  * @return function multiply2MultiDimArrays allocates on the heap the new T
419  * multiDimArray and returns it
420  *
421  * @warning In practice, do not use this function but rather operator* on
422  * multiDimImplementations. This operator will take care to select this
423  * function if it is appropriate for your multiplication.
424  */
425  template < typename T >
428  const MultiDimImplementation< T >* t2);
429 
430  /// @}
431  // ==========================================================================
432  /// @name Divide MultiDims
433  // ==========================================================================
434  /// @{
435 
436  /**
437  * @brief a specialized function for dividing two multiDimArrays
438  * @ingroup multidim_op_group
439  *
440  * The function produces a tensorial division of t1 by t2, that is, if t1 and
441  * t2 are multiDimArrays over variables A,B,C,D and D,B,E respectively,
442  * function divide2MultiDimArrays will return a multiDimArray T defined as
443  * T[A,B,C,D,E] = t1[A,B,C,D] / t2[D,B,E] for all A,B,C,D,E.
444  *
445  * @return function divide2MultiDimArrays allocates on the heap the new T
446  * multiDimArray and returns it
447  *
448  * @warning In practice, do not use this function but rather operator/ on
449  * multiDimImplementations. This operator will take care to select this
450  * function if it is appropriate for your division.
451  */
452  template < typename T >
454  const MultiDimArray< T >* t2);
455 
456  /**
457  * @brief a specialized function for dividing two multiDimArrays
458  * @ingroup multidim_op_group
459  *
460  * The function produces a tensorial division of t1 by t2, that is, if t1 and
461  * t2 are multiDimArrays over variables A,B,C,D and D,B,E respectively,
462  * function divide2MultiDimArrays will return a multiDimArray T defined as
463  * T[A,B,C,D,E] = t1[A,B,C,D] / t2[D,B,E] for all A,B,C,D,E.
464  *
465  * @return function divide2MultiDimArrays allocates on the heap the new T
466  * multiDimArray and returns it
467  *
468  * @warning In practice, do not use this function but rather operator/ on
469  * multiDimImplementations. This operator will take care to select this
470  * function if it is appropriate for your division.
471  */
472  template < typename T >
475  const MultiDimImplementation< T >* t2);
476 
477  /**
478  * @brief a specialized function for dividing two multiDimArrays
479  * @ingroup multidim_op_group
480  *
481  * The function produces a tensorial division of t1 by t2, that is, if t1 and
482  * t2 are multiDimArrays over variables A,B,C,D and D,B,E respectively,
483  * function divide2MultiDimArrays will return a multiDimArray T defined as
484  * T[A,B,C,D,E] = t1[A,B,C,D] / t2[D,B,E] for all A,B,C,D,E.
485  *
486  * @return function divide2MultiDimArrays allocates on the heap the new T
487  * multiDimArray and returns it
488  *
489  * @warning In practice, do not use this function but rather operator/ on
490  * multiDimImplementations. This operator will take care to select this
491  * function if it is appropriate for your division.
492  */
493  template < typename T >
494  MultiDimArray< T* >*
496  const MultiDimArray< T* >* t2);
497 
498  /**
499  * @brief a specialized function for dividing two multiDimArrays
500  * @ingroup multidim_op_group
501  *
502  * The function produces a tensorial division of t1 by t2, that is, if t1 and
503  * t2 are multiDimArrays over variables A,B,C,D and D,B,E respectively,
504  * function divide2MultiDimArrays will return a multiDimArray T defined as
505  * T[A,B,C,D,E] = t1[A,B,C,D] / t2[D,B,E] for all A,B,C,D,E.
506  *
507  * @return function divide2MultiDimArrays allocates on the heap the new T
508  * multiDimArray and returns it
509  *
510  * @warning In practice, do not use this function but rather operator/ on
511  * multiDimImplementations. This operator will take care to select this
512  * function if it is appropriate for your division.
513  */
514  template < typename T >
517  const MultiDimImplementation< T* >* t2);
518 
519  /**
520  * @brief a specialized function for dividing two multiDimArrays
521  * @ingroup multidim_op_group
522  *
523  * The function produces a tensorial division of t1 by t2, that is, if t1 and
524  * t2 are multiDimArrays over variables A,B,C,D and D,B,E respectively,
525  * function divide2MultiDimArrays will return a multiDimArray T defined as
526  * T[A,B,C,D,E] = t1[A,B,C,D] / t2[D,B,E] for all A,B,C,D,E.
527  *
528  * @return function divide2MultiDimArrays allocates on the heap the new T
529  * multiDimArray and returns it
530  *
531  * @warning In practice, do not use this function but rather operator/ on
532  * multiDimImplementations. This operator will take care to select this
533  * function if it is appropriate for your division.
534  */
535  template < typename T >
538  const MultiDimFunctionGraph< T >* t2);
539 
540  /**
541  * @brief a specialized function for dividing two multiDimArrays
542  * @ingroup multidim_op_group
543  *
544  * The function produces a tensorial division of t1 by t2, that is, if t1 and
545  * t2 are multiDimArrays over variables A,B,C,D and D,B,E respectively,
546  * function divide2MultiDimArrays will return a multiDimArray T defined as
547  * T[A,B,C,D,E] = t1[A,B,C,D] / t2[D,B,E] for all A,B,C,D,E.
548  *
549  * @return function divide2MultiDimArrays allocates on the heap the new T
550  * multiDimArray and returns it
551  *
552  * @warning In practice, do not use this function but rather operator/ on
553  * multiDimImplementations. This operator will take care to select this
554  * function if it is appropriate for your division.
555  */
556  template < typename T >
559  const MultiDimImplementation< T >* t2);
560 
561  /// @}
562  // ==========================================================================
563  /// @name Maximise MultiDims
564  // ==========================================================================
565  /// @{
566 
567  /**
568  * @brief a specialized function for compare value from two
569  * multiDimFunctionGraphs and gets the maximal
570  * @ingroup multidim_op_group
571  *
572  * The function produces a tensorial comparison between t1 and t2, that is,
573  * if t1 and t2 are multiDimFunctionGraphs over variables A,B,C,D and D,B,E
574  * respectively, function maximise2MultiDimFunctionGraphs will return a
575  * multiDimFunctionGraph T defined as T[A,B,C,D,E] = max( t1[A,B,C,D],
576  * t2[D,B,E] ) for all A,B,C,D,E.
577  *
578  * @return function maximise2MultiDimFunctionGraphs allocates on the heap the
579  * new T multiDimFunctionGraph and returns it
580  */
581  template < typename T >
584  const MultiDimFunctionGraph< T >* t2);
585 
586  /**
587  * @brief a specialized function for compare value from two
588  * multiDimFunctionGraphs and gets the maximal
589  * @ingroup multidim_op_group
590  *
591  * The function produces a tensorial comparison between t1 and t2, that is,
592  * if t1 and t2 are multiDimFunctionGraphs over variables A,B,C,D and D,B,E
593  * respectively, function maximise2MultiDimFunctionGraphs will return a
594  * multiDimFunctionGraph T defined as T[A,B,C,D,E] = max( t1[A,B,C,D],
595  * t2[D,B,E] ) for all A,B,C,D,E.
596  *
597  * @return function maximise2MultiDimFunctionGraphs allocates on the heap the
598  * new T multiDimFunctionGraph and returns it
599  */
600  template < typename T >
603  const MultiDimImplementation< T >* t2);
604 
605  /// @}
606  // ==========================================================================
607  /// @name Operators over MultiDim
608  // ==========================================================================
609  /// @{
610 
611  /// The function to be used to add two MultiDimImplementations
612  /// @ingroup multidim_op_group
613  template < typename T >
615  const MultiDimImplementation< T >&);
616 
617  /// The function to be used to subtract two MultiDimImplementations
618  /// @ingroup multidim_op_group
619  template < typename T >
621  const MultiDimImplementation< T >&);
622 
623  /// The function to be used to multiply two MultiDimImplementations
624  /// @ingroup multidim_op_group
625  template < typename T >
627  const MultiDimImplementation< T >&);
628 
629  /// The function to be used to divide two MultiDimImplementations
630  /// @ingroup multidim_op_group
631  template < typename T >
633  const MultiDimImplementation< T >&);
634 
635  /// @}
636 
637  // ==========================================================================
638  // DO NOT FORGET TO REGISTER YOUR BINARY FUNCTIONS AT THE END OF FILE
639  // operators4MultiDim_tpl.h
640  // ==========================================================================
641 
642  /**
643  * @brief the function used to register all the operators on
644  * multidimImplementations over non-pointers types.
645  * @ingroup multidim_op_group
646  */
647  template < typename GUM_SCALAR >
648  void operators4MultiDimInit();
649 
650  /**
651  * @brief the function used to register all the operators on
652  * multidimImplementations over pointers types.
653  * @ingroup multidim_op_group
654  */
655  template < typename GUM_SCALAR >
657 
658  /**
659  * @brief a class used to register operators over non-pointers types
660  * @ingroup multidim_op_group
661  *
662  * This class is of course completely redundant with function
663  * operators4MultiDimInit. Its aim is to enable specialization of function
664  * operators4MultiDimInit for pointer types: C++ allows partial
665  * specialization of templated classes (e.g., create different
666  * implementations for C<T> and C<T*>) but it does not allows partial
667  * specialization for functions. Hence, by creating a class the primary
668  * purpose of which is to run function operators4MultiDimInit, we allow this
669  * partial specialization. This is most effective to produce different codes
670  * for pointer types and non-pointer types.
671  */
672  template < typename GUM_SCALAR >
674  void init() { operators4MultiDimInit< GUM_SCALAR >(); };
675  };
676 
677  /**
678  * @brief a class used to register operators over pointers types
679  * @ingroup multidim_op_group
680  *
681  * This class is of course completely redundant with function
682  * pointerOperators4MultiDimInit. Its aim is to enable different
683  * implementations of the operators for multidims depending in whether these
684  * multidim contain pointers or not. Actually, C++ allows partial
685  * specialization of templated classes (e.g., create different
686  * implementations for C<T> and C<T*>) but it does not allows partial
687  * specialization for functions. Hence, by creating a class the primary
688  * purpose of which is to run function operators4MultiDimInit or
689  * pointerOperators4MultiDimInit, we allow this partial specialization to
690  * obtain.
691  */
692  template < typename GUM_SCALAR >
693  struct Operators4MultiDimInitialize< GUM_SCALAR* > {
694  void init() { pointerOperators4MultiDimInit< GUM_SCALAR >(); };
695  };
696 
697  /// @}
698 
699 } /* namespace gum */
700 
701 // always include the templatized implementations
702 #include <agrum/tools/multidim/utils/operators/operators4MultiDim_tpl.h>
703 
704 #endif /* GUM_OPERATORS_4_MULTI_DIM_H */
MultiDimImplementation< T > * operator/(const MultiDimImplementation< T > &, const MultiDimImplementation< T > &)
The function to be used to divide two MultiDimImplementations.
MultiDimImplementation< T *> * divide2MultiDimArrays4Pointers(const MultiDimImplementation< T * > *t1, const MultiDimImplementation< T * > *t2)
a specialized function for dividing two multiDimArraysThe function produces a tensorial division of t...
MultiDimImplementation< T > * divide2MultiDimArrays(const MultiDimImplementation< T > *t1, const MultiDimImplementation< T > *t2)
a specialized function for dividing two multiDimArraysThe function produces a tensorial division of t...
MultiDimImplementation< T *> * multiply2MultiDimArrays4Pointers(const MultiDimImplementation< T * > *t1, const MultiDimImplementation< T * > *t2)
a specialized function for multiplying two multiDimArraysThe function produces a tensorial product of...
void operators4MultiDimInit()
the function used to register all the operators on multidimImplementations over non-pointers types...
INLINE void emplace(Args &&... args)
Definition: set_tpl.h:669
MultiDimImplementation< T > * maximise2MultiDimFunctionGraphs(const MultiDimImplementation< T > *t1, const MultiDimImplementation< T > *t2)
a specialized function for compare value from two multiDimFunctionGraphs and gets the maximalThe func...
MultiDimImplementation< T > * operator*(const MultiDimImplementation< T > &, const MultiDimImplementation< T > &)
The function to be used to multiply two MultiDimImplementations.
a class used to register operators over non-pointers typesThis class is of course completely redundan...
MultiDimImplementation< T > * add2MultiDimArrays(const MultiDimImplementation< T > *t1, const MultiDimImplementation< T > *t2)
a specialized function for summing two multiDimArraysThe function produces a tensorial addition of t1...
MultiDimImplementation< T > * multiply2MultiDimArrays(const MultiDimImplementation< T > *t1, const MultiDimImplementation< T > *t2)
a specialized function for multiplying two multiDimArraysThe function produces a tensorial product of...
MultiDimImplementation< T > * subtract2MultiDimArrays(const MultiDimImplementation< T > *t1, const MultiDimImplementation< T > *t2)
a specialized function for subtracting two multiDimArraysThe function produces a tensorial subtractio...
void pointerOperators4MultiDimInit()
the function used to register all the operators on multidimImplementations over pointers types...
MultiDimImplementation< T *> * add2MultiDimArrays4Pointers(const MultiDimImplementation< T * > *t1, const MultiDimImplementation< T * > *t2)
a specialized function for summing two multiDimArraysThe function produces a tensorial addition of t1...
MultiDimImplementation< T > * operator+(const MultiDimImplementation< T > &, const MultiDimImplementation< T > &)
The function to be used to add two MultiDimImplementations.
MultiDimImplementation< T > * operator-(const MultiDimImplementation< T > &, const MultiDimImplementation< T > &)
The function to be used to subtract two MultiDimImplementations.
MultiDimImplementation< T > * multiply2MultiDimFunctionGraphs(const MultiDimImplementation< T > *t1, const MultiDimImplementation< T > *t2)
a specialized function for multiplying two multiDimArraysThe function produces a tensorial product of...
MultiDimImplementation< T > * divide2MultiDimFunctionGraphs(const MultiDimImplementation< T > *t1, const MultiDimImplementation< T > *t2)
a specialized function for dividing two multiDimArraysThe function produces a tensorial division of t...
MultiDimImplementation< T > * subtract2MultiDimFunctionGraphs(const MultiDimImplementation< T > *t1, const MultiDimImplementation< T > *t2)
a specialized function for subtracting two multiDimArraysThe function produces a tensorial subtractio...
MultiDimImplementation< T *> * subtract2MultiDimArrays4Pointers(const MultiDimImplementation< T * > *t1, const MultiDimImplementation< T * > *t2)
a specialized function for subtracting two multiDimArraysThe function produces a tensorial subtractio...
MultiDimImplementation< T > * add2MultiDimFunctionGraphs(const MultiDimImplementation< T > *t1, const MultiDimImplementation< T > *t2)
a specialized function for summing two multiDimArraysThe function produces a tensorial addition of t1...