aGrUM  0.14.2
scheduleCombinationBasic.h File Reference

A class to combine efficiently several ScheduleMultiDims. 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
 gum is the global namespace for all aGrUM entities
 

Detailed Description

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.