aGrUM  0.20.3
a C++ library for (probabilistic) graphical models
operators4MultiDim.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 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 >
82  const MultiDimImplementation< T >* t2);
83 
84  /**
85  * @brief a specialized function for summing two multiDimArrays
86  * @ingroup multidim_op_group
87  *
88  * The function produces a tensorial addition of t1 and t2, that is, if t1
89  * and t2 are multiDimArrays over variables A,B,C,D and D,B,E respectively,
90  * function add2MultiDimArrays will return a multiDimArray T defined as
91  * T[A,B,C,D,E] = t1[A,B,C,D] + t2[D,B,E] for all A,B,C,D,E.
92  *
93  * @return function add2MultiDimArrays allocates on the heap the new T
94  * multiDimArray and returns it
95  *
96  * @warning In practice, do not use this function but rather operator+ on
97  * multiDimImplementations. This operator will take care to select this
98  * function if it is appropriate for your addition.
99  */
100  template < typename T >
102  const MultiDimArray< T* >* t2);
103 
104  /**
105  * @brief a specialized function for summing two multiDimArrays
106  * @ingroup multidim_op_group
107  *
108  * The function produces a tensorial addition of t1 and t2, that is, if t1
109  * and t2 are multiDimArrays over variables A,B,C,D and D,B,E respectively,
110  * function add2MultiDimArrays will return a multiDimArray T defined as
111  * T[A,B,C,D,E] = t1[A,B,C,D] + t2[D,B,E] for all A,B,C,D,E.
112  *
113  * @return function add2MultiDimArrays allocates on the heap the new T
114  * multiDimArray and returns it
115  *
116  * @warning In practice, do not use this function but rather operator+ on
117  * multiDimImplementations. This operator will take care to select this
118  * function if it is appropriate for your addition.
119  */
120  template < typename T >
122  const MultiDimImplementation< T* >* t2);
123 
124  /**
125  * @brief a specialized function for summing two multiDimArrays
126  * @ingroup multidim_op_group
127  *
128  * The function produces a tensorial addition of t1 and t2, that is, if t1
129  * and t2 are multiDimArrays over variables A,B,C,D and D,B,E respectively,
130  * function add2MultiDimArrays will return a multiDimArray T defined as
131  * T[A,B,C,D,E] = t1[A,B,C,D] + t2[D,B,E] for all A,B,C,D,E.
132  *
133  * @return function add2MultiDimArrays allocates on the heap the new T
134  * multiDimArray and returns it
135  *
136  * @warning In practice, do not use this function but rather operator+ on
137  * multiDimImplementations. This operator will take care to select this
138  * function if it is appropriate for your addition.
139  */
140  template < typename T >
142  const MultiDimFunctionGraph< T >* t2);
143 
144  /**
145  * @brief a specialized function for summing two multiDimArrays
146  * @ingroup multidim_op_group
147  *
148  * The function produces a tensorial addition of t1 and t2, that is, if t1
149  * and t2 are multiDimArrays over variables A,B,C,D and D,B,E respectively,
150  * function add2MultiDimArrays will return a multiDimArray T defined as
151  * T[A,B,C,D,E] = t1[A,B,C,D] + t2[D,B,E] for all A,B,C,D,E.
152  *
153  * @return function add2MultiDimArrays allocates on the heap the new T
154  * multiDimArray and returns it
155  *
156  * @warning In practice, do not use this function but rather operator+ on
157  * multiDimImplementations. This operator will take care to select this
158  * function if it is appropriate for your addition.
159  */
160  template < typename T >
162  const MultiDimImplementation< T >* t2);
163 
164  /// @}
165  // ==========================================================================
166  /// @name Substract MultiDims
167  // ==========================================================================
168  /// @{
169 
170  /**
171  * @brief a specialized function for subtracting two multiDimArrays
172  * @ingroup multidim_op_group
173  *
174  * The function produces a tensorial subtraction of t2 from t1, that is, if
175  * t1 and t2 are multiDimArrays over variables A,B,C,D and D,B,E
176  * respectively, function subtract2MultiDimArrays will return a multiDimArray
177  * 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.
178  *
179  * @return function subtract2MultiDimArrays allocates on the heap the new T
180  * multiDimArray and returns it
181  *
182  * @warning In practice, do not use this function but rather operator- on
183  * multiDimImplementations. This operator will take care to select this
184  * function if it is appropriate for your subtraction.
185  */
186  template < typename T >
188  const MultiDimArray< T >* t2);
189 
190  /**
191  * @brief a specialized function for subtracting two multiDimArrays
192  * @ingroup multidim_op_group
193  *
194  * The function produces a tensorial subtraction of t2 from t1, that is, if
195  * t1 and t2 are multiDimArrays over variables A,B,C,D and D,B,E
196  * respectively, function subtract2MultiDimArrays will return a multiDimArray
197  * 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.
198  *
199  * @return function subtract2MultiDimArrays allocates on the heap the new T
200  * multiDimArray and returns it
201  *
202  * @warning In practice, do not use this function but rather operator- on
203  * multiDimImplementations. This operator will take care to select this
204  * function if it is appropriate for your subtraction.
205  */
206  template < typename T >
208  const MultiDimImplementation< T >* t2);
209 
210  /**
211  * @brief a specialized function for subtracting two multiDimArrays
212  * @ingroup multidim_op_group
213  *
214  * The function produces a tensorial subtraction of t2 from t1, that is, if
215  * t1 and t2 are multiDimArrays over variables A,B,C,D and D,B,E
216  * respectively, function subtract2MultiDimArrays will return a multiDimArray
217  * 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.
218  *
219  * @return function subtract2MultiDimArrays allocates on the heap the new T
220  * multiDimArray and returns it
221  *
222  * @warning In practice, do not use this function but rather operator- on
223  * multiDimImplementations. This operator will take care to select this
224  * function if it is appropriate for your subtraction.
225  */
226  template < typename T >
228  const MultiDimArray< T* >* t2);
229 
230  /**
231  * @brief a specialized function for subtracting two multiDimArrays
232  * @ingroup multidim_op_group
233  *
234  * The function produces a tensorial subtraction of t2 from t1, that is, if
235  * t1 and t2 are multiDimArrays over variables A,B,C,D and D,B,E
236  * respectively, function subtract2MultiDimArrays will return a multiDimArray
237  * 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.
238  *
239  * @return function subtract2MultiDimArrays allocates on the heap the new T
240  * multiDimArray and returns it
241  *
242  * @warning In practice, do not use this function but rather operator- on
243  * multiDimImplementations. This operator will take care to select this
244  * function if it is appropriate for your subtraction.
245  */
246  template < typename T >
249  const MultiDimImplementation< T* >* t2);
250 
251  /**
252  * @brief a specialized function for subtracting two multiDimArrays
253  * @ingroup multidim_op_group
254  *
255  * The function produces a tensorial subtraction of t2 from t1, that is, if
256  * t1 and t2 are multiDimArrays over variables A,B,C,D and D,B,E
257  * respectively, function subtract2MultiDimArrays will return a multiDimArray
258  * 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.
259  *
260  * @return function subtract2MultiDimArrays allocates on the heap the new T
261  * multiDimArray and returns it
262  *
263  * @warning In practice, do not use this function but rather operator- on
264  * multiDimImplementations. This operator will take care to select this
265  * function if it is appropriate for your subtraction.
266  */
267  template < typename T >
269  const MultiDimFunctionGraph< T >* t2);
270 
271  /**
272  * @brief a specialized function for subtracting two multiDimArrays
273  * @ingroup multidim_op_group
274  *
275  * The function produces a tensorial subtraction of t2 from t1, that is, if
276  * t1 and t2 are multiDimArrays over variables A,B,C,D and D,B,E
277  * respectively, function subtract2MultiDimArrays will return a multiDimArray
278  * 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.
279  *
280  * @return function subtract2MultiDimArrays allocates on the heap the new T
281  * multiDimArray and returns it
282  *
283  * @warning In practice, do not use this function but rather operator- on
284  * multiDimImplementations. This operator will take care to select this
285  * function if it is appropriate for your subtraction.
286  */
287  template < typename T >
290  const MultiDimImplementation< T >* t2);
291 
292  /// @}
293  // ==========================================================================
294  /// @name Multiply MultiDims
295  // ==========================================================================
296  /// @{
297 
298  /**
299  * @brief a specialized function for multiplying two multiDimArrays
300  * @ingroup multidim_op_group
301  *
302  * The function produces a tensorial product of t2 from t1, that is, if t1
303  * and t2 are multiDimArrays over variables A,B,C,D and D,B,E respectively,
304  * function multiply2MultiDimArrays will return a multiDimArray T defined as
305  * T[A,B,C,D,E] = t1[A,B,C,D] * t2[D,B,E] for all A,B,C,D,E.
306  *
307  * @return function multiply2MultiDimArrays allocates on the heap the new T
308  * multiDimArray and returns it
309  *
310  * @warning In practice, do not use this function but rather operator* on
311  * multiDimImplementations. This operator will take care to select this
312  * function if it is appropriate for your multiplication.
313  */
314  template < typename T >
316  const MultiDimArray< T >* t2);
317 
318  /**
319  * @brief a specialized function for multiplying two multiDimArrays
320  * @ingroup multidim_op_group
321  *
322  * The function produces a tensorial product of t2 from t1, that is, if t1
323  * and t2 are multiDimArrays over variables A,B,C,D and D,B,E respectively,
324  * function multiply2MultiDimArrays will return a multiDimArray T defined as
325  * T[A,B,C,D,E] = t1[A,B,C,D] * t2[D,B,E] for all A,B,C,D,E.
326  *
327  * @return function multiply2MultiDimArrays allocates on the heap the new T
328  * multiDimArray and returns it
329  *
330  * @warning In practice, do not use this function but rather operator* on
331  * multiDimImplementations. This operator will take care to select this
332  * function if it is appropriate for your multiplication.
333  */
334  template < typename T >
336  const MultiDimImplementation< T >* t2);
337 
338  /**
339  * @brief a specialized function for multiplying two multiDimArrays
340  * @ingroup multidim_op_group
341  *
342  * The function produces a tensorial product of t2 from t1, that is, if t1
343  * and t2 are multiDimArrays over variables A,B,C,D and D,B,E respectively,
344  * function multiply2MultiDimArrays will return a multiDimArray T defined as
345  * T[A,B,C,D,E] = t1[A,B,C,D] * t2[D,B,E] for all A,B,C,D,E.
346  *
347  * @return function multiply2MultiDimArrays allocates on the heap the new T
348  * multiDimArray and returns it
349  *
350  * @warning In practice, do not use this function but rather operator* on
351  * multiDimImplementations. This operator will take care to select this
352  * function if it is appropriate for your multiplication.
353  */
354  template < typename T >
356  const MultiDimArray< T* >* t2);
357 
358  /**
359  * @brief a specialized function for multiplying two multiDimArrays
360  * @ingroup multidim_op_group
361  *
362  * The function produces a tensorial product of t2 from t1, that is, if t1
363  * and t2 are multiDimArrays over variables A,B,C,D and D,B,E respectively,
364  * function multiply2MultiDimArrays will return a multiDimArray T defined as
365  * T[A,B,C,D,E] = t1[A,B,C,D] * t2[D,B,E] for all A,B,C,D,E.
366  *
367  * @return function multiply2MultiDimArrays allocates on the heap the new T
368  * multiDimArray and returns it
369  *
370  * @warning In practice, do not use this function but rather operator* on
371  * multiDimImplementations. This operator will take care to select this
372  * function if it is appropriate for your multiplication.
373  */
374  template < typename T >
377  const MultiDimImplementation< T* >* t2);
378 
379  /**
380  * @brief a specialized function for multiplying two multiDimArrays
381  * @ingroup multidim_op_group
382  *
383  * The function produces a tensorial product of t2 from t1, that is, if t1
384  * and t2 are multiDimArrays over variables A,B,C,D and D,B,E respectively,
385  * function multiply2MultiDimArrays will return a multiDimArray T defined as
386  * T[A,B,C,D,E] = t1[A,B,C,D] * t2[D,B,E] for all A,B,C,D,E.
387  *
388  * @return function multiply2MultiDimArrays allocates on the heap the new T
389  * multiDimArray and returns it
390  *
391  * @warning In practice, do not use this function but rather operator* on
392  * multiDimImplementations. This operator will take care to select this
393  * function if it is appropriate for your multiplication.
394  */
395  template < typename T >
397  const MultiDimFunctionGraph< T >* t2);
398 
399  /**
400  * @brief a specialized function for multiplying two multiDimArrays
401  * @ingroup multidim_op_group
402  *
403  * The function produces a tensorial product of t2 from t1, that is, if t1
404  * and t2 are multiDimArrays over variables A,B,C,D and D,B,E respectively,
405  * function multiply2MultiDimArrays will return a multiDimArray T defined as
406  * T[A,B,C,D,E] = t1[A,B,C,D] * t2[D,B,E] for all A,B,C,D,E.
407  *
408  * @return function multiply2MultiDimArrays allocates on the heap the new T
409  * multiDimArray and returns it
410  *
411  * @warning In practice, do not use this function but rather operator* on
412  * multiDimImplementations. This operator will take care to select this
413  * function if it is appropriate for your multiplication.
414  */
415  template < typename T >
418  const MultiDimImplementation< T >* t2);
419 
420  /// @}
421  // ==========================================================================
422  /// @name Divide MultiDims
423  // ==========================================================================
424  /// @{
425 
426  /**
427  * @brief a specialized function for dividing two multiDimArrays
428  * @ingroup multidim_op_group
429  *
430  * The function produces a tensorial division of t1 by t2, that is, if t1 and
431  * t2 are multiDimArrays over variables A,B,C,D and D,B,E respectively,
432  * function divide2MultiDimArrays will return a multiDimArray T defined as
433  * T[A,B,C,D,E] = t1[A,B,C,D] / t2[D,B,E] for all A,B,C,D,E.
434  *
435  * @return function divide2MultiDimArrays allocates on the heap the new T
436  * multiDimArray and returns it
437  *
438  * @warning In practice, do not use this function but rather operator/ on
439  * multiDimImplementations. This operator will take care to select this
440  * function if it is appropriate for your division.
441  */
442  template < typename T >
444  const MultiDimArray< T >* t2);
445 
446  /**
447  * @brief a specialized function for dividing two multiDimArrays
448  * @ingroup multidim_op_group
449  *
450  * The function produces a tensorial division of t1 by t2, that is, if t1 and
451  * t2 are multiDimArrays over variables A,B,C,D and D,B,E respectively,
452  * function divide2MultiDimArrays will return a multiDimArray T defined as
453  * T[A,B,C,D,E] = t1[A,B,C,D] / t2[D,B,E] for all A,B,C,D,E.
454  *
455  * @return function divide2MultiDimArrays allocates on the heap the new T
456  * multiDimArray and returns it
457  *
458  * @warning In practice, do not use this function but rather operator/ on
459  * multiDimImplementations. This operator will take care to select this
460  * function if it is appropriate for your division.
461  */
462  template < typename T >
464  const MultiDimImplementation< T >* t2);
465 
466  /**
467  * @brief a specialized function for dividing two multiDimArrays
468  * @ingroup multidim_op_group
469  *
470  * The function produces a tensorial division of t1 by t2, that is, if t1 and
471  * t2 are multiDimArrays over variables A,B,C,D and D,B,E respectively,
472  * function divide2MultiDimArrays will return a multiDimArray T defined as
473  * T[A,B,C,D,E] = t1[A,B,C,D] / t2[D,B,E] for all A,B,C,D,E.
474  *
475  * @return function divide2MultiDimArrays allocates on the heap the new T
476  * multiDimArray and returns it
477  *
478  * @warning In practice, do not use this function but rather operator/ on
479  * multiDimImplementations. This operator will take care to select this
480  * function if it is appropriate for your division.
481  */
482  template < typename T >
484  const MultiDimArray< T* >* t2);
485 
486  /**
487  * @brief a specialized function for dividing two multiDimArrays
488  * @ingroup multidim_op_group
489  *
490  * The function produces a tensorial division of t1 by t2, that is, if t1 and
491  * t2 are multiDimArrays over variables A,B,C,D and D,B,E respectively,
492  * function divide2MultiDimArrays will return a multiDimArray T defined as
493  * T[A,B,C,D,E] = t1[A,B,C,D] / t2[D,B,E] for all A,B,C,D,E.
494  *
495  * @return function divide2MultiDimArrays allocates on the heap the new T
496  * multiDimArray and returns it
497  *
498  * @warning In practice, do not use this function but rather operator/ on
499  * multiDimImplementations. This operator will take care to select this
500  * function if it is appropriate for your division.
501  */
502  template < typename T >
505  const MultiDimImplementation< T* >* t2);
506 
507  /**
508  * @brief a specialized function for dividing two multiDimArrays
509  * @ingroup multidim_op_group
510  *
511  * The function produces a tensorial division of t1 by t2, that is, if t1 and
512  * t2 are multiDimArrays over variables A,B,C,D and D,B,E respectively,
513  * function divide2MultiDimArrays will return a multiDimArray T defined as
514  * T[A,B,C,D,E] = t1[A,B,C,D] / t2[D,B,E] for all A,B,C,D,E.
515  *
516  * @return function divide2MultiDimArrays allocates on the heap the new T
517  * multiDimArray and returns it
518  *
519  * @warning In practice, do not use this function but rather operator/ on
520  * multiDimImplementations. This operator will take care to select this
521  * function if it is appropriate for your division.
522  */
523  template < typename T >
525  const MultiDimFunctionGraph< T >* t2);
526 
527  /**
528  * @brief a specialized function for dividing two multiDimArrays
529  * @ingroup multidim_op_group
530  *
531  * The function produces a tensorial division of t1 by t2, that is, if t1 and
532  * t2 are multiDimArrays over variables A,B,C,D and D,B,E respectively,
533  * function divide2MultiDimArrays will return a multiDimArray T defined as
534  * T[A,B,C,D,E] = t1[A,B,C,D] / t2[D,B,E] for all A,B,C,D,E.
535  *
536  * @return function divide2MultiDimArrays allocates on the heap the new T
537  * multiDimArray and returns it
538  *
539  * @warning In practice, do not use this function but rather operator/ on
540  * multiDimImplementations. This operator will take care to select this
541  * function if it is appropriate for your division.
542  */
543  template < typename T >
545  const MultiDimImplementation< T >* t2);
546 
547  /// @}
548  // ==========================================================================
549  /// @name Maximise MultiDims
550  // ==========================================================================
551  /// @{
552 
553  /**
554  * @brief a specialized function for compare value from two
555  * multiDimFunctionGraphs and gets the maximal
556  * @ingroup multidim_op_group
557  *
558  * The function produces a tensorial comparison between t1 and t2, that is,
559  * if t1 and t2 are multiDimFunctionGraphs over variables A,B,C,D and D,B,E
560  * respectively, function maximise2MultiDimFunctionGraphs will return a
561  * multiDimFunctionGraph T defined as T[A,B,C,D,E] = max( t1[A,B,C,D],
562  * t2[D,B,E] ) for all A,B,C,D,E.
563  *
564  * @return function maximise2MultiDimFunctionGraphs allocates on the heap the
565  * new T multiDimFunctionGraph and returns it
566  */
567  template < typename T >
569  const MultiDimFunctionGraph< T >* t2);
570 
571  /**
572  * @brief a specialized function for compare value from two
573  * multiDimFunctionGraphs and gets the maximal
574  * @ingroup multidim_op_group
575  *
576  * The function produces a tensorial comparison between t1 and t2, that is,
577  * if t1 and t2 are multiDimFunctionGraphs over variables A,B,C,D and D,B,E
578  * respectively, function maximise2MultiDimFunctionGraphs will return a
579  * multiDimFunctionGraph T defined as T[A,B,C,D,E] = max( t1[A,B,C,D],
580  * t2[D,B,E] ) for all A,B,C,D,E.
581  *
582  * @return function maximise2MultiDimFunctionGraphs allocates on the heap the
583  * new T multiDimFunctionGraph and returns it
584  */
585  template < typename T >
588  const MultiDimImplementation< T >* t2);
589 
590  /// @}
591  // ==========================================================================
592  /// @name Operators over MultiDim
593  // ==========================================================================
594  /// @{
595 
596  /// The function to be used to add two MultiDimImplementations
597  /// @ingroup multidim_op_group
598  template < typename T >
600  const MultiDimImplementation< T >&);
601 
602  /// The function to be used to subtract two MultiDimImplementations
603  /// @ingroup multidim_op_group
604  template < typename T >
606  const MultiDimImplementation< T >&);
607 
608  /// The function to be used to multiply two MultiDimImplementations
609  /// @ingroup multidim_op_group
610  template < typename T >
612  const MultiDimImplementation< T >&);
613 
614  /// The function to be used to divide two MultiDimImplementations
615  /// @ingroup multidim_op_group
616  template < typename T >
618  const MultiDimImplementation< T >&);
619 
620  /// @}
621 
622  // ==========================================================================
623  // DO NOT FORGET TO REGISTER YOUR BINARY FUNCTIONS AT THE END OF FILE
624  // operators4MultiDim_tpl.h
625  // ==========================================================================
626 
627  /**
628  * @brief the function used to register all the operators on
629  * multidimImplementations over non-pointers types.
630  * @ingroup multidim_op_group
631  */
632  template < typename GUM_SCALAR >
633  void operators4MultiDimInit();
634 
635  /**
636  * @brief the function used to register all the operators on
637  * multidimImplementations over pointers types.
638  * @ingroup multidim_op_group
639  */
640  template < typename GUM_SCALAR >
642 
643  /**
644  * @brief a class used to register operators over non-pointers types
645  * @ingroup multidim_op_group
646  *
647  * This class is of course completely redundant with function
648  * operators4MultiDimInit. Its aim is to enable specialization of function
649  * operators4MultiDimInit for pointer types: C++ allows partial
650  * specialization of templated classes (e.g., create different
651  * implementations for C<T> and C<T*>) but it does not allows partial
652  * specialization for functions. Hence, by creating a class the primary
653  * purpose of which is to run function operators4MultiDimInit, we allow this
654  * partial specialization. This is most effective to produce different codes
655  * for pointer types and non-pointer types.
656  */
657  template < typename GUM_SCALAR >
659  void init() { operators4MultiDimInit< GUM_SCALAR >(); };
660  };
661 
662  /**
663  * @brief a class used to register operators over pointers types
664  * @ingroup multidim_op_group
665  *
666  * This class is of course completely redundant with function
667  * pointerOperators4MultiDimInit. Its aim is to enable different
668  * implementations of the operators for multidims depending in whether these
669  * multidim contain pointers or not. Actually, C++ allows partial
670  * specialization of templated classes (e.g., create different
671  * implementations for C<T> and C<T*>) but it does not allows partial
672  * specialization for functions. Hence, by creating a class the primary
673  * purpose of which is to run function operators4MultiDimInit or
674  * pointerOperators4MultiDimInit, we allow this partial specialization to
675  * obtain.
676  */
677  template < typename GUM_SCALAR >
678  struct Operators4MultiDimInitialize< GUM_SCALAR* > {
679  void init() { pointerOperators4MultiDimInit< GUM_SCALAR >(); };
680  };
681 
682  /// @}
683 
684 } /* namespace gum */
685 
686 // always include the templatized implementations
687 #include <agrum/tools/multidim/utils/operators/operators4MultiDim_tpl.h>
688 
689 #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:643
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...