aGrUM  0.20.3
a C++ library for (probabilistic) graphical models
scheduleCombinationBasic.h File Reference

Copyright (c) 2005-2021 by Pierre-Henri WUILLEMIN() & Christophe GONZALES() info_at_agrum_dot_org. More...

+ Include dependency graph for scheduleCombinationBasic.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  gum::ScheduleCombinationBasic< GUM_SCALAR >
 

Namespaces

 gum
 Copyright (c) 2005-2021 by Pierre-Henri WUILLEMIN() & Christophe GONZALES() info_at_agrum_dot_org.
 

Detailed Description

Copyright (c) 2005-2021 by Pierre-Henri WUILLEMIN() & Christophe GONZALES() info_at_agrum_dot_org.

This library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library. If not, see http://www.gnu.org/licenses/. A class to combine efficiently several ScheduleMultiDims

MultiDimCombinationBasic is a class designed to combine efficiently several ScheduleMultiDims, that is, to compute expressions like T1 op T2 op T3 op .... op Tn, where the Ti's are either the ScheduleMultiDims or just MultiDimImplementations that will be later wrapped into ScheduleMultiDims and op is an operator or a function taking in argument two such objects and producing a new (combined) Ti object. By default, the combination operation "op" is assumed to be COMMUTATIVE and ASSOCIATIVE.

To be quite generic, the MultiDimCombinationBasic takes in argument the function that produces the result of the combination of two multidimensional objects. The following code gives an example of the usage of MultiDimCombinationBasics:

// a function used to combine two MultiDimImplementation<float>'s:
MultiDimImplementation<float>* add ( const MultiDimImplementation<float>& t1,
const MultiDimImplementation<float>& t2
) {
return new MultiDimImplementation<float> (t1 + t2);
}
// another function used to combine two MultiDimImplementation<float>'s:
MultiDimImplementation<float>*
mult ( const MultiDimImplementation<float>& t1,
const MultiDimImplementation<float>& t2 ) {
return new MultiDimImplementation<float> (t1 * t2);
}
MultiDimImplementation<float> t1, t2, t3;
Set<const MultiDimImplementation<float>*> set;
set << &t1 << &t2 << &t3;
ScheduleCombinationBasic<float> Comb ( add );
ScheduleMultiDim<float> combined_table = Comb.combine ( set );
// do the same thing only with ScheduleMultiDims
MultiDimImplementation<float> tt4, tt5;
ScheduleMultiDim<float> t4 ( &tt4 ), t5 ( &tt5 );
Set<const ScheduleMultiDim<float>*> set;
set << &t4 << &t5;
ScheduleCombinationBasic<float> Comb ( add );
ScheduleMultiDim<float> combined_table2 = Comb.combine ( set );
// change the operator to apply
Comb.setCombineFunction ( mult );
ScheduleMultiDim<float> combined_table3 = Comb.combine ( set );
Author
Christophe GONZALES() and Pierre-Henri WUILLEMIN()

Definition in file scheduleCombinationBasic.h.